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

@Kurt I am trying to enhance a script for Call of Cthulhu so that books will only show if the character has the right language skill above a threshold. Languages on the sheet are in a repeating section, but none of the repeating functions appear to work. I'm no doubt doing something stupid but any help would be appreciated. the attributes sheet has an r_languages_count.  I've tried various permutations of r, repeating + language, languages, Language etc but nothing is found. Other singly defined attributes are accessible
1627169858
Kurt J.
Pro
API Scripter
Keeper said: @Kurt I am trying to enhance a script for Call of Cthulhu so that books will only show if the character has the right language skill above a threshold. Languages on the sheet are in a repeating section, but none of the repeating functions appear to work. I'm no doubt doing something stupid but any help would be appreciated. the attributes sheet has an r_languages_count.  I've tried various permutations of r, repeating + language, languages, Language etc but nothing is found. Other singly defined attributes are accessible In the Cthulhu sheet, the section is called "repeating_languages". The following will display all of the languages for the selected character (except "OWN" which is handled as a separate attribute): !script {{ --Rfirst|@{selected|character_id};repeating_languages --:LANG_LOOP| --?"[*R:name]" -eq "NoRepeatingAttributeLoaded"|DONE_LANG --+Language|[*R:name] --Rnext| --^LANG_LOOP| --:DONE_LANG| }} If you wanted to see if a certain language was known, you could use --Rfind: --Rfind|@{selected|character_id};Dwarvish;repeating_languages;name If the language is known to the character, [*R:name] will contain the name (Dwarvish for example). if not, it will contain "NoRepeatingAttributeLoaded"
Kurt J. said: Keeper said: @Kurt I am trying to enhance a script for Call of Cthulhu so that books will only show if the character has the right language skill above a threshold. Languages on the sheet are in a repeating section, but none of the repeating functions appear to work. I'm no doubt doing something stupid but any help would be appreciated. the attributes sheet has an r_languages_count.  I've tried various permutations of r, repeating + language, languages, Language etc but nothing is found. Other singly defined attributes are accessible In the Cthulhu sheet, the section is called "repeating_languages". The following will display all of the languages for the selected character (except "OWN" which is handled as a separate attribute): !script {{ --Rfirst|@{selected|character_id};repeating_languages --:LANG_LOOP| --?"[*R:name]" -eq "NoRepeatingAttributeLoaded"|DONE_LANG --+Language|[*R:name] --Rnext| --^LANG_LOOP| --:DONE_LANG| }} If you wanted to see if a certain language was known, you could use --Rfind: --Rfind|@{selected|character_id};Dwarvish;repeating_languages;name If the language is known to the character, [*R:name] will contain the name (Dwarvish for example). if not, it will contain "NoRepeatingAttributeLoaded" You sir, are a legend. Thanks so much
1627192396

Edited 1627624181
Ivo
Pro
Awesome!!! Ill have a play around, didn't think to use concatenation, figured it would still fail. Will M. said: @Ivo:  I wrote a function library for setting global NPC parameters in my campaigns a while back.  Here is the code I developed to make this work.  Warning, they all have the _allgm option which means that this will rip through and adjust these settings globally across all your NPCs in a campaign.   As this uses the reentrant buttons to provide a list of options to in a card that you can select from, you'll also want to set a #reentrant parameter for your scriptcard if you use this code as is.  Also, these work on the Roll20 D&D 5e OGL sheets.  I don't know if they'll work for any of the other sheets out there.   You can see I got around the }} issue (Scriptcards sees this and interprets this as the end of the script), through string concatenation. --&P1|{{normal=1} --&P1|+} {{r2=[[0d20
1627330631

Edited 1627330939
Is there a way to change an attribute with script cards? I tried using CharSetAttr but the script kept giving me an error and I'm not sure which script is causing the error, the wiki for ScriptCards said we could use the CharSetAttr as an API command line but it keeps giving me an error regardless. Command I'm running in ScriptCards: --:SWeaBall| --Lsettings|SWeaBall --#emoteText|@{selected|token_name} attempts to atmospherically perceive --#leftsub|Atmospheric Perception --#rightsub|Level 0 --#title|Weather Balloon --+Info:|Able to perceive atmospheric changes allowing for per reactive action again projectiles as well as weather/temperature changes. +1 blue dies to perception. --@eed rollPlayer(character:@{Ymir Koslov|name}) label(skill:Crimson Push) @{Ymir Koslov|dicePool} 2y 1b 5p (gmdice) --*Increase Count?|[rbutton]YES::#UpSWeaBall[/rbutton] --X| --:UpSWeaBall| --@setattr _sel _mod _SWeaBall|1 --X| Note: I tried running "--" for the CharSetAttr but that didn't work so I just replaced with "_" and it gave an output, just not the one desired. The output: Errors No target characters. You need to supply one of --all, --allgm, --sel, --allplayers, --charid, or --name. No attributes supplied. Edit: If it can't run the command, is there any way to run a normal roll20 macro using the [rbutton] command? (I like the formatting I set up for it as opposed to the bulky pink [buttonName](!
#UpWeaBall) result. So can I run a button using the scriptcards formatting that leads to another macro outside the one the button is in?
1627333037
David M.
Pro
API Scripter
Try installing the SelectManager script. Your setattr command is expecting a token to be selected, which is getting lost by the api once it enters scriptcards. SelectManager is a meta-script that will retain the selected token for subsequent api calls from another script.
1627334090

Edited 1627334203
I installed SelectManager but it still is giving me the same result, tried substituting --@setattr _sel _mod _SWeaBall|1 With --@forselected setattr _sel _mod _SWeaBall|1 or --@forselected setattr _mod _SWeaBall|1 But I was still met with the same error result from the setattr attempt ಠ﹏ಠ looked into it and I'm just not sure where I'm going wrong. Edit: I think it's just the "_" part messing up the script from that line but I just don't know how to fix it or avoid it altogether.
1627334228
timmaugh
Pro
API Scripter
You shouldn't need the forselected handle, there, but you may need to configure SelectManager to give back the playerid, too: !smconfig +playerid If I remember, ChatSetAttr needs to know who is sending the new value to make sure they can control the character. If that doesn't work, I will try to replicate this tonight.
Make sure players can modify option is turned on for Chatsetattr.  Use the following command: !setattr-config
1627336672

