Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[Script] ScriptCards - My "Spiritual Successor" to PowerCards

Don R, Look at the line:  --?[$Cast] -eq 0|SpellText| (About 14 below) Appears to have an extra pipe at the end.  Not sure if that's the problem.
Brien V. said: I have my attack card pretty much where it needs to be, for now.  I'm trying to figure out how incorporate Full Attack functionality into what I already have.  I have a roll query that asks if it is a Full Attack and, if so, applies a -4 to attack rolls.  I thought about using a conditional that would send the card back to the beginning of the attack sequence.  I feel like it would start looping since the conditional that would start the loops would likely send it back again. Any thoughts? Could you not do this in your top attack roll?: --=AttackRoll|10d20kh1 + [*R:total] [Attack Bonus] + ?{Full Attack?|No,0|Yes,-4} [Attack Penalty]
1619265781

Edited 1619273903
Will M. said: Brien V. said: I have my attack card pretty much where it needs to be, for now.  I'm trying to figure out how incorporate Full Attack functionality into what I already have.  I have a roll query that asks if it is a Full Attack and, if so, applies a -4 to attack rolls.  I thought about using a conditional that would send the card back to the beginning of the attack sequence.  I feel like it would start looping since the conditional that would start the loops would likely send it back again. Any thoughts? Could you not do this in your top attack roll?: --=AttackRoll|10d20kh1 + [*R:total] [Attack Bonus] + ?{Full Attack?|No,0|Yes,-4} [Attack Penalty] I need full attack as a variable because in Starfinder, a full attack is 2 attacks at -4.  So I need to repeat the attack sequence for 2 attacks.  I'm trying to avoid going to a second script card, though it would be simple enough. Follow on question.  In the following code, can anyone see why the Attack! button has a smaller button frame and doesn't work.   !scriptcard {{ --#title|Choose Your Weapon! --#subtitleFontSize|1.0em --#titleFontFace|Tahoma --#bodyFontFace|Tahoma --#tableBorderRadius|3px --#buttonfontsize|medium --Rfirst|@{selected|character_id};repeating_attack --:ButtonDisplayLoop| --+[button][*R:name]::!
!setattr --sel --weaponname|[*R:name][/button]| --Rnext| --? "[*R:name]" -ne NoRepeatingAttributeLoaded|ButtonDisplayLoop --#buttonbackground|#993333 --+[c][button][i]Attack![/i]::
#AttackSC[/button][/c]| }}
1619274056

