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

1638111826
Kurt J.
Pro
API Scripter
With a bit more investigation, I was able to determine what is happening here. I'm guessing you use tabs as indents for readability (<span style=\"white-space: pre\">\t</span> indicates an HTML escaped tab character). This works fin in macros, but as soon as you put this in a library handout, the Roll20 editor starts causing problems. This line:     --?[$EdgeUsing] -gt [$current]|NotEnoughEdge looks like it is ok, but while the ScriptCards processor will strip out spaces between this and the next line, the tab character starting the following line (along with the editor HTML) is being interpreted as a continuation of the label name until it hits the next --, so ScriptCards is literally looking for a label of NotEnoughEdge <span style="\white-space:pre\">\t</span> to jump to. I never caught this in testing because I always use spaces as indents instead of tabs - and as I said above it also only seems to be a problem in Library Handout code. I'll do some experimenting and see if I can come up with a code-based fix that makes sense, but that seems to be where the problem is coming from.
Sorry for the delay.  The wild die explodes on a 6, and any six rolled from there.  A one on an exploded roll just counts as a one.  If the wild die rolls a 1 on the first roll, you drop the 1 and the highest roll on the remaining dice. David M. said: Ok I get the first part, but the rolling one part needs some clarification Examples: (1) 3d6 + 1d6(wild) 2,4,6 + 6(explodes and rolls 3) = 12+9 = 21 (2) 3d6 + 1d6(wild) 2,4,6 + 1 => drop the six = 2+4 = 6 ? (or do you still add the wild 1 to get 7?) (3) 3d6 + 1d6 (wild) 1,5,5 + 6(explodes to another 6, explodes again to a 1) = ??? (do you drop the 5 from the first three dice and add 13 to get 19?) (4) 1d6 + 1d6 (wild) 4 + 6(explodes to a 1) = ??? (5) 1d6 + 1d6 (wild) 4 + 1 = 0? or 1?
Has anyone tried building a card to roll on the Universal Table?  I have an old macro that does so but I can't figure out how it actually works.
Kurt J. said: With a bit more investigation, I was able to determine what is happening here. I'm guessing you use tabs as indents for readability (<span style=\"white-space: pre\">\t</span> indicates an HTML escaped tab character). This works fin in macros, but as soon as you put this in a library handout, the Roll20 editor starts causing problems. That absolutely fixed it.  The problem for me came actually from Notepad++.  I was doing all the writing in that and it was installing tabs with returns.  When I actually went in to the library and just backspaced and deleted spaces it worked just fine
I hope this isn't a dumb/repetitive question. My Google-fu has not suggested that anyone has asked this recently, though, so I'll go ahead and throw this out in hopes that someone knows. Is there some way to use the built-in math function for min or max, so that it accepts multiple parameters? I have a use case where I'd like to pick the lowest or highest value in a collection of different variables. Right now, I can make it work by going like this: !scriptcard  {{   --=ResistanceMagic|10   --=ResistancePiercing|3   --=ResistanceSilver|12   --=BaseDamage|15   --=BaseDamage2|20   --=BaseMinusMagic|[$BaseDamage]-[$DRmagic]   --=BaseMinusPiercing|[$BaseDamage]-[$DRpiercing]   --=BaseMinusSilver|[$BaseDamage]-[$DRsilver]   --~DRContention1|math;min;[$BaseMinusMagic];[$BaseMinusSilver]   --~DRContention2|math;min;[$DRContention1];[$BaseMinusPiercing]   --~DRContention3|math;min;[$DRContention2];[$BaseDamage]   --~DRContention4|math;min;[$DRContention3];[$BaseDamage2]   --+Outcome|The lowest of [$BaseMinusMagic], [$BaseMinusSilver], [$BaseMinusPiercing], [$BaseDamage] and [$BaseDamage2] is [$DRContention4] }} But I have a pretty lengthy series of variables to compare, so if there's a more efficient way of doing it that just isn't obvious to me, I'd love to know about it.
Heya! i was just wondering if there is a similar macro generator that was used for Powercards that i can use here? I'm completely unfamiliar with coding or working through scripts, and it seems it would require a lot of work to make attacks and spells within the API.
1638311969
David M.
Pro
API Scripter
@Edward, My first thought was to assign all of your values to an array and use the sort function, but it appears that it only sorts alphanumerically (so for example, 12 is considered smaller than 5!). I could be missing something, but maybe Kurt or someone else could chime in to see if there is a way to sort arrays numerically? !scriptcard {{ --=ResistanceMagic|10 --=ResistancePiercing|3 --=ResistanceSilver|12 --=BaseDamage|15 --=BaseDamage2|20 --=BaseMinusMagic|[$BaseDamage]-[$ResistanceMagic] --=BaseMinusPiercing|[$BaseDamage]-[$ResistancePiercing] --=BaseMinusSilver|[$BaseDamage]-[$ResistanceSilver] --:Define the Array| --~dummy|array;define;myArray;[$BaseMinusMagic];[$BaseMinusSilver];[$BaseMinusPiercing];[$BaseDamage];[$BaseDamage2] --:Debug line only| --+first array val before sort|[@myArray(0)] --:Sort the Array| --~dummy|array;sort;myArray --:Debug line only| --+first array val after sort|[@myArray(0)] --:Assign first array element to a roll variable and output results| --=lowestVal|[@myArray(0)] --+Outcome|The lowest of [$BaseMinusMagic], [$BaseMinusSilver], [$BaseMinusPiercing], [$BaseDamage] and [$BaseDamage2] is [$lowestVal] ​ }} Here's the (erroneous) output:
1638319010
Kurt J.
Pro
API Scripter
I do have an update to address this by adding a "numericsort" function, but since the API sandbox appears to be broken at the moment, I can't test it :)
1638319199
Kurt J.
Pro
API Scripter
The GM said: Heya! i was just wondering if there is a similar macro generator that was used for Powercards that i can use here? I'm completely unfamiliar with coding or working through scripts, and it seems it would require a lot of work to make attacks and spells within the API. I put together a script called "5E Character Action Menu" that does something similar to what PCMHelper did. It is available here:  ScriptCards/5e_Character_Action_Menu.txt at main · kjaegers/ScriptCards (github.com) I can be marked either in-bar or as a token action and available to players. It will display a menu (whispered to the player that clicks it) with attacks and spells from their character sheet and allow them to click a button to use one. It is also customizable by adding spell-specific macros to a macro mule that will be used when someone casts a spell with a matching name (ie, Fireball). Not necessary by any means, but if you have advanced macros for specific spells it lets you use them seamlessly.
Right, my first thought was to try and use an array, but that didn't work out. If Kurt's update pans out, then it sounds like I have an efficient solution in the wings; in the meantime the way I did it, by chaining together --~variablename|math;min;varA;varB expressions, works fine. I was just trying to avoid using them because brute-forcing something like that isn't particularly elegant. David M. said: @Edward, My first thought was to assign all of your values to an array and use the sort function, but it appears that it only sorts alphanumerically (so for example, 12 is considered smaller than 5!). I could be missing something, but maybe Kurt or someone else could chime in to see if there is a way to sort arrays numerically? !scriptcard {{ --=ResistanceMagic|10 --=ResistancePiercing|3 --=ResistanceSilver|12 --=BaseDamage|15 --=BaseDamage2|20 --=BaseMinusMagic|[$BaseDamage]-[$ResistanceMagic] --=BaseMinusPiercing|[$BaseDamage]-[$ResistancePiercing] --=BaseMinusSilver|[$BaseDamage]-[$ResistanceSilver] --:Define the Array| --~dummy|array;define;myArray;[$BaseMinusMagic];[$BaseMinusSilver];[$BaseMinusPiercing];[$BaseDamage];[$BaseDamage2] --:Debug line only| --+first array val before sort|[@myArray(0)] --:Sort the Array| --~dummy|array;sort;myArray --:Debug line only| --+first array val after sort|[@myArray(0)] --:Assign first array element to a roll variable and output results| --=lowestVal|[@myArray(0)] --+Outcome|The lowest of [$BaseMinusMagic], [$BaseMinusSilver], [$BaseMinusPiercing], [$BaseDamage] and [$BaseDamage2] is [$lowestVal] ​ }} Here's the (erroneous) output:
1638398207
Kurt J.
Pro
API Scripter
ScriptCards version 1.4.10 A new version of ScriptCards is now available on the GitHub - Added a new array function: numericsort. Same usage as the "sort" function, but will sort numerically insted of alphabetically.
Awesome!
1638613130