Edited 1627338197
Did the config for it, same result. It still gives out the error. I think I'll just have to do the default button macro call setup with a different macro for the CharSetAttr script.  Is there a way to use the scriptcards button to call for a different macro or do the macros called with the [rbutton] [/rbutton] have to reference a command structure inside the same macro? Edit: Tried both configs for Charsetattr and the Selectmanager, same result. I'm stumped. Edit: This is the whole command structure at the moment, it's running on the Genesys sheet system with the Genesys script addon !scriptcard {{ --Lsettings|SSqualler --#title|Squaller --#leftsub|Mana Check --#rightsub|Rank 3 --#sourceToken|@{selected|token_id} --#emoteText|@{selected|token_name} focuses on the wind around him --+Info:|The ability to use any Squaller skill, it can also be used in a variety of ways, see ranks for more info. [rbutton]Ranks Info::RANKS;9[/rbutton] --+Abilities:| --+|*Combat*: [rbutton]Airmo Control::SAirmo;9[/rbutton] *|* [rbutton]Gusty Push::SGPush;9[/rbutton] *|* [rbutton]Tempest::STemp;9[/rbutton] --+|*Utility*: [rbutton]Weather Balloon::SWeaBall;9[/rbutton] *|* [rbutton]Gentle Breeze::SGenBree;9[/rbutton] --+Mana Check|[rbutton]Mana Used::MANA[/rbutton] --@eed rollPlayer(character:@{Araton Ilkov|name}) label(skill:Durast) @{Araton Ilkov|dicePool} 2b 1g 2y 4p (gmdice) --X| --:MANA| --#emoteText|@{selected|token_name} struggles to use their abilities --@alter|_target|@{selected|token_id} _bar|2 _amount|-1 --+Abilities:| --+|*Combat*: [rbutton]Airmo Control::SAirmo;9[/rbutton] *|* [rbutton]Gusty Push::SGPush;9[/rbutton] *|* [rbutton]Tempest::STemp;9[/rbutton] --+|*Utility*: [rbutton]Weather Balloon::SWeaBall;9[/rbutton] *|* [rbutton]Gentle Breeze::SGenBree;9[/rbutton] --X| --:RANKS| --Lsettings|n/emoteSSqualler --#emoteText| --#title|Squaller --#leftsub|Rank 3 --#rightsub| --+Rank 1:|fundamental mastery is completed, basic wind actions are now possible. --+Rank 2:|wind knowledge increases making the user more proficient at wind manipulation techniques. --+Rank 3:|wind can guide you towards what you see (+1 blue die on perception checks to sight) (roll a Divine to see if your god would direct you towards the answer you seek). --X| --:SAirmo| --Lsettings|SAirmo --#emoteText|@{selected|token_name} attempts to control the air inside @{target|token_name} --#title|Airmo Control --#leftsub|Strain Damage --#rightsub|Level 1 --+Info:|Used to control the air inside the targets lungs, causing them some strain. --+Does it hit?|[rbutton]HIT::1d5HIT;9[/rbutton] | [rbutton]CRIT::1d5CRIT;9[/rbutton] | [rbutton]MISS::MISS;9[/rbutton] --@eed rollPlayer(character:@{Ymir Koslov|name}) label(skill:Crimson Push) @{Ymir Koslov|dicePool} 2y 1g 5p (gmdice) --X| --:SGPush| --Lsettings|SGPush --#emoteText|@{selected|token_name} attempts to shove @{target|token_name} using a strong gust of wind --#title|Gusty Push --#leftsub|Strain Attack | Wound Attack (on combo) --#rightsub|Level 0 --+Info:|Accelerates the wind around the target building up it's concentration and power enough to push a target. --+Stats:|*Damage*: 1d5 *|* *Difficulty*: 5 purple *|* *Range*: 1d10 *|* *Toss Range*: 1d10 --+Does it hit?|[rbutton]HIT::1d5HIT;9[/rbutton] | [rbutton]CRIT::1d5CRIT;9[/rbutton] | [rbutton]MISS::MISS;9[/rbutton] --+CRIT:|Toss Range is extended to 1d15 and ***combo*** damage is applied to both equally (instead of split) --@eed rollPlayer(character:@{Ymir Koslov|name}) label(skill:Crimson Push) @{Ymir Koslov|dicePool} 3g 5p (gmdice) --X| --:SWeaBall| --Lsettings|SWeaBall --#emoteText|@{selected|token_name} attempts to atmospherically perceive --#leftsub|Atmospheric Perception --#rightsub|Level 0 --#title|Weather Balloon --+Info:|Able to perceive atmospheric changes allowing for per reactive action again projectiles as well as weather/temperature changes. +1 blue dies to perception. --@eed rollPlayer(character:@{Ymir Koslov|name}) label(skill:Crimson Push) @{Ymir Koslov|dicePool} 2y 1b 5p (gmdice) --*Increase Count?|[rbutton]YES::UpSWeaBall;9[/rbutton] --X| --:UpSWeaBall| --@setattr _sel _mod _SWeaBall|1 --*Weather Balloon Count:|@{selected|SWeaBall} --X| --:1d5HIT| --Lsettings|n/titleHVaso --#emoteText|@{selected|token_name} attacks @{target|token_name} --=Damage|1d5 --+Hit!|The attack hit @{target|token_name} for [$Damage] strain damage. --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --X| --:1d5CRIT| --Lsettings|n/titleHVaso --#emoteText|@{selected|token_name} seriously attacks @{target|token_name} --=Damage|2d5 --+Hit!|The attack crit @{target|token_name} for [$Damage] strain damage. --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --X| --:MISS| --Lsettings|n/titleHVaso --#emoteText|@{selected|token_name} misses their attack on @{target|token_name} --+Miss|The attack missed @{target|token_name}. ( ̄﹏ ̄;) --X| }}
1627338590

Edited 1627339470
I see it now - you are missing the required pipe after the API name.&nbsp; Try changing to the following syntax when you make the setattr call: --@setattr|_sel _mod _SWeaBall|1 I use the [button] command to call macros from my macro mule character sheet or call on an attribute.&nbsp; Here are some examples: [button]Acrobatics Check::~[*[&amp;CharId]:character_name]|npc_acrobatics[/button] Opening another web page: --:DNDBEYOND_SPELL_LINK|SpellName, button caption&nbsp; &nbsp; --/|Format is <a href="https://www.dndbeyond.com/spells/dominate-person" rel="nofollow">https://www.dndbeyond.com/spells/dominate-person</a> &nbsp; --~SN|string;replaceall; ;-;[%1%] &nbsp; --&amp;zDnDBeyondSpellLink|<a href="https://www.dndbeyond.com/spells/[&amp;SN]" rel="nofollow">https://www.dndbeyond.com/spells/[&amp;SN]</a> &nbsp; --&amp;DNDBEYOND_SPELL_BTN|[button][%2%]::[&amp;zDnDBeyondSpellLink][/button]&nbsp;&nbsp; --&lt;| Calling a macro ability from a Macro Mule Sheet: [button]Utilities::~Mule|Menu-Utility-Macros[/button] I've considered writing up a white paper type document on the various ways to get user input with scriptcards: [rbutton] : Rbutton and reentrant functionality [button] : button actions and button functionality --&amp;Var|?{Caption|Option1, 1|Option 2, 2}:&nbsp; Useing roll query to get information from users.&nbsp; &nbsp; --I| : Input Command It would include: Example syntax Tips and tricks Pros / Cons of each method
1627339294

Edited 1627339713
Will M. said: I see it now - you are missing the required pipe after the API name.&nbsp; Try changing to the following syntax when you make the setattr call: --@setattr|_sel _mod _SWeaBall|1 It worked! Thank you so much. Can't believe I missed that, I feel like such an idiot. Thank you so much! Edit: I'd love to take a look at the document once it's complete! It sounds really helpful!
1627494194

Edited 1627494219
Heyas,&nbsp; I need some help with HTML characters in queries.&nbsp; I'm trying to get arrow indicators in a query for my players to direct line attacks. The hiccup seems to be if I use the Information Request command.&nbsp; This works as intended with a northwest arrow in the query.&nbsp; !scriptcard{{ --&amp;Angle|?{What is the firing angle?|0|45|90|135|180|225|270|315 &amp;nwarr;} }} This one, however, doesn't show the arrow. Instead the query seems to be cut off at the semi-colon. Which, I guess, makes sense as the semi-colon is the delineator for the information query syntax. !scriptcard{{ --IWhat is the firing; angle?|q;angle;angle?|0|45|90|135|180|225|270|315 &amp;nwarr; }} Is there a way around this or another way to put in the HTML code? Thanks!
1627494833

Edited 1627494944
@Erik M. - I've got two suggestions: 1.&nbsp; Take a look at this Gust of Wind/Joystick script I wrote yesterday for a similar situation.&nbsp; It approaches the problem of asking for a direction a little differently, presenting a grid of buttons representing the various directions.&nbsp;&nbsp; 2.&nbsp; Wait a little bit as I believe that in the near future, the next version of scriptcards will have an angle function that returns the angle between two tokens (caster and target for example).&nbsp;&nbsp;
That looks neat, Will. I use something less advanced for starship movement. :) What I'm trying to do is to get the angle as I'm using that value to pass to weapon-arcs to draw the AOE of an attack. So I could output a card with directional markers on it, and have the script come back in with the re-entry value and continue on? Great idea!
1627501415
Kurt J.
Pro
API Scripter
ScriptCards 1.3.9a New update is on the GIST (and headed for OneClick): New math function : angle - Takes two token IDs as parameters and returns a stringvariable containing the angle (in degrees) from the first to the second token. A value of 0 is "up/north", with angles winding in the clockwise direction (so 90=east, 120=south, 270=west). The number is returned as-is from the Javascript, so you may wish to use other math commands to round it. Example:&nbsp; !script {{ --~resultangle|math;angle;@{selected|token_id};@{target|token_id} --+The angle is|[&amp;resultangle] degrees }}
Geez, when Will said near future, I wasn't expecting that near! A question, of course: is there a way to take into account the orientation of the token? Or to get that information?
1627508847
Kurt J.
Pro
API Scripter
Erik M. said: Geez, when Will said near future, I wasn't expecting that near! A question, of course: is there a way to take into account the orientation of the token? Or to get that information? Roll20 is... weird about rotation. If you rotate a token fully around clockwise back to its original facing, the rotation value will be 360 (instead of 0). If you keep going, you can get it up to well over 1000 depending on how you rotate it :) The below code will get you the actual angle of the token relative to 0 being unrotated: !script {{ --~angle|math;angle;@{selected|token_id};@{target|token_id} --#sourcetoken|@{selected|token_id} --#targettoken|@{target|token_id} --=SourceAngle|[*S:t-rotation] % 360 --=TargetAngle|[*T:t-rotation] % 360 --+Source Angle|[$SourceAngle.Raw] --+Target Angle|[$TargetAngle.Raw] --+Angle (Source to Target)|[&amp;angle] }}
That is pretty weird. Just like the angles in Javascript go from -90 to 270 instead of 0 to 360.&nbsp; Guess that is what I get for running a facing matters game.&nbsp; Thanks!
1627587419

