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

@Gene - looks like the macro is trying to assign an invalid value to bar3_value attribute of a token in a tokenmod command.
Kurt J.,  The dragonborn breath weapon script is amazing! Thank you. I also snagged the Fireball script. It works great up until it applies damage and then nothing happens.    I see this in the code:    --:ApplyDamageTokenmod|Parameters are tokenid;bar#;amount   --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%] What I don't see and can't figure out how to tell the code what the %2% is. Any ideas?
Michael C. said: @Gene - looks like the macro is trying to assign an invalid value to bar3_value attribute of a token in a tokenmod command. Yea, I can't figure it out, but Kurt just posted a breath weapon for dragonborn that is awesome. 
1631099760

Edited 1631100683
David M.
Pro
API Scripter
Gene, the [%2%] is the second parameter passed to the procedure in which the --@token-mod line resides. See this section of the wiki for more details on calling procedures. I scrolled back a bit to try to find your original macro in question but didn't see what you were referencing so I can't be more explicit at the moment. But, at some point in the macro, you will see something like -->ApplyDamageTokenmod|param1;param2;param3     //where param1 is an id variable, param2 is bar number, and param3 is the value or maybe part of a conditional like --?[$var1] -gt [$someOtherValue]|>ApplyDamageTokenmod;param1;param2;param3 The param values will be passed to that procedure as [%1%], [%2%], and [%3%].
1631100416