Edited 1638627320
Hmm, brand new to scripts and things, I've tried setting up the Tashas Barbarian wild surge one, and it works fine when I click the test macro button, but not when I run it as a token action or in bar option or just type the name into the chat.  Is there something obvious I'm missing? Edit to add... when I run it through those options, it just shows the code in the chat, when I click the test macro button it shows the script card correctly like below.
1638724191
Andreas J.
Forum Champion
Sheet Author
Translator
Can ScriptCards do Hidden/Blind Rolls? Didn't find anything in the documentation. i.e. player making a roll, and part of the result is only sent to the GM, without the player knowing the result. I saw some throwaway comment about PowerCards being able to do it, but didn't find any info on how it would do it either. I'm trying to collect the various methods of making blind roll into one place: <a href="https://wiki.roll20.net/Hidden_Rolls" rel="nofollow">https://wiki.roll20.net/Hidden_Rolls</a>
1638724554

Edited 1638724931
David M.
Pro
API Scripter
Yep! Check out the command&nbsp; --* &nbsp;described here . EDIT - Here's a simple example !script {{ --#title|Stealth Check --=Roll|1d20 + @{selected|stealth} --+|@{selected|token_name} attempts to move undetected... --*GMLine|@{selected|token_name} rolled a [$Roll] }}
1638727040

Edited 1638727481
Andreas J.
Forum Champion
Sheet Author
Translator
Thanks! Yeah, I spotted it on the second read-through, was looking for wrong keywords :) Added your example to Scriptcards' example section.
Hi everyone, I'm new with ScriptCards so maybe my question could be quite simple. I've tried to look for an answer in this thread but I had no luck. So I'm using PF Community Sheet and I get only the name with the following code. Am I missing something? !script {{ &nbsp;--Rfirst|@{selected|character_id};repeating_weapon &nbsp;--+Name|[*R:name] &nbsp;--+Total Attack|[*R:total-attack] &nbsp;--+Damage|[*R:total-damage] }}
Try issuing the --Rdump command after the --Rfirst command.&nbsp; Should dump a list of fieldnames to your API console. --Rdump| Valerio I. said: Hi everyone, I'm new with ScriptCards so maybe my question could be quite simple. I've tried to look for an answer in this thread but I had no luck. So I'm using PF Community Sheet and I get only the name with the following code. Am I missing something? !script {{ &nbsp;--Rfirst|@{selected|character_id};repeating_weapon &nbsp;--+Name|[*R:name] &nbsp;--+Total Attack|[*R:total-attack] &nbsp;--+Damage|[*R:total-damage] }}
Thank you for the hint. That was actually interesting. So it seems that the attributes I was looking for are not there... "name|Arco lungo composito +1" "name_max|" "masterwork|1" "masterwork_max|" "macro_options_max|" "type|P" "type_max|" "attack|2" "attack_max|" "attack-type|attk-ranged" "attack-type_max|" "attack-type_macro_insert|" "attack-type_macro_insert_max|" "damage-type_macro_insert|" "damage-type_macro_insert_max|" "range|110" "range_max|" "crit-multiplier|3" "crit-multiplier_max|" "damage-dice-num|1" "damage-dice-num_max|" "default_damage-dice-num|1" "default_damage-dice-num_max|" "default_damage-die|6" "default_damage-die_max|" "damage-die|6" "damage-die_max|" "damage|4" "damage_max|" "damage-ability|STR-mod" "damage-ability_max|" "damage-ability-max|1" "damage-ability-max_max|" "add-damage-show|0" "add-damage-show_max|" "misc-show|0" "misc-show_max|" "iterative-attacks-show|0" "iterative-attacks-show_max|" "type2|P" "type2_max|" "toggle_iterative_attack2|" "toggle_iterative_attack2_max|" "notes|" "notes_max|" "row-show|0" "row-show_max|" (NOTE the damage here is actually the mod_damage attribute, and not the total-damage) So the only way is to actually do all the maths in the scriptcard again just to obtain the total-attack and total-damage attributes. Doesn't sound much convenient to me. I'll have to find a workaround... Another question, is there a way to use a variable (a loop counter) into an ability roll? Something like %{selected|repeating_item_@HERE_roll} Where "HERE" goes the loop counter or something increasing?
So, I discovered a behavioral issue with decimals and math.&nbsp; Let's say I use an --I statement to retrieve a numeric value.&nbsp; For example, 4.&nbsp; It obviously is returned as a string variable.&nbsp; I then assign that string variable to a roll variable.&nbsp; If that roll variable is involved in a multiplication with a decimal,&nbsp; for example, .8, it returns 3.19999999997 or something of the like. But, if I do not convert that string variable to a roll variable and I use the string variable in the math equation, it returns the correct total of 3.2.
1638842398