Edited 1619325585
timmaugh
Pro
API Scripter
@Michael... SelectManager is going to track the selected tokens from the last time you sent a message... the idea being that when you call an API, you would have tokens selected, and when that API called another script, the downstream script would have forgotten the selected tokens but SM would be able to restore them. Using any kind of @{target} construction in the same macro (or character ability) as the lead-off API means that there are no selected tokens for SelectManager to track and hand off. If this is the case, we can still work around it with new functionality in SelectManager v1.0.0, but we just have to know what we're working with. Can you post the full text of the macro, as it stands now? FYI, if you want or need to use the @{target} call elsewhere in the macro (you can't get around it), then you can virtually select a token by use of a {& select} construction, and telling the forselected to escape its downstream command line. You do this by enclosing the escape character in parentheses as the last thing attached to the forselected handle: --@forselected(\)|Spawn _name|Giant Ape _qty|1 _size|2,2 {\& select @{target|...} ^ ^ ^ ^ -------------^-------------- ------------^------------ | declare escape character | | use escape character | ---------------------------- ------------------------- Make sure your @{target} is the same as what you used elsewhere in the macro so that you only have the one prompt. The above will work for you because you have only one target you want to affect with the forselected call, however... I am also seeing a fix I need to put into SM... like I said, this will work for you, but for future use (or for people looking at this later and wanting to replicate), if you have multiple virtually-selected tokens, you would want the {& select} statement to be outside of the forselected, so that it was able to establish the pool of tokens forselected should iterate over. That connection needs to be added, and I will get that into a v1.0.1 before the weekend is out.
1619280455
David M.
Pro
API Scripter
Tim, having trouble understanding what the injection is doing. For the example line you posted, is the {\& select...} sending something else to chat, or is it just telling the Spawn script to use the target token as the "selected" token? Do we need ZeroFrame or another meta script installed for this to work? The following crashes my sandbox, with the identical error regardless of ZeroFrame install. !script {{ --@token-mod| _ignore|selected _ids @{target|token_id} _set layer|gmlayer --@forselected(\)|Spawn _name|Giant Ape _qty|1 _size|2,2 {\& select @{target|token_id} }}
1619280985

Edited 1619281913
Will M. said: Don R, Look at the line:  --?[$Cast] -eq 0|SpellText| (About 14 below) Appears to have an extra pipe at the end.  Not sure if that's the problem. Boy I wish that were the problem.  Actually tried it with and without the pipe at the end (sorry accidentally left it in, but tested it again anyway, after awhile I forget what I've tried).  The pipe has no effect in it's operation in either location.  Codded directly into the Abilities code box (where it works) or from calling a macro from the Abilities box (where it doesn't). Type error h is undefined, is the error thrown but it resolves and changes to TypeError: undefined has no properties (something I thought I was imagining until today). It starts to execute stopping at select target and not continuing.
Hello, i have a little question on the formatting. Kurt say on 1.1.19 : Behavior Change : Previously, the entire card would be generated and then inline formatting would be applied to each line at the end. I have modified this behavior so that inline formatting is applied as each line is generated. This won't impact existing cards, but it will allow you to set things like fonts and button backgrounds on a per-line basis. Essentially when you set a setting that has a formatting impact it will be active from that line onward. But I can't make different font sizes per line. Has anyone succeeded yet?
Feature Request: GetCharacters function: Ability to enumerate characters in the campaign and walk through them like you do with the GetSelected function.  Maybe similar to how you walk through Repeated Attributes.  Would probably want to add some filtering capability based on character attributes.  For example, I would usually want to filter out NPC character sheets. Ability to do variable substitution within the [*id:attribute] syntax so that I could do something like [*[&char_id]:[&my_attribute]].  I thought you introduced this around version 0.13, but I can't seem to get it to work (see below quote). Ability to do variable substitution with the [*id:attribute] against character names so that it would facilitate something like the @{char_name|attribute} function.  @{Conan|hp} works within Scriptcards, but @{[&Char_Name]|[&MyAttrib]} doesn't because it's trying to pre-process the command and can't find a character named [&Char_Name] or an attribute called [&MyAttrib].  Would be nice if something like [@[&Char_Name]:[MyAttrib]] worked.   Conversion functions to easily convert a Roll Variable to a simple String Variable Behavior Change : Added explicit string variable substitution inside [*id:attribute] references (not the returned results – just the “id” and “attribute” portions of the reference)
1619294136
David M.
Pro
API Scripter
Variable conversion is already about as concise as I can imagine, unless I'm misunderstanding your meaning? --=roll|1d20 --&roll|[$roll.Total]
1619294152

Edited 1619294395
I tested in the library a --c command. When you write : --C[%1%]|1:>R1|2:>R2|3:>R3|4:>R4|5:>R5|6:>R6 It doesn't work. When writing : --C[%1%]|1:R1|2:R2|3:R3|4:R4|5:R5|6:R6 It works. I think there is a bug with the use of gosub into the library while using the classical labels it works .
1619302830