Edited 1631100434
@Gene - [%#%] codes substitute a parameter passed by the calling command:  e.g. -->Gosub|[value1];[value2];[value3].  In this case, it looks like it is trying to pass the hp value to the tokenmod subroutine but is passing something other than the expected number.  The call to this particular subroutine is passing three values sequentially with the third being incorrect.  It is a standard command passing the tokenid, bar# for hp (I usually hard code this to 1 rather than a parameter but each to their own) and the hit points to add and subtract.  Check to see what value is being placed as [%3%].  Edit: Oops.  I see I cross posted with David's better answer. 
1631222924

Edited 1631416048
I am trying to incorporate the DND 5e Library.  I am attempting the test on the scriptcard wiki: !script {{ +++dnd5elib+++ --#|Damage Modifiers Test --#targettoken|@{target|token_id} -->Lib5E_CheckDamageModifiers|ResistType;fire --=DamageRoll|2d10 [&ResistType] --+Test:|[$DamageRoll] fire damage -->Lib5E_CheckDamageModifiers|ResistType;cold --=DamageRoll|2d10 [&ResistType] --+Test:|[$DamageRoll] cold damage -->Lib5E_CheckDamageModifiers|ResistType;poison --=DamageRoll|2d10 [&ResistType] --+Test:|[$DamageRoll] poison damage -->Lib5E_CheckDamageModifiers|ResistType;acid --=DamageRoll|2d10 [&ResistType] --+Test:|[$DamageRoll] acid damage --X| }} I am getting the following error: "ScriptCards Error: Parameter content is not valid. Do you have unescaped quotes or qoutes not surrounding escaped values?" These is the results I get: Assassin should be resistant to poison damage. Anyone got some pointers? I believe it is having an issues with the Library that is on the scriptcards Wiki.  The [%1%] doesn't seem to be carrying over to the second part.  I have tried changing it to the variable name it seems to work. --/|ScriptCards Library: dnd5elib version 0.0.1 --/|Provides various utility procedures for D&D 5E games --/|Lib5E_CheckDamageModifiers handle damage resistance, vulnerability, and immunity. --/|Pass a string variable to be filled with a string to be appended to a dice roll and the damage type --:Lib5E_CheckDamageModifiers|damageVariableName;damageType --&[%1%]| --?"[*T:npc_vulnerabilities]" -inc "[%2%]"|>_Lib5E_IsVulnerable;[%1%] --?"[*T:npc_resistances]" -inc "[%2%]"|>_Lib5E_IsResistant;[%1%] --?"[*T:npc_immunities]" -inc "[%2%]"|>_Lib5E_IsImmune;[%1%] --<| --:_Lib5E_IsVulnerable| --&[%1%]| * 2 [Vulnerable] --<| --:_Lib5E_IsResistant| --&[%1%]| \ 2 [Resistant] --<| --:_Lib5E_IsImmune| --&[%1%]| * 0 [Immune] --<|
Michael C. said: @Gene - looks like the macro is trying to assign an invalid value to bar3_value attribute of a token in a tokenmod command. Not sure what I did, but I got it to work the way I wanted. I really do suck at this scripting.
David M. said: Gene, the [%2%] is the second parameter passed to the procedure in which the --@token-mod line resides. See this section of the wiki for more details on calling procedures. I scrolled back a bit to try to find your original macro in question but didn't see what you were referencing so I can't be more explicit at the moment. But, at some point in the macro, you will see something like -->ApplyDamageTokenmod|param1;param2;param3     //where param1 is an id variable, param2 is bar number, and param3 is the value or maybe part of a conditional like --?[$var1] -gt [$someOtherValue]|>ApplyDamageTokenmod;param1;param2;param3 The param values will be passed to that procedure as [%1%], [%2%], and [%3%]. Here is the Fireball script: !script {{   --/|Script Name : 5E Fireball   --/|Version     : 1.1   --/|Requires SC : 1.3.1+   --/|Author      : Kurt Jaegers   --/|Description : Deals fireball damage to all tokens that represent creations in a 20' radius around target token   --/|Set up the card appearance   --#title|@{selected|character_name} casts Fireball!   --#bodyFontSize|12px   --#titlecardbackground|#800000   --#leftsub|Save DC @{selected|spell_save_dc}   --/|Get a spell slot level from the caster.   --=SpellLevel|?{Spell Slot Level?|3|4|5|6|7|8|9}   --#rightsub|Slot Level: [$SpellLevel]   --/|Calculate damage based on spell slot. Fireball is 8d6 for 3rd level, so 5+SpellLevel d6 total.   --=DamageDice|[$SpellLevel.Total] + 5   --=Damage|[$DamageDice.Total]d6   --=HalfDamage|[$Damage.Total] \ 2   --/|Since we want to be able to hover over a roll and see the dice details, output the rolled damage at the   --/|top of the card. If all critters make their save, the half damage roll won't contain the details.   --+|[c][b]Damage Roll: [/b][$Damage][/c]   --+|    --/|Get all tokens on the page into the "alltokens" array   --~|array;pagetokens;alltokens;@{target|token_id}   --/|Create the "inRange" array. It will have a blank item in it to begin with, which we will remove later.   --~|array;define;inRange;   --/|Loop through all of the tokens in "alltokens" to check their distance   --~tokenid|array;getfirst;alltokens   --?[&tokenid] -eq ArrayError|endOutput   --:loopCheck|   --/|Skip targets that are not on the token layer or that don't represent creatures   --?[*[&tokenid]:t-layer] -ne objects|continue   --?"[*[&tokenid]:t-represents]" -ninc "-"|continue   --/|Check the distance between the target token and the current array token. 20 feet is 4 units   --~dist|distance;@{target|token_id};[&tokenid]   --?[$dist] -gt 4|continue   --/|If we didn't skip over this part, the token is within 20 feet, so add it to the inRange array   --~|array;add;inRange;[&tokenid]   --:continue|   --~tokenid|array;getnext;alltokens   --?[&tokenid] -ne ArrayError|loopCheck   --/|Remove the dummy first item in the inRange array   --~|array;removeat;inRange;0   --/|Loop through the inRange tokens and roll saves for each one and apply damage   --~tokenid|array;getfirst;inRange   --?[&tokenid] -eq ArrayError|endOutput   --:loopDisplay|   -->MakeSavingThrow|[&tokenid];dexterity;@{selected|spell_save_dc};[$Damage.Total];fire;thisTokenDamage;saveResult;dex   --+[*[&tokenid]:character_name]:|Save [$savingThrow] [r][$thisTokenDamage] fire damage[/r]   --/|Put a burn-fire visual effect on impacted tokens   --vtoken|[&tokenid] burn-fire   --/|Get the next token and continue the loop until we run out.   --~tokenid|array;getnext;inRange   --?[&tokenid] -ne ArrayError|loopDisplay   --/|Add some extra visual effects - a nova-fire at the target, and a beam-fire from source to target   --vtoken|@{target|token_id} nova-fire   --vbetweentokens|@{selected|token_id} @{target|token_id} beam-fire   --:endOutput|   --X|   --/|Subroutine to make saving throws and calculate damage amounts   --:MakeSavingThrow|tokenid;savetype;dc;damage;damagetype;damagevariable;saveresultvariable;shortabilityname   --?"X[*[%1%]:npc_[%8%]_save_base]" -eq "X"|>set_string;baseSaveBonus;|>set_string;baseSaveBonus; + + [*[%1%]:npc_[%8%]_save_base]   --=savingThrow|1d20 + [*[%1%]:[%2%]_save_bonus] [&baseSaveBonus]   --&dmgmult|   --?[$savingThrow] -ge [%3%]|>set_string;dmgmult; \ 2   --?[$savingThrow] -lt [%3%]|>set_string;[%7%];fail   --?[$savingThrow] -ge [%3%]|>set_string;[%7%];success   --?"[*[%1%]:npc_resistances]" -inc "[%5%]" -and [$savingThrow] -lt [%3%]|>set_string;dmgmult; \ 2   --?"[*[%1%]:npc_resistances]" -inc "[%5%]" -and [$savingThrow] -ge [%3%]|>set_string;dmgmult; * 0   --?"[*[%1%]:npc_vulnerabilities]" -inc "[%5%]" -and [$savingThrow] -ge [%3%]|>set_string;dmgmult;   --?"[*[%1%]:npc_vulnerabilities]" -inc "[%5%]" -and [$savingThrow] -lt [%3%]|>set_string;dmgmult; * 2   --?"[*[%1%]:npc_immunities]" -inc "[%5%]"|>set_string;dmgmult; * 0     --=[%6%]|[%4%] [&dmgmult]    --<|   --:set_string|mod_variable;value   --&[%1%]|[%2%]   --<|      --/|Subroutine to apply damage with TokenMod. Could be replcaed with alterbars or chatsetattr   --:ApplyDamageTokenmod|Parameters are tokenid;bar#;amount   --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%]   --<| }}
Michael C. said: @Gene - [%#%] codes substitute a parameter passed by the calling command:  e.g. -->Gosub|[value1];[value2];[value3].  In this case, it looks like it is trying to pass the hp value to the tokenmod subroutine but is passing something other than the expected number.  The call to this particular subroutine is passing three values sequentially with the third being incorrect.  It is a standard command passing the tokenid, bar# for hp (I usually hard code this to 1 rather than a parameter but each to their own) and the hit points to add and subtract.  Check to see what value is being placed as [%3%].  Edit: Oops.  I see I cross posted with David's better answer.  Thanks, I saw both replies at the same time. 
1631253896
Senjak
Pro
Sheet Author
I wanted to be able to choose the dice sides and the number of dice and put out a result that matched the format of another tool I'd put together. I had a bit of a struggle getting the syntax right to sum the dice and display that. (I never did quite figure out how to sum the dice and have the tooltip include all of the die rolls) But I got things mostly working. One part that is bothering me still is little problem with roll highlights that I'm hoping someone can suggest a solution other than using '--#norollhighlight|1' to turn off the highlighting.&nbsp; Note that I see this problem in both Firefox and Chrome. Version is "-=&gt; ScriptCards - 1.4.0e by Kurt Jaegers Ready &lt;=- Meta Offset : 9680" The problem is that although I adjusted the font size on the card, the box around a die roll didn't grow as well. I've included my source so that my error can more rapidly be found :-) Thank you for any help you can offer and any suggestions on how to improve the script. !scriptcards {{ --#titlefontlineheight|3.5em --#titleCardBackground|#000000 --#buttontextcolor|#000000 --#buttonbordercolor|#000000 --#lineheight|2.0em --#titleFontSize|2.05em --#bodyfontsize|22px --#subtitlefontsize|16px --#dicefontsize|18px --#title|Challenge to beat! --#norollhighlight|1 --:Set some Variables| --&amp;base_html|<a href="https://raw.githubusercontent.com/Roll20/roll20-character-sheets/master/Dragon-Prince-fanmade/assets/" rel="nofollow">https://raw.githubusercontent.com/Roll20/roll20-character-sheets/master/Dragon-Prince-fanmade/assets/</a> --&amp;normal_html|-280x280.png --&amp;hitch_html|-blank-280x280-hitch.png --&amp;plot_point|[&amp;base_html]plotpoint.png --&amp;normal_rgb|#0F0 --&amp;hitch_rgb|#F00 --=Dice_Total|0 --&amp;Difficulty|?{How difficult is the challenge?|Very_Easy|Easy|Challenging|Hard|Very_Hard} --?[&amp;Difficulty] -inc Very_Easy|[ --&amp;Difficulty_Dice|d4 --]|[ --?[&amp;Difficulty] -inc "Easy"|[ --&amp;Difficulty_Dice|d6 --]| --]| --?[&amp;Difficulty] -inc "Challenging"|[ --&amp;Difficulty_Dice|d8 --]| --?[&amp;Difficulty] -inc "Very_Hard"|[ --&amp;Difficulty_Dice|d12 --]|[ --?[&amp;Difficulty] -inc Hard|[ --&amp;Difficulty_Dice|d10 --]| --]| --&amp;Dice2Roll|?{How many dice to roll?|1|2|3|4|5|6} --#leftsub|[&amp;Difficulty] --#rightsub|[&amp;Dice2Roll][&amp;Difficulty_Dice] --%LoopCounter|1;[&amp;Dice2Roll]|1 --C[&amp;Difficulty_Dice]|d4:&gt;Dice_Checks;[&amp;LoopCounter];d4|d6:&gt;Dice_Checks;[&amp;LoopCounter];d6|d8:&gt;Dice_Checks;[&amp;LoopCounter];d8|d10:&gt;Dice_Checks;[&amp;LoopCounter];d10|d12:&gt;Dice_Checks;[&amp;LoopCounter];d12 --=Dice_Total|[$Dice_Total]+[$X_Roll] --%| --&amp;GT|[$Dice_Total] --=ME|[&amp;GT] --+Total:|[$ME] --X| --:Hitch| --&amp;html_tail|[&amp;hitch_html] --&lt;|End of Hitch --:Normal| --&amp;html_tail|[&amp;normal_html] --&lt;|End of Normal --:d4| --?[%1%] -eq 1|[ --&amp;html_tail|[&amp;hitch_html] --+[img width=60][&amp;base_html]d4[&amp;html_tail][/img]|[#F00]Roll #[%2%]: [b][%1%][/b][/#] --]|[ --&amp;html_tail|[&amp;normal_html] --+[img width=60][&amp;base_html]d4[&amp;html_tail][/img]|Roll #[%2%]: [b][%1%][/b] --]| --&lt;|End of d4 --:d6| --?[%1%] -eq 1|[ --&amp;html_tail|[&amp;hitch_html] --+[img width=60][&amp;base_html]d6[&amp;html_tail][/img]|[#F00]Roll #[%2%]: [b][%1%][/b][/#] --]|[ --&amp;html_tail|[&amp;normal_html] --+[img width=60][&amp;base_html]d6[&amp;html_tail][/img]|Roll #[%2%]: [b][%1%][/b] --]| --&lt;|End of d6 --:d8| --?[%1%] -eq 1|[ --&amp;html_tail|[&amp;hitch_html] --+[img width=60][&amp;base_html]d8[&amp;html_tail][/img]|[#F00]Roll #[%2%]: [b][%1%][/b][/#] --]|[ --&amp;html_tail|[&amp;normal_html] --+[img width=60][&amp;base_html]d8[&amp;html_tail][/img]|Roll #[%2%]: [b][%1%][/b] --]| --&lt;|End of d8 --:d10| --?[%1%] -eq 1|[ --&amp;html_tail|[&amp;hitch_html] --+[img width=60][&amp;base_html]d10[&amp;html_tail][/img]|[#F00]Roll #[%2%]: [b][%1%][/b][/#] --]|[ --&amp;html_tail|[&amp;normal_html] --+[img width=60][&amp;base_html]d10[&amp;html_tail][/img]|Roll #[%2%]: [b][%1%][/b] --]| --&lt;|End of D10 --:d12| --?[%1%] -eq 1|[ --&amp;html_tail|[&amp;hitch_html] --+[img width=60][&amp;base_html]d12[&amp;html_tail][/img]|[#F00]Roll #[%2%]: [b][%1%][/b][/#] --]|[ --&amp;html_tail|[&amp;normal_html] --+[img width=60][&amp;base_html]d12[&amp;html_tail][/img]|Roll #[%2%]: [b][%1%][/b] --]| --&lt;|End of D12 --:Dice_Checks| --&amp;X_Sides|[%2%] --&amp;X_Base_Roll|1[%2%] --=X_Roll|[&amp;X_Base_Roll] --C[%2%]|d4:&gt;d4;[$X_Roll];[%1%]|d6:&gt;d6;[$X_Roll];[%1%]|d8:&gt;d8;[$X_Roll];[%1%]|d10:&gt;d10;[$X_Roll];[%1%]|d12:&gt;d12;[$X_Roll];[%1%] --&lt;| }}
1631257999
Senjak
Pro
Sheet Author
Oddly enough, when I removed the line: --#lineheight|2.0em from my code the output looked as I was expecting.
@Gene - the subroutine in question is the last set of commands but that macro doesn't seem to actually call the subroutine.&nbsp; There should be a line: &nbsp;&nbsp; --&gt;ApplyDamageTokenmod|[&amp;tokenid];1;[$thisTokenDamage]&nbsp; ( note that I use bar1 for hp, if you use 3 then the second parameter should reflect that ) Just after the two lines: &nbsp; --&gt;MakeSavingThrow|[&amp;tokenid];dexterity;@{selected|spell_save_dc};[$Damage.Total];fire;thisTokenDamage;saveResult;dex &nbsp; --+[*[&amp;tokenid]:character_name]:|Save [$savingThrow] [r][$thisTokenDamage] fire damage[/r]
1631312477

Edited 1631314525
Can someone please help me figure out why a Conditional within a Procedure doesn't seem to be working.&nbsp; Essentially, this script goes through all of the Repeating Resources, looking for Potions (resource name includes "Potion").&nbsp; This part of the conditional works.&nbsp; However, when I get to the part where I list specific macro buttons based on the type of Potion, the conditional isn't working and the variable [&amp;MacroName] never gets set. !scriptcard {{ --#title|Available Potions --#sourceToken|@{selected|token_id} --#leftsub|Potion Quantity --#rightsub|Bonus Action --:FindAllPotions| --Rfirst|@{selected|character_id};repeating_resource --:SearchResourceLoop| --?"[*R:resource_left_name]" -inc "Potion" |&gt;ListPotion;[*R:resource_left_name];[*R:resource_left] --?"[*R:resource_right_name]" -inc "Potion"|&gt;ListPotion;[*R:resource_right_name];[*R:resource_right] --Rnext| --?"[*R:resource_left_name]" -ne "NoRepeatingAttributeLoaded"|SearchResourceLoop --&gt;End| --:ListPotion|Params are Attribute Reference;Attribute value --&amp;PotionName|[%1%] --=PotionCount|[%2%] --&gt;GetMacroName| --?[$PotionCount] -ge 1|[ --+[&amp;PotionName]|[$PotionCount][r][button]TAKE POTION::!&amp;#13;#[&amp;MacroName][/button][/r] --]|[ --+[&amp;PotionName]|[$PotionCount] --]| --&lt;| --:GetMacroName| --?[&amp;PotionName] -inc "Speed"|&amp;MacroName;Potion-Speed --?[&amp;PotionName] -inc "of Healing"|&amp;MacroName;Potion-Healing --?[&amp;PotionName] -inc "Greater Healing"|&amp;MacroName;Potion-GrHealing --?[&amp;PotionName] -inc "Superior Healing"|&amp;MacroName;Potion-SHealing --?[&amp;PotionName] -inc "Supreme Healing"|&amp;MacroName;Potion-SpHealing --?[&amp;PotionName] -inc "Heroism"|&amp;MacroName;Potion-Heroism --&lt;| --:End| }} There must be some error I'm missing in the GetMacroName conditionals.&nbsp; I just saw that it is throwing an API Sandbox message: "ScriptCards conditional error: Condition contains an invalid clause joiner on line. Only -and and -or are supported. Assume results are incorrect. Potion of Heroism -inc \"Speed\"" "ScriptCards conditional error: Condition contains an invalid clause joiner on line. Only -and and -or are supported. Assume results are incorrect. Potion of Heroism -inc \"of Healing\"" "ScriptCards conditional error: Condition contains an invalid clause joiner on line. Only -and and -or are supported. Assume results are incorrect. Potion of Heroism -inc \"Greater Healing\"" "ScriptCards conditional error: Condition contains an invalid clause joiner on line. Only -and and -or are supported. Assume results are incorrect. Potion of Heroism -inc \"Superior Healing\"" "ScriptCards conditional error: Condition contains an invalid clause joiner on line. Only -and and -or are supported. Assume results are incorrect. Potion of Heroism -inc \"Supreme Healing\"" "ScriptCards conditional error: Condition contains an invalid clause joiner on line. Only -and and -or are supported. Assume results are incorrect. Potion of Heroism -inc \"Heroism\""
1631353957
Kurt J.
Pro
API Scripter
Matt M. said: Can someone please help me figure out why a Conditional within a Procedure doesn't seem to be working.&nbsp; Essentially, this script goes through all of the Repeating Resources, looking for Potions (resource name includes "Potion").&nbsp; This part of the conditional works.&nbsp; However, when I get to the part where I list specific macro buttons based on the type of Potion, the conditional isn't working and the variable [&amp;MacroName] never gets set. --:GetMacroName| --?[&amp;PotionName] -inc "Speed"|&amp;MacroName;Potion-Speed --?[&amp;PotionName] -inc "of Healing"|&amp;MacroName;Potion-Healing --?[&amp;PotionName] -inc "Greater Healing"|&amp;MacroName;Potion-GrHealing --?[&amp;PotionName] -inc "Superior Healing"|&amp;MacroName;Potion-SHealing --?[&amp;PotionName] -inc "Supreme Healing"|&amp;MacroName;Potion-SpHealing --?[&amp;PotionName] -inc "Heroism"|&amp;MacroName;Potion-Heroism --&lt;| --:End| }} In the lines above, put quotes around the [&amp;PotionName], because it is likely (definite) that the value contains one or more spaces, which is what is throwing off the conditional.
1631354068
Kurt J.
Pro
API Scripter
Senjak said: Oddly enough, when I removed the line: --#lineheight|2.0em from my code the output looked as I was expecting. I will look at what I can do to make the roll highlight respect the line height setting.
Thanks! &nbsp;Not sure why that didn’t occur to me, but that did it! Kurt J. said: Matt M. said: Can someone please help me figure out why a Conditional within a Procedure doesn't seem to be working.&nbsp; Essentially, this script goes through all of the Repeating Resources, looking for Potions (resource name includes "Potion").&nbsp; This part of the conditional works.&nbsp; However, when I get to the part where I list specific macro buttons based on the type of Potion, the conditional isn't working and the variable [&amp;MacroName] never gets set. --:GetMacroName| --?[&amp;PotionName] -inc "Speed"|&amp;MacroName;Potion-Speed --?[&amp;PotionName] -inc "of Healing"|&amp;MacroName;Potion-Healing --?[&amp;PotionName] -inc "Greater Healing"|&amp;MacroName;Potion-GrHealing --?[&amp;PotionName] -inc "Superior Healing"|&amp;MacroName;Potion-SHealing --?[&amp;PotionName] -inc "Supreme Healing"|&amp;MacroName;Potion-SpHealing --?[&amp;PotionName] -inc "Heroism"|&amp;MacroName;Potion-Heroism --&lt;| --:End| }} In the lines above, put quotes around the [&amp;PotionName], because it is likely (definite) that the value contains one or more spaces, which is what is throwing off the conditional.
When using Scriptcards Repeating Resource capability, how do I reference the actual ID once it is found?&nbsp; I can use the [*R:attribute] to reference the resource name, amount and max.&nbsp; But what is the parameter to reference the actual ID?&nbsp; I need this in order to manipulate it via chatsetattr. The bolded line below is hardcoded to&nbsp; repeating_resource_$1_resource_left.&nbsp; What would the equivalent be to reference this repeating resource ID using the [*R:]? --:FindPotion| &nbsp; --&amp;PotionName|Potion of Healing &nbsp; --Rfirst|@{selected|character_id};repeating_resource &nbsp; --:SearchResourceLoop| &nbsp; --?"[*R:resource_left_name]" -eq "[&amp;PotionName]" |&gt;CheckUses;[*R:resource_left_name];[*R:resource_left] &nbsp; --?"[*R:resource_right_name]" -eq "[&amp;PotionName]"|&gt;CheckUses;[*R:resource_right_name];[*R:resource_right] &nbsp; --Rnext| &nbsp; --?"[*R:resource_left_name]" -ne "NoRepeatingAttributeLoaded"|SearchResourceLoop &nbsp; --&gt;End| --:CheckUses| &nbsp; --=Uses|[%2%] &nbsp; --=Remaining|[$Uses]-1 &nbsp; --?[$Uses.Total] -gt 0|&gt;HasUses|&gt;NoMoreUses --X|End Macro --:FUNCTIONS| &nbsp; --:HasUses| &nbsp; &nbsp; &nbsp; &nbsp;--=Healed|2d4 + 2 &nbsp; &nbsp; &nbsp; &nbsp;--+Amount Healed|[$Healed] &nbsp; &nbsp; &nbsp; &nbsp;--+Potions Remaining|[$Remaining] &nbsp; &nbsp; &nbsp; &nbsp;--@modattr|_silent _name @{selected|token_name} _repeating_resource_$1_resource_left |-1 &nbsp; &nbsp; &nbsp; &nbsp;--@token-mod|_ids @{selected|token_id}&nbsp; _set bar1_value|+[$Healed]! &nbsp; --&lt;|
You might look at the *R&gt;attributename notation below.&nbsp; That might get you what you are looking for. Repeating Section Values You can reference repeating attribute data using the syntax [*R:attributename] syntax (similar to referencing standard character attributes). The currently active repeating row information will be used to retrieve attribute values. You can also retrieve the full attribute name for a repeating row attribute by using the [*R&gt;attributename] notation. This is useful to pass to things like chatsetattr. Matt M. said: When using Scriptcards Repeating Resource capability, how do I reference the actual ID once it is found?&nbsp; I can use the [*R:attribute] to reference the resource name, amount and max.&nbsp; But what is the parameter to reference the actual ID?&nbsp; I need this in order to manipulate it via chatsetattr. The bolded line below is hardcoded to&nbsp; repeating_resource_$1_resource_left.&nbsp; What would the equivalent be to reference this repeating resource ID using the [*R:]?
Michael C. said: @Gene - the subroutine in question is the last set of commands but that macro doesn't seem to actually call the subroutine.&nbsp; There should be a line: &nbsp;&nbsp; --&gt;ApplyDamageTokenmod|[&amp;tokenid];1;[$thisTokenDamage]&nbsp; ( note that I use bar1 for hp, if you use 3 then the second parameter should reflect that ) Just after the two lines: &nbsp; --&gt;MakeSavingThrow|[&amp;tokenid];dexterity;@{selected|spell_save_dc};[$Damage.Total];fire;thisTokenDamage;saveResult;dex &nbsp; --+[*[&amp;tokenid]:character_name]:|Save [$savingThrow] [r][$thisTokenDamage] fire damage[/r] I got that put in and it works great. Well it does once I added a "-" before [$thisTokenDamage]. It was just setting the bar to equal the damage done. Thanks again for all of your help.&nbsp;
I'm sure this is a dumb question but does anyone have a list of fonts that Script Cards will utilize?&nbsp;
1631399390

Edited 1631406263
Gene S. said: I'm sure this is a dumb question but does anyone have a list of fonts that Script Cards will utilize?&nbsp; I believe most of these should work.&nbsp; I looked at one time, and never found anything definitive.&nbsp;&nbsp; --I;Set Title Card Font Face|q;UserInput;Title Card Font Face (fmt: Font name)?|Arial|Candal|Contrail One|Patrick Hand|Shadows Into Light|Brush Script MT|Courier New|Garamond|Georgia|Helvetica|Tahoma|Times New Roman|Trebuchet MS|Verdana
Will M. said: Gene S. said: I'm sure this is a dumb question but does anyone have a list of fonts that Script Cards will utilize?&nbsp; I believe most of these should work.&nbsp; I looked at one time, and never found anything definitive.&nbsp;&nbsp; --I;Set Title Card Font Face|q;UserInput;Title Card Font Face (fmt: Font name)?|Arial|Candal|Contrail One|Patrick Hand|Shadows Into Light|Brush Script MT|Courier New|Garamond|Georgia|Helvetica|Tahoma|Times New Roman|Trebuchet MS|Verdana Thanks, I'll try them when I get home. I appreciate your time.&nbsp;
@Will M. Thanks, they worked and now I can give a different look for each of my players. I appreciate it.&nbsp;
1631831321
Kurt J.
Pro
API Scripter
ScriptCards version 1.4.2 on GitHub (From 1.4.1) Added math/sqrt function and {SQRT} roll modifier. (From 1.4.1)&nbsp;Fixed abs, min, and max functions that got broken at some point. (From 1.4.1)&nbsp;Fixed a potential sandbox crash if incorrect/missing parameters were passed to replaceVariableContent Added several additional roll modifiers, including {SIN}, {COS}, {TAN}, {ASIN}, {ACOS}, {ATAN}, {SQUARE}, {CUBEROOT}, {CUBE} Added setting (--#) called "rollhilightlineheight" which can be used to set the size of the roll hilight box. This is useful if you have increased the lineheight setting and want the hilight box to expand as well. Fixed the incorrect handling of negative numbers in roll parsing for operations other than addition (which just became subtraction :))
@Kurt - Massive! Thanks!&nbsp; I had a (possibly stupid) question I meant to ask: I understand that the reversed "\" symbol divides and rounds up.&nbsp; What is the command if you want to divide and round down?
Gene S. said: Michael C. said: @Gene - the subroutine in question is the last set of commands but that macro doesn't seem to actually call the subroutine.&nbsp; There should be a line: &nbsp;&nbsp; --&gt;ApplyDamageTokenmod|[&amp;tokenid];1;[$thisTokenDamage]&nbsp; ( note that I use bar1 for hp, if you use 3 then the second parameter should reflect that ) Just after the two lines: &nbsp; --&gt;MakeSavingThrow|[&amp;tokenid];dexterity;@{selected|spell_save_dc};[$Damage.Total];fire;thisTokenDamage;saveResult;dex &nbsp; --+[*[&amp;tokenid]:character_name]:|Save [$savingThrow] [r][$thisTokenDamage] fire damage[/r] I got that put in and it works great. Well it does once I added a "-" before [$thisTokenDamage]. It was just setting the bar to equal the damage done. Thanks again for all of your help.&nbsp; Sorry, I should have mentioned that my macros deal with damage differently.&nbsp; I use alterbars instead of tokenmod as well as ignoring the character sheet in favor of lvl#_slots_expended showing expended rather than remaining slots.&nbsp; Glad it worked for you.
1631884525
Andrew R.
Pro
Sheet Author
Michael C. said: @Kurt - Massive! Thanks!&nbsp; I had a (possibly stupid) question I meant to ask: I understand that the reversed "\" symbol divides and rounds up.&nbsp; What is the command if you want to divide and round down? You have that backwards. The "\" operator rounds down. You use "{CEIL}" etc., to round up.
1631918416

Edited 1631971265
Kurt J.
Pro
API Scripter
Andrew R. said: Michael C. said: @Kurt - Massive! Thanks!&nbsp; I had a (possibly stupid) question I meant to ask: I understand that the reversed "\" symbol divides and rounds up.&nbsp; What is the command if you want to divide and round down? You have that backwards. The "\" operator rounds down. You use "{CEIL}" etc., to round up. Technically the "\" operator does division with an integer result. By default, it will round down, but setting the --#roundup|1 setting value will change this behavior. As Andrew indicated, it is likely preferable to explicitly spell out what you want to do in the roll: --=Roll|1d20 / 5 {FLOOR} or&nbsp; --=Roll|1d20 / 5 {CEIL} So it is always evident what the result is. Also, while looking into this, I noticed that the "\" operator was not being implemented in some cases, like if the divisor was a roll expression instead of a constant number. I've bumped the GitHub version to 1.4.3 that corrects this oversight.
Does anyone know if there is a field on the 5E OGL NPC sheet to query whether the target has advantage (or disadvantage) on Saving Throws or not?&nbsp;&nbsp; For example, the Barbed Devil has "Magic Resistance" which gives Advantage on Saving Throws vs Magic.&nbsp; So, in my Scriptcards for spells, I'm looking for a way to make the Save at Advantage (when the target NPC gets Advantage).&nbsp;&nbsp;
Matt M. said: Does anyone know if there is a field on the 5E OGL NPC sheet to query whether the target has advantage (or disadvantage) on Saving Throws or not?&nbsp;&nbsp; For example, the Barbed Devil has "Magic Resistance" which gives Advantage on Saving Throws vs Magic.&nbsp; So, in my Scriptcards for spells, I'm looking for a way to make the Save at Advantage (when the target NPC gets Advantage).&nbsp;&nbsp; Hey Matt. This works for me. It runs through all the traits for the "target" and is looking for a value that -inc "Magic Resistance", and then it branches to the magic resistance procedure to include in the save roll. --Rfirst|@{target|character_id};repeating_npctrait&nbsp; --:npctraitLoop|&nbsp; --?"[*R:name]" -eq NoRepeatingAttributeLoaded|endTraits&nbsp; --?"[*R:name]" -inc "Magic Resistance" |MagicResistanceYes --Rnext|&nbsp; --&gt;npctraitLoop|&nbsp; &nbsp; --:endTraits|
1632498701
Kurt J.
Pro
API Scripter
ScriptCards v 1.4.4 on the GitHub Version 1.4.4 is available, with the following updates: Updated distance calculations to take page scale (snapping_increment) into account Added setting options for rollhilightcolornormal, rollhilightcolorcrit, rollhilightcolorfumble, and rollhilightcolorboth to allow the color of the box around rolls to be customized.
Mads said: Hey Matt. This works for me. It runs through all the traits for the "target" and is looking for a value that -inc "Magic Resistance", and then it branches to the magic resistance procedure to include in the save roll. --Rfirst|@{target|character_id};repeating_npctrait&nbsp; --:npctraitLoop|&nbsp; --?"[*R:name]" -eq NoRepeatingAttributeLoaded|endTraits&nbsp; --?"[*R:name]" -inc "Magic Resistance" |MagicResistanceYes --Rnext|&nbsp; --&gt;npctraitLoop|&nbsp; &nbsp; --:endTraits| Very cool!&nbsp; I will have to test this out.&nbsp; Thanks!!
I'm trying to find a way to select a dynamic number of targets based on Spell Level.&nbsp; Many spells do this, so figuring this out will enable a whole lot of upgrades to spells that I have locked to a fixed number of targets right now (usually single target) like Invisibility, Hold Person, Aid, etc. At first, I tried using a variable in the target call like this @{target|[%1%]|target_name} But that doesn't work.&nbsp; I used brute force around that by using a Case Statement and calling the correct target subroutine.&nbsp; But I'm stuck on how to only *select* the correct number of targets.&nbsp; With this, the caster has to still select the full (maximum) number of targets, regardless of the Spell Level.&nbsp; Is there a way to only *select* the correct number of targets needed based on Spell Level? &nbsp;--|/Call Correct Number of Targets based on Spell Level &nbsp; --=TotalTargets|[$SpellLevel] - 1 /One target at 2nd level and one additional target per higher spell level &nbsp; --%TargetLoop|1;[$TotalTargets] &nbsp; &nbsp; --&gt;TargetCast|[&amp;TargetLoop] &nbsp; &nbsp; --%| &nbsp; &nbsp; &nbsp; --:EndMacro|&nbsp; &nbsp; --X| &nbsp; --:TargetCast| &nbsp; &nbsp; --=TargetNum|[%1%] &nbsp; &nbsp; --+TargetNum|[$TargetNum] --C[$TargetNum]|1:&gt;Target1|2:&gt;Target2|3:&gt;Target3|4:&gt;Target4|5:&gt;Target5 &nbsp; &nbsp; --&lt;| &nbsp; --:Target1| &nbsp; &nbsp; --+Target 1 Name|@{target|1|token_name} &nbsp; &nbsp; --&lt;| &nbsp; --:Target2| &nbsp; &nbsp; --+Target 2 Name|@{target|2|token_name} &nbsp; &nbsp; --&lt;| &nbsp; --:Target3| &nbsp; &nbsp; --+Target 3 Name|@{target|3|token_name} &nbsp; &nbsp; --&lt;| &nbsp; --:Target4| &nbsp; &nbsp; --+Target 4 Name|@{target|4|token_name} &nbsp; &nbsp; --&lt;| &nbsp; --:Target5| &nbsp; &nbsp; --+Target 5 Name|@{target|5|token_name} &nbsp; &nbsp; --&lt;|
1632659276
Kurt J.
Pro
API Scripter
Matt M. said: I'm trying to find a way to select a dynamic number of targets based on Spell Level.&nbsp; Many spells do this, so figuring this out will enable a whole lot of upgrades to spells that I have locked to a fixed number of targets right now (usually single target) like Invisibility, Hold Person, Aid, etc. At first, I tried using a variable in the target call like this @{target|[%1%]|target_name} But that doesn't work.&nbsp; I used brute force around that by using a Case Statement and calling the correct target subroutine.&nbsp; But I'm stuck on how to only *select* the correct number of targets.&nbsp; With this, the caster has to still select the full (maximum) number of targets, regardless of the Spell Level.&nbsp; Is there a way to only *select* the correct number of targets needed based on Spell Level? &nbsp;--|/Call Correct Number of Targets based on Spell Level &nbsp; --=TotalTargets|[$SpellLevel] - 1 /One target at 2nd level and one additional target per higher spell level &nbsp; --%TargetLoop|1;[$TotalTargets] &nbsp; &nbsp; --&gt;TargetCast|[&amp;TargetLoop] &nbsp; &nbsp; --%| &nbsp; &nbsp; &nbsp; --:EndMacro|&nbsp; &nbsp; --X| &nbsp; --:TargetCast| &nbsp; &nbsp; --=TargetNum|[%1%] &nbsp; &nbsp; --+TargetNum|[$TargetNum] --C[$TargetNum]|1:&gt;Target1|2:&gt;Target2|3:&gt;Target3|4:&gt;Target4|5:&gt;Target5 &nbsp; &nbsp; --&lt;| &nbsp; --:Target1| &nbsp; &nbsp; --+Target 1 Name|@{target|1|token_name} &nbsp; &nbsp; --&lt;| &nbsp; --:Target2| &nbsp; &nbsp; --+Target 2 Name|@{target|2|token_name} &nbsp; &nbsp; --&lt;| &nbsp; --:Target3| &nbsp; &nbsp; --+Target 3 Name|@{target|3|token_name} &nbsp; &nbsp; --&lt;| &nbsp; --:Target4| &nbsp; &nbsp; --+Target 4 Name|@{target|4|token_name} &nbsp; &nbsp; --&lt;| &nbsp; --:Target5| &nbsp; &nbsp; --+Target 5 Name|@{target|5|token_name} &nbsp; &nbsp; --&lt;| Using the @{target...} notation directly will always prompt for every potential &nbsp;target, because that happens on the chat server before the ScriptCard gets executed. The Magic Missile sample script from when the --i command was added provides an example of selecting a dynamic number of targets. I've updated the script to use my current conventions on the GitHub here :&nbsp; ScriptCards/5e_Magic_Missile.txt at main · kjaegers/ScriptCards (github.com) Essentially it figures out how many targets there should be and then has the user click on a button to select them and reenter the script with the targets defined. Because the @{target...} entries are dynamically generated and hidden from the chat server when the card is initially run, you only get prompted for the correct number of targets.
Kurt J. said: Using the @{target...} notation directly will always prompt for every potential &nbsp;target, because that happens on the chat server before the ScriptCard gets executed. The Magic Missile sample script from when the --i command was added provides an example of selecting a dynamic number of targets. I've updated the script to use my current conventions on the GitHub here :&nbsp; ScriptCards/5e_Magic_Missile.txt at main · kjaegers/ScriptCards (github.com) Essentially it figures out how many targets there should be and then has the user click on a button to select them and reenter the script with the targets defined. Because the @{target...} entries are dynamically generated and hidden from the chat server when the card is initially run, you only get prompted for the correct number of targets. Kurt, this is excellent!&nbsp; I was able to use your example to create Scriptcards for Invisibility and Hold Person that prompts for the correct number of targets based on the selected Spell Slot Level.&nbsp; Fantastic! Thanks.
Hi everyone. I'm GMing a game, and I'm trying to use the "echo to chat" functionality in ScriptCards to send a whisper to one of my players. - When I tried this... &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --eGM|/w &lt;the name of his character&gt; asdfasdfasdfasdf ... nothing happened. - And when I tried this... &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --eplayer|&lt;my playerID&gt;|/w &lt;the name of his character&gt; asdfasdfasdfasdf ... it became clear that the "player|&lt;my playerID&gt;" part isn't going to work unless if ScriptCards has some sort of command that substitutes the "|" symbol in without messing with the ScriptCards syntax. - But anyway...&nbsp; &nbsp;has anyone got any ideas for how to make this work?
1632763335
David M.
Pro
API Scripter
Ronnie, I just did some testing on this and it looks like there is some counterintuitive behavior. I tried to whisper to my dummy account from a scriptcards echo to chat. My GM chat showed no output, but my dummy account actually did receive the whispered message. My guess is it has something to do with the way Roll20 interprets who is sending the message to provide the "copy" of the sent message in the sender's chat. Even though&nbsp; --eGM|/w &lt;Player&gt; msg &nbsp;sends a message "as" the GM, I'm guessing Roll20 still sees it as coming from the api and so doesn't have a valid sender for the sent copy. So, good news is that your first syntax example is probably working. Bad news is you currently don't get confirmation of it as GM. Unless this can be fixed, here's a hacky workaround: send yourself another whisper with the same message. Here's an example sending to my dummy player "Blavid" !script {{ --#hidecard|1 --&amp;player|Blavid --&amp;msg|This msg sent via Scriptcards --eGM|/w [&amp;player] [&amp;msg] --eGM|/w gm **Message to [&amp;player] from Scriptcards:** [&amp;msg] }}
David M. said: Ronnie, I just did some testing on this and it looks like there is some counterintuitive behavior. I tried to whisper to my dummy account from a scriptcards echo to chat. My GM chat showed no output, but my dummy account actually did receive the whispered message. My guess is it has something to do with the way Roll20 interprets who is sending the message to provide the "copy" of the sent message in the sender's chat. Even though&nbsp; --eGM|/w &lt;Player&gt; msg &nbsp;sends a message "as" the GM, I'm guessing Roll20 still sees it as coming from the api and so doesn't have a valid sender for the sent copy. So, good news is that your first syntax example is probably working. Bad news is you currently don't get confirmation of it as GM. Unless this can be fixed, here's a hacky workaround: send yourself another whisper with the same message. Here's an example sending to my dummy player "Blavid" !script {{ --#hidecard|1 --&amp;player|Blavid --&amp;msg|This msg sent via Scriptcards --eGM|/w [&amp;player] [&amp;msg] --eGM|/w gm **Message to [&amp;player] from Scriptcards:** [&amp;msg] }} That works! Thank you so much! :-D By the way, since I'm guessing that other people will eventually run into this problem too, then I decided to add a little section about it into the ScriptCards wiki. Just because, y'know... when someone does a good deed, then it's nice to pass it along to others :-)
Hi everyone :-) Does anyone know how to get rid of that extra line of output that the Lib5E_FindResource&nbsp;function (from the dnd5elib library) always puts on the output card? (I'm talking about the line that always says either "IsLeft", "IsRight", "IsClass", or "IsOther!")
1632925890
timmaugh
Pro
API Scripter
David M. said: Ronnie, I just did some testing on this and it looks like there is some counterintuitive behavior. I tried to whisper to my dummy account from a scriptcards echo to chat. My GM chat showed no output, but my dummy account actually did receive the whispered message. My guess is it has something to do with the way Roll20 interprets who is sending the message to provide the "copy" of the sent message in the sender's chat. Even though&nbsp; --eGM|/w &lt;Player&gt; msg &nbsp;sends a message "as" the GM, I'm guessing Roll20 still sees it as coming from the api and so doesn't have a valid sender for the sent copy. So, good news is that your first syntax example is probably working. Bad news is you currently don't get confirmation of it as GM. Unless this can be fixed, here's a hacky workaround: send yourself another whisper with the same message. Here's an example sending to my dummy player "Blavid" !script {{ --#hidecard|1 --&amp;player|Blavid --&amp;msg|This msg sent via Scriptcards --eGM|/w [&amp;player] [&amp;msg] --eGM|/w gm **Message to [&amp;player] from Scriptcards:** [&amp;msg] }} You could also fire off a DiscreteWhisper script command. The DW script lets you not only give differentiated whispers to multiple players at once (potentially different messages for each), it will also report the messages it sent. In that case, David's quick test ScriptCard, above, would look more like: !script {{ --#hidecard|1 --&amp;player|Blavid --&amp;msg|This msg sent via Scriptcards --&amp;title|TITLE FOR MESSAGE --@w|_[&amp;player] _[&amp;msg] _[&amp;title] }} That produces this (changed "Blavid" to be "Igtharian", a character in my test game): The above message is what is received by those who can control "Igtharian". The lower message is the delivery notice sent to me as the original whisperer.
1632958363
Kurt J.
Pro
API Scripter
Ronnie McDurgen said: Hi everyone :-) Does anyone know how to get rid of that extra line of output that the Lib5E_FindResource&nbsp;function (from the dnd5elib library) always puts on the output card? (I'm talking about the line that always says either "IsLeft", "IsRight", "IsClass", or "IsOther!") Oops :) Those are left over from debugging. In these lines: --:_Lib5E_IsResourceClass| --+IsClass| --&amp;[%3%]|class_resource_name --&amp;[%4%]|class_resource --=[%4%]|[*[%1%]:class_resource] --&lt;| --:_Lib5E_IsResourceOther| --+IsOther!| --&amp;[%3%]|class_resource_name --&amp;[%4%]|class_resource --=[%4%]|[*[%1%]:other_resource] --&lt;| --:_Lib5E_IsResourceLeft| --+IsLeft| --&amp;[%3%]|[*R&gt;resource_left_name] --&amp;[%4%]|[*R&gt;resource_left] --=[%4%]|[*R:resource_left] --&lt;| --:_Lib5E_IsResourceRight| --+IsRight| --&amp;[%3%]|[*R&gt;resource_right_name] --&amp;[%4%]|[*R&gt;resource_right] --=[%4%]|[*R:resource_right] --&lt;| remove the --+IsClass|, --+IsOther|, etc. I'll also update the library code on the github.
Kurt J. said: Ronnie McDurgen said: Hi everyone :-) Does anyone know how to get rid of that extra line of output that the Lib5E_FindResource&nbsp;function (from the dnd5elib library) always puts on the output card? (I'm talking about the line that always says either "IsLeft", "IsRight", "IsClass", or "IsOther!") Oops :) Those are left over from debugging. In these lines: --:_Lib5E_IsResourceClass| --+IsClass| --&amp;[%3%]|class_resource_name --&amp;[%4%]|class_resource --=[%4%]|[*[%1%]:class_resource] --&lt;| --:_Lib5E_IsResourceOther| --+IsOther!| --&amp;[%3%]|class_resource_name --&amp;[%4%]|class_resource --=[%4%]|[*[%1%]:other_resource] --&lt;| --:_Lib5E_IsResourceLeft| --+IsLeft| --&amp;[%3%]|[*R&gt;resource_left_name] --&amp;[%4%]|[*R&gt;resource_left] --=[%4%]|[*R:resource_left] --&lt;| --:_Lib5E_IsResourceRight| --+IsRight| --&amp;[%3%]|[*R&gt;resource_right_name] --&amp;[%4%]|[*R&gt;resource_right] --=[%4%]|[*R:resource_right] --&lt;| remove the --+IsClass|, --+IsOther|, etc. I'll also update the library code on the github. Thanks :-)
Does anyone have a good list of the Page Attributes? I'm working on a Wildshape script that will do a page attribute lookup to determine what the appropriate grid scale settings, etc., are, and compare them to the token size attribute to set the correct size for the wildshaped token. E.g., 70 px * grid scale / 5 * token size attribute value. I can get the page ID from using the *S:t-pageid parameter, and I know to use the *P: construction, but I can't seem to call the right attribute names.
1633097677
David M.
Pro
API Scripter
Colin, all of the api object properties are documented here . Sounds like you are looking for "snapping_increment"
David M. said: Colin, all of the api object properties are documented here . Sounds like you are looking for "snapping_increment" Thanks! That worked.
1633118838

Edited 1633118957
Crossposted here in the Muler thread. I'm still working on a Wildshape macro: &nbsp; !script {{ --#whisper|gm --#sourcetoken|@(selected|token_id) --#activepage|[*S:t-pageid] --=Snap|[*P:snapping_increment] --=Scale|[*P:scale_number] / 5 --=TokenScale|70 * [$Snap] * [$Scale] --~Name|string;before; ;[*S:character_name] --#title|[&amp;Name]'s Wildshapes --#leftsub|[*S:class_resource] Uses Left --#reentrant|[&amp;Name]WS --?[*S:class_resource] -lt 1|NoWS --:WSLookup| --+Large Land Animals|[rbutton]Brown Bear::WildShape;Brown Bear[/rbutton] [rbutton]Giant Goat::WildShape;Giant Goat[/rbutton] [rbutton]Warhorse::WildShape;Warhorse[/rbutton] --X| --:WildShape|chosen form --#hideTitleCard|1 --~Form|string;replace; ;;[&amp;reentryval] --@script|_#hideCard|1 _#title|SettingVars| _#debug|1 _&amp;Side|get.[&amp;Form] {&amp; mule [&amp;Name].WSMule} _=hp|@^([&amp;Name]'s [&amp;reentryval]|npc_hpformula) {&amp; log} --@token-mod|_set currentside|[&amp;Side] height|[$TokenScale]*[&amp;Size] width|[$TokenScale]*[&amp;Size] represents|"[&amp;Name]'s [&amp;reentryval]" bar1_link|hp hp|[$hp] bar2_link|npc_ac bar3_link|passive_wisdom --X| --:NoWS| --+No More Wildshapes!|Rest before using. --X| }} The trouble is, the Mule isn't loading at the right time. I need it to load after the reentry selection is made, but before the token-mod call. I am independently able to use the mule outside this script in a simpler form, so I know it is set up correctly. Basically, each wildshape gets a line with a side #. The druid's PC is side 1, Brown Bear is side 2, etc., and the mule reflects that. &lt;character name&gt;=1 BrownBear=2 GiantGoat=3 Warhorse=4 etc. The end idea is to be able to call to the mule to get the currentside parameter, and then call to the separate character sheet for the wildshape to reference the token size, and use both of those data in token-mod to change the token. I've tried having the mule loaded within the base scriptcard, rather than within a subscript, but I ran into the same problem. Muler is trying to find a mule for [&amp;Name].WSMule without knowing what [&amp;Name] is
1633119328
Kurt J.
Pro
API Scripter
Colin C. said: Crossposted here in the Muler thread. Been loving how much control I can achieve with your meta-scripts (provided I can structure them correctly to do what I want!) I'm working on a Wildshape macro: &nbsp; !script {{ --#whisper|gm --#sourcetoken|@(selected|token_id) --#activepage|[*S:t-pageid] --=Snap|[*P:snapping_increment] --=Scale|[*P:scale_number] / 5 --=TokenScale|70 * [$Snap] * [$Scale] --~Name|string;before; ;[*S:character_name] --#title|[&amp;Name]'s Wildshapes --#leftsub|[*S:class_resource] Uses Left --#reentrant|[&amp;Name]WS --?[*S:class_resource] -lt 1|NoWS --:WSLookup| --+Large Land Animals|[rbutton]Brown Bear::WildShape;Brown Bear[/rbutton] [rbutton]Giant Goat::WildShape;Giant Goat[/rbutton] [rbutton]Warhorse::WildShape;Warhorse[/rbutton] --X| --:WildShape|chosen form --#hideTitleCard|1 --~Form|string;replace; ;;[&amp;reentryval] --@script|_#hideCard|1 _#title|SettingVars| _#debug|1 _&amp;Side|get.[&amp;Form] {&amp; mule [&amp;Name].WSMule} _=hp|@^([&amp;Name]'s [&amp;reentryval]|npc_hpformula) {&amp; log} --@token-mod|_set currentside|[&amp;Side] height|[$TokenScale]*[&amp;Size] width|[$TokenScale]*[&amp;Size] represents|"[&amp;Name]'s [&amp;reentryval]" bar1_link|hp hp|[$hp] bar2_link|npc_ac bar3_link|passive_wisdom --X| --:NoWS| --+No More Wildshapes!|Rest before using. --X| }} The trouble is, the Mule isn't loading at the right time. I need it to load after the reentry selection is made, but before the token-mod call. I am independently able to use the mule outside this script in a simpler form, so I know it is set up correctly. Basically, each wildshape gets a line with a side #. The druid's PC is side 1, Brown Bear is side 2, etc., and the mule reflects that. The end idea is to be able to call to the mule to get the currentside, and then call to the separate character sheet for the wildshape to reference the token size, and use both of those data in token-mod to change the token. I've tried having the mule loaded within the base scriptcard, rather than within a subscript, but I ran into the same problem. Muler is trying to find a mule for [&amp;Name].WSMule without knowing what [&amp;Name] is Hopefully&nbsp;timmaugh will jump in here because I'm probably going to botch this :), but maybe it will be close... I think you might need some additional deferral in this line: --@script|_#hideCard|1 _#title|SettingVars| _#debug|1 _&amp;Side|get.[&amp;Form] {&amp; mule [&amp;Name].WSMule} _=hp|@^([&amp;Name]'s [&amp;reentryval]|npc_hpformula) {&amp; log} Wouldn't you need to defer the {&amp; mule [&amp;Name].WSMule} call? --@script|_#hideCard|1 _#title|SettingVars| _#debug|1 _&amp;Side|get.[&amp;Form] { ^ &amp; mule [&amp;Name].WSMule} _=hp|@^([&amp;Name]'s [&amp;reentryval]|npc_hpformula) {&amp; log} &nbsp;
1633123766
timmaugh
Pro
API Scripter
Kurt's exactly right, but you'll also need to defer the get statement (which would retrieve the variable from the Mule): get^.[&amp;Form] I wrote up a longer explanation in the Muler thread . @Kurt, it didn't apply this time, but this question made me wonder about a "re-entry deferral" character for SC... or if that's the right concept. Basically, it would come down to how you handle the reentry. I'm just wondering if there would be a way to expose metascript constructs (or other constructs) only *after* reentry. For instance, if you expect a downstream/outbound call to set a Mule variable, you wouldn't want to retrieve it until after the SC was reentered. The hang-up is that the metascripts would only trigger if the message containing them went through the Roll20 parser, so if you store the message object from the initial SC call (with all of the processing done in it, including any command line changes and/or variables, arrays, etc.), then by the time SC received the reentry command to "un-mothball" that stored message object, it would be too late -- that unmothballing wouldn't go through the parsers. You have a way better understanding of that reentry coding, so I'll leave it to you, but I could see at least the above situation potentially solved by a SC dispatched call with a newly generated, prepended UUID, which SC would know to catch. By the time it caught it, however, the metascripts would have had their chance, too. !-M1234567890abcdef_script &lt;&lt;existing command line after deferral removal&gt;&gt; Then the messages would have to be merged (old/saved with the newly caught). This is the same process ZeroFrame uses. Anyway, it might be not worth the effort, but I thought I'd mention it!