Edited 1638842537
Andrew R.
Pro
Sheet Author
Steve H. said: If that roll variable is involved in a multiplication with a decimal,&nbsp; for example, .8, it returns 3.19999999997 or something of the like. But, if I do not convert that string variable to a roll variable and I use the string variable in the math equation, it returns the correct total of 3.2. Welcome to floating point arithmetic. ;) I've never converted the output of --I statement to a roll variable, because using the string variable has worked correctly every time. So I suggest you just not do that.&nbsp;
1638887119
timmaugh
Pro
API Scripter
Valerio I. said: Another question, is there a way to use a variable (a loop counter) into an ability roll? Something like %{selected|repeating_item_@HERE_roll} Where "HERE" goes the loop counter or something increasing? If ScriptCards does not offer this natively, 1) I'd be surprised... and 2) it will shortly. =D That said, meta constructions can offer a measure of access, depending on how/when you need to resolve them. Can you post an example of what you have so see if that solution would work for you?
1638903947

Edited 1638904243
timmaugh said: Valerio I. said: Another question, is there a way to use a variable (a loop counter) into an ability roll? Something like %{selected|repeating_item_@HERE_roll} Where "HERE" goes the loop counter or something increasing? If ScriptCards does not offer this natively, 1) I'd be surprised... and 2) it will shortly. =D That said, meta constructions can offer a measure of access, depending on how/when you need to resolve them. Can you post an example of what you have so see if that solution would work for you? !script {{ --#title|@{selected|character_name} --#oddRowBackground|#DCDCDC --#titleCardBackground|#000000 --#leftsub|Spells --#rightsub|Modifica --#buttonFontSize|11px --#whisper|self --#buttonBackground|#000000 --Rfirst|@{selected|character_id};repeating_spells --=n|0 --:Loop| --?"[*R:name]" -eq NoRepeatingAttributeLoaded|Done --&amp;Prefix|selected|repeating_spells_$ --&amp;Prefix|+[$n.Raw] --&amp;Final|[&amp;Prefix]+_roll --~Subs|string;substring;0;3;[*R:spellclass] --+[&amp;Subs][button][*R:name]::~[&amp;Final][/button]|[r][rbutton][*R:used]::MOD_SPELLS;[$n.Raw][/rbutton] [rbutton]R::RESET_SPELLS;[$n.Raw][/rbutton][/r] --=n|[$n] + 1 --Rnext| --&gt;Loop| --:Done| --+Verifica utilizzi|[rbutton]@{selected|spellclass-0-name}::USED0;0[/rbutton] [rbutton]@{selected|spellclass-1-name}::USED1;1[/rbutton] --X| --:USED0| --+@{selected|spellclass-0-name} 0| [r]@{selected|spellclass-0-level-0-spells-per-day} | @{selected|spellclass-0-level-0-spells-per-day|max}[/r] --+@{selected|spellclass-0-name} 1| [r]@{selected|spellclass-0-level-1-spells-per-day} | @{selected|spellclass-0-level-1-spells-per-day|max}[/r] --+@{selected|spellclass-0-name} 2| [r]@{selected|spellclass-0-level-2-spells-per-day} | @{selected|spellclass-0-level-2-spells-per-day|max}[/r] --+@{selected|spellclass-0-name} 3| [r]@{selected|spellclass-0-level-3-spells-per-day} | @{selected|spellclass-0-level-3-spells-per-day|max}[/r] --+@{selected|spellclass-0-name} 4| [r]@{selected|spellclass-0-level-4-spells-per-day} | @{selected|spellclass-0-level-4-spells-per-day|max}[/r] --+@{selected|spellclass-0-name} 5| [r]@{selected|spellclass-0-level-5-spells-per-day} | @{selected|spellclass-0-level-5-spells-per-day|max}[/r] --+@{selected|spellclass-0-name} 6| [r]@{selected|spellclass-0-level-6-spells-per-day} | @{selected|spellclass-0-level-6-spells-per-day|max}[/r] --+@{selected|spellclass-0-name} 7| [r]@{selected|spellclass-0-level-7-spells-per-day} | @{selected|spellclass-0-level-7-spells-per-day|max}[/r] --+@{selected|spellclass-0-name} 8| [r]@{selected|spellclass-0-level-8-spells-per-day} | @{selected|spellclass-0-level-8-spells-per-day|max}[/r] --+@{selected|spellclass-0-name} 9| [r]@{selected|spellclass-0-level-9-spells-per-day} | @{selected|spellclass-0-level-9-spells-per-day|max}[/r] --^End| --:USED1| --+@{selected|spellclass-1-name} 0| [r]@{selected|spellclass-1-level-0-spells-per-day} | @{selected|spellclass-1-level-0-spells-per-day|max}[/r] --+@{selected|spellclass-1-name} 1| [r]@{selected|spellclass-1-level-1-spells-per-day} | @{selected|spellclass-1-level-1-spells-per-day|max}[/r] --+@{selected|spellclass-1-name} 2| [r]@{selected|spellclass-1-level-2-spells-per-day} | @{selected|spellclass-1-level-2-spells-per-day|max}[/r] --+@{selected|spellclass-1-name} 3| [r]@{selected|spellclass-1-level-3-spells-per-day} | @{selected|spellclass-1-level-3-spells-per-day|max}[/r] --+@{selected|spellclass-1-name} 4| [r]@{selected|spellclass-1-level-4-spells-per-day} | @{selected|spellclass-1-level-4-spells-per-day|max}[/r] --+@{selected|spellclass-1-name} 5| [r]@{selected|spellclass-1-level-5-spells-per-day} | @{selected|spellclass-1-level-5-spells-per-day|max}[/r] --+@{selected|spellclass-1-name} 6| [r]@{selected|spellclass-1-level-6-spells-per-day} | @{selected|spellclass-1-level-6-spells-per-day|max}[/r] --+@{selected|spellclass-1-name} 7| [r]@{selected|spellclass-1-level-7-spells-per-day} | @{selected|spellclass-1-level-7-spells-per-day|max}[/r] --+@{selected|spellclass-1-name} 8| [r]@{selected|spellclass-1-level-8-spells-per-day} | @{selected|spellclass-1-level-8-spells-per-day|max}[/r] --+@{selected|spellclass-1-name} 9| [r]@{selected|spellclass-1-level-9-spells-per-day} | @{selected|spellclass-1-level-9-spells-per-day|max}[/r] --^End| --:RESET_SPELLS| --=flag|0 --#whisper| --=R|[&amp;reentryval] --@setattr|_charid @{selected|character_id} _silent _repeating_spells_$[&amp;reentryval]_used|0 --^Find| --:MOD_SPELLS| --=flag|1 --#whisper| --=R|[&amp;reentryval] --iSegno meno per sottrarre;Quantità|q;qty;Quantità| --@modattr|_charid @{selected|character_id} _silent _repeating_spells_$[&amp;reentryval]_used|[&amp;qty] --:Find| --Rfirst|@{selected|character_id};repeating_spells --=n1|0 --:Loop1| --?"[*R:name]" -eq NoRepeatingAttributeLoaded|Done1 --?[$n1] -eq [$R]|Done1 --=n1|[$n1] + 1 --Rnext| --&gt;Loop1| --:Done1| --?[$flag] -eq 1|Output --+[*R:name]| --+Reset| Effettuato --^End| --:Output| --+[*R:name]| --=Old|0+[*R:used] --+Qtà precedente|[$Old] --=Mod|[&amp;qty] --+Qta modificata| [$Mod] --=New|[&amp;qty]+[*R:used] --+Quantità attuale| [$New] --:End| --X| }} Ok, this works for me (PF Com Sheet). Sorry for the messy code, but after hours banging my head on the wall to make it work...I was exhausted but I'll try to make it look better as soon as I can. So: I managed to call "roll" ability in a button building a String (Final) step by step (don't ask me why it doesn't work if you try and build it all at once, I'm done trying to figure it out...what matters is that THIS works for me). And I'm using these steps in many other Repeating scenarios and it always works (inventory, buffs) --&amp;Prefix|selected|repeating_spells_$ --&amp;Prefix|+[$n.Raw] --&amp;Final|[&amp;Prefix]+_roll The issue is: There are TONS of attributes that --R (repeating section access) can't find, and some of them are super important. In this particular scenario the attribute "spell_level", for instance. The "RDump" function doesn't show it either. That's why I was looking for some kind of workaround for those attributes. @{selected|repeating_spells_$HERE_spell_level} Something like that...where "HERE" can be replaced by some variable. I've tried anything along the line of @{selected|repeating_spells_$[$somevariable]_spell_level} but that doesn't work as everything beginning with "@{" is parsed as soon as the macro starts and an error pops up "Can't find the attribute: @{selected|repeating_spells_$[$somevariable]_spell_level}" That would be soooo cool. Any idea? Thank you for your time.
Valerio,&nbsp; Like you said, you are, unfortunately, bumping up again&nbsp; Roll20's Order of Operations &nbsp;here. I have had some success with the following workaround though.&nbsp; Set a source token: --#sourceToken|@{selected|token_id} Then you can use [*S:***] formatting. --=spellLevel|1 --@modattr|_charid [*S:character_id] _[*S:repeating_spells_$[$spellLevel.Raw]_spell_level]|[$SomeQuantity] _silent
1638909477

Edited 1638909534
Dumb question here: if I'm using an array, is there some way that I can use one of the get subfunctions to pull one of the array values as numeric instead of a string? I have figured out that I can convert from a string to numeric by calling something like this. &nbsp; &nbsp; --~DRContentionCritArray|array;define;DRCritDamage;[$BaseCritDamage];[$DR_BludgeoningCritCalc];[$DR_PiercingCritCalc];[$DR_SlashingCritCalc];[$DR_AdamantineCritCalc];[$DR_ColdIronCritCalc];[$DR_SilverCritCalc];[$DR_ColdIronGoodCritCalc];[$DR_ColdIronEvilCritCalc];[$DR_EvilSilverCritCalc];[$DR_GoodSilverCritCalc];[$DR_MagicCritCalc];[$DR_EpicCritCalc];[$DR_GoodCritCalc];[$DR_EvilCritCalc];[$DR_LawCritCalc];[$DR_CompleteCritCalc] &nbsp; &nbsp; --~DRContentionCritSort|array;numericsort;DRCritDamage &nbsp; &nbsp; --~DRContentionCrit|array;getfirst;DRCritDamage &nbsp; &nbsp;--=DRContentionCritInteger|[&amp;DRContentionCrit] But what I'm doing above seems cludgy, so if there's a way to do it with fewer steps, I'd certainly be glad to hear about it.
1638920876
Kurt J.
Pro
API Scripter
There are items filtered out of the repeating section list, as there are some that are references to other values. I need to do some thinking about how to handle them, and will likely do so by building a function to recursively dereference the contents of these types of fields. This will be an item for an upcoming release of the script as it will probably be a bit complicated to do. It wouldn't be too bad if references couldn't be nested and (potentially) circular, but I'll need to account for that. What I mean by that is you could have attribute A which has a value of @{B} and attribute B with a value of @{A}.
1638920957
Kurt J.
Pro
API Scripter
Edward R. said: Dumb question here: if I'm using an array, is there some way that I can use one of the get subfunctions to pull one of the array values as numeric instead of a string? I have figured out that I can convert from a string to numeric by calling something like this. &nbsp; &nbsp; --~DRContentionCritArray|array;define;DRCritDamage;[$BaseCritDamage];[$DR_BludgeoningCritCalc];[$DR_PiercingCritCalc];[$DR_SlashingCritCalc];[$DR_AdamantineCritCalc];[$DR_ColdIronCritCalc];[$DR_SilverCritCalc];[$DR_ColdIronGoodCritCalc];[$DR_ColdIronEvilCritCalc];[$DR_EvilSilverCritCalc];[$DR_GoodSilverCritCalc];[$DR_MagicCritCalc];[$DR_EpicCritCalc];[$DR_GoodCritCalc];[$DR_EvilCritCalc];[$DR_LawCritCalc];[$DR_CompleteCritCalc] &nbsp; &nbsp; --~DRContentionCritSort|array;numericsort;DRCritDamage &nbsp; &nbsp; --~DRContentionCrit|array;getfirst;DRCritDamage &nbsp; &nbsp;--=DRContentionCritInteger|[&amp;DRContentionCrit] But what I'm doing above seems cludgy, so if there's a way to do it with fewer steps, I'd certainly be glad to hear about it. Arrays are always stored as strings, but what is the use case for converting it to a roll variable? The [&amp;DRContentionCrit] should work directly in other roll formulas or output as a string.&nbsp;
1638931189

Edited 1638931425
Erik M. said: Valerio,&nbsp; Like you said, you are, unfortunately, bumping up again&nbsp; Roll20's Order of Operations &nbsp;here. I have had some success with the following workaround though.&nbsp; Set a source token: --#sourceToken|@{selected|token_id} Then you can use [*S:***] formatting. --=spellLevel|1 --@modattr|_charid [*S:character_id] _[*S:repeating_spells_$[$spellLevel.Raw]_spell_level]|[$SomeQuantity] _silent Thank you Erik, that does seems like a nice trick when you want to use ChatSetAttr in order to modify the spell_level attribute and it could come in handy. But, just to be clear, what I'm trying to do here is getting the name and the level of every spell in the list and display them in a card (with buttons to cast or to add/remove daily spells, and this part actually works just fine, but I cant display the spell level, just the name). I've tried this simple code using your advice !script {{ &nbsp; --#sourceToken|@{selected|token_id} &nbsp; --Rfirst|[*S:character_id];repeating_spells &nbsp; --=n|0 &nbsp; --:Loop| &nbsp; --?"[*R:name]" -eq NoRepeatingAttributeLoaded|Done &nbsp; --+[*R:name]|Level [*S:repeating_spells_$[$n.Raw]_spell_level] &nbsp; --=n|[$n] + 1 &nbsp; --Rnext| &nbsp; --&gt;Loop| &nbsp; --:Done| }} and this is the output Luce Level [S:repeating_spells_$0_spell_level] Evoca strumento Level [S:repeating_spells_$1_spell_level] Conoscere direzione Level [S:repeating_spells_$2_spell_level] Lettura del magico Level [S:repeating_spells_$3_spell_level] Resistenza Level [S:repeating_spells_$4_spell_level] Individuazione del magico Level [S:repeating_spells_$5_spell_level] Allarme Level [S:repeating_spells_$6_spell_level] Camuffare sè stesso Level [S:repeating_spells_$7_spell_level] Cura ferite leggere Level [S:repeating_spells_$8_spell_level] Ipnosi Level [S:repeating_spells_$9_spell_level] Cura ferite moderate Level [S:repeating_spells_$10_spell_level] Silenzio Level [S:repeating_spells_$11_spell_level] Cecità e Sordità Level [*S:repeating_spells_$12_spell_level] As you can see in the first line (and the same happens for any other line) this part is actually correct repeating_spells_$0_spell_level if it was surrounded by @{ and }. Any other advice or workaround is very appreciated and, again, thank you Erik for your time. Tonight was my first session with my new ScriptCards and it was awesome (thanks Kurt J, your work is great) ! But suddenly something went wrong. The "selected" token wasn't working as expected. Sometimes when (let's say) Player1 had his token selected while Player2 used the macro calling a ScriptCard he was changing/looking to Player1 character items/spells/buffs. Even the title with "selected character name" was wrong, and even if I (the GM) was selecting another token and any player called the script they would see the card of the Token I was selecting in that moment. This strange behaviour lasted a while, then API console stopped working and, when I restarted it, everything was working fine again. I had no time to look further into it, but I was wondering if that had something to do with SelectManager (with default options). I'll keep an eye on this in the next session.
1638968435
timmaugh
Pro
API Scripter
Valerio I. said: Tonight was my first session with my new ScriptCards and it was awesome (thanks Kurt J, your work is great) ! But suddenly something went wrong. The "selected" token wasn't working as expected. Sometimes when (let's say) Player1 had his token selected while Player2 used the macro calling a ScriptCard he was changing/looking to Player1 character items/spells/buffs. Even the title with "selected character name" was wrong, and even if I (the GM) was selecting another token and any player called the script they would see the card of the Token I was selecting in that moment. This strange behaviour lasted a while, then API console stopped working and, when I restarted it, everything was working fine again. I had no time to look further into it, but I was wondering if that had something to do with SelectManager (with default options). I'll keep an eye on this in the next session. Let me know if you see this again, Valerio. I wouldn't think SelectManager would be the cause, but if you can come up with repro steps I'll investigate. SelectManager just listens to every message, tracking the last set of selected tokens. Since selected tokens only come with user-generated messages, if an API-generated message comes along, it hands those last-selected tokens off to the new message... in effect "giving them back." It could be possible that if your API was buggy SelectManager was stuck with the previous set of selected tokens (since the API wouldn't have been running to track each new set as they came in). However, if that were the case, then the API wouldn't be running for SelectManager to give the tokens back to the next API-generated message. Drop me a DM if you see this again. I try to follow this thread, but I don't always catch everything.
As Andrew R. correctly pointed out, floating point arithmetic can be bothersome.&nbsp; As an example, in DnD 5e character sheets the initiative tiebreaker, if used through the character sheet, will give the appropriate 2-decimal answer (using dexterity) every time.&nbsp; However, attempting to do the same thing with a scriptcards macro like:&nbsp; --=Init|[&amp;AdvRoll] + @{selected|dexterity_mod} + @{selected|initiative_bonus} [TIE]&nbsp; will occasionally, but not always, pump out a repeating decimal.&nbsp; &nbsp;Again, I have workarounds for this but I wonder if we could have a rounding feature similar to spreadsheets where we can specify the number of decimal places [e.g. {Round2}]?
Kurt J. said: Edward R. said: Dumb question here: if I'm using an array, is there some way that I can use one of the get subfunctions to pull one of the array values as numeric instead of a string? I have figured out that I can convert from a string to numeric by calling something like this. &nbsp; &nbsp; --~DRContentionCritArray|array;define;DRCritDamage;[$BaseCritDamage];[$DR_BludgeoningCritCalc];[$DR_PiercingCritCalc];[$DR_SlashingCritCalc];[$DR_AdamantineCritCalc];[$DR_ColdIronCritCalc];[$DR_SilverCritCalc];[$DR_ColdIronGoodCritCalc];[$DR_ColdIronEvilCritCalc];[$DR_EvilSilverCritCalc];[$DR_GoodSilverCritCalc];[$DR_MagicCritCalc];[$DR_EpicCritCalc];[$DR_GoodCritCalc];[$DR_EvilCritCalc];[$DR_LawCritCalc];[$DR_CompleteCritCalc] &nbsp; &nbsp; --~DRContentionCritSort|array;numericsort;DRCritDamage &nbsp; &nbsp; --~DRContentionCrit|array;getfirst;DRCritDamage &nbsp; &nbsp;--=DRContentionCritInteger|[&amp;DRContentionCrit] But what I'm doing above seems cludgy, so if there's a way to do it with fewer steps, I'd certainly be glad to hear about it. Arrays are always stored as strings, but what is the use case for converting it to a roll variable? The [&amp;DRContentionCrit] should work directly in other roll formulas or output as a string.&nbsp; I said it was a dumb question, and it was; I was having difficulties because of a problem elsewhere in the script I'm working on, and thought it was because of this value being a string.
1639102541