Edited 1619304407
timmaugh
Pro
API Scripter
David M. said: Tim, having trouble understanding what the injection is doing. For the example line you posted, is the {\& select...} sending something else to chat, or is it just telling the Spawn script to use the target token as the "selected" token? Do we need ZeroFrame or another meta script installed for this to work? The following crashes my sandbox, with the identical error regardless of ZeroFrame install. !script {{ --@token-mod| _ignore|selected _ids @{target|token_id} _set layer|gmlayer --@forselected(\)|Spawn _name|Giant Ape _qty|1 _size|2,2 {\& select @{target|token_id} }} It should work regardless of ZeroFrame presence. All of this happens within the SelectManager script. To answer your question... {& select id1, id2, token name 1, token name 2, etc.}  ...should step on the selected array of the message, re-writing it with the tokens that are detected from the comma-separated list. In the case of a macro with a @{target} command, nothing is lost because there isn't a selected array to begin with (as you know). This is different from the {& inject ...} in that inject adds tokens to the selected array. So using the escape character designated in the forselected handle (a backslash in the example), we break up the text token so that it isn't detected until the forselected-generated message runs. The @{target} has already been resolved by Roll20 by then, so we now have a fully formed selection token, with a token id to select. That's what should happen. I am wondering if the disconnect/problem I mentioned earlier is more of an immediate liability than I had realized. I will test this tonight and see if I can arrive at a resolution.
David M. said: Variable conversion is already about as concise as I can imagine, unless I'm misunderstanding your meaning? --=roll|1d20 --&roll|[$roll.Total] Thanks, I was thinking that sometimes when I do that, it still outputs as a roll format when using the --+| command.  I'll double check.  
1619304151
David M.
Pro
API Scripter
@Will, the roll formatting would be retained in the string variable conversion if you omitted the .Total from [$roll.Total]. --=roll|1d20 --&roll|[$roll]          //string variable will display with roll variable formatting --&roll|[$roll.Total]    //string variable will display with string variable formatting @Tim, thanks for checking!
Hoping someone can help with this (it's making me crazy!). I'm trying to create an attack for my 5e crocodile that applies the grab condition on hit. This is what I got, but it's not working -  !scriptcard  {{   --#title|Bite   --#leftsub|Melee Attack    --#sourceToken|@{selected|token_id}   --#targetToken|@{target|token_id}   --#emoteText|NPC attacks @{target|token_name}   --=TargetAC|@{target|npc_ac}   --?[$TargetAC.Total] -gt 0|DoneWithAC   --=TargetAC|@{target|ac}   --:DoneWithAC|   --=AttackRoll|1d20 + 4   --+Attack|@{selected|token_name} rolls [$AttackRoll] vs AC [$TargetAC].   --?[$AttackRoll.Base] -eq 20|Crit   --?[$AttackRoll.Base] -eq 1|Fumble   --?[$AttackRoll.Total] -ge [$TargetAC.Total]|Hit   --+Miss|The attack missed.   --^Final|   --:Fumble|   --+Fumble!|The attack went horribly wrong.   --^Final|   --:Hit|   --=Damage|1d10 + 2   --+Hit!|The attack hit @{target|token_name} for [$Damage] Piercing Damage. The target is grappled, escape dc 12 Until this grapple ends, the target is restrained, and the crocodile can't bite another target   --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage]   --@token-mod|_ids @{target|token_id} _set statusmarkers|grab   --^Final|   --:Crit|   --=Damage|1d10 + 2 + 1d10 + 2    --+Critical Hit!|The attack hit @{target|token_name} for [$Damage] Piercing Damage. The target is grappled, escape dc 12 Until this grapple ends, the target is restrained, and the crocodile can't bite another target   --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage]   --@token-mod|_ids @{target|token_id} _set statusmarkers|grab   --:Final| }} I'm sure this is an easy fix, but I can't quite figure it out. Thanks,
1619307291
David M.
Pro
API Scripter
Krackhour, what part is not working?
It's not setting the condition grab when hit is successful.
1619307870
David M.
Pro
API Scripter
Hmm, when I run it the grab condition marker seems to be assigned to the token properly on a hit. I don't suppose token-mod is missing in the game you are testing this on, is it? 
you might run:   !token-mod --help  Review the output and make sure Grab is the fully qualified name of your marker.  
Token-mod is installed, when I run !token-mod --set statusmarkers|grab - it works properly. 
Krackhour said: Hoping someone can help with this (it's making me crazy!). I'm trying to create an attack for my 5e crocodile that applies the grab condition on hit. This is what I got, but it's not working -  !scriptcard  {{   --#title|Bite   --#leftsub|Melee Attack    --#sourceToken|@{selected|token_id}   --#targetToken|@{target|token_id}   --#emoteText|NPC attacks @{target|token_name}   --=TargetAC|@{target|npc_ac}   --?[$TargetAC.Total] -gt 0|DoneWithAC   --=TargetAC|@{target|ac}   --:DoneWithAC|   --=AttackRoll|1d20 + 4   --+Attack|@{selected|token_name} rolls [$AttackRoll] vs AC [$TargetAC].   --?[$AttackRoll.Base] -eq 20|Crit   --?[$AttackRoll.Base] -eq 1|Fumble   --?[$AttackRoll.Total] -ge [$TargetAC.Total]|Hit   --+Miss|The attack missed.   --^Final|   --:Fumble|   --+Fumble!|The attack went horribly wrong.   --^Final|   --:Hit|   --=Damage|1d10 + 2   --+Hit!|The attack hit @{target|token_name} for [$Damage] Piercing Damage. The target is grappled, escape dc 12 Until this grapple ends, the target is restrained, and the crocodile can't bite another target   --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage]   --@token-mod|_ids @{target|token_id} _set statusmarkers|grab   --^Final|   --:Crit|   --=Damage|1d10 + 2 + 1d10 + 2    --+Critical Hit!|The attack hit @{target|token_name} for [$Damage] Piercing Damage. The target is grappled, escape dc 12 Until this grapple ends, the target is restrained, and the crocodile can't bite another target   --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage]   --@token-mod|_ids @{target|token_id} _set statusmarkers|grab   --:Final| }} I'm sure this is an easy fix, but I can't quite figure it out. Thanks, I copy it to my game its working, did you do the  !token-mod --config players-can-ids ? 
1619322350

Edited 1619322503
So when i drag a token from my game for monsters bar 1 will show HP but the attribute of the is not set to HP. I have a check in my cards to check the targets hp. If I change the attribute to HP its show  How do it get value to be the same as the max value without manually edit ever token I drop.  Here is the default when you drop a token Can I change my check to look at the bar 1 first value? If so how?  This is what I currently use. --:Healthcheck| --=targethp|@{target|hp}-[$Damage] --?[$targethp] -lt 1|Dead --^Final|  
1619328155
timmaugh
Pro
API Scripter
@David & @Michael... I think I've found and corrected the problem in SelectManager. With v1.0.1 , you should be able to use the {& select... } or {& inject ...} syntax to include a targeted token straightaway, with no need to defer/escape the syntax: !script {{   --@token-mod| _ignore|selected _ids @{target|token_id} _set layer|gmlayer   --@forselected|Spawn _name|Giant Ape  _qty|1 _size|2,2 {& select @{target|token_id}} }} (the {&select...} statement can actually be anywhere, even outside the forselected line, since SelectManager will catch the formation and parse it out before forselected sees it.) Also, @David, I did find a missing closing brace after the @{target} statement in your macro, so you'll want to correct that, as well. =D
1619349103

Edited 1619459809
David M.
Pro
API Scripter
Tim, I grabbed the latest SM version from your repo and copied your code above, but it still crashed my sandbox (different error than before though).  EDIT - Appears to be coming from ZeroFrame! I had forgotten that I had installed v1.0.1 of ZF when troubleshooting earlier. After disabling it, your scripcard code above works! Thanks for the help :) EDIT 2 - The problem was related to another lingering script I had in my test game that I never cleaned up. No issues with ZeroFrame! @Michael, you will want to add a --layer|object command to your Spawn call, since otherwise the Ape will Spawn on the same layer as the target token (GM layer). So something like this: !script {{ --@token-mod| _ignore|selected _ids @{target|token_id} _set layer|gmlayer --@forselected|Spawn _name|Giant Ape _qty|1 _size|2,2 _layer|object {& select @{target|token_id}} }}
Hey thanks guys! I really appreciate you guys looking into this! For whatever reason, the attack and the condition are working this morning. I did remove and reinstall a few API's last night that may have fixed it up, the players can IDs was toggled. In any case thank you, it's working!
1619362546
Kurt J.
Pro
API Scripter
Michael C. said: @David M. In a scriptcard I tried to work Spawn with ForSelected and am not doing something right.  (I tried to PM you so as not to fill this thread with chatter but my PM doesn't work for some reason. I hope I have not offended.)  The statement:   --:Swap Token |     --@token-mod| _ignore|selected _ids @{target|token_id} _set layer|gmlayer     --@forselected|Spawn _name|Giant Ape  _qty|1 _size|2,2  set the selected token to the gmlayer but did not spawn the Giant Ape.  Help? Kurt J.  I know that the conditional branch will accept a operation|true|false formula but is it possible to turn the conditional branch into more of an "if...then...else" statement rather than branch to a goto or gosub?  Such as...If V = W then X = Z else Y = Z (or branch)...kind of thing?   Just musing... One of the goals of the 1.2.x builds will be to improve on conditionals and how they work. In my current code, I've expanded the abilities of the --? statement to include the ability to set string and roll variables as the result of a conditional (instead of a branch/gosub). I'll be adding that functionality to case statements as well, and that will probably make up the bulk of changes in the 1.2.0 release.
Based on a roll query, my players can either make a single attack or a full, double attack.  I already have the card set up adjust attack modifiers if they do a full attack.  The trouble I am having is how to repeat the attack commands without doing a second card.  I thought of trying to loop back to the start of the attack commands but I think when it gets to the loop point again, it would just continue looping. Thoughts? !scriptcard {{ --#title|@{selected|weaponname} --Rfind|@{selected|character_id};@{selected|weaponname};repeating_attack;name --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#leftsub|[*R:engagement_range] --#rightsub|[*R:category] --#emoteText|[*S:character_name] knocks da shit outta [*T:character_name] -->ACtype| -->AttackTypeSelect| --+Attack Modifier?|[$AttackMod] --+Enemy AC:|[$AC] --:AttackRoll| --=AttackRoll|10d20kh1 + [*R:total] [Attack Bonus] + [$AttackMod] [Attack Penalty] --+|@{selected|token_name} rolls a [$AttackRoll] to hit versus Armor Class [$AC] --?[$AttackRoll.Base] -eq 20|Crit --?[$AttackRoll.Base] -eq 1|Fumble --?[$AttackRoll.Total] -lt [$AC]|Miss --:Hit| -->RollDamage| --+Hit!|You did [$Damage] points damage. --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --X| --:Miss| --+|You missed --X| --:Fumble| --+|Ya effed up A-A-Ron --X| --:Crit| -->RollDamage|crit --+Critical Hit!!!| You hit really well. You did [$Damage] points of damage. --X| --:RollDamage| --?[%1%] -eq crit|CritDamage --=Damage|[*R:damage_total] [Base] --<| --:CritDamage| --?[$AttackRoll.Total] -gt [$AC]|FullCrit --=Damage|[*R:total_damage] [Base] --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --<| --:FullCrit| --=Damage|[*R:damage_total] [Base] + @[*R:damage_total] [Bonus] + [*R:crit] [Weapon Crit] --+Critical Hit!!!| You hit really well. You did [$Damage] points of damage. --?[&ACtype] -eq Energy|EnergyCrit --=roll|[T#CritDeckKinetic] --+Critical Effect:|[$roll.tableEntryText] -->Done| --:EneryCrit| --=roll|[T#CritDeckEnergy] --+Critical Effect:|[$roll.tableEntryText] --+Crit Effect:|[*R:crit] --:Done| --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --X| --:ACtype| --?[*R:type] -eq "b"|KAC --?[*R:type] -eq "p"|KAC --?[*R:type] -eq "s"|KAC --?[*R:type] -eq "bludgeoning"|KAC --?[*R:type] -eq "slashing"|KAC --?[*R:type] -eq "piercing"|KAC --=AC|[*R:eac] --&ACtype|Energy --+AC Type:|Energy --<| --:KAC| --=AC|[*T:kac] --&ACtype|Kinetic --+AC Type:|Kinetic --<| --:AttackTypeSelect| --=AttackMod|?{Full Attack?|No,0|Yes,-4} --<| }}
1619364061
David M.
Pro
API Scripter
Brien, you could add a NumAttacks variable populated (possibly with a conditional) based on your Full Attack query. Then in your attack loop, add a counter and only loop if the counter is less than the number of attacks. Simple example: !script {{ --=NumAttacks|?{Full Attack?|Yes,2|No,1} --=i|0 --:Loop| --=i|[$i]+1 --+Attack #[$i.Total]| --?[$i] -lt [$NumAttacks]|Loop }}
I did something much less elegant.  It works but looks messy.  I will try your solution as well. David M. said: Brien, you could add a NumAttacks variable populated (possibly with a conditional) based on your Full Attack query. Then in your attack loop, add a counter and only loop if the counter is less than the number of attacks. Simple example: !script {{ --=NumAttacks|?{Full Attack?|Yes,2|No,1} --=i|0 --:Loop| --=i|[$i]+1 --+Attack #[$i.Total]| --?[$i] -lt [$NumAttacks]|Loop }}
So - Working on implementing a ScriptCard that uses indexof - I thought it would be fairly simple and straightforward, and it quite possibly is and I'm just not seeing where I am going wrong ;-) Started out simple enough: !scriptcard {{ --~dummy|array;define;myarray;Apple;Banana;Pear;Pumpkin --~itemindex|array;indexof;myarray;Banana --=Title|Searching for Bananas --+Banana|is at [$itemindex] }} This results in scripts being disabled, restarting the API and running the script again produces the same error. Am I just not using indexof correctly?  . For reference, the error message generated was:  ReferenceError: arrayvariables is not defined ReferenceError: arrayvariables is not defined at apiscript.js:909:30 at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:154:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:154:1), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1663:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:400
@timmaugh and David M. - Wow thanks for the help on this!.  I did have an interesting side issue with the !Forselected as the debug began showing some odd graphics and I had to disable and reload it.  One question, is there supposed to be spaces in the {& select @{target|token_id}} line? !script {{ --@token-mod| _ignore|selected _ids @{target|token_id} _set layer|gmlayer --@forselected|Spawn _name|Giant Ape _qty|1 _size|2,2 _layer|object {& select @{target|token_id}} }}
@ Kurt - most excellent.  I am looking forward to 1.2 as it sounds like it's going to be very helpful.
Søren S. said: So - Working on implementing a ScriptCard that uses indexof - I thought it would be fairly simple and straightforward, and it quite possibly is and I'm just not seeing where I am going wrong ;-) Started out simple enough: !scriptcard {{ --~dummy|array;define;myarray;Apple;Banana;Pear;Pumpkin --~itemindex|array;indexof;myarray;Banana --=Title|Searching for Bananas --+Banana|is at [$itemindex] }} This results in scripts being disabled, restarting the API and running the script again produces the same error. Am I just not using indexof correctly?  . For reference, the error message generated was:  ReferenceError: arrayvariables is not defined ReferenceError: arrayvariables is not defined at apiscript.js:909:30 at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:154:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:154:1), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1663:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:400 Soren - I was able to replicate your issue.  There are a couple issues with this code sample, but even after correcting, I still get the error . --=Title|Searching for Bananas probably should be the following if you want it as part of the card title --#Title|Searching for Bananas --+Banana|is at [$itemindex] ItemIndex is supposed to be a string variable, so the syntax should maybe be: --+Banana|is at [&itemindex] array indexof arrayname;searchvalue stringVariable Searches the array "arrayname" for and item with the value of "searchvalue" and, if found, returns the index of the first matching value or "ArrayError" if not found
My debug keeps printing this out.  Any idea what it means? "    ���������������������������������������������������������������������������������������������������������������������������������         ���_______________________________________���            ���___________________________________���                   ___��� ���_______________��� ���___                       ���___   _______________   ___���                          ��� ���               ��� ���                              ��� ���               ��� ���                              ��� ���               ��� ���                              ��� ���               ��� ���                              ��� ���               ��� ���                ______________��� ���_______________��� ���_______________              ������������            ������������       "
1619393638
timmaugh
Pro
API Scripter
That's my fault, Michael... I have a log signature that should look like this: It only registers once, no matter how many of my scripts you have installed... but I didn't realize when I first started pushing scripts to the one-click that the one-click process ate certain unicode characters, leaving you with the mess you posted. I have since updated the signature to look like this: _____________________________________________ )_________________________________________( )_____________________________________( ___| |_______________| |___ |___ _______________ ___| | | | | | | | | | | | | | | | | | | | | ______________|_|_______________|_|_______________ Built all out of ascii, so it should work, provided the first script of mine you encounter is one of those I've updated. I'm replacing the signature as I update the scripts and send them to the one-click. If you are still seeing that, you have one of my old ones. The current set of Meta-Toolbox scripts haven't been released to the one-click yet -- I'm letting the bugs settle out of them so I make sure I don't break games. Ok, more games. All the games. :-/
Craven said: So when i drag a token from my game for monsters bar 1 will show HP but the attribute of the is not set to HP. I have a check in my cards to check the targets hp. If I change the attribute to HP its show  How do it get value to be the same as the max value without manually edit ever token I drop.  Here is the default when you drop a token Can I change my check to look at the bar 1 first value? If so how?  This is what I currently use. --:Healthcheck| --=targethp|@{target|hp}-[$Damage] --?[$targethp] -lt 1|Dead --^Final|   Anyone?
1619438949
David M.
Pro
API Scripter
Have you tried using @{target|bar1}?
1619442665
Kurt J.
Pro
API Scripter
Søren S. said: So - Working on implementing a ScriptCard that uses indexof - I thought it would be fairly simple and straightforward, and it quite possibly is and I'm just not seeing where I am going wrong ;-) Started out simple enough: !scriptcard {{ --~dummy|array;define;myarray;Apple;Banana;Pear;Pumpkin --~itemindex|array;indexof;myarray;Banana --=Title|Searching for Bananas --+Banana|is at [$itemindex] }} This results in scripts being disabled, restarting the API and running the script again produces the same error. Am I just not using indexof correctly?  . For reference, the error message generated was:  ReferenceError: arrayvariables is not defined ReferenceError: arrayvariables is not defined at apiscript.js:909:30 at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:154:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:154:1), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1663:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:400 This is a typo in the code as a result of me changing something and not testing enough (sorry). I'll fix it for the next release, but if you want to update the script in the mean time, search for "indexof" (WITH the quotes). three lines down is a "for (var x=)"... line that has arrayvariables instead of arrayVariables. if you capitalize the V that should fix the issue.
1619454320

Edited 1619455365
Does anyone have an idea of why when I run the character summary code the formatting is incorrect  around the attributes? !script {{    +++5E Tools+++     --#title|@{selected|token_name}    -->Lib5E_Character_Summary|@{selected|character_id} }}
1619460082
David M.
Pro
API Scripter
David M. said: Tim, I grabbed the latest SM version from your repo and copied your code above, but it still crashed my sandbox (different error than before though).  <snip> EDIT - Appears to be coming from ZeroFrame! I had forgotten that I had installed v1.0.1 of ZF when troubleshooting earlier. After disabling it, your scripcard code above works! Thanks for the help :) FYI - After extensive troubleshooting by timmaugh, turns out the problem was related to a lingering(and poorly compartmentalized) script I had in my test game that I never cleaned up [hangs head in shame]. No issues with ZeroFrame!  Thanks, Tim!
Kurt J. said: This is a typo in the code as a result of me changing something and not testing enough (sorry). I'll fix it for the next release, but if you want to update the script in the mean time, search for "indexof" (WITH the quotes). three lines down is a "for (var x=)"... line that has arrayvariables instead of arrayVariables. if you capitalize the V that should fix the issue. Hey, these things happen :) I've never .. ever .. had a typo anywhere in my code *cough* especially not ones that ended up in production and being discovered a year later because one function was doing something erratic. Great to know you're aware of it and I'll fix it here and await the next version. Thank you :) 
1619460710
timmaugh
Pro
API Scripter
No worries! To be fair, it helps to know the way ZeroFrame interacts with other scripts like this, because it did point out a way ZeroFrame can play nicer with other scripts! I'll work that into my next release. =D
Usually, you do *not* want to link the bars to the hp of the NPC, because that would mean every token would always have the same hp as one another. Instead, you should refer to the token's bar values, at least for hp. Craven said: Craven said: So when i drag a token from my game for monsters bar 1 will show HP but the attribute of the is not set to HP. I have a check in my cards to check the targets hp. If I change the attribute to HP its show  How do it get value to be the same as the max value without manually edit ever token I drop.  Here is the default when you drop a token Can I change my check to look at the bar 1 first value? If so how?  This is what I currently use. --:Healthcheck| --=targethp|@{target|hp}-[$Damage] --?[$targethp] -lt 1|Dead --^Final|   Anyone?
Don R. said: Will M. said: Don R, Look at the line:  --?[$Cast] -eq 0|SpellText| (About 14 below) Appears to have an extra pipe at the end.  Not sure if that's the problem. Boy I wish that were the problem.  Actually tried it with and without the pipe at the end (sorry accidentally left it in, but tested it again anyway, after awhile I forget what I've tried).  The pipe has no effect in it's operation in either location.  Codded directly into the Abilities code box (where it works) or from calling a macro from the Abilities box (where it doesn't). Type error h is undefined, is the error thrown but it resolves and changes to TypeError: undefined has no properties (something I thought I was imagining until today). It starts to execute stopping at select target and not continuing.
1619566380
Kurt J.
Pro
API Scripter
Don R. said: Don R. said: Will M. said: Don R, Look at the line:  --?[$Cast] -eq 0|SpellText| (About 14 below) Appears to have an extra pipe at the end.  Not sure if that's the problem. Boy I wish that were the problem.  Actually tried it with and without the pipe at the end (sorry accidentally left it in, but tested it again anyway, after awhile I forget what I've tried).  The pipe has no effect in it's operation in either location.  Codded directly into the Abilities code box (where it works) or from calling a macro from the Abilities box (where it doesn't). Type error h is undefined, is the error thrown but it resolves and changes to TypeError: undefined has no properties (something I thought I was imagining until today). It starts to execute stopping at select target and not continuing. Can you post a screenshot of the error message in the console? That usually has information that is helpful in tracking down problems.
@Tim - I'm with Soren...being perfect and error-free as I am :cough, cough::  is a hard reputation to keep up.
@Kurt J  (David/Anybody)  -  I've been thinking about a way to accomplish the ability to center an AOE on any point on the page and have an idea to bounce off you.  At the moment, I just create a Fireball character, assign a token and allow the player edit rights.  When a player is about to cast the spell I put the token on the page, have them place it where they wish then they call the Kurt J. (magical, mystical) Fireball multi-token array spell, chooses the Fireball token and blasts away catching all nearby tokens in the blast.  (The token is included in the result but that's a minor issue.) I note that the --i command will interrupt the normal processing of the script to fill a variable or choose a token and thought that it might be expanded to also be able to call a script (such as Spawn) or perform a function that would accomplish the preliminary steps of calling the manual portion of the process above?  Some other process maybe?  Just thinking....
1619613028

Edited 1619613128
David M.
Pro
API Scripter
Would it work for you to add your Spawn call outside of the scriptcard in the same macro? This works for me, but is just using print commands in the scriptcard. I haven't used the --i command yet, so I don't know if it would allow the selected token to change (from the caster to the AoE token) during the pause.  !Spawn --name|Fireball --size|8,8 !script {{ --#title|test --+Do some stuff|then pause with your i command }} EDIT - regardless of selected, I think it should work if you used a @{target...} during your pause.
@David M.  Well, I did do something similar at first.  Currently, I have a macro that lists available tokens for the player then allows them to call their tokens using buttons.   After calling their token in that macro they open their spell card macro and cast the spell using the token as target.  It's a work around that requires selecting their token, spawning it then selecting the target token.  It would be lovely if I could incorporate all tasks into one macro that imported the token first before calling the spell. The --i command looked ideal because it is the only command that allows suspending the API script long enough for the player to input something or select a target.  (I also tried the --s and --l commands but I did something wrong with the call and retrieve and stopped all scripts from functioning.)  
1619634370

Edited 1619634395
David M.
Pro
API Scripter
One option that works pretty nicely for me (this started pre-scriptcards) is to spawn the Fireball token** as normal, then have a token action for an ability on the Fireball character sheet that fires off the damage. If you have multiple characters that can fireball, you could have either multiple copies of Fireball char sheets (e.g. "Dave's Fireball"), or multiple token action abilities that reference specific player char sheets for DC's etc. Since you already have the fireball token selected to move it into place, extra clicking is minimized. That token action ability could easily be the super-duper fireball scriptcard. **I actually spawn a single rollable table token that contains all of the caster's available Area of Effect spell templates/graphics, and have a set of token action abilities on that GenericAoE character sheet for the different spell rolls, etc. to send to chat. The abilities all reference the individual player's stats. So the same multi-sided token gives options for Fireball, Cone of Cold, etc., and the player just selects the one they want. I'm not going to speak for Kurt to say how difficult it would be to change how --i works, so just trying to think of things that are doable as-is.  
@David M.  Hadn't thought about that - I use that process for Wild Shape and Invisibility and you are quite correct that that would allow for a single character sheet/token to be used.  Good suggestion!  The player can then pull the token from the rollable table and just select through the multi-sided choices for the token they want.  Can you use the Spawn script to pull a rollable token onto the page? I'm going to have to look in to rollable tables again and see how I can manipulate that to good effect.   Thanks!