Edited 1627601410
Kurt J.
Pro
API Scripter
ScriptCards 1.3.9b (Minor Update) ( GIST ) Small update to fix the case of negative angles when between 270 and 360.
1627602541
Kurt J.
Pro
API Scripter
I have set up a GitHub repo for ScriptCards that contains the latest development version of the API script itself as well as a collection of example scripts. I only added my own scripts there right now, but if others want to give me the go ahead to add theirs, I can do that manually, or folks can fork the repo and do pull requests and we can build the catalog that way. The repo is located here :&nbsp; kjaegers/ScriptCards: A repository containing the current ScriptCards API development code and example/community ScriptCards macros (github.com)
1627606450

Edited 1627693833
Can anyone help, I've been working on creating a script for&nbsp; Thunder Clap &nbsp;but it isn't quite working correctly !scriptcards {{ --#title|Thunderclap --#titleCardBackground|#000066 --#titleFontColor|#FFFFFF --#evenRowBackground|#000066 --#evenRowFontColor|#FFFFFF --#oddRowBackground|#d9d9d9 --#oddRowFontColor|#000000 --#sourceToken|@{selected|token_id} --@token-mod _config|players-can-ids --#leftsub|Save DC @{selected|spell_save_dc} --#rightsub|Range 5' --#emoteText| @{selected|token_name} claps his palms and a thunderous clap eminates from him --/|Calculate the damage based on the spell caster's level. 1 to 4 1d6, 5 to 10 2d6, 11 to 16 3d6, 17 to 20 4d6 --C[*S:level]|1:&gt;Damage;1|2:&gt;Damage;1|3:&gt;Damage;1|4:&gt;Damage;1|5:&gt;Damage;2|6:&gt;Damage;2|7:&gt;Damage;2|8:&gt;Damage;1|9:&gt;Damage;2|10:&gt;Damage;2|11:&gt;Damage;3|12:&gt;Damage;3|13:&gt;Damage;3|14:&gt;Damage;3|15:&gt;Damage;3|16:&gt;Damage;3|17:&gt;Damage;4|18:&gt;Damage;4|19:&gt;Damage;4|20:&gt;Damage;4 --:Damage| --:RollDamage| --=Damage| [%1%]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] --+|&nbsp; --/|Get all tokens on the page into the "alltokens" array --~|array;pagetokens;alltokens;@{selected|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 --?[&amp;tokenid] -eq ArrayError|endOutput --:loopCheck| --/|Skip targets that are not on the token layer or that don't represent creatures --?[*[&amp;tokenid]:t-layer] -ne objects|continue --?"[*[&amp;tokenid]:t-represents]" -ninc "-"|continue --/|Check the distance between the casting token and the current array token. 5 feet is 1 unit --~dist|distance;@{selected|token_id};[&amp;tokenid] --?[$dist] -eq 0 -or [$dist] -gt 1|continue --/|If we didn't skip over this part, the token is within 5 feet, so add it to the inRange array --~|array;add;inRange;[&amp;tokenid] --:continue| --~tokenid|array;getnext;alltokens --?[&amp;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 --?[&amp;tokenid] -eq ArrayError|endOutput --:loopDisplay| --&gt;MakeSavingThrow|[&amp;tokenid];constitution;@{selected|spell_save_dc};[$Damage.Total];thunder;thisTokenDamage;saveResult;con --+[*[&amp;tokenid]:character_name]:|Constitution saving throw was [$savingThrow] he takes [$thisTokenDamage] thunder damage. --&gt;ApplyDamageTokenmod|[&amp;tokenid];1;[$thisTokenDamage] --&gt;PlayEffects|@{selected|token_id};[&amp;ThisTarget];nova-smoke;none;none;spell-thunderclap --&lt;| --/|Get the next token and continue the loop until we run out. --~tokenid|array;getnext;inRange --?[&amp;tokenid] -ne ArrayError|loopDisplay --: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"|&gt;set_string;baseSaveBonus;|&gt;set_string;baseSaveBonus; + + [*[%1%]:npc_[%8%]_save_base] --=savingThrow|1d20 + [*[%1%]:[%2%]_save_bonus] [&amp;baseSaveBonus] --&amp;dmgmult| --?[$savingThrow] -ge [%3%]|&gt;set_string;dmgmult; \ 2 --?[$savingThrow] -lt [%3%]|&gt;set_string;[%7%];fail --?[$savingThrow] -ge [%3%]|&gt;set_string;[%7%];success --?"[*[%1%]:npc_resistances]" -inc "[%5%]" -and [$savingThrow] -lt [%3%]|&gt;set_string;dmgmult; \ 2 --?"[*[%1%]:npc_resistances]" -inc "[%5%]" -and [$savingThrow] -ge [%3%]|&gt;set_string;dmgmult; * 0 --?"[*[%1%]:npc_vulnerabilities]" -inc "[%5%]" -and [$savingThrow] -ge [%3%]|&gt;set_string;dmgmult; --?"[*[%1%]:npc_vulnerabilities]" -inc "[%5%]" -and [$savingThrow] -lt [%3%]|&gt;set_string;dmgmult; * 2 --?"[*[%1%]:npc_immunities]" -inc "[%5%]"|&gt;set_string;dmgmult; * 0 --=[%6%]|[%4%] [&amp;dmgmult] --&lt;| --:set_string|mod_variable;value --&amp;[%1%]|[%2%] --&lt;| --/|Subroutine to apply damage with TokenMod. Could be replaced with alterbars or chatsetattr --:ApplyDamageTokenmod|Parameters are tokenid;bar#;amount --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|-[%3%] --&lt;| --:PlayEffects|Parameters are : sourcetoken; targettoken; source effect; target effect; line effect; sound effect --vtoken|[%1%] [%3%] --vtoken|[%2%] [%4%] --vbetweentokens|[%1%] [%2%] [%5%] --@roll20AM|_audio,play,nomenu|[%6%] --&lt;| }} As you can see from the screen capture it's rolling two damage rolls, and impacting the same target twice, but not all the other targets in range. There should be read outs for 4 targets.&nbsp; Any assistance on this would be a boon, as one of my players is running a tempest cleric/storm sorcerer
I've noticed recently that scripts with a call to select targets that use a button in the chat are no longer functioning.&nbsp; For example, the following Bless script no longer functions properly. !scriptcard {{ --#title|You've been Blessed by the Gods! --#titlecardbackground|#FFC600 --#evenrowbackground|#FFC600 --#oddrowbackground|#FCFBC0 --#evenrowfontcolor|#020202 --#oddrowfontcolor|#020202 --#sourceToken|@{selected|token_id} --config players-can-ids|on. --&gt;GetAndCheckSlotInformation| --=BlessCount|[$SlotLevel] + 2 --&gt;BuildAndAskTargets|[$BlessCount.Total] --=DisplayCount|1 --#leftsub| --#rightsub| --#emoteText|@{selected|character_name} casts Bless! --:BlessLoop| --&gt;FireMissile|[$DisplayCount.Total] --=DisplayCount|[$DisplayCount] + 1 --?[$DisplayCount] -le [$BlessCount]|BlessLoop --&gt;DeductSpellSlot| --#rightsub|Level [$SlotLevel] Left: [$SlotsRemaining] --X| --:FireMissile| --&amp;ThisTarget|[&amp;target[%1%]] --+|[c][b]**[*[&amp;ThisTarget]:character_name]**[/b][/c] --@act| -1| 10| _Bless [*[&amp;ThisTarget]:character_name] --&gt;PlayEffects|@{selected|token_id};[&amp;ThisTarget];none;nova-holy;none;bless --&lt;| --:GetAndCheckSlotInformation| --=SlotLevel|?{Spell Slot Level Used?|1|2|3|4|5|6|7|8|9} --=SlotsTotal|0 --=SlotsExpended|[*S:lvl[$SlotLevel]_slots_expended] --?[$SlotsExpended.Total] -eq [$SlotsTotal.Total]|NoSlotsLeft --&lt;| --:NoSlotsLeft| --+|[*S:character_name] has no level [$SlotLevel.Total] spell slots available. --#emoteText|[*S:character_name] tries to cast a spell but farts in instead. --X| --:DeductSpellSlot| --=SlotsExpended|[$SlotsExpended] - 1 --@setattr|_charid [*S:character_id] _lvl[$SlotLevel]_slots_expended|[$SlotsExpended] _silent --+|[c][b]Level [$SlotLevel] Slots Left: [$SlotsExpended][/c][/b] --X| --:PlayEffects|Parameters are : sourcetoken; targettoken; source effect; target effect; line effect; sound effect --@setattr|_charid [*[%2%]:character_id] _repeating_savemod_$2_global_save_active_flag|1 _silent --@setattr|_charid [*[%2%]:character_id] _repeating_tohitmod_$2_global_attack_active_flag|1 _silent --@token-mod| _ids [*[%2%]:character_id] _set statusmarkers|blessed::4106671 --vtoken|[%1%] [%3%] --vtoken|[%2%] [%4%] --vbetweentokens|[%1%] [%2%] [%5%] --@roll20AM|_audio,play,nomenu|[%6%] --&lt;| --:BuildAndAskTargets| --&amp;TargetString| --=targetCount|1 --:TargetLoop| --&amp;TargetString|+t;target[$targetCount.Total];Missile [$targetCount.Total] Target --=targetCount|[$targetCount.Total] + 1 --?[$targetCount.Total] -le [%1%]|&gt;AddSeparator --?[$targetCount.Total] -le [%1%]|TargetLoop --iPlease click the button below to select targets to bless.;Select [%1%] Targets|[&amp;TargetString] --/| --&lt;| --:AddSeparator| --&amp;TargetString|+|| --&lt;| }} Is there a work around that I missed on this?
1627611103

Edited 1627622960
Ivo
Pro
Hi, Is it possible to action a sheet ability, ie %{char_id|ability} from within scriptcards. I'm using a reentrant button that is created as part of the attack list from a sheet to intercept the actioning of the attack from the button to allow a @{target|token_id} to take place, then action the actual attack which was passed in as theReentryValue. The ability call comes through the reentryvalue perfectly, ie&nbsp; ReentryVal &nbsp;~-LNjaxFXPq46f47hgpMj|repeating_npcaction_-LNjaxfuDhXktJpBRLyS_npc_action Sample From a modified library --&amp;_Lib5E_Temp|+[rbutton][&amp;_Lib5E_NameTemp]::TARGET_AND_ATTACK;~[%1%]|[*R&gt;npc_action][/rbutton] From a mule sheet --:TARGET_AND_ATTACK| &nbsp; --+ReentryVal|[&amp;reentryval] --+|%{[&amp;reentryval]} &nbsp; --X| The --+|%{[&amp;reentryval]} throws the usual exception&nbsp; TypeError: Cannot read property 'substring' of undefined Is there a simpler way? The issue of course seems to be it wants to process&nbsp; --+|%{[&amp;reentryval]}&nbsp; immediately , not when the button is pressed, same goes for the @{target|token_id} call if I add that in I'm guessing even if there was a way, it would action the ability immediately, rather than delaying it until the button is pressed Rethink time... What about storing the ability call / reentryval and calling a macro instead, would that delay parsing until the button is pressed, then how to call a macro from within scriptcards, --+|#macro didnt seem to work Maybe using a deferral? As a side note, the code below does not effect the size of reentrant buttons, they seem fixed -#buttonFontSize|small If i try this --:TARGET_AND_ATTACK| &nbsp; --&amp;P1|% &nbsp; --&amp;P1|+{[&amp;reentryval] &nbsp; --&amp;P1|+&amp;#125; &nbsp; --+|[&amp;P1] &nbsp; --X| it actually spits this to the chat (From Ivo (GM)): Goblin %{-LNjaxFXPq46f47hgpMj|repeating_npcaction_-LNjaxfuDhXktJpBRLyS_npc_action} But doesnt actually run it, however cutting and pasting the same command does Why you might ask, well I keep getting complaints from players about 2 clicks, one to use the attack, another to target. Coming up with abilities for each character to replicate the attack list is fine(I used to do this, adding in a target command at the same time). However I found that players can cause grief here by either changing the attack list, or playing around with the macros. So I'm trying scriptcards with the 5e library and R functions to spit the characters/npc attack list to chat as buttons, and at present adding a separate target button(this is what i,m trying to remove). At present i have the whole routine select-less, ie move turn order on, it auto spits out a mini sheet to chat with all of there attack list and some other options, like checks/saves/target etc. They can select any of these without having to select there token first and it all works. Token actions, sure, been there, done that, they can stack up fast though, so I have moved away from them as well, only used as a backup now.
1627611409

Edited 1627611448
@Kurt J. - I love the idea!!! I just setup a github account and am beginning the process of learning how to use it.&nbsp; I downloaded the desktop app, setup a repository and am slowly uploading all my scripts.&nbsp; It'll be good to have it all organized.&nbsp; It'll take me a week to work through the learning curve though.&nbsp;&nbsp; I'm also adding header comments to all my scripts as I do this based on your example in the Action script.&nbsp;&nbsp; --/|Script Name : DMTools --/|Version : 4.0 --/|Requires SC : 1.3.7+, TokenMod, NoteLog*, ChatSetAttr, ping-token* --/|Author : Will M. --/|Description : A collection of utility functions against party characters Once I figure this out, I'll send you a link to my github so that you can link it to yours.&nbsp;&nbsp; Kurt J. said: I have set up a GitHub repo for ScriptCards that contains the latest development version of the API script itself as well as a collection of example scripts. I only added my own scripts there right now, but if others want to give me the go ahead to add theirs, I can do that manually, or folks can fork the repo and do pull requests and we can build the catalog that way. The repo is located here :&nbsp; kjaegers/ScriptCards: A repository containing the current ScriptCards API development code and example/community ScriptCards macros (github.com)
I'm not great at making these scriptcards. I was wondering if there is someone that can make a "Thunderwave" spellcard that can do the knockback, saves, and damage. Something like the Fireball scriptcard and Will M. new Gustwind scriptcard but combined for Thunderwave. Thank you.
1627661264

Edited 1627661352
Kurt J.
Pro
API Scripter
5E Character Action Menu version 1.5 is available on the GITHUB and on the GIST .&nbsp; This version will attempt to load a saved settings profile with the name (case sensitive) of the token selected when you the script is run, allowing you to customize the appearance of the card based on those saved settings. There is a line in the script (--&amp;UseNamedCharacterSettings|1) that you can set to 0 to disable this behavior. I recommend using Will M.s Format Scriptcard Tool &nbsp;to generate and save formats.
1627662074
Kurt J.
Pro
API Scripter
ez2rpg said: I've noticed recently that scripts with a call to select targets that use a button in the chat are no longer functioning.&nbsp; For example, the following Bless script no longer functions properly. --&amp;TargetString|+t;target[$targetCount.Total];Missile [$targetCount.Total] Target Is there a work around that I missed on this? The line above needs to be updated after the rewrite of variable substitution code to: --&amp;TargetString|+t;target[$targetCount.Raw];Missile [$targetCount.Raw] Target (Just replacing .Total with .Raw) because Total in a --&amp; line inserts the HTML to format the roll for display.
1627662152
Kurt J.
Pro
API Scripter
Ivo said: Hi, Is it possible to action a sheet ability, ie %{char_id|ability} from within scriptcards. I'm using a reentrant button that is created as part of the attack list from a sheet to intercept the actioning of the attack from the button to allow a @{target|token_id} to take place, then action the actual attack which was passed in as theReentryValue. The ability call comes through the reentryvalue perfectly, ie&nbsp; ReentryVal &nbsp;~-LNjaxFXPq46f47hgpMj|repeating_npcaction_-LNjaxfuDhXktJpBRLyS_npc_action Sample From a modified library --&amp;_Lib5E_Temp|+[rbutton][&amp;_Lib5E_NameTemp]::TARGET_AND_ATTACK;~[%1%]|[*R&gt;npc_action][/rbutton] From a mule sheet --:TARGET_AND_ATTACK| &nbsp; --+ReentryVal|[&amp;reentryval] --+|%{[&amp;reentryval]} &nbsp; --X| The --+|%{[&amp;reentryval]} throws the usual exception&nbsp; TypeError: Cannot read property 'substring' of undefined Is there a simpler way? The issue of course seems to be it wants to process&nbsp; --+|%{[&amp;reentryval]}&nbsp; immediately , not when the button is pressed, same goes for the @{target|token_id} call if I add that in I'm guessing even if there was a way, it would action the ability immediately, rather than delaying it until the button is pressed Rethink time... What about storing the ability call / reentryval and calling a macro instead, would that delay parsing until the button is pressed, then how to call a macro from within scriptcards, --+|#macro didnt seem to work Maybe using a deferral? As a side note, the code below does not effect the size of reentrant buttons, they seem fixed -#buttonFontSize|small If i try this --:TARGET_AND_ATTACK| &nbsp; --&amp;P1|% &nbsp; --&amp;P1|+{[&amp;reentryval] &nbsp; --&amp;P1|+&amp;#125; &nbsp; --+|[&amp;P1] &nbsp; --X| it actually spits this to the chat (From Ivo (GM)): Goblin %{-LNjaxFXPq46f47hgpMj|repeating_npcaction_-LNjaxfuDhXktJpBRLyS_npc_action} But doesnt actually run it, however cutting and pasting the same command does Why you might ask, well I keep getting complaints from players about 2 clicks, one to use the attack, another to target. Coming up with abilities for each character to replicate the attack list is fine(I used to do this, adding in a target command at the same time). However I found that players can cause grief here by either changing the attack list, or playing around with the macros. So I'm trying scriptcards with the 5e library and R functions to spit the characters/npc attack list to chat as buttons, and at present adding a separate target button(this is what i,m trying to remove). At present i have the whole routine select-less, ie move turn order on, it auto spits out a mini sheet to chat with all of there attack list and some other options, like checks/saves/target etc. They can select any of these without having to select there token first and it all works. Token actions, sure, been there, done that, they can stack up fast though, so I have moved away from them as well, only used as a backup now. While a [sheetbutton] can be used to create a button to call a sheet ability, it is not possible to have the scriptcard actually run the ability without player interaction. This is a limitation of the API in that it isn't actually working through the UI and doesn't get some of the processing required.
1627663335
Kurt J.
Pro
API Scripter
ez2rpg said: Can anyone help, I've been working on creating a script for&nbsp; Thunder Clap &nbsp;but it isn't quite working correctly !scriptcards {{ --#title|Thunderclap --#titleCardBackground|#000066 --#titleFontColor|#FFFFFF --#evenRowBackground|#000066 --#evenRowFontColor|#FFFFFF --#oddRowBackground|#d9d9d9 --#oddRowFontColor|#000000 --#sourceToken|@{selected|token_id} --@token-mod _config|players-can-ids --#leftsub|Save DC @{selected|spell_save_dc} --#rightsub|Range 5' --#emoteText| @{selected|token_name} claps his palms and a thunderous clap eminates from him --/|Calculate the damage based on the spell caster's level. 1 to 4 1d6, 5 to 10 2d6, 11 to 16 3d6, 17 to 20 4d6 --C[*S:level]|1:&gt;Damage;1|2:&gt;Damage;1|3:&gt;Damage;1|4:&gt;Damage;1|5:&gt;Damage;2|6:&gt;Damage;2|7:&gt;Damage;2|8:&gt;Damage;1|9:&gt;Damage;2|10:&gt;Damage;2|11:&gt;Damage;3|12:&gt;Damage;3|13:&gt;Damage;3|14:&gt;Damage;3|15:&gt;Damage;3|16:&gt;Damage;3|17:&gt;Damage;4|18:&gt;Damage;4|19:&gt;Damage;4|20:&gt;Damage;4 --:Damage| --:RollDamage| --=Damage| [%1%]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] --+|&nbsp; --/|Get all tokens on the page into the "alltokens" array --~|array;pagetokens;alltokens;@{selected|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 --?[&amp;tokenid] -eq ArrayError|endOutput --:loopCheck| --/|Skip targets that are not on the token layer or that don't represent creatures --?[*[&amp;tokenid]:t-layer] -ne objects|continue --?"[*[&amp;tokenid]:t-represents]" -ninc "-"|continue --/|Check the distance between the casting token and the current array token. 5 feet is 1 unit --~dist|distance;@{selected|token_id};[&amp;tokenid] --?[$dist] -eq 0 -or [$dist] -gt 1|continue --/|If we didn't skip over this part, the token is within 5 feet, so add it to the inRange array --~|array;add;inRange;[&amp;tokenid] --:continue| --~tokenid|array;getnext;alltokens --?[&amp;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 --?[&amp;tokenid] -eq ArrayError|endOutput --:loopDisplay| --&gt;MakeSavingThrow|[&amp;tokenid];constitution;@{selected|spell_save_dc};[$Damage.Total];thunder;thisTokenDamage;saveResult;con --+[*[&amp;tokenid]:character_name]:|Constitution saving throw was [$savingThrow] he takes [$thisTokenDamage] thunder damage. --&gt;ApplyDamageTokenmod|[&amp;tokenid];1;[$thisTokenDamage] --&gt;PlayEffects|@{selected|token_id};[&amp;ThisTarget];nova-smoke;none;none;spell-thunderclap --&lt;| --/|Get the next token and continue the loop until we run out. --~tokenid|array;getnext;inRange --?[&amp;tokenid] -ne ArrayError|loopDisplay --: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"|&gt;set_string;baseSaveBonus;|&gt;set_string;baseSaveBonus; + + [*[%1%]:npc_[%8%]_save_base] --=savingThrow|1d20 + [*[%1%]:[%2%]_save_bonus] [&amp;baseSaveBonus] --&amp;dmgmult| --?[$savingThrow] -ge [%3%]|&gt;set_string;dmgmult; \ 2 --?[$savingThrow] -lt [%3%]|&gt;set_string;[%7%];fail --?[$savingThrow] -ge [%3%]|&gt;set_string;[%7%];success --?"[*[%1%]:npc_resistances]" -inc "[%5%]" -and [$savingThrow] -lt [%3%]|&gt;set_string;dmgmult; \ 2 --?"[*[%1%]:npc_resistances]" -inc "[%5%]" -and [$savingThrow] -ge [%3%]|&gt;set_string;dmgmult; * 0 --?"[*[%1%]:npc_vulnerabilities]" -inc "[%5%]" -and [$savingThrow] -ge [%3%]|&gt;set_string;dmgmult; --?"[*[%1%]:npc_vulnerabilities]" -inc "[%5%]" -and [$savingThrow] -lt [%3%]|&gt;set_string;dmgmult; * 2 --?"[*[%1%]:npc_immunities]" -inc "[%5%]"|&gt;set_string;dmgmult; * 0 --=[%6%]|[%4%] [&amp;dmgmult] --&lt;| --:set_string|mod_variable;value --&amp;[%1%]|[%2%] --&lt;| --/|Subroutine to apply damage with TokenMod. Could be replaced with alterbars or chatsetattr --:ApplyDamageTokenmod|Parameters are tokenid;bar#;amount --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|-[%3%] --&lt;| --:PlayEffects|Parameters are : sourcetoken; targettoken; source effect; target effect; line effect; sound effect --vtoken|[%1%] [%3%] --vtoken|[%2%] [%4%] --vbetweentokens|[%1%] [%2%] [%5%] --@roll20AM|_audio,play,nomenu|[%6%] --&lt;| }} As you can see from the screen capture it's rolling two damage rolls, and impacting the same target twice, but not all the other targets in range. There should be read outs for 4 targets.&nbsp; Then it tends to crash shortly thereafter Any assistance on this would be a boon, as one of my players is running a tempest cleric/storm sorcerer I'm not getting any errors or issues running the macro. The sandbox error you listed looks like it is coming from Roll20AM, since ScriptCards doesn't do anything with tracks.&nbsp;
1627666267

Edited 1627666561
Kurt J.
Pro
API Scripter
5E Character Action Menu version 1.6 is available on the&nbsp; GITHUB&nbsp; and on the&nbsp; GIST .&nbsp; Now supports prepared spells, including the differences in ritual casting between wizards and everyone else.&nbsp;If you are a sorcerer (at all) there is no filtering for prepared spells (since Sorcs don't have to prepare). If you are a Wizard, ritual spells will appear even if not prepped (as they can cast them from the spellbook). Other casters will only see rituals they have prepared. Any of your multi-classes can count as a Sorc or Wizard. Also, spells that can be cast as rituals will be tagged with [R] in the button name.
1627667038
Kurt J.
Pro
API Scripter
Snow said: I'm not great at making these scriptcards. I was wondering if there is someone that can make a "Thunderwave" spellcard that can do the knockback, saves, and damage. Something like the Fireball scriptcard and Will M. new Gustwind scriptcard but combined for Thunderwave. Thank you. I started working on a generic AOE script that could be used for something like this (lines, cones, spheres, and cubes) I'll see if I can find it and dust it off.
Kurt J. said: ez2rpg said: I've noticed recently that scripts with a call to select targets that use a button in the chat are no longer functioning.&nbsp; For example, the following Bless script no longer functions properly. --&amp;TargetString|+t;target[$targetCount.Total];Missile [$targetCount.Total] Target Is there a work around that I missed on this? The line above needs to be updated after the rewrite of variable substitution code to: --&amp;TargetString|+t;target[$targetCount.Raw];Missile [$targetCount.Raw] Target (Just replacing .Total with .Raw) because Total in a --&amp; line inserts the HTML to format the roll for display. Thank you, missed that update&nbsp;
1627694820

Edited 1627699844
Ivo
Pro
Cool, why re-invent the wheel :) I gave it a whirl, the only issue I have is that using the Rfind on spells seems to take a lot of time, I noticed this in another spell script by Will M I think. It can take around 10-12 seconds to load for someone with spells, 3-5 seconds if no spells. Is this how long it should take? I have a decent high end PC with a fast internet connection. I haven't noticed a slow down to this extent with other macros or scripts(powercards) etc. I'm using a few styles to alter the appearance, but they dont seem to effect other macros/scripts. Any thoughts EDIT I created a fresh game, the only api loaded is scriptcards and there is one macro to run it, I loaded two tokens and tested. It dropped down to 2 seconds for a player with spells and less than a second for a goblin. So possibly a conflict, or simply to many other things running or listening? Nothing in the logs to indicate that. I will starting added more api scripts and see if there is a particular culprit, or a slow degredation. Then start again by adding a large map with lots of tokens and go from there Will keep you posted Ok, Loaded in all of the meta toolbox scripts, no change Loaded ChatSetAttr - no change Loaded Tokenmod - adds about 1 second, no idea why, tokenmod doesn't listen? Took it out, re-tested, got the second back, added it back, lost the second. Actually Token mod does listen, for on graphic changes? EDIT - inconclusive - Token-Mod after adding many more scripts doesnt seem to effect the time Loaded GroupInit, GroupCheck, Tokenlock, DoorKnocker(add 3 math dependants), Powercards, Token Action Maker, Bump, Pathsplitter, DynamicLighting Recorder, DLEllipseDrawer, Experience Tracker, Hourglass, 5e Resting in Style, Recursive Table, Torch, Supernotes No Change with all of the one-click installs, now for modified scripts Loaded all remaining modified scripts, alterbars, HitDice, OnMYTurn and many others, no change. Now to test a bloated module, loading MadMage Ok Sadly its linked to module size, a bare bones Mad Mage, with no added maps or anything else, went straight to 10 seconds up from 2 seconds to load the character with spells. It doesnt improve over time, same result +/- a second. If you only had to bring that chat menu up once, and had a way to bring it back to the end of the current chat..... Kurt J. said: 5E Character Action Menu version 1.6 is available on the&nbsp; GITHUB&nbsp; and on the&nbsp; GIST .&nbsp; Now supports prepared spells, including the differences in ritual casting between wizards and everyone else.&nbsp;If you are a sorcerer (at all) there is no filtering for prepared spells (since Sorcs don't have to prepare). If you are a Wizard, ritual spells will appear even if not prepped (as they can cast them from the spellbook). Other casters will only see rituals they have prepared. Any of your multi-classes can count as a Sorc or Wizard. Also, spells that can be cast as rituals will be tagged with [R] in the button name.
Kurt J. said: ez2rpg said: Can anyone help, I've been working on creating a script for&nbsp; Thunder Clap &nbsp;but it isn't quite working correctly I'm not getting any errors or issues running the macro. The sandbox error you listed looks like it is coming from Roll20AM, since ScriptCards doesn't do anything with tracks.&nbsp; Kurt, Finally figured out what was happening, there was a problem with Roll20 Audio Master, cleaned that mess up and with a little help from Michael C &nbsp;I was able to correct the problem with the script for Thunder Clap , its working great now. Thanks as always for your input
1627712850

Edited 1627720286
Ivo
Pro
5E Character Action Menu version 1.6 I noticed a new command --]| it appears to be a block end for blocks of...., but cant find any reference as to what it does functionally. It&nbsp; looks like its being used to treat a branch call as an external macro, as part of a --? line EDIT: After some testing, it looks like the --[ and --] commands treat the code inside as if it was in a separate macro, so some commands can be repeated for output as if it was a new execution of scriptcards, ie --#leftsub ? Which btw is very cool because we would no longer have to call separate macros in many cases(just build them in), just use a reentry point, and have access to existing variables Is this a typo, it still seems to work Line 194 --[*R:name] -ne "NoRepeatingAttributeLoaded"|[ Shouldnt it be --?" [*R:name]" -ne "NoRepeatingAttributeLoaded"|[
1627739272
Kurt J.
Pro
API Scripter
ScriptCards version 1.3.9c Now Available I've re-written the code that handles retrieving information on repeating sections to be significantly faster, and it should no longer be impacted by the size of the adventure (number of objects/characters) since I'm now using findObjs and filtering manually instead of using filterObjs. Available on the GIST .
1627739856

Edited 1627740309
Kurt J.
Pro
API Scripter
Ivo said: I noticed a new command --]| it appears to be a block end for blocks of...., but cant find any reference as to what it does functionally. It&nbsp; looks like its being used to treat a branch call as an external macro, as part of a --? line I updated the wiki with information on code blocks. They were added in 1.2.7 .&nbsp; And yes, the that conditional line is missing the conditional marker. I uploaded 5E Action Menu 1.6.3 to the github repo with this fix, though since the button is created with a known-good ID, this should never have impacted the execution of the script... it was still wrong though :)
1627743813