Edited 1639105092
timmaugh said: Valerio I. said: Tonight was my first session with my new ScriptCards and it was awesome (thanks Kurt J, your work is great) ! But suddenly something went wrong. The "selected" token wasn't working as expected. Sometimes when (let's say) Player1 had his token selected while Player2 used the macro calling a ScriptCard he was changing/looking to Player1 character items/spells/buffs. Even the title with "selected character name" was wrong, and even if I (the GM) was selecting another token and any player called the script they would see the card of the Token I was selecting in that moment. This strange behaviour lasted a while, then API console stopped working and, when I restarted it, everything was working fine again. I had no time to look further into it, but I was wondering if that had something to do with SelectManager (with default options). I'll keep an eye on this in the next session. Let me know if you see this again, Valerio. I wouldn't think SelectManager would be the cause, but if you can come up with repro steps I'll investigate. SelectManager just listens to every message, tracking the last set of selected tokens. Since selected tokens only come with user-generated messages, if an API-generated message comes along, it hands those last-selected tokens off to the new message... in effect "giving them back." It could be possible that if your API was buggy SelectManager was stuck with the previous set of selected tokens (since the API wouldn't have been running to track each new set as they came in). However, if that were the case, then the API wouldn't be running for SelectManager to give the tokens back to the next API-generated message. Drop me a DM if you see this again. I try to follow this thread, but I don't always catch everything. It happened again...but now I think I have some good clues. When my players attempt to click on the ScriptCard macro which allows them to change some repeating attribute (ie repeating items, repeating buffs...) simultaneously or with very little delay between them, the first one works fine but all the following Cards set the previous player attributes. After that the API console prompts incoherent errors (ie "SHEET WORKER ERROR: You attempted to set an attribute beginning with 'repeating_' but did not include a Row ID or Attribute Name in repeating_weapon_total-damage", but that attribute doesn't even appear in any macro, they were trying to toggle a buff using ChatSetAttr in a ScriptCard and, moreover, that very same toggle works fine if just one player clicks on it with no concurrency) and then API just stop working. When I reset, everything works fine again. I was able to reproduce the issue with a friend of mine, because I cant really click simultaneously using my dummy account, I guess. I have no idea how ScriptCards work, so I can't make assuptions. Any ideas?
I don't see what's wrong here. No matter what I try, and can't get the conditional at the end to work. It always shows both results. !scriptcard&nbsp; {{&nbsp; &nbsp; --#sourceToken|@{selected|token_id} &nbsp; --#title|[*S:name] Rolls Dice &nbsp; --=Base|1d6 &nbsp; --+Base Roll|[$Base] &nbsp; --=Skill|?{Use Skill?|No,0|Yes,1d6} &nbsp; --+Skill Roll|[$Skill] &nbsp; --=Push|?{Push?|No,0|Yes,+1d6} &nbsp; --+Push Roll|[$Push] &nbsp; --=Stress|[*S:character_stress] &nbsp; --+Stress Level|[$Stress] &nbsp; --?[$Push] -ge [$Stress]| [ --=Stress|[*S:character_stress]+1 --+Stress Level|increases by 1 to [$Stress] &nbsp; &nbsp; --][ --+Stress Level|[$Stress] ] &nbsp; --=Roll|[$Base]+[$Skill]+[$Push] &nbsp; --+Roll|[$Roll] &nbsp; --+Difficult|?{Difficulty?|Medium,4|Hard,5|Very Hard,6} &nbsp; --?Result|[$Roll] -ge [$Difficult]|&gt;Yay &nbsp; --?Result|[$Roll] -lt [$Difficult]|&gt;Nay &nbsp; --X| &nbsp;&nbsp; &nbsp; --:Yay| &nbsp; --+|Test was successful &nbsp; --&lt;| &nbsp;&nbsp; &nbsp; --:Nay| &nbsp; --+|Test failed &nbsp; --&lt;| }}
1639105440
David M.
Pro
API Scripter
@Joab, doesn't look like you assigned a roll variable named "Difficult" anywhere? Try something like this: --=Difficult|?{Difficulty?|Medium,4|Hard,5|Very Hard,6} &nbsp; --+Difficult|[$Difficult] Then, for your conditionals: &nbsp; --?[$Roll] -ge [$Difficult]|&gt;Yay &nbsp; --?[$Roll] -lt [$Difficult]|&gt;Nay This is untested btw, just eyeballing. There could be some other stuff going on.
1639106717
timmaugh
Pro
API Scripter
Valerio, I sent a potential fix in answer to your PM, if it works, I'll post it here for others who might run into that particular situation.
1639111772

Edited 1639111801
Andrew R.
Pro
Sheet Author
I've found it less error prone to put Roll statements as early as possible, then the rest of the script. A hang over from C coding, I know, but it still works for me.
1639132893
Kurt J.
Pro
API Scripter
ScriptCards v 1.4.10 is now on OneClick Just a note that ScriptCards version 1.4.10 (the current development version) has now been pushed to OneClick. Here is a consolidation of the changes since the previous OneClick version (1.4.0e): Various bug fixes. Added math/sqrt function Added SIN}, {COS}, {TAN}, {ASIN}, {ACOS}, {ATAN}, {SQUARE}, {CUBEROOT}, {CUBE}, and {SQRT} roll modifiers. Added setting (--#) called "rollhilightlineheight" which can be used to set the size of the roll hilight box. Updated distance calculations to take page scale (snapping_increment) into account. Added setting options for rollhilightcolornormal, rollhilightcolorcrit, rollhilightcolorfumble, and rollhilightcolorboth. Added deferral character support for get and set Meta APIs. Added support for AirBag Crash Handler API Script (if installed) Added XdY!h and XdY!l roll formulas to support Deadlands-style rolls. Added the ability to set button colors (text and background) inline using [button:#aabbcc:#ddeeff]. Added support for Fudge dice rolling (XdF) with values of "-", " ", and "+". Added function array;numericsort.
1639132986
Kurt J.
Pro
API Scripter
Michael C. said: As Andrew R. correctly pointed out, floating point arithmetic can be bothersome.&nbsp; As an example, in DnD 5e character sheets the initiative tiebreaker, if used through the character sheet, will give the appropriate 2-decimal answer (using dexterity) every time.&nbsp; However, attempting to do the same thing with a scriptcards macro like:&nbsp; --=Init|[&amp;AdvRoll] + @{selected|dexterity_mod} + @{selected|initiative_bonus} [TIE]&nbsp; will occasionally, but not always, pump out a repeating decimal.&nbsp; &nbsp;Again, I have workarounds for this but I wonder if we could have a rounding feature similar to spreadsheets where we can specify the number of decimal places [e.g. {Round2}]? I can look at adding {Round:X} as a roll modifier to round to a given precision. Should be fairly straightforward (famous last words!) :)
1639559582

Edited 1639560066
Hi guys...I am still struggling with the concurrency issue between calls to scriptcard. I'm going to explain the details and what I've found so far. I love ScriptCards and I use 'em almost for everything whispering to "self" to: toggle buff, change spells "use", change item "qty" (useful for ammo and potions with one click), attacks, etc etc...Let's focus on one of these macros, but the same happens with any of them: the ToggleBuffMacro, which lists all the buff in "selected" sheet and shows a toggle button for each of them. Here's what happens Player A controls Character A Player B controls Character B The issue happens if (in this order) Player A selects Character A token Player A calls a Macro with ScriptCards+ChatSetAttr (i.e. the Buff Macro which lists all the available buffs for a Character and if you click on the button, it toggles it on or off setting a Character attribute, btw all Macros work fine if no concurrency occurs) Before Player A clicks on any ToggleButton in that Macro, Player B selects Character B token Player A clicks on a ToggleButton in the scriptcard (let's say the THIRD button in HIS list, toggling buff number 3) The THIRD buff of Character B's list is toggled (on/off) instead If this problem occurs a couple of times in a row, the API will get buggy and the console prompts messages like this one "SHEET WORKER ERROR: You attempted to set an attribute beginning with 'repeating_' but did not include a Row ID or Attribute Name in repeating_weapon_total-damage" "SHEET WORKER ERROR: You attempted to set an attribute beginning with 'repeating_' but did not include a Row ID or Attribute Name in repeating_weapon_total-damage" "SHEET WORKER ERROR: You attempted to set an attribute beginning with 'repeating_' but did not include a Row ID or Attribute Name in repeating_weapon_total-damage" "SHEET WORKER ERROR: You attempted to set an attribute beginning with 'repeating_' but did not include a Row ID or Attribute Name in repeating_weapon_total-damage" "SHEET WORKER ERROR: You attempted to set an attribute beginning with 'repeating_' but did not include a Row ID or Attribute Name in repeating_weapon_total-damage" "SHEET WORKER ERROR: You attempted to set an attribute beginning with 'repeating_' but did not include a Row ID or Attribute Name in repeating_weapon_total-damage" "SHEET WORKER ERROR: You attempted to set an attribute beginning with 'repeating_' but did not include a Row ID or Attribute Name in repeating_weapon_total-damage" "SHEET WORKER ERROR: You attempted to set an attribute beginning with 'repeating_' but did not include a Row ID or Attribute Name in repeating_weapon_total-damage" even if I am not setting any "weapon" in my calls. I prefer using ScriptCards as they can deal with Repeating lists easy...but just for the sake of testing, I've written a similar Macro which does about the same thing as ToggleBuff but without ScriptCards (using just ChatSetAttr + Chat Menu) and this one works great even with concurrency (of course it takes ages to write and doesnt dynamically adjust if you add a new buff, and that's why I'd LOVE to use ScriptCards). Because I use SelectManager, Timmaugh (thank you) suggested to use {^&amp; select @{selected|token_id} } when I make an API script call in ScriptCards, but that didn't solve the problem. --:ToggleOff| --@setattr|_charid @{selected|character_id} _silent _repeating_buff2_$[&amp;nBuff]_enable_toggle|0 {^&amp; select @{selected|token_id} } That's so frustrating. During the last session, I had to set up a rigorous Turn Order so as not to let multiple players use the "bugged macros" at the same time even just to toggle a buff. Any idea?
1639574346
timmaugh
Pro
API Scripter
Valerio I. said: Hi guys...I am still struggling with the concurrency issue between calls to scriptcard. So... this both sounds like a SelectManager problem and sounds like not a SelectManager problem. I'll repeat some of what I said to Valerio in PM, just so anyone else who might have an idea understands certain context. SelectManager tracks the set of most recent tokens selected when any user-initiated API call is made. When any subsequent API-generated API call comes through, SelectManager gives that last-tracked set of tokens to the new message before the recipient script gets a hold of it. Now, although there is a user attached to the original message (THIS user initiated the message), for an API message, there is no user. So there's no way to tell that I initiated the API call (say, ScriptCards) that initiated a secondary message (say, ChatSetAttr), versus you doing the same thing. SelectManager (currently) just figures that the last user to initiate a call to the API is the one responsible for subsequent API-generated messages, so the set of selected tokens it is tracking is accurate. I could probably add a per-user track of selected tokens to SelectManager, and then provide a {&amp; restore &lt;&lt;speaker_id&gt;&gt;} construct for secondary messages... so you could specifically instruct it to restore the tokens that were last stored for you. I'll see if I can get that added. That said, I don't think that's necessarily what's going on, here. ChatSetAttr is concerned with the character sheet. Why would it care about selected tokens? It wants the character sheet id (which Valerio is providing). And sheetworkers can't access the selected token information; they only know about the character sheet. I think some race condition is happening either in ChatSetAttr, or in how ScriptCard/SelectManager/ChatSetAttr is getting called and buttons are getting created... where some component is being resolved in an unexpected order. I'll get that syntax added to SelectManager, but does any one have any other thoughts?
1639575345
David M.
Pro
API Scripter
An unsatisfying solution (also requiring an extra click) might be to change from an @{selected...} to an @{target...} to get the character_id for the setattr call? The odds of two targets being acquired at the same time have to be super low.
1639576316
timmaugh
Pro
API Scripter
It has to be something with the order things are processed, don't you think? The @{selected} and @{target} are both processed by Roll20 as the original message comes through, and the information is retrieved based on who sent the message. Both of those should resolve with equal accuracy. And... just so I understand... is this the order of things (without regard to concurrency, just the order of how tasks are managed in scripts): A player runs the ScriptCards macro ScriptCards builds a menu of buttons That player clicks a button from the menu, which runs the ChatSetAttr call ? Because in that case I wonder when ScriptCards is stripping off the deferral character. In fact, if Valerio has ZeroFrame installed, s/he could drop a {&amp;log} in the original ScriptCard. The "Loop 1" entry should show how command line was rendered after Roll20 parsing. We could see if the @{select|character_id} is resolving correctly. Also, you could drop a deferred log command in the ChatSetAttr line: {^&amp;log} So that we get a separate log for what THAT script will see. Valerio can you do that and post your logged results for both (they will appear in chat)?
1639577212
David M.
Pro
API Scripter
What about this: Can you just have the original scriptcard (the one that creates the buttons) hardcode the character_id into each button when they are created (using a string variable like [&amp;charID]), rather than the button content relying on @{selected...}? &nbsp; &nbsp;
1639580246
Andreas J.
Forum Champion
Sheet Author
Translator
Valerio I. said: Hi guys...I am still struggling with the concurrency issue between calls to scriptcard. I'm going to explain the details and what I've found so far. Whatever the cause of this issue, I'm sure it stems from the interactions between the three separate APIs you're combining. timmaugh said: ChatSetAttr is concerned with the character sheet. Why would it care about selected tokens? It wants the character sheet id (which Valerio is providing). And sheetworkers can't access the selected token information; they only know about the character sheet. ChatSetAttr might care about token selection, and the fact that SelectManager is needed complicates things. I second David's idea about using @{target}, that should be able to cut out SelectManager completely, with the drawback that the targetting needs to be done each time. For Chatsetattr I've in the past noticed that --charid @{target|character_id} should work as a substitute for when it's passed to other APIs, using target instead of selected. You could create a target-based version of the macro, along with versions where the character_id is hardcoded, which saves clicks. Bottom line, I suggest you try make this scriptcard macro work with only calling ChatSetAttr, instead of the current version where all 3 APIs are packaged together to interaction.
1639584888
timmaugh
Pro
API Scripter
I just read through the ChatSetAttr code. The only time it cares about the selected tokens is if the user includes the "sel" argument option in the command line (as if to say, "get the characters from the tokens I have selected"). Valerio's code doesn't have that option, so there should be no interaction of CSA and the selected tokens. Valerio is providing the charid &nbsp;argument, so that's where it's getting the list of characters to modify. As for the efficacy of @{selected|... } vs @{target|... }, both are processed by Roll20 immediately. Their return values are given to the command line before the API (and therefore SelectManager) gets involved. Either will output the token id or character id (whatever you ask for) immediately. That's what the {&amp;log} statement should show. My current hunch is that this actually has to do with an async operation in CSA in how it sets the values of attributes to keep the sandbox from timing out. Maybe that is interfering with the sheetworkers. I'm not as strong with async, so I'm bringing that question to the House of Mod to see if the brains there can help.
1639585183
David M.
Pro
API Scripter
Valerio, can you post your scriptcard macro that creates the buttons?
1639585780
timmaugh
Pro
API Scripter
Also, can you confirm that the second user only has to click on their token to make this work? The API doesn't know that you clicked on a token until you run a script command. Just because someone clicked on a token shouldn't change anything about an API message's set of selected tokens. There is no interaction with the API (or changing a state that the API cares about) without running an API command. So is Player B doing more than selecting their token?
1639609839