Edited 1627743837
Great work Kurt!!! My testing this morning verifies that repeating sections are significantly faster.&nbsp; I had been working on a Potions and Scrolls script that was taking over 12 seconds to pull all potions and scrolls from a set of 5 character sheets.&nbsp; It's now down to 3.5 seconds.&nbsp;&nbsp; I had given up on the script because of performance, now I'll pick it back up again and complete it.&nbsp; The concept for this script is that the party can use this utility to better manage consumable resources.&nbsp; It does the following: Party Inventory: List all Scrolls, Oils, Potions, etc. grouped by party member Inventory Mgt: Allows the party member to reduce or add to their supply.&nbsp; For example, go from 2 healing potions to 3.&nbsp;&nbsp; Exchanges: Allows a party member to exchange/move an item to another party member&nbsp; What brought this on, is they are always forgetting that they have consumables stashed away in one of their character sheets that could have been used to solve a problem or assist them in their moment of need.&nbsp; How many times have you heard, "Too bad none of us can cast invisibility" and they have 2 potions stashed away, or "what...we have no healing potions?&nbsp; I thought you had 3 in your bag of holding". Kurt J. said: ScriptCards version 1.3.9c Now Available I've re-written the code that handles retrieving information on repeating sections to be significantly faster, and it should no longer be impacted by the size of the adventure (number of objects/characters) since I'm now using findObjs and filtering manually instead of using filterObjs. Available on the GIST .
Kurt J. said: ScriptCards version 1.3.9c Now Available I've re-written the code that handles retrieving information on repeating sections to be significantly faster, and it should no longer be impacted by the size of the adventure (number of objects/characters) since I'm now using findObjs and filtering manually instead of using filterObjs. Available on the GIST . Wow, that was quick, I guess I wasn't the first person to comment on the repeating sections process time, either way, great job! I will give it a test on the Mad Mage test! Yep that did the trick, less than a second even when loading spells!!! Thank you Kurt
Kurt J. said: Ivo said: I noticed a new command --]| it appears to be a block end for blocks of...., but cant find any reference as to what it does functionally. It&nbsp; looks like its being used to treat a branch call as an external macro, as part of a --? line I updated the wiki with information on code blocks. They were added in 1.2.7 .&nbsp; And yes, the that conditional line is missing the conditional marker. I uploaded 5E Action Menu 1.6.3 to the github repo with this fix, though since the button is created with a known-good ID, this should never have impacted the execution of the script... it was still wrong though :) Great, I will have a read. I had assumed it was something added recently, so didnt even think to check back through the earlier version updates Ty Kurt
@Kurt/Will - Do you guys sleep?&nbsp; Wow. @Kurt - After a brief hiatus, I have managed to get some time to look at the (awesome!!) 5e Action Menu macro.&nbsp; I apologize for my acute and rather chronic ignorance but I am not sure how to use the Spell_Mule feature.&nbsp; I have a series of character sheets (MacrosCantrips, Macros1stLevel, etc.) with spell macros added as attributes &amp; abilities.&nbsp; I assume that this is what is meant by Spell_Mule?&nbsp; (This may be my big mistake.)&nbsp; However, when changing&nbsp;&nbsp; --&amp;spellmulename|Spell_Mule&nbsp; &nbsp; &nbsp;to&nbsp;&nbsp; --&amp;spellmulename|MacrosCantrips it doesn't seem to do anything.&nbsp; I also tried&nbsp;&nbsp; --&amp;spellmulename|MacrosCantrips::Frostbite to see if it required a specific attribute on the character sheet.&nbsp; No change.&nbsp;&nbsp; The macro also has an instruction after the Spell_Mule that comments: "Set to "1" to enable loading of settings information from a saved format named after the character (case sensitive)" that points to a --lsettings command.&nbsp; This would seem to indicate that we needed to have a --ssettings performed somewhere?&nbsp; Where should this format be saved and in what form? Where do we plug in the name/location of the saved format?&nbsp;&nbsp; I note also, as a minor matter, that&nbsp; [hr #58180d]&nbsp; appears as the first entry after "Action Menu" with some of my PCs. Gorsch.&nbsp; And I have just begun to look at the macro.&nbsp; Lucky you!&nbsp; :-)
1627826502
Kurt J.
Pro
API Scripter
Michael C. said: @Kurt/Will - Do you guys sleep?&nbsp; Wow. @Kurt - After a brief hiatus, I have managed to get some time to look at the (awesome!!) 5e Action Menu macro.&nbsp; I apologize for my acute and rather chronic ignorance but I am not sure how to use the Spell_Mule feature.&nbsp; I have a series of character sheets (MacrosCantrips, Macros1stLevel, etc.) with spell macros added as attributes &amp; abilities.&nbsp; I assume that this is what is meant by Spell_Mule?&nbsp; (This may be my big mistake.)&nbsp; However, when changing&nbsp;&nbsp; --&amp;spellmulename|Spell_Mule&nbsp; &nbsp; &nbsp;to&nbsp;&nbsp; --&amp;spellmulename|MacrosCantrips it doesn't seem to do anything.&nbsp; I also tried&nbsp;&nbsp; --&amp;spellmulename|MacrosCantrips::Frostbite to see if it required a specific attribute on the character sheet.&nbsp; No change.&nbsp;&nbsp; The macro also has an instruction after the Spell_Mule that comments: "Set to "1" to enable loading of settings information from a saved format named after the character (case sensitive)" that points to a --lsettings command.&nbsp; This would seem to indicate that we needed to have a --ssettings performed somewhere?&nbsp; Where should this format be saved and in what form? Where do we plug in the name/location of the saved format?&nbsp;&nbsp; I note also, as a minor matter, that&nbsp; [hr #58180d]&nbsp; appears as the first entry after "Action Menu" with some of my PCs. Gorsch.&nbsp; And I have just begun to look at the macro.&nbsp; Lucky you!&nbsp; :-) I have a character in my game with the character name "Spell_Mule". In the abilities section, I have macros named for various 5E spells: Those abilities are ScriptCards (though they don't have to be... they could be any type of macro) with custom scripts to implement spells in greater detail than what the Action Menu can determine by examining the properties of the spell (AoE effects, for instance). Right now, only one Spell Mule is supported (I didn't divide it up by levels, npc/pc, etc). The formatting information will be loaded from a saved format named after the character executing the menu. If you create a ScriptCard with all of the colors, font sizes, etc. that you want for a particular character and then end it with "--Ssettings|Character Name" (replacing Character Name with the name of the character) the setting will be saved under that name. You can use "!sc-liststoredsettings" to get a report of your stored settings groups and see what they contain. The HR issue is odd, as the inline formatting should be replacing it with a horizontal rule. What version of ScriptCards do you currently have installed?
@Kurt - Thanks! Ok, so I was on the right track with the SpellMule just a different format - I used the attribute section for scriptcard spell macros (mage hand, etc.) as you do but divided them up rather than have all spells on a single character SpellMule.&nbsp; However, when I used the MacrosCantrips instead of SpellMule the button did not call the spells (attributes) from the MacrosCantrip character.&nbsp;&nbsp; So, the scriptcard will only contain the formatting (title font, erowbackground, etc.) and the --Ssetting instruction as the last entry?&nbsp; Ok. v1.3.9c - I always try to pick up any revision as soon as you post it.&nbsp;&nbsp;
Hey guys, I have a question about Script Cards. When using the sourceToken parameter, can you have multiples listed, or is it just for one token? Also, is there a way to create it without using: @{selected|Token_id} The reason I ask, is because I like using the Party Health macro that KurtJ made, but one of my players always likes to change his character's name, and it always gets messed up. I was thinking of putting in a sourceToken parameter, but trying to figure out a way to do it without having to select all the tokens. Any help with this would be appreciated.
1627963289

Edited 1627964270
There are a couple options here when building party level reports and through trial and error I've tried all the ways below.&nbsp; There may be more creative solutions, but this is what I've come up with: Options 1: You can hardcode their names (Like you've already done) Pros - Easy to build Cons - Pain to maintain when you have changing names, party members or want to copy them to a new campaign. Option 2: You can use PageTokens array logic ( --~tokencnt|array;pagetokens;alltokens;@{selected|token_id} ) Pros - Dynamic, code one time and never have to touch again, even when adding new characters, changing names and between campaigns Cons - Logic to walk through and filter out all tokens but the party tokens is a little more complex.&nbsp; Requires a token be selected on the page that it can hook into.&nbsp; I believe it needs this to get a pageid and return a filtered list of tokens just for that page.&nbsp; Performance is a little slower, but new features are coming that will make filtering and performance significantly better. Only those character's on the page get get reported.&nbsp; One day it might be nice to have an an array;characters;pcs (npcs, ...) function available in scriptcards. Easy to tweak and make a NPC Health Report (for GM only).&nbsp; &nbsp; Option 3: You can hardcode a comma delimited list of character_ids (not token_ids) in a campaign/mule character sheet. Pro's - Once you set it up, you only have to change it when adding/deleting new character sheets and for moving macros to different campaigns. Performance is good Con's - You have to maintain a list of character_ids in an attribute field on a dedicated character sheet which can be a pain. Only works with Character Sheet data, (not token data like bar values, aura, UDL, ...).&nbsp; Every instance of a token has a new token_id and would be a pain to maintain on every page.&nbsp; &nbsp; I've personally opted for option 2 because it's so much easier to maintain over the long term. Here's a simple Party UDL Lighting Report that demonstrates this: !scriptcards {{ --/|Script Name : UDL Report --/|Version : 4.0 --/|Requires SC : 1.3.7+, --/|Author : Will M. --/|Description : Quick report showing Lighting Config for page and characters. --/|Dev Note : Need to add new parameters recently added --#title|UDL Lighting Report --#leftsub| --#rightsub| --#oddRowBackground|#eeeeee --#evenRowBackground|#ffffff --#whisper|self --/|Loop through all of the tokens in "alltokens" --~tokencnt|array;pagetokens;alltokens;@{selected|token_id} --~TokenId|array;getfirst;alltokens --?[&amp;TokenId] -eq ArrayError|UDL_ENDLOOP --:UDL_LOOPCHECK| --&amp;CharId|[*[&amp;TokenId]:t-represents] --/I added a flag in my player character sheets called PlayerCharacter and set it to 1 for all player controlled objects (themselves and their npc companions) --?"[*[&amp;TokenId]:playercharacter]" -eq 1|UDL_PC --/|Otherwise - Skip targets that are not on the token layer or that don't represent characters --?[*[&amp;TokenId]:t-layer] -ne objects|UDL_CONTINUE --?"[*[&amp;TokenId]:t-represents]" -ninc "-"|UDL_CONTINUE --?"[*[&amp;TokenId]:npc]" -eq 1|UDL_CONTINUE --:UDL_PC| --&amp;CharId|[*[&amp;TokenId]:t-represents] --/|Default icons to red X --&amp;Vis|&amp;#x274C; --&amp;NightVis|&amp;#x274C; --&amp;BrightLight|&amp;#x274C; --&amp;LowLight|&amp;#x274C; --/|Update Emoji icons based on UDL settings --?"[*[&amp;TokenId]:t-has_bright_light_vision]" -ne "true"|NO_BLV --&amp;Vis|&amp;#x1F453; --:NO_BLV| --?"[*[&amp;TokenId]:t-has_night_vision]" -ne "true"|NO_NV --&amp;NightVis|&amp;#x1F319; --:NO_NV| --?"[*[&amp;TokenId]:t-emits_bright_light]" -ne "true"|NO_BL --&amp;BrightLight|&amp;#x1F4A1; --:NO_BL| --?"[*[&amp;TokenId]:t-emits_low_light]" -ne "true"|NO_LL --&amp;LowLight|&amp;#x1F56F; --:NO_LL| --+|[c][b] [*[&amp;CharId]:character_name][/b] [/c] --+|[t style="width:100%"][tr][td style="width:50%;text-align:left"]Vision[/td] [td style="width:30%;text-align:center"][&amp;Vis][/td][td style="width:10%;text-align:center"][/td][/tr] [tr][td style="width:50%;text-align:left"]Night Vision[/td] [td style="width:30%;text-align:center"][&amp;NightVis][/td] [td style="width:20%;text-align:right"][*[&amp;TokenId]:t-night_vision_distance] ft.[/td][/tr] [tr][td style="width:50%"][l]Emits Light[/l] [r][i]Bright[/i][/r][/td] [td style="width:30%;text-align:center"][&amp;BrightLight][/td] [td style="width:20%;text-align:right"][*[&amp;TokenId]:t-bright_light_distance] ft.[/td][/tr] [tr][td style="width:50%;text-align:right"][i]Low[/i][/td] [td style="width:30%;text-align:center"][&amp;LowLight][/td] [td style="width:20%;text-align:right"][*[&amp;TokenId]:t-low_light_distance] ft.[/td][/tr][/t] --:UDL_CONTINUE| --~TokenId|array;getnext;alltokens --?[&amp;TokenId] -ne ArrayError|UDL_LOOPCHECK --:UDL_ENDLOOP| --X| }} Arthur B. said: Hey guys, I have a question about Script Cards. When using the sourceToken parameter, can you have multiples listed, or is it just for one token? Also, is there a way to create it without using: @{selected|Token_id} The reason I ask, is because I like using the Party Health macro that KurtJ made, but one of my players always likes to change his character's name, and it always gets messed up. I was thinking of putting in a sourceToken parameter, but trying to figure out a way to do it without having to select all the tokens. Any help with this would be appreciated.
1627963675
timmaugh
Pro
API Scripter
Arthur B. said: Hey guys, I have a question about Script Cards. When using the sourceToken parameter, can you have multiples listed, or is it just for one token? Also, is there a way to create it without using: @{selected|Token_id} The reason I ask, is because I like using the Party Health macro that KurtJ made, but one of my players always likes to change his character's name, and it always gets messed up. I was thinking of putting in a sourceToken parameter, but trying to figure out a way to do it without having to select all the tokens. Any help with this would be appreciated. You have four options (that I can think of) to solve your issue . The third one actually answers your question . Here they are in ascending order of "easiness"... 1) Use the macro as Kurt wrote it, but just substitute the @{character|character_id} with the actual ID of the character your renaming-happy player is playing. The ID won't change when the character's name changes, and that's all the Roll20 @-structure is retrieving for you (before ScriptCards even gets the command line. So you can get around the problem of having the character or token renamed by jumping right to the character id. --&gt;HealthCheck|-MYoplGxUFiHAOpm5x5f 2) Nothing in that macro seems to use the "selected" tokens explicitly, so it seems you won't lose anything by using a @{target} statement in the macro: --&gt;HealthCheck|@{target|Who is being a problem?|character_id} 3)&nbsp; SelectManager &nbsp; can designate a set of selected tokens (which is what you were asking): {&amp;select Bob the Hirsute, Volcano Man, -M1234567890abcdef, @{selected|token_id}, @{target|token_id}} Since it is a metascript, you can use it in the command line of your ScriptCards macro. By the time the recipient script receives it, that part of the command line will be removed, and the recipient script (ScriptCards) will see the selected tokens. The {&amp;select} structure can take names or IDs, so you could supply the token ID of the character who is getting renamed. The tokens aren't actually selected on the tabletop, and nothing changes about who/what you have selected. This can be a way to run a command that you know will affect particular tokens without taking the time to find and select them, and without having to deselect what you already have selected. Note, too, that this is a way you can have both targets and selected tokens in the same message (without this method, you have no selected tokens if you use the @{target} statement. In that case, the @{selected|...} statement still resolves in the command line, but the tokens aren't "selected" for the purposes of the message. For that reason, we can select the first token selected in this statement using the @{selected|token_id} statement. It might be a little more up front effort than the first two option, but it actually answers your question. Also, just because you have them selected, you'd still have to loop over them... which lies in the realm of ScriptCard code that I'm not as good with. 4) Last, you can use Fetch (another metascript, usable in the ScriptCards command line) instead of the built in Roll20 @{character|character_id} statement. Since the token id doesn't change when your player changes the token or character name, you can use the token id of a character that represents the character in question in the Fetch construction. So, use a @{target|token_id} statement to get the ID (one time), then use that in a Fetch construction: &nbsp; --&gt;HealthCheck|@(-MYm78WQ-4Is70X7-UN7.character_id) But... if you're going as far as getting the token's ID, you might as well just get the character ID.