Edited 1639610478
Kurt J.
Pro
API Scripter
Valerio I. said: Hi guys...I am still struggling with the concurrency issue between calls to scriptcard. I'm going to explain the details and what I've found so far. I love ScriptCards and I use 'em almost for everything whispering to "self" to: toggle buff, change spells "use", change item "qty" (useful for ammo and potions with one click), attacks, etc etc...Let's focus on one of these macros, but the same happens with any of them: the ToggleBuffMacro, which lists all the buff in "selected" sheet and shows a toggle button for each of them. Here's what happens Player A controls Character A Player B controls Character B The issue happens if (in this order) Player A selects Character A token Player A calls a Macro with ScriptCards+ChatSetAttr (i.e. the Buff Macro which lists all the available buffs for a Character and if you click on the button, it toggles it on or off setting a Character attribute, btw all Macros work fine if no concurrency occurs) Before Player A clicks on any ToggleButton in that Macro, Player B selects Character B token Player A clicks on a ToggleButton in the scriptcard (let's say the THIRD button in HIS list, toggling buff number 3) The THIRD buff of Character B's list is toggled (on/off) instead If this problem occurs a couple of times in a row, the API will get buggy and the console prompts messages like this one "SHEET WORKER ERROR: You attempted to set an attribute beginning with 'repeating_' but did not include a Row ID or Attribute Name in repeating_weapon_total-damage" "SHEET WORKER ERROR: You attempted to set an attribute beginning with 'repeating_' but did not include a Row ID or Attribute Name in repeating_weapon_total-damage" "SHEET WORKER ERROR: You attempted to set an attribute beginning with 'repeating_' but did not include a Row ID or Attribute Name in repeating_weapon_total-damage" "SHEET WORKER ERROR: You attempted to set an attribute beginning with 'repeating_' but did not include a Row ID or Attribute Name in repeating_weapon_total-damage" "SHEET WORKER ERROR: You attempted to set an attribute beginning with 'repeating_' but did not include a Row ID or Attribute Name in repeating_weapon_total-damage" "SHEET WORKER ERROR: You attempted to set an attribute beginning with 'repeating_' but did not include a Row ID or Attribute Name in repeating_weapon_total-damage" "SHEET WORKER ERROR: You attempted to set an attribute beginning with 'repeating_' but did not include a Row ID or Attribute Name in repeating_weapon_total-damage" "SHEET WORKER ERROR: You attempted to set an attribute beginning with 'repeating_' but did not include a Row ID or Attribute Name in repeating_weapon_total-damage" even if I am not setting any "weapon" in my calls. I prefer using ScriptCards as they can deal with Repeating lists easy...but just for the sake of testing, I've written a similar Macro which does about the same thing as ToggleBuff but without ScriptCards (using just ChatSetAttr + Chat Menu) and this one works great even with concurrency (of course it takes ages to write and doesnt dynamically adjust if you add a new buff, and that's why I'd LOVE to use ScriptCards). Because I use SelectManager, Timmaugh (thank you) suggested to use {^&amp; select @{selected|token_id} } when I make an API script call in ScriptCards, but that didn't solve the problem. --:ToggleOff| --@setattr|_charid @{selected|character_id} _silent _repeating_buff2_$[&amp;nBuff]_enable_toggle|0 {^&amp; select @{selected|token_id} } That's so frustrating. During the last session, I had to set up a rigorous Turn Order so as not to let multiple players use the "bugged macros" at the same time even just to toggle a buff. Any idea? I would definitely be helpful to see the Script in order to troubleshoot. If you are using reentrancy, what are you setting&nbsp;--#reentrant to in the ScriptCard. In my 5e Character Action Menu sample, I do this: --#reentrant|CharacterAction @{selected|character_id} If you are setting it to a non-dynamic value, anyone running the same ScriptCard will get the reentrant pull with the values the most recent execution set. By making the value include the character id of the desired character you can handle multiple requests without clashing.