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 - Thread #2

I'm having trouble with a loop structure containing an information request. I created a stub sample to illustrate the problem. !script {{   --#title|TestLoop   --=Dots|5   --/| ------------------Loop---------------    --%LoopCounter|1;10;1       --+Dots=[$Dots]| Counter=[&LoopCounter]       --iClick choose how many of [$Dots] to subtract|q;sub1;Subtract |0       --=Dots| [$Dots] - [&sub1]       --+after sub=[&sub1] Dots=[$Dots]|       --?[$Dots] -lt 1|%!       --+after check -lt 1 Dots=[$Dots]|    --%|   --/| ---------------End of Loop------------   --+End of Loop| Counter=[&LoopCounter] }} No matter what number I enter to subtract, the loop stops without looping. TestLoop Dots=5 Counter=1 after sub=3 Dots=2 after check -lt 1 Dots=2 End of Loop Counter=1 Have I made an error or is the information request interfering with the loop? It appears that you can't have an information request inside a loop structure. The loop works fine using the Roll20 version " --&sub1|?{Num subtract?|0}," but of course it uses the same number at each iteration whereas I need different numbers.
1668767776
Kurt J.
Pro
API Scripter
Loop state is not preserved when a script is stashed. I'll see if that is a possibility (essentially, --i (and reentrant buttons) end the script and store most of the information about it in a variable in memory. Clicking the --i button, etc. runs a special command that retrieves the script from memory and reconstitutes it, but when I added the looping mechanism I didn't think to preserve loop status in the stash. I'll experiment, but in the mean time you would need to do an "old fashioned" loop where you set a variable value and check it manually and use a goto branch to go back to the top of the loop.
1668768053
Kurt J.
Pro
API Scripter
Kaspar K. said: Also, how do I access the max value of an atribute? @{selected|atribute_max}, @{selected|atribute|max} or @{selected|atribute^} did not work. @{selected|atribute|max} is the format the chat server uses, though it will return nothing if the attribute doesn't have a max value defined (ie, @{selected|hp|max} returns 9 for my test character, but @{selected|gp|max} is null. Using ScriptCards referencing, if would be  [*@{selected|token_id}:hp^] , with @{selected|token_id} being filled in with however you get a token id (ie, *S or *T, or *tokenidallwrittenout, etc.
Thank you. This is an awsome script. What am I doing wronh here, thought? Trying to add/remove custom statusmarkers: !script {{ --@token-mod _set statusmarkers|-sprint|aim }}
1668840278
Andrew R.
Pro
Sheet Author
Make sure that token-mod command works on the Chat first. You may need to use the full name including the id number as documented in the TokenMod handout created in the game. 
Andrew R. said: Make sure that token-mod command works on the Chat first. You may need to use the full name including the id number as documented in the TokenMod handout created in the game.  !token-mod --set statusmarkers|-sprint|aim|red Works as expected, but not the !script version. The default statusmarkers like 'red' does not function either, so it desnt seem te a problem with markers being custom.
1668847102
Andrew R.
Pro
Sheet Author
You are missing the vertical bar after token-mod.  —@token-mod|_set …
I've a bit a question/suggestion and was hoping I might get some assistance with this, or even ask for a slight update to how the ScriptCards are coded.  I have been making use of the Distance function, but I have run into bit of a snag with how its coded with tokens of various sizes. --~HowFarAway|distance;@{selected|token_id};@{target|token_id} When, the tokens are more than one square in size it reports an incorrect distance since it counts from the center vertex instead of the edge of the token.  While this may be acceptable for some game systems, this is not really appropriate for all systems.  Is there any way to get the size of the token and then subtract that from final value if the size is greater than one unit? Barring that, do you think it might be possible to add in a parameter or toggle option to automatically adjust for token size?  There are many systems that allow for creatures larger than one map square. On a related note, is it possible for script cards to interact with token markers specifically pulling the number assigned to the token marker.  I generally use the wings marker with the number to indicate that a token is in flight and x number of squares above a base height (typically ground).  I know that not all systems use vertical height.  But some do, and would actually be quite helpful to pull this information.
1669029007
Kurt J.
Pro
API Scripter
James B. said: I'm having trouble with a loop structure containing an information request. I created a stub sample to illustrate the problem. I've uploaded a push to the Github version of the script that now stashes loop information with the rest of the card, so --i can now function inside loops.
1669029726
Kurt J.
Pro
API Scripter
Toby said: I've a bit a question/suggestion and was hoping I might get some assistance with this, or even ask for a slight update to how the ScriptCards are coded.  I have been making use of the Distance function, but I have run into bit of a snag with how its coded with tokens of various sizes. --~HowFarAway|distance;@{selected|token_id};@{target|token_id} When, the tokens are more than one square in size it reports an incorrect distance since it counts from the center vertex instead of the edge of the token.  While this may be acceptable for some game systems, this is not really appropriate for all systems.  Is there any way to get the size of the token and then subtract that from final value if the size is greater than one unit? Barring that, do you think it might be possible to add in a parameter or toggle option to automatically adjust for token size?  There are many systems that allow for creatures larger than one map square. On a related note, is it possible for script cards to interact with token markers specifically pulling the number assigned to the token marker.  I generally use the wings marker with the number to indicate that a token is in flight and x number of squares above a base height (typically ground).  I know that not all systems use vertical height.  But some do, and would actually be quite helpful to pull this information. You would probably need to do this calculation manually and use euclideanpixel instead of distance. Here is an example: !script {{   --~HowFarAway|euclideanpixel;@{selected|token_id};@{target|token_id}   --=W1|[*@{selected|token_id}:t-width] / 2   --=W2|[*@{target|token_id}:t-width] / 2   --=HowFarAway|[$HowFarAway] - [$W1] - [$W2]   --+HowFar|[$HowFarAway] }} This would give the "edge to edge" distance between two tokens (by subtracting the radius of each token from the distance between their centers). You could divide by the grid size to get the number of squares of distance after having the edge-to-edge distance.
Is there a way to access the contents of title, leftsub, and rightsub within a script? I tried the obvious [&title] and got nothing.
1669170410
Andrew R.
Pro
Sheet Author
Assign them to string variables first, then use the string variables in the —# commands. 
I should have been more specific. I'm using --Ssettings to store the settings in one macro and then --Lsettings to restore them in another. I'm then trying to find out what was stored in the first macro in the script on the second. Never mind I just realized what I was doing wrong in using --Srollvariables and I am getting the information I needed.
1669194433
Andrew R.
Pro
Sheet Author
Sorry! I've used the --S & --L commands just for colours so the monster's abilities are colour matched to their token surrounds in 13th Age Glorantha . 
1669340992
Kurt J.
Pro
API Scripter
James B. said: Is there a way to access the contents of title, leftsub, and rightsub within a script? I tried the obvious [&title] and got nothing. There is... Settings are accessible using ~ as the referencing character, so: --+Title:[~title] will output the value of the title setting at that point. Note that all settings are stored internally in lower case.
Try to add a Output to the end of my script card that link to a compendium page. Example Oath bow at&nbsp; <a href="https://app.roll20.net/compendium/dnd5e/Items%3AOathbow?sharedCompendium=8482598#toc_2" rel="nofollow">https://app.roll20.net/compendium/dnd5e/Items%3AOathbow?sharedCompendium=8482598#toc_2</a> &nbsp;but I don't want it to show the link. I have&nbsp;--+OathBow|<a href="https://app.roll20.net/compendium/dnd5e/Items%3AOathbow?sharedCompendium=8482598#toc_2" rel="nofollow">https://app.roll20.net/compendium/dnd5e/Items%3AOathbow?sharedCompendium=8482598#toc_2</a> How can I clean this up to only show the text and if you click it it opens the Compendium page or even a button.&nbsp;
1669386786
Kurt J.
Pro
API Scripter
Craven said: Try to add a Output to the end of my script card that link to a compendium page. Example Oath bow at&nbsp; <a href="https://app.roll20.net/compendium/dnd5e/Items%3AOathbow?sharedCompendium=8482598#toc_2" rel="nofollow">https://app.roll20.net/compendium/dnd5e/Items%3AOathbow?sharedCompendium=8482598#toc_2</a> &nbsp;but I don't want it to show the link. I have&nbsp;--+OathBow| <a href="https://app.roll20.net/compendium/dnd5e/Items%3AOathbow?sharedCompendium=8482598#toc_2" rel="nofollow">https://app.roll20.net/compendium/dnd5e/Items%3AOathbow?sharedCompendium=8482598#toc_2</a> How can I clean this up to only show the text and if you click it it opens the Compendium page or even a button.&nbsp; You could make it a button with [button]...[/button]: --+Output|[button]Oathbow::<a href="https://app.roll20.net/compendium/dnd5e/Items%3AOathbow?sharedCompendium=8482598#toc_2[/button]" rel="nofollow">https://app.roll20.net/compendium/dnd5e/Items%3AOathbow?sharedCompendium=8482598#toc_2[/button]</a>
Referencing target token makes it deselect the token and tokenmod no longer works. Here either line works on its own, but not both combined: !script {{ --#hideTitleCard|1 --+@{selected|token_name}|attacks **@{target|token_name}** --@token-mod|&nbsp; _set statusmarkers|-aim|-gun|-arrow }} Would there be some to, say, store selected or target characer_id in a variable, then give that value to tokenmod?
1669494239

Edited 1669494271
Kurt J.
Pro
API Scripter
Kaspar K. said: Referencing target token makes it deselect the token and tokenmod no longer works. Here either line works on its own, but not both combined: !script {{ --#hideTitleCard|1 --+@{selected|token_name}|attacks **@{target|token_name}** --@token-mod|&nbsp; _set statusmarkers|-aim|-gun|-arrow }} Would there be some to, say, store selected or target characer_id in a variable, then give that value to tokenmod? There are a couple of ways... you can use ScriptCards' --! command to avoid shelling out to token-mod altogether. There is also a set of functions available on the ScriptCards github ( ScriptCards/StatusMarkerFunctions.scard at main · kjaegers/ScriptCards (github.com) ) that can be appended to the end of any script to allow by-name manipulation of status markers. In both of these cases, you would just specify the token ID you want to modify, which you still have access to since it is all happening in the originally called script. You can use the ignoreselected and ids feature of token-mod to specify the token to modify. Again, you would have that ID since the scriptcard was called first. Finally, if you check out the Meta Toolkit ( Community Forums: [MetaScript Updates] Fetch and SelectManager get config to allow players to do more | Roll20: Online virtual tabletop ) and your arcane scripting proficiency is high enough (mine sometimes isn't :)), you can use that to pass selected token information to sub-scripts.
Hey Kurt,&nbsp; I've got a question if something is possible: So I have an array of NPC abilities and index 8 of that array is&nbsp;Defensive Abilities body of fire/ Resistances cold 10 Is there a way to use indexof to find that array element just by searching for "Defensive Abilities" instead of the entire item value? Thanks!
1669684735
timmaugh
Pro
API Scripter
Kurt J. said: Finally, if you check out the Meta Toolkit ( Community Forums: [MetaScript Updates] Fetch and SelectManager get config to allow players to do more | Roll20: Online virtual tabletop ) and your arcane scripting proficiency is high enough (mine sometimes isn't :)), you can use that to pass selected token information to sub-scripts. I feel seen. But also... &gt;D
I am attempting to use ScriptCards expanded string referencing. I am determining the index of a character and then trying to use that index to cut the string there: &nbsp; --=ind|[&amp;con(indexof,:)] &nbsp; --&amp;scon|[&amp;con(0,[$ind])]&nbsp; &nbsp;If I substitute the number which ind holds, scon contains what I want. But if I use [$ind] in its place scon contains nothing. Am I doing something wrong or is it impossible to use variable references in your string referencing?
1669891382
Kurt J.
Pro
API Scripter
James B. said: I am attempting to use ScriptCards expanded string referencing. I am determining the index of a character and then trying to use that index to cut the string there: &nbsp; --=ind|[&amp;con(indexof,:)] &nbsp; --&amp;scon|[&amp;con(0,[$ind])]&nbsp; &nbsp;If I substitute the number which ind holds, scon contains what I want. But if I use [$ind] in its place scon contains nothing. Am I doing something wrong or is it impossible to use variable references in your string referencing? This is probably a documentation oversight on my part... When referencing roll variables, in most cases [$variable] is the same as [$variable.Total], which includes HTML formatting information to put the highlight box around the number, so that is messing with the substring value. If you use [$ind.Raw], you should get the expected behavior, as Raw just returns the number itself.
Tried it and it worked perfectly. Thank you very much!
I am trying get the TokenMod work inside scriptcards and overcome the problem that @TargetToken couses deselction of the troken, so TokenMod can no longer find it. !script {{ --=SelectedToken|@{selected|token_id} --=TargetedToken|@{target|token_id} --+ |Selected ID is [$SelectedToken] Target ID is [$TargetedToken]&nbsp; --@token-mod| _ids} [$TargetedToken] _set statusmarkers|-red }} It stores the ID's but how do I properly feed that variable to TokenMod?
1670015793
timmaugh
Pro
API Scripter
The @selected syntax will resolve anywhere it is seen in your command line, so anywhere you use it in your initial command (that you send to ScriptCards), it will immediately explode to be the ID of the "first" token selected. In that way, you don't necessarily have to assign it to a SC variable just to get access to it, even in the portion of the command line that SC sends to TokenMod... because by the time SC sends that command, the @selected syntax has been changed to be the token id. After that, it's a matter of matching TM's syntax. To use the --ids argument, you have to be a GM or have the playerscanids config set to "true". You can then supply the IDs separated by a space. All of these lines should work: --@token-mod| _ids| [$SelectedToken] [$TargetedToken] _set statusmarkers|-red --@token-mod| _ids| @{selected|token_id} [$TargetedToken] _set statusmarkers|-red --@token-mod| _ids| @{selected|token_id} @{target|token_id} _set statusmarkers|-red
Neither of these scripts removed the red. What am I still mising? !script {{ --#hideTitleCard|1 --=SelectedToken|@{selected|token_id} --=TargetedToken|@{target|token_id} --+@{selected|token_name}|attacks **@{target|token_name}** --@token-mod| _ids| [$SelectedToken] [$TargetedToken] _set statusmarkers|-red }} !script {{ --#hideTitleCard|1 --+@{selected|token_name}|attacks **@{target|token_name}** --@token-mod| _ids| @{selected|token_id} @{target|token_id} _set statusmarkers|-red }}
Kaspar K. said: Neither of these scripts removed the red. What am I still mising? !script {{ --#hideTitleCard|1 --=SelectedToken|@{selected|token_id} --=TargetedToken|@{target|token_id} --+@{selected|token_name}|attacks **@{target|token_name}** --@token-mod| _ids| [$SelectedToken] [$TargetedToken] _set statusmarkers|-red }} !script {{ --#hideTitleCard|1 --+@{selected|token_name}|attacks **@{target|token_name}** --@token-mod| _ids| @{selected|token_id} @{target|token_id} _set statusmarkers|-red }} Try: --@token-mod| _ids @{selected|token_id} @{target|token_id} _set statusmarkers|-red
Here is the script I have been working on all day. This is a request from my DM that is doing a Barovia Campaign and wanted a Long/Short rest script that based on the conditions he decides would apply exhaustion to players. They might get a long rest or a short reset based on the dice. !scriptcard&nbsp; {{ &nbsp; --#title|Barovia Long Rest &nbsp;--#emoteText|@{selected|token_name} &nbsp;--#sourceToken|@{selected|token_id} &nbsp;--#rightsub|[b]Or is it??[/b] &nbsp;--#titleFontColor|#FFFFFF &nbsp;--#titleCardBackground|#135A9C &nbsp;--#evenRowBackground|#B6AB91 &nbsp;--#evenRowFontColor|#000000 &nbsp;--#oddRowBackground|#CEC7B6 &nbsp;--#oddRowFontColor|#000000 &nbsp;--#emoteBackground|#FFFFFF &nbsp;--#tableBorderRadius|8px &nbsp; --~|array;define;saves;[*S:constitution_save_bonus];[*S:wisdom_save_bonus];[*S:survival_bonus] --~|array;define;savetype;constitution;wisdom;survival --:Advantage, Disadvantage, Normal| &nbsp; --&amp;RollType|?{Advantage or Disadvantage?|Normal,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1} --: ROLL CALCULATIONS FOR THE EXHAUSTION SAVES --~type|array;getfirst;savetype --~save_bonus|array;getfirst;saves &nbsp; --=Save1|[&amp;RollType] + [&amp;save_bonus] &nbsp; &nbsp; &nbsp; --+Saving Throw is|[&amp;type] [$Save1] &nbsp; &nbsp; &nbsp; --~type|array;getnext;savetype &nbsp; &nbsp; &nbsp; --~save_bonus|array;getnext;saves --=Save2|[&amp;RollType] + [&amp;save_bonus] &nbsp; &nbsp; &nbsp; --+Saving Throw is|[&amp;type] [$Save2] &nbsp; &nbsp; &nbsp; --~type|array;getnext;savetype &nbsp; &nbsp; &nbsp; --~save_bonus|array;getnext;saves --=Save3|[&amp;RollType] + [&amp;save_bonus] &nbsp; &nbsp; &nbsp; --+Saving Throw is|[&amp;type] [$Save3] --:CONDITION RULES FOR PASSING OR FAILING THE SAVE CHECK DC --?[$Save1] -ge 15|=roll1;1 --?[$Save1] -lt 15|=roll1;0 --?[$Save2] -ge 15|=roll2;1 --?[$Save2] -lt 15|=roll2;0 --?[$Save3] -ge 15|=roll3;1 --?[$Save3] -lt 15|=roll3;0 --=TotalRoll|[$roll1] + [$roll2] + [$roll3] --: APPLYING EXHAUSTION ON FAILS OF 0 or 1, PASS IS A 2 or 3 --?[$TotalRoll.Raw] -ge 2|[--@setattr|_silent _charid @{selected|character_id} _class_resource|@{selected|class_resource|max} --@setattr|_silent _charid @{selected|character_id} _other_resource|@{selected|other_resource|max} --@setattr|_silent _charid @{selected|character_id} _hp|@{selected|hp|max} --@setattr|_silent _charid @{selected|character_id} _repeating_resource_$0_resource_right|@{selected|repeating_resource_$0_resource_right|max} --@setattr|_silent _charid @{selected|character_id} _repeating_resource_$0_resource_left|@{selected|repeating_resource_$0_resource_left|max} --@setattr|_silent _charid @{selected|character_id} _repeating_resource_$1_resource_right|@{selected|repeating_resource_$1_resource_right|max} --@setattr|_silent _charid @{selected|character_id} _repeating_resource_$1_resource_left|@{selected|repeating_resource_$1_resource_left|max} --@setattr|_silent _charid @{selected|character_id} _lvl1_slots_expended|@{selected|lvl1_slots_total} --@setattr|_silent _charid @{selected|character_id} _lvl2_slots_expended|@{selected|lvl2_slots_total} --@setattr|_silent _charid @{selected|character_id} _lvl3_slots_expended|@{selected|lvl3_slots_total} --@setattr|_silent _charid @{selected|character_id} _lvl4_slots_expended|@{selected|lvl4_slots_total} --@setattr|_silent _charid @{selected|character_id} _lvl5_slots_expended|@{selected|lvl5_slots_total} --@setattr|_silent _charid @{selected|character_id} _lvl6_slots_expended|@{selected|lvl6_slots_total} --@setattr|_silent _charid @{selected|character_id} _lvl7_slots_expended|@{selected|lvl7_slots_total} --@setattr|_silent _charid @{selected|character_id} _lvl8_slots_expended|@{selected|lvl8_slots_total} --@setattr|_silent _charid @{selected|character_id} _lvl9_slots_expended|@{selected|lvl9_slots_total} --+|[b]YOU GET A LONG REST YOU LUCKY ASS!!![/b] --]|[ --?[$TotalRoll.Raw] -lt 2|--@setattr|_silent _charid @{selected|character_id} _exhaustion_level|[[@{selected|exhaustion_level}+1]] --+|[b]YOU GET A SHORT REST YOU LOSER!!! AND YOU HAVE EXHAUSTION TI BOOT!!![/b] --]| }}
Hello scriptomancers! I am trying to modify a script for the Scorching Ray spell.&nbsp; I am using the macro by Will M. found HERE , which is based on Michael C. found HERE . I live Will's format and use of Token-Mod to apply damage, but I would like each Missile Loop to roll and apply it's own damage instead of using one damage roll for all of them. Is this possible and/or a manageable fix? Here is the macro: !script {{ --/|Script Name : Scorching Ray --/|Version : 1.0 --/|Requires SC : 1.3.7+, TokenMod --/|Author : Will M. --/|Updated : 8/14/2021 --/|Description : Scorching Ray Spell --/| --/| --#title|Scorching Ray --#sourceToken|@{selected|token_id} --#emoteText|@{selected|character_name} Casts Scorching Rays! --&amp;TFColor|#FFFFFF --&amp;STFColor|#000000 --&amp;FColor1|#000000 --&amp;FColor2|#000000 --&amp;EBColor|#FFFFFF --&amp;BColor1|#FFFFFF --&amp;BColor2|#FFFFFF --#titlecardbackground|[&amp;BColor1] --#titlecardbackgroundimage|linear-gradient(to bottom, #FFF000, #FF0000) --#titleFontColor|[&amp;TFColor] --#subtitleFontColor|[&amp;STFColor] --#emoteBackground|[&amp;EBColor] --#titlefontsize|2.0em --#titlefontlineheight|1.2em --#titlefontface|Times New Roman --#norollhighlight|0 --#hideTitleCard|0 --#bodyfontsize|12px --#oddrowbackground|[&amp;BColor1] --#oddrowfontcolor|[&amp;FColor2] --#evenrowbackground|[&amp;BColor2] --#evenrowfontcolor|[&amp;FColor1] --#leftsub|Level 2 | Evocation | Action --#rightsub| 120' | V S | Fire --#debug|1 --:STEP1| Setup --&amp;DamageType|fire --=MissileDamage|2d6 --=DisplayCount|0 --+|You create three rays of fire and hurl them at targets within range. You can hurl them at one target or several. Make a ranged spell attack for each ray. On a hit, the target takes 2d6 fire damage. --+|[b]At Higher Levels.[/b] When you cast this spell using a spell slot of 3rd level or higher, you create one additional ray for each slot level above 2nd. --+|[br] --+|[c][b]Spell Save DC: [#FF0000][*S:spell_save_dc][/#] Damage: [#FF0000][$MissileDamage.Raw][/#][/b][/c] --+|[br] --+|[b][c]Spell Level?[/c][/b] --+|[c][rbutton]2nd::STEP2;2[/rbutton][rbutton]3rd::STEP2;3[/rbutton][rbutton]4th::STEP2;4[/rbutton][rbutton]5th::STEP2;5[/rbutton][/c] --+|[c][rbutton]6th::STEP2;6[/rbutton][rbutton]7th::STEP2;7[/rbutton][rbutton]8th::STEP2;8[/rbutton][rbutton]9th::STEP2;9[/rbutton][/c] --+|[br] --+|After picking a level above, you will be asked to select a series of targets until all your rays are delivered - [b]Good Luck![/b] --X| --:STEP2| --&amp;SlotLevel|[&amp;reentryval] --=SlotsTotal|[*S:lvl[&amp;SlotLevel]_slots_total] --=SlotsRemaining|[*S:lvl[&amp;SlotLevel]_slots_expended] --?[$SlotsRemaining.Total] -le 0|NoSlotsLeft --=MissileCount|[&amp;SlotLevel] - 2 + 3 --:MissileLoop| --=DisplayCount|[$DisplayCount] + 1 --?[$DisplayCount] -gt [$MissileCount]|EndMacro --?[$DisplayCount] -ne 1|[ --+|[hr] --+|[br] --+|[c][rbutton]Next Target::NEXT_TARGET[/rbutton][/c] --+|[br] --+|[c][b]Spell Save DC: [#FF0000][*S:spell_save_dc][/#] Damage: [#FF0000][$MissileDamage][/#][/b][/c] --+|[br] --X| --]| --:NEXT_TARGET| --I Select the target of your Scorching Ray.;Scoring Ray #[$DisplayCount].|t;ThisTarget;Scorching Ray #[$DisplayCount]: --#leftsub|Ray # [$DisplayCount.Raw] --#rightsub|[*[&amp;ThisTarget]:t-name] --#targetToken|[&amp;ThisTarget] --#emoteText|Scorching Ray #[$DisplayCount.Raw] --&gt;PlayEffects|@{selected|token_id};[&amp;ThisTarget];none;burst-smoke;beam-magic --&amp;DamageResistNote| --=TotalDamage|[$MissileDamage] --?"[*[&amp;ThisTarget]:npc_ac]" -gt 0|[ --=TargetAC|[*[&amp;ThisTarget]:npc_ac] --?"[*[&amp;ThisTarget]:npc_immunities]" -inc "[&amp;DamageType]"|&gt;Immune --?"[*[&amp;ThisTarget]:npc_resistances]" -inc "[&amp;DamageType]"|&gt;DamageResist --?"[*[&amp;ThisTarget]:npc_vulnerabilities]" -inc "[&amp;DamageType]"|&gt;DamageVuln --]|[ --=TargetAC|[*[&amp;ThisTarget]:ac] --]| --=AttackRoll|1d20 [BASE] + [*S:spell_attack_bonus] --/|Determine results| --?[$AttackRoll.Base] -eq 1|FUMBLE --?[$AttackRoll.Base] -eq 20|CRITICAL --?[$AttackRoll.Total] -lt [$TargetAC.Total]|MISS --?[$AttackRoll.Total] -ge [$TargetAC.Total]|HIT --X| --&lt;| --:EndMacro| --X| --/|PROCEDURES --:DeductSpellSlot| --=SlotsRemaining|[$SlotsRemaining] - 1 --@setattr|_charid [*S:character_id] _lvl[&amp;SlotLevel]_slots_expended|[$SlotsRemaining] _silent --&lt;| --:NoSlotsLeft| --+|[*S:character_name] has no level [&amp;SlotLevel] spell slots available. --X| --:DamageResist| --=TotalDamage|[$MissileDamage] \ 2 --&amp;DamageResistNote|(Resistant) --&lt;| --:DamageVuln| --=TotalDamage|[$MissileDamage] * 2 --&amp;DamageResistNote|(Vulnerable) --&lt;| --:Immune| --=TotalDamage|0 --&amp;DamageResistNote|(Immune) --&lt;| --:FUMBLE| --+&amp;#x1F613;Ray #[$DisplayCount.Raw] Fumbles! |[*S:character_name] rolls [$AttackRoll] to attack [*[&amp;ThisTarget]:t-name] and something went horribly wrong. --^MissileLoop| --:MISS| --+&amp;#x274C;Ray #[$DisplayCount.Raw] Misses! |[*S:character_name] rolls [$AttackRoll] to attack [*[&amp;ThisTarget]:t-name] and missed. --^MissileLoop| --:HIT| pass Damage string --+&amp;#x1F3AF;Ray #[$DisplayCount.Raw] hits! |[*S:character_name] rolls [$AttackRoll] to attack and hits [*[&amp;ThisTarget]:t-name] for [$TotalDamage] [&amp;DamageType] damage. [&amp;DamageResistNote] --&gt;ApplyDamage| --^MissileLoop| --:CRITICAL| --=TotalDamage|[$TotalDamage] * 2 --+&amp;#x2757;&amp;#x2757;&amp;#x2757;Crits!|[*S:character_name] rolls [$AttackRoll] to attack and CRITS [*[&amp;ThisTarget]:t-name] for [$TotalDamage] [&amp;DamageType] damage. [&amp;DamageResistNote] --&gt;ApplyDamage| --^MissileLoop| --:ApplyDamage| --=CurrentHP|[*[&amp;ThisTarget]:t-bar3_value] --@token-mod|_ids [&amp;ThisTarget] _ignore-selected _set bar3_value|-[$TotalDamage.Raw] --/|Did that kill them? --?[$CurrentHP.Raw] -gt [$TotalDamage.Raw]|ALIVE|DEAD --:ALIVE| --/+|[*[&amp;ThisTarget]:character_name] is still a!script {{ --/|Script Name : Scoring Ray --/|Version : 1.0 --/|Requires SC : 1.3.7+, TokenMod --/|Author : Will M. --/|Updated : 8/14/2021 --/|Description : Scorching Ray Spell --/| --/| --#title|Scorching Ray --#sourceToken|@{selected|token_id} --#emoteText|@{selected|character_name} Casts Scorching Rays! --&amp;TFColor|#FFFFFF --&amp;STFColor|#000000 --&amp;FColor1|#000000 --&amp;FColor2|#000000 --&amp;EBColor|#FFFFFF --&amp;BColor1|#FFFFFF --&amp;BColor2|#FFFFFF --#titlecardbackground|[&amp;BColor1] --#titlecardbackgroundimage|linear-gradient(to bottom, #FFF000, #FF0000) --#titleFontColor|[&amp;TFColor] --#subtitleFontColor|[&amp;STFColor] --#emoteBackground|[&amp;EBColor] --#titlefontsize|2.0em --#titlefontlineheight|1.2em --#titlefontface|Times New Roman --#norollhighlight|0 --#hideTitleCard|0 --#bodyfontsize|12px --#oddrowbackground|[&amp;BColor1] --#oddrowfontcolor|[&amp;FColor2] --#evenrowbackground|[&amp;BColor2] --#evenrowfontcolor|[&amp;FColor1] --#leftsub|Level 2 | Evocation | Action --#rightsub| 120' | V S | Fire --#debug|1 --:STEP1| Setup --&amp;DamageType|fire --=MissileDamage|2d6 --=DisplayCount|0 --+|You create three rays of fire and hurl them at targets within range. You can hurl them at one target or several. Make a ranged spell attack for each ray. On a hit, the target takes 2d6 fire damage. --+|[b]At Higher Levels.[/b] When you cast this spell using a spell slot of 3rd level or higher, you create one additional ray for each slot level above 2nd. --+|[br] --+|[c][b]Spell Save DC: [#FF0000][*S:spell_save_dc][/#] Damage: [#FF0000][$MissileDamage.Raw][/#][/b][/c] --+|[br] --+|[b][c]Spell Level?[/c][/b] --+|[c][rbutton]2nd::STEP2;2[/rbutton][rbutton]3rd::STEP2;3[/rbutton][rbutton]4th::STEP2;4[/rbutton][rbutton]5th::STEP2;5[/rbutton][/c] --+|[c][rbutton]6th::STEP2;6[/rbutton][rbutton]7th::STEP2;7[/rbutton][rbutton]8th::STEP2;8[/rbutton][rbutton]9th::STEP2;9[/rbutton][/c] --+|[br] --+|After picking a level above, you will be asked to select a series of targets until all your rays are delivered - [b]Good Luck![/b] --X| --:STEP2| --&amp;SlotLevel|[&amp;reentryval] --=SlotsTotal|[*S:lvl[&amp;SlotLevel]_slots_total] --=SlotsRemaining|[*S:lvl[&amp;SlotLevel]_slots_expended] --?[$SlotsRemaining.Total] -le 0|NoSlotsLeft --=MissileCount|[&amp;SlotLevel] - 2 + 3 --:MissileLoop| --=DisplayCount|[$DisplayCount] + 1 --?[$DisplayCount] -gt [$MissileCount]|EndMacro --?[$DisplayCount] -ne 1|[ --+|[hr] --+|[br] --+|[c][rbutton]Next Target::NEXT_TARGET[/rbutton][/c] --+|[br] --+|[c][b]Spell Save DC: [#FF0000][*S:spell_save_dc][/#] Damage: [#FF0000][$MissileDamage.Raw][/#][/b][/c] --+|[br] --X| --]| --:NEXT_TARGET| --I Select the target of your Scorching Ray.;Scoring Ray #[$DisplayCount].|t;ThisTarget;Scorching Ray #[$DisplayCount]: --#leftsub|Ray # [$DisplayCount.Raw] --#rightsub|[*[&amp;ThisTarget]:t-name] --#targetToken|[&amp;ThisTarget] --#emoteText|Scorching Ray #[$DisplayCount.Raw] --&gt;PlayEffects|@{selected|token_id};[&amp;ThisTarget];none;burst-smoke;beam-magic --&amp;DamageResistNote| --=TotalDamage|[$MissileDamage] --?"[*[&amp;ThisTarget]:npc_ac]" -gt 0|[ --=TargetAC|[*[&amp;ThisTarget]:npc_ac] --?"[*[&amp;ThisTarget]:npc_immunities]" -inc "[&amp;DamageType]"|&gt;Immune --?"[*[&amp;ThisTarget]:npc_resistances]" -inc "[&amp;DamageType]"|&gt;DamageResist --?"[*[&amp;ThisTarget]:npc_vulnerabilities]" -inc "[&amp;DamageType]"|&gt;DamageVuln --]|[ --=TargetAC|[*[&amp;ThisTarget]:ac] --]| --=AttackRoll|1d20 [BASE] + [*S:spell_attack_bonus] --/|Determine results| --?[$AttackRoll.Base] -eq 1|FUMBLE --?[$AttackRoll.Base] -eq 20|CRITICAL --?[$AttackRoll.Total] -lt [$TargetAC.Total]|MISS --?[$AttackRoll.Total] -ge [$TargetAC.Total]|HIT --X| --&lt;| --:EndMacro| --X| --/|PROCEDURES --:DeductSpellSlot| --=SlotsRemaining|[$SlotsRemaining] - 1 --@setattr|_charid [*S:character_id] _lvl[&amp;SlotLevel]_slots_expended|[$SlotsRemaining] _silent --&lt;| --:NoSlotsLeft| --+|[*S:character_name] has no level [&amp;SlotLevel] spell slots available. --X| --:DamageResist| --=TotalDamage|[$MissileDamage] \ 2 --&amp;DamageResistNote|(Resistant) --&lt;| --:DamageVuln| --=TotalDamage|[$MissileDamage] * 2 --&amp;DamageResistNote|(Vulnerable) --&lt;| --:Immune| --=TotalDamage|0 --&amp;DamageResistNote|(Immune) --&lt;| --:FUMBLE| --+&amp;#x1F613;Ray #[$DisplayCount.Raw] Fumbles! |[*S:character_name] rolls [$AttackRoll] to attack [*[&amp;ThisTarget]:t-name] and something went horribly wrong. --^MissileLoop| --:MISS| --+&amp;#x274C;Ray #[$DisplayCount.Raw] Misses! |[*S:character_name] rolls [$AttackRoll] to attack [*[&amp;ThisTarget]:t-name] and missed. --^MissileLoop| --:HIT| pass Damage string --+&amp;#x1F3AF;Ray #[$DisplayCount.Raw] hits! |[*S:character_name] rolls [$AttackRoll] to attack and hits [*[&amp;ThisTarget]:t-name] for [$TotalDamage] [&amp;DamageType] damage. [&amp;DamageResistNote] --&gt;ApplyDamage| --^MissileLoop| --:CRITICAL| --=TotalDamage|[$TotalDamage] * 2 --+&amp;#x2757;&amp;#x2757;&amp;#x2757;Crits!|[*S:character_name] rolls [$AttackRoll] to attack and CRITS [*[&amp;ThisTarget]:t-name] for [$TotalDamage] [&amp;DamageType] damage. [&amp;DamageResistNote] --&gt;ApplyDamage| --^MissileLoop| --:ApplyDamage| --=CurrentHP|[*[&amp;ThisTarget]:t-bar1_value] --@token-mod|_ids [&amp;ThisTarget] _ignore-selected _set bar1_value|-[$TotalDamage.Raw] --/|@alter|_target|[&amp;ThisTarget] _bar|1 _amount|-[$TotalDamage.Raw] --/|Did that kill them? --?[$CurrentHP.Raw] -gt [$TotalDamage.Raw]|ALIVE|DEAD --:ALIVE| --/+|[*[&amp;ThisTarget]:character_name] is still alive and kicking! --&lt;| --:DEAD| --+Congrats|You managed to kill [*[&amp;ThisTarget]:character_name] --@token-mod|_ids [&amp;ThisTarget] _ignore-selected _set statusmarkers|dead bar1_value|0 --&lt;| --:PlayEffects|Parameters are : sourcetoken; targettoken; source effect; target effect; line effect --vtoken|[%1%] [%3%] --vtoken|[%2%] [%4%] --vbetweentokens|[%1%] [%2%] [%5%] --&lt;| }}live and kicking! --&lt;| --:DEAD| --+Congrats|You managed to kill [*[&amp;ThisTarget]:character_name] --@token-mod|_ids [&amp;ThisTarget] _ignore-selected _set statusmarkers|dead bar1_value|0 --&lt;| --:PlayEffects|Parameters are : sourcetoken; targettoken; source effect; target effect; line effect --vtoken|[%1%] [%3%] --vtoken|[%2%] [%4%] --vbetweentokens|[%1%] [%2%] [%5%] --&lt;| }}
1670877513
Kurt J.
Pro
API Scripter
CatSwann said: Hello scriptomancers! I am trying to modify a script for the Scorching Ray spell.&nbsp; I am using the macro by Will M. found HERE , which is based on Michael C. found HERE . I live Will's format and use of Token-Mod to apply damage, but I would like each Missile Loop to roll and apply it's own damage instead of using one damage roll for all of them. Is this possible and/or a manageable fix? If I'm reading it right, all you would really need to do is move : --=MissileDamage|2d6 down a bit so it is right under: --:MissileLoop|
Thanks, Kurt J.&nbsp; I noodled around a lot with it today and reworked some syntax errors and subroutines, added a few more details and jazzed up the format a bit, and this is what I landed on: !scriptcards {{&nbsp; --#title|Scorching Ray --#sourceToken|@{selected|token_id} --#emoteText|@{selected|character_name} Casts Scorching Rays! --&amp;TFColor|#FFFFFF --&amp;STFColor|#000000 --&amp;FColor1|#000000 --&amp;FColor2|#000000 --&amp;EBColor|#000000 --&amp;BColor1|#f5d2a6 --&amp;BColor2|#fff0de --#titlecardbackground|[&amp;BColor1] --#titlecardbackgroundimage|linear-gradient(to bottom, #FFF000, #FF0000) --#titleFontColor|[&amp;TFColor] --#subtitleFontColor|[&amp;STFColor] --#subtitleFontSize|11px --#emoteBackground|[&amp;EBColor] --#emoteFontColor|[STFColor1] --#titlefontsize|2.0em --#titlefontlineheight|1.2em --#titlefontface|Times New Roman --#norollhighlight|0 --#hideTitleCard|0 --#bodyfontsize|12px --#oddrowbackground|[&amp;BColor1] --#oddrowfontcolor|[&amp;FColor2] --#evenrowbackground|[&amp;BColor2] --#evenrowfontcolor|[&amp;FColor1] --#leftsub|Lvl 2|Evocation|1 Action --#rightsub|120'|V,S|Fire --#debug|1 --:Setup| --&gt;GetAndCheckSlotInformation| --&amp;DamageType|fire --=MissileCount|[$SlotLevel] + 1 --&gt;BuildAndAskTargets|[$MissileCount.Total] --=DisplayCount|1 --=ThisMissile|2d6 --=ThisCrit|2d6 --:MissileLoop| --&gt;FireMissile|[$DisplayCount.Total] --=DisplayCount|[$DisplayCount] + 1 --?[$DisplayCount] -ge [$MissileCount]|EndMacro --X| --:FireMissile| --&amp;ThisTarget|[&amp;target[%1%]] --&gt;PlayEffects|@{selected|token_id};[&amp;ThisTarget];none;burn-fire;beam-holy --&gt;Attack|[&amp;ThisTarget] --&lt;| --:EndMacro| --+Remaining:|[j][*S:character_name] has [b][$SlotsExpended][/b] level [$SlotLevel.Total] spell slots remaining.[/j] --X| --:PROCEDURES| --:GetAndCheckSlotInformation| --=SlotLevel|?{Spell Slot Level?|2|3|4|5|6|7|8|9} --=SlotsTotal|[*S:lvl[$SlotLevel]_slots_total] --=SlotsExpended|[*S:lvl[$SlotLevel]_slots_expended] --?[$SlotsExpended.Total] -le 0|NoSlotsLeft --:DeductSpellSlot| --=SlotsExpended|[$SlotsExpended] - 1 --@setattr|_charid [*S:character_id] _lvl[$SlotLevel]_slots_expended|[$SlotsExpended] _silent --=SlotsRemaining|[$SlotsTotal] - [$SlotsExpended] --&lt;| --:NoSlotsLeft| --+|[*S:character_name] has no level [$SlotLevel.Total] spell slots available. --X| --:Attack| --?"[*[%1%]:npc_ac]" -gt 0|=TargetAC;[*[%1%]:npc_ac]|=TargetAC;[*[%1%]:ac] --=TotalDamage|[$ThisMissile] --?"[*[%1%]:npc_immunities]" -inc "[&amp;DamageType]"|Immune --?"[*[%1%]:npc_resistances]" -inc "[&amp;DamageType]"|&gt;DamageResist;[%1%];[$ThisMissile] --?"[*[%1%]:npc_vulnerabilities]" -inc "[&amp;DamageType]"|&gt;DamageVuln;[%1%];[$ThisMissile] --=AttackRoll|1d20 [BASE] + [*S:spell_attack_bonus] --=ThisMissile|2d6 --=ThisCrit|2d6 --+Attack:|[*S:character_name] rolls [$AttackRoll] vs AC [$TargetAC]. --:Determine results| --?[$AttackRoll.Base] -eq 1|&gt;Fumble;[&amp;ThisTarget] --?[$AttackRoll.Total] -lt [$TargetAC.Total]|&gt;Miss;[&amp;ThisTarget] --?[$AttackRoll.Base] -eq 20|&gt;DamageCrit;[&amp;ThisTarget];[$TotalDamage] --?[$AttackRoll.Total] -ge [$TargetAC.Total] -and [$AttackRoll.Base] -ne 20|&gt;Hit;[&amp;ThisTarget];[$TotalDamage] --X| --:DamageResist| --=TotalDamage|[%2%] \ 2 --+[b]Resistant![/b]|[b][*[%1%]:t-name] takes [$TotalDamage] damage![/b] --&lt;| --:DamageVuln| --=TotalDamage|[%2%] * 2 --+[b]Vulnerable![/b]|[b][*[%1%]:t-name] takes [$TotalDamage] damage![/b] --&lt;| --:Fumble| --+Fumble!|The attack on [*[%1%]:t-name] went horribly wrong. --=DisplayCount|[$DisplayCount] + 1 --?[$DisplayCount] -le [$MissileCount]|MissileLoop|EndMacro --:Miss| --+Miss!|The attack on [*[%1%]:t-name] missed. --=DisplayCount|[$DisplayCount] + 1 --?[$DisplayCount] -le [$MissileCount]|MissileLoop|EndMacro --:Hit| pass Damage string&nbsp; --+Hit!|[*S:character_name]'s Spell hits [*[%1%]:t-name] for [$TotalDamage] [&amp;DamageType] damage. --&gt;ApplyDamage|[%1%];[$TotalDamage] --:DamageCrit| --=TotalDamage|[$ThisMissile] + [$ThisCrit] --+[b]Crit![/b]|[b][*[%1%]:t-name] takes [$TotalDamage] [&amp;DamageType] damage![/b] --&gt;ApplyDamage|[%1%];[$TotalDamage] --:Immune| --=DisplayCount|[$DisplayCount] + 1 --+|[b][*[%1%]:t-name] is immune to [&amp;DamageType] damage![/b] --=DisplayCount|[$DisplayCount] + 1 --?[$DisplayCount] -le [$MissileCount]|MissileLoop|EndMacro --:ApplyDamage| --@token-mod|_ids [&amp;ThisTarget] _ignore-selected _set bar3_value|-[$TotalDamage.Raw] --=DisplayCount|[$DisplayCount] + 1 --?[$DisplayCount] -le [$MissileCount]|MissileLoop|EndMacro --:BuildAndAskTargets| --&amp;TargetString| --=targetCount|1 --:TargetLoop| --&amp;TargetString|+t;target[$targetCount.Raw];Missile [$targetCount.Raw] Target --=targetCount|[$targetCount.Total] + 1 --?[$targetCount.Total] -le [%1%]|&gt;AddSeparator --?[$targetCount.Total] -le [%1%]|TargetLoop --iClick button below to select targets. The same target may be selected more than once;Select [%1%] Targets|[&amp;TargetString] --&lt;| --:AddSeparator| --&amp;TargetString|+|| --&lt;| --:PlayEffects|Parameters are : sourcetoken; targettoken; source effect; target effect; line effect --vtoken|[%1%] [%3%] --vtoken|[%2%] [%4%] --vbetweentokens|[%1%] [%2%] [%5%] --&lt;| }} I'm not a huge fan of the effects output, but that lies more in the Roll20 Effects engine than the script. I probably have some extra or errant info in there, but it works.&nbsp; The only issue I seem to have is when dealing with vulnerabilities. It seems with this setup you can only have a vulnerability damage or a crit damage, but not both...
!script {{ --@token-mod| _ids @{selected|token_id} @{target|token_id} _set statusmarkers|-red }} Does not work.The red mark remains.
1671240702

Edited 1671240843
Kurt J.
Pro
API Scripter
Kaspar K. said: !script {{ --@token-mod| _ids @{selected|token_id} @{target|token_id} _set statusmarkers|-red }} Does not work.The red mark remains. Copying and pasting that into my game works just fine, removing the red dot on both tokens. Do you have token-mod configured so players can use IDs?
That fixed it. Thank you.
Is there a way to extract the token tooltip? Something like: !script {{ --&amp;TIP|[*S:t-tooltip] --+@{selected|token_name}| [&amp;TIP] }}
1671295117
Kurt J.
Pro
API Scripter
Kaspar K. said: Is there a way to extract the token tooltip? Something like: !script {{ --&amp;TIP|[*S:t-tooltip] --+@{selected|token_name}| [&amp;TIP] }} Yes, though to use [*S:...] you need to set the source token first (ie, --#sourcetoken|@{selected|token_id}. You can also skip that and just do: !script {{ &nbsp; --+Tip|[*@{selected|token_id}:t-tooltip] }}
I have hit a snag with Kurt's Action Menu macro mentioned HERE .&nbsp; I loved the idea of using a spell mule to customize spells.&nbsp; I am sure we have all found spells that just don't work as described within the sheet framework (magic missile, scorching ray, etc.), and there are lots of great spell macros to go around (lightning bolt, fireball, etc.). Kurt's Action Menu macro to the rescue. My group and I enjoy seeing the 3d dice roll, and since the built-in formatting in the action menu foregoes the visual dice, and does not seem to trigger Combat Master, I decided to make a spell mule and copy all the roll commands from the player's spell lists directly in, incorporating several other API commands when appropriate, adding some flavor and fluff, while still retaining the visual appeal of the dice and triggering Combat Master.&nbsp; HOWEVER, I seem to have hit upon an issue with this macro command.&nbsp; After spending literally days copying roll commands from the sheet button into the Spell Mule action list, and accumulating over a hundred abilities, I found that some spells just would not fire from the SM Ability and would default to the built-in format.&nbsp; After combing through my spell list and testing each entry, I found a patern. Apparently, this Scriptcard macro fails to detect spells from the Ability section of the spell mule if it's name is more than two words.&nbsp; Any spell with two or less words works fine, but spells like Toll the Dead, Word of Radiance, Shield of Faith, Tasha's Hideous Laughter, Mass Healing Word, the list goes on, fail to register in the substitution framework of the macro. Kurt, or anyone else, do you have any thoughts? Here is my modified Action Menu where I have removed all basic attack syntax, leaving a trimmed down Spell Action Menu. (It also gives a report on available resources like Sorcery Points and other abilities stored in the Repeating Resource list which I have customized for each character.) !script {{ --/|Script Name : 5E Action Menu --/|Version : 1.6.4 --/|Requires SC : 1.3.9+ --/|Author : Kurt Jaegers, Catori Swann --/|Description : This script can be used with either a PC or NPC selected. It will generate an action menu with clickable --/| buttons to execute character actions and cast spells. The menu is whispered to the player executing the --/| script, while the results of clicking the action buttons are displayed in general chat. --/|========================================================================================================= --/|Settings Area - Customize the behavior of the script here --/|If you create a "spell mule" character and put its name here, it's ability list will be checked for --/|abilities that match the name of each spell found on PCs. If a match is found, the button that is --/|created for that spell will be a sheet-button for that ability instead of a reentrant button back to --/|this script for generic processing. This lets you define "special case" macros for non-standard spells. --/|The name of the ability on the spell mule needs to exactly match the spell name (case sensitive) --&amp;spellmulename|Spell_Mule --/|Set to "1" to enable loading of settings information from a saved format named after the character (case sensitive) --&amp;UseNamedCharacterSettings|1 --/|If this value is set to 1, prepared spells checks will be skipped --&amp;skipPreppedSpellsCheck|0 --/|If this value is set to 1, NPC attack information will be sent to the GM only, and AC will be masked from the players. --&amp;sendGmInfo|1 --/|These are here for future implementation, and don't do anything quite yet: --&amp;hipoint_bar_number|3 --&amp;damageapi|token-mod --/|End Settings Area --/|========================================================================================================= --/|Give the script a reentrant name based on the selected character id so we can have multiple instances at the same time --#reentrant|CharacterAction @{selected|character_id} --/|Set up some style information for the action menu and subsequent cards. These attempt to somewhat --/|simulate the 5E style --#bodyfontface|Helvetica --#bodyfontcolor|#000000 --#buttonfontsize|11px --#buttonbackground|#0229e8 --#buttonfontface|Tahoma --#titlecardbackground|#f6efd6 --#titlefontcolor|#000000 --#titlefontsize|1.5em --#titlefontshadow|0 --#oddrowbackground|#f6efd6 --#evenrowbackground|#f6efd6 --#subtitlefontcolor|#000000 --#emoteBackground|#070091 --emoteFontColor|#FFFFFF --/|The menu is whispered to the player executing the macro. #whisper will be set again later for the --/|actual output to be public. --#whisper|self --/|Store the selected character so we can use it later even if it gets de-selected --#sourcetoken|@{selected|token_id} --?[&amp;UseNamedCharacterSettings] -eq 1|[ --lsettings|[*S:character_name] --]| --#emotestate|visible --#emoteText|[*S:character_name] [*s:castquote] --#title|[*S:character_name] --#rightsub|[*S:class_display] --+|[hr #58180d] --+|[t border=0 width=90%] [tr][td][b] &amp;nbsp;&amp;nbsp;&amp;nbsp;Save DC:[/b] [*S:spell_save_dc] [/td][td][r] [b]Attack Bonus:[/b] +[*S:spell_attack_bonus][/r][/td][/tr][/t][br] --+|[c][b][*S:class_resource_name]: [/b][*S:class_resource][/c] --+|[c][b][*S:other_resource_name]: [/b][*S:other_resource][/c] --+|[c][b][*S:repeating_resource_$1_resource_left_name]: [/b][*S:repeating_resource_$1_resource_left][/c] --+|[c][b][*S:repeating_resource_$0_resource_left_name]: [/b][*S:repeating_resource_$0_resource_left][/c] --+|[c][b][*S:repeating_resource_$4_resource_left_name]: [/b][*S:repeating_resource_$4_resource_left][/c] --+|[c][b][*S:repeating_resource_$5_resource_left_name]: [/b][*S:repeating_resource_$5_resource_left][/c] --+|[c][b][*S:repeating_resource_$5_resource_right_name]: [/b][*S:repeating_resource_$5_resource_right][/c] --+|[hr #58180d] --+[c]Available Spells[/c]|[br] --+|[t border=0 width=100%][tr][td][c][b]Level 1:[/b] [*S:lvl1_slots_total][/c][/td][td][c][b]Remaining:[/b] [*S:lvl1_slots_expended][/c][/tr][/td][/t] --+|[t border=0 width=100%][tr][td][c][b]Level 2:[/b] [*S:lvl2_slots_total][/c][/td][td][c][b]Remaining:[/b] [*S:lvl2_slots_expended][/c][/tr][/td][/t] --+|[t border=0 width=100%][tr][td][c][b]Level 3:[/b] [*S:lvl3_slots_total][/c][/td][td][c][b]Remaining:[/b] [*S:lvl3_slots_expended][/c][/tr][/td][/t] --/|Determine if the selected character is a PC or NPC and process appropriately --?[*S:npc] -eq 1|proc_npc|proc_pc --:proc_pc| --+|[hr #58180d] --#whisper|self --]| --Rfirst|[*S:character_id];repeating_spell-cantrip --&amp;PCCantrips|[br] --?"[*R:spellname]" -ne "NoRepeatingAttributeLoaded"|[ --:PCCantrips_Display| --~testName|string;replace; ;-;[*R:spellname] --~testMule|system;findability;[&amp;spellmulename];[&amp;testName] --?[&amp;testMule] -ne "AbilityNotFound"|MULE_CANTRIP --?"[*R:spelloutput]" -eq ATTACK|CANTRIP_GENERATE_WITH_TARGET --&amp;PCCantrips|+ [rbutton][*R:spellname]::EXEC_PC_CANTRIP;[*R:spellname]|NONE[/rbutton] --^CANTRIP_END_GENERATE| --:CANTRIP_GENERATE_WITH_TARGET| --&amp;PCCantrips|+ [rbutton][*R:spellname]::EXEC_PC_CANTRIP;[*R:spellname]|&amp;#64;{target|character_id}[/rbutton] --^CANTRIP_END_GENERATE| --:MULE_CANTRIP| --&amp;PCCantrips|+ [sheetbutton][*R:spellname]::[&amp;spellmulename]::[&amp;testName][/sheetbutton] --:CANTRIP_END_GENERATE| --Rnext| --?"[*R:spellname]" -ne "NoRepeatingAttributeLoaded"|PCCantrips_Display --+[C]Cantrips[/C]|[C][&amp;PCCantrips][/C][br] --]| --%levelCounter|1;9 --Rfirst|[*S:character_id];repeating_spell-[&amp;levelCounter] --&amp;PCSpells|[br] --=PCSpellCount|0 --?"[*R:spellname]" -ne "NoRepeatingAttributeLoaded"|[ --:PCSpells_Display| --?[&amp;skipPreppedSpellsCheck] -eq 1|SKIP_PREP_CHECK --?[*S:class] -eq "Sorcerer"|SKIP_PREP_CHECK --?"X[*S:multiclass1_flag]" -eq "X1" -and [*S:multiclass1] -eq "Sorcerer"|SKIP_PREP_CHECK --?"X[*S:multiclass2_flag]" -eq "X1" -and [*S:multiclass2] -eq "Sorcerer"|SKIP_PREP_CHECK --?"X[*S:multiclass3_flag]" -eq "X1" -and [*S:multiclass3] -eq "Sorcerer"|SKIP_PREP_CHECK --&amp;isWizard|0 --?[*S:class] -eq "Wizard"|&amp;isWizard;1 --?"X[*S:multiclass1_flag]" -eq "X1" -and [*S:multiclass1] -eq "Wizard"|&amp;isWizard;1 --?"X[*S:multiclass2_flag]" -eq "X1" -and [*S:multiclass2] -eq "Wizard"|&amp;isWizard;1 --?"X[*S:multiclass3_flag]" -eq "X1" -and [*S:multiclass3] -eq "Wizard"|&amp;isWizard;1 --?[&amp;isWizard] -eq 0 -and "X[*R:spellprepared]" -ne "X1"|DONE_SPELL_BUTTON --?"X[*R:spellprepared]" -ne "X1" -and "X[*R:spellritual]" -ne "XYes"|DONE_SPELL_BUTTON --&amp;spellsuffix| --?"X[*R:spellritual]" -eq "XYes"|&amp;spellsuffix; [R] --:SKIP_PREP_CHECK| --~testName|string;replace; ;-;[*R:spellname] --~testMule|system;findability;[&amp;spellmulename];[&amp;testName] --?[&amp;testMule] -ne "AbilityNotFound"|MULE_SPELL --&amp;slotString| --?[&amp;levelCounter] -eq 9|SKIP_SLOT_LIST --&amp;slotString||&amp;# --&amp;slotString|+63;{Slot Level| --%slotcounter|[&amp;levelCounter];9 --&amp;slotString|+[&amp;slotcounter] --?[&amp;slotcounter] -eq 9|SKIP_VERTICAL_BAR --&amp;slotString|+| --:SKIP_VERTICAL_BAR| --%| --&amp;slotString|+} --^DONE_SLOT_LIST| --:SKIP_SLOT_LIST| --&amp;slotString||9 --:DONE_SLOT_LIST| --&amp;PCSpells|+ [rbutton][*R:spellname][&amp;spellsuffix]::EXEC_PC_SPELL;[&amp;levelCounter]|[*R:spellname]|&amp;#64;{target|character_id}[&amp;slotString][/rbutton] --=PCSpellCount|[$PCSpellCount.Raw] + 1 --^DONE_SPELL_BUTTON| --:MULE_SPELL| --&amp;PCSpells|+ [sheetbutton][*R:spellname][&amp;spellsuffix]::[&amp;spellmulename]::[&amp;testName][/sheetbutton] --=PCSpellCount|[$PCSpellCount.Raw] + 1 --:DONE_SPELL_BUTTON| --Rnext| --?"[*R:spellname]" -ne "NoRepeatingAttributeLoaded"|PCSpells_Display --?[$PCSpellCount] -eq 0|PC_SKIP_LEVEL_DISPLAY --+[C]Level [&amp;levelCounter] Spells[/C]|[C][&amp;PCSpells][/C] [br] --:PC_SKIP_LEVEL_DISPLAY| --]| --%| --X| --:EXEC_PC_CANTRIP| --+|[hr #58180d] --~cantrip_name|string;before;|;[&amp;reentryval] --~cantrip_target|string;after;|;[&amp;reentryval] --#whisper| --#targettoken|[&amp;cantrip_target] --&gt;Find_Active_Global_Attack_Modifiers|[*S:character_id];PC_GAM --Rfind|[*S:character_id];[&amp;cantrip_name];repeating_spell-cantrip;spellname --?"[*R:spelloutput]" -eq ATTACK|PC_ATTACK_CANTRIP|PC_CARD_CANTRIP --:PC_ATTACK_CANTRIP| --?"X[*R:spellattack]" -eq "XRanged" -or "X[*R:spellattack]" -eq "XMelee"|CANTRIP_ATTACK_ROLL|CANTRIP_DONE_ATTACK_ROLL --&amp;cantrip_crit|0 --:CANTRIP_ATTACK_ROLL| --&amp;rollType|1d20 --?"[*S:advantagetoggle]" -inc advantage|&amp;rollType;2d20kh1 --?"[*S:advantagetoggle]" -inc disadvantage|&amp;rollType;2d20kl1 --=attackRoll|[&amp;rollType] + [*S:spell_attack_bonus] [Spell Atk Bonus] [&amp;PC_GAM] --=AC|[*T:ac] --?"X[*T:npc_ac]" -ne "X"|=AC;[*T:npc_ac] --?[&amp;sendGmInfo] -eq 1|[ --+[*R:spellattack] Attack|rolled [$attackRoll] vs the target's AC[br][br] --]|[ --+[*R:spellattack] Attack|rolled [$attackRoll] vs AC [b][$AC.Raw][/b][br][br] --]| --?[$attackRoll.Base] -eq 20|=cantrip_crit;1 --?[$attackRoll.Total] -lt [$AC]|CANTRIP_ATTACK_MISS --?[$attackRoll.Base] -eq 1|CANTRIP_ATTACK_MISS --:CANTRIP_DONE_ATTACK_ROLL| --&amp;damageRoll|[*R:spelldamage] --?[*S:level] -ge 5|&amp;damageRoll;+ + [*R:spelldamage] --?[*S:level] -ge 11|&amp;damageRoll;+ + [*R:spelldamage] --?[*S:level] -ge 17|&amp;damageRoll;+ + [*R:spelldamage] --?[$cantrip_crit] -eq 1|&amp;damageRoll;+ + [&amp;damageRoll] --=cantripDamage|[&amp;damageRoll] --?"X[*R:spellsave]" -ne "X"|CANTRIP_SAVE|CANTRIP_NO_SAVE --:CANTRIP_NO_SAVE| --?[$cantrip_crit] -eq 1|&amp;hittag;Critical Hit!|&amp;hittag;Hit! --?[$cantrip_crit] -eq 1|&amp;hitdesc;critically hits|&amp;hitdesc;hits --+[&amp;hittag]|The [*R:spellname] [&amp;hitdesc] and deals [$cantripDamage] [*R:spelldamagetype] damage.[br][br] --^PC_CARD_CANTRIP| --:CANTRIP_SAVE| --+|The target needs to make a DC [*S:spell_save_dc] [*R:spellsave] saving throw or take [$cantripDamage] [*R:spelldamagetype] damage.[br][br] --/&amp;output|The [b][i][*R:spellname][/i][/b] deals [$cantripDamage] [*R:spelldamagetype] damage. --/?"X[*R:spellsave]" -ne "X"|&amp;output;+ The target can make a [*R:spellsave] save vs DC [*S:spell_save_dc] to negate the damage. --^PC_CARD_CANTRIP| --:CANTRIP_ATTACK_MISS| --+The [*R:spellname] attack missed!|[br][br] --:PC_CARD_CANTRIP| --#title|[&amp;cantrip_name] --#leftsub|[*S:character_name] --+|[*R:spelldescription] --:PC_DONE_CANTRIP| --X| --:EXEC_PC_SPELL|spellInfo1=Spell Level, 2=SpellName, 3=Target ID, 4=Slot Level --+|[hr #58180d] --~spellInfo|string;split;|;[&amp;reentryval] --=UpCast|[&amp;spellInfo4] - [&amp;spellInfo1] --#title|[&amp;spellInfo2] --#leftsub|[*S:character_name] --#whisper| --#targettoken|[&amp;action_target] --&gt;Find_Active_Global_Attack_Modifiers|[*S:character_id];PC_GAM --Rfind|[*S:character_id];[&amp;spellInfo2];repeating_spell-[&amp;spellInfo1];spellname --#targettoken|[&amp;spellInfo3] --?"[*R:spelloutput]" -eq ATTACK|PC_ATTACK_SPELL|PC_CARD_SPELL --:PC_ATTACK_SPELL| --?"X[*R:spellattack]" -eq "XRanged" -or "X[*R:spellattack]" -eq "XMelee"|SPELL_ATTACK_ROLL|SPELL_DONE_ATTACK_ROLL --&amp;spell_crit|0 --:SPELL_ATTACK_ROLL| --&amp;rollType|1d20 --?"[*S:advantagetoggle]" -inc advantage|&amp;rollType;2d20kh1 --?"[*S:advantagetoggle]" -inc disadvantage|&amp;rollType;2d20kl1 --=attackRoll|[&amp;rollType] + [*S:spell_attack_bonus] [Spell Atk Bonus] [&amp;PC_GAM] --=AC|[*T:ac] --?"X[*T:npc_ac]" -ne "X"|=AC;[*T:npc_ac] --?[&amp;sendGmInfo] -eq 1|[ --+[*R:spellattack] Attack|rolled [$attackRoll] vs the target's AC[br][br] --]|[ --+[*R:spellattack] Attack|rolled [$attackRoll] vs AC [b][$AC.Raw][/b][br][br] --]| --?[$attackRoll.Base] -eq 20|=spell_crit;1 --?[$attackRoll.Total] -lt [$AC]|SPELL_ATTACK_MISS --:SPELL_DONE_ATTACK_ROLL| --&amp;damageRoll|[*R:spelldamage] --&amp;damageRoll2|[*R:spelldamage2] --&amp;ability_bonus| --?"X[*R:spell_ability]" -eq "Xspell"|[ --~ability|string;before;};[*S:spellcasting_ability] --~ability|string;after;{;[&amp;ability] --?[&amp;ability] -eq strength_mod|&amp;ability_bonus; + [*S:strength_mod] [Spellcasting Ability] --?[&amp;ability] -eq dexterity_mod|&amp;ability_bonus; + [*S:dexterity_mod] [Spellcasting Ability] --?[&amp;ability] -eq constitution_mod|&amp;ability_bonus; + [*S:constitution_mod] [Spellcasting Ability] --?[&amp;ability] -eq intelligence_mod|&amp;ability_bonus; + [*S:intelligence_mod] [Spellcasting Ability] --?[&amp;ability] -eq wisdom_mod|&amp;ability_bonus; + [*S:wisdom_mod] [Spellcasting Ability] --?[&amp;ability] -eq charisma_mod|&amp;ability_bonus; + [*S:charisma_mod] [Spellcasting Ability] --]| --&amp;spell_heal|0 --?"X[*R:spellhealing]" -ne "X"|&amp;spell_heal;1 --?"X[*R:spellhealing]" -ne "X"|&amp;damageRoll;[*R:spellhealing] --?[$UpCast] -eq 0|NO_UPCAST --=upcastDice|[$UpCast.Raw] * [*R:spellhldie] --&amp;damageRoll|+ + [$upcastDice.Raw][*R:spellhldietype] [Upcasting] --:NO_UPCAST| --?[$spell_crit] -eq 1|&amp;damageRoll;+ + [&amp;damageRoll] --?[$spell_crit] -eq 1|&amp;damageRoll2;+ + [&amp;damageRoll2] --?[$spell_crit] -eq 1|&amp;hittag;Critical Hit!|&amp;hittag;Hit! --?[$spell_crit] -eq 1|&amp;hitdesc;critically hits|&amp;hitdesc;hits and deals --?[&amp;spell_heal] -eq 1|&amp;hittag;[b][/b] --?[&amp;spell_heal] -eq 1|&amp;hitdesc;heals for --/&amp;damageRoll|+ [&amp;ability_bonus] --/&amp;damageRoll2|+ [&amp;ability_bonus] --=spellDamage|[&amp;damageRoll] --=spellDamage2|[&amp;damageRoll2] --?"X[*R:spelldamage2]" -ne "X"|TWO_DAMAGE --+[&amp;hittag]|The [*R:spellname] [&amp;hitdesc] [$spellDamage] [*R:spelldamagetype] damage.[br][br] --^DONE_SPELL_DAMAGE| --:TWO_DAMAGE| --+[&amp;hittag]|The [*R:spellname] [&amp;hitdesc] [$spellDamage] [*R:spelldamagetype] damage and [$spellDamage2] [*R:spelldamagetype2] damage.[br][br] --:DONE_SPELL_DAMAGE| --?"X[*R:spellsave]" -eq "X"|PC_CARD_SPELL --+|The target can make a [*R:spellsave] save vs DC [*S:spell_save_dc] to modify the damage as described below.[br][br] --^PC_CARD_SPELL| --:SPELL_ATTACK_MISS| --+The [*R:spellname] attack missed!|[br][br] --:PC_CARD_SPELL| --+|[*R:spelldescription] --:PC_DONE_SPELL| --X| --/| FUNCTIONS --:Find_Active_Global_Attack_Modifiers|character_id;StringVariableToSet --&amp;_GAM_Temp| --Rfirst|[%1%];repeating_tohitmod --:_GAM_Loop| --?"[*R:global_attack_active_flag]" -eq "1"|&gt;_AddGAM;[*R:global_attack_name];[*R:global_attack_roll] --Rnext| --?"[*R:global_attack_name]" -ne "NoRepeatingAttributeLoaded"|_GAM_Loop --&amp;[%2%]|[&amp;_GAM_Temp] --&lt;| --:_AddGAM| --&amp;_GAM_Temp|+ + [%2%] [ [%1%] ] --&lt;| }} Any help would be greatly appreciated!
1671384168
Kurt J.
Pro
API Scripter
CatSwann said: Here is my modified Action Menu where I have removed all basic attack syntax, leaving a trimmed down Spell Action Menu. (It also gives a report on available resources like Sorcery Points and other abilities stored in the Repeating Resource list which I have customized for each character.) That looks like it is based on a pretty ancient version of the Action Menu. (1.6.4)... there have been a couple dozen updates since then, including an update on 2022-05-25 that addressed the multiple spaces issue. If you don't want to upgrade to 2.2.2 (the current version) you should able to fix the issue by changing "replace" to "replaceall" in the --~testName lines in a few places above. The latest version of the action menu is always available at&nbsp; The GitHub Repo , and gets regular feature updates and bug fixes.
Ah!&nbsp; Thanks, Kurt!
I'm getting odd results from a conditional in a very large script. Here is a piece outside the script: !Script{{ &nbsp; --=str|5&nbsp; --=Tstr|2&nbsp; --=pot|0&nbsp; --=pen|0&nbsp; --&amp;Dtype|Strength &nbsp; --*|before Dtype=[&amp;Dtype] dnum=[$dnum] str=[$str] Tstr=[$Tstr] pot=[$pot] pen=[$pen]&nbsp; &nbsp; --?"[&amp;Dtype]" -eq "Strength"|=dnum;[$str] + [$Tstr] + [$pot] - [$pen]&nbsp; &nbsp; --*|after Dtype=[&amp;Dtype] dnum=[$dnum] str=[$str] Tstr=[$Tstr] pot=[$pot] pen=[$pen]&nbsp; }} &nbsp;&nbsp;&nbsp;&nbsp;As you can see dnum is undefined before the conditional and should have the value of 7 after the conditional. In the little script above that is exactly what happens. In the 700+ line script it is undefined both before and after. As you can see the line before the conditional gives me all the items involved in the conditional. They are exactly the values they are in the small script. The line after the conditional gives me the same values again. All of them are as they should be except that dnum is undefined instead of 7. &nbsp;&nbsp;&nbsp;&nbsp;I can't imagine what could be happening elsewhere in the large script which could cause this failure. I tried running the lines through TestEdit to get rid of any invisible characters; no help. I tried adding .Raw to all the [$xxx.Raw] values as you suggested to solve my earlier problem; again nothing. How can this be possible? I think I have isolated all factors. I tried defining dnum earlier as a string variable (--&amp;dnum|None) knowing that would also show undefined (i.e. blank) on the first line, however that still gave dnum as 7 on the second line using the short script. &nbsp; &nbsp; Any ideas or suggestions? I'm out of ideas.
I've got a question if something is possible: So I have an array of text entries and index 8 of that array is "Defensive Abilities body of fire/ Resistances cold 10". Is there a way to use indexof or another way to find that array element just by searching for "Defensive Abilities" instead of the entire item value? Thanks!
1672579583

Edited 1672579643
Kurt J.
Pro
API Scripter
**ScriptCards 2.2.4** Has been uploaded to the GitHub Repo : &nbsp; - Added the --\ command to log content to the API console &nbsp; - Testing empty strings in conditionals now works as expected and should no longer require a workaround &nbsp; - Math functions (ie, {MIN:X} are now usable in inline rolls ([=...]) &nbsp; - Any setting that is purely a color (oddrowbackground, for example) now checks to see if it is getting set to a 3, 6, or 8 digit hex value without a # in front and will add one if needed. **5E Character Action Menu 2.3.0** Has been uploaded to the GitHub Repo : &nbsp; - Lots of rewriting and refactoring to improve the script's efficiency and ease of porting to other sheets. More work to do on this. About 70 lines of code have been eliminated via this rewrite. &nbsp; - Ritual spells now have "As Ritual" as the default spell slot level and won't consume a slot when cast that way &nbsp; - Added NPC Ability and PC Ability mule support &nbsp; - Cleaned up Custom Action code that was introduced in the previous update to prevent empty lists (with just "false") from being shown. As always, more detailed change information is available in the changelog. These updates will be queued for OneClick inclusion later this week to allow some time for any required bug fixing on the GitHub version prior to that update.
I am using .Ones and .Aces to count 1s and 6s on a dice pool of d6s. It works just fine for normal dice, and for the initial 1s rolled on an exploding die, but sixes rolled on the exploding die do not get counted. Nor do any 1s rolled as part of an explosion. Is there a way to get the exploding numbers to be counted? Here is the code—it has some extra lines for testing purposes: !Scriptcard {{ &nbsp; -- --#title|Standard Roll &nbsp; --=dicePool|?{Number of Dice?|3} &nbsp; --=baseDice|[$dicePool] - 1 &nbsp; --#leftsub|Rolling [$baseDice]d6 + Wild Die &nbsp; --/ROLL DICE &nbsp; --=BaseRoll|[$baseDice]d6 &nbsp; --=WildRoll|1d6! &nbsp; --=CombTotal|[$BaseRoll] + [$WildRoll] &nbsp; --/NUMBER COUNTS &nbsp; --=BaseOnes|[$BaseRoll.Ones] &nbsp; --=BaseSixes|[$BaseRoll.Aces] &nbsp; --=WildOnes|[$WildRoll.Ones] &nbsp; --=WildSixes|[$WildRoll.Aces] &nbsp; --=CombOnes|[$BaseOnes] + [$WildOnes] &nbsp; --=FailTotal|[$CombOnes] - [$BaseSixes] &nbsp; --=SuccessTotal|[$BaseSixes] - [$CombOnes] &nbsp; --/OUTPUT &nbsp; --+Base Result|[$BaseRoll] &nbsp; --+Wild Result|[$WildRoll] &nbsp; --+Total:|[$CombTotal] &nbsp; --+Base Threats|[$BaseOnes] &nbsp; --+Base Advantages|[$BaseSixes] &nbsp; --+Wild Threats|[$WildOnes] &nbsp; --+Wild Advantages|[$WildSixes] &nbsp; --/CASE EVALS &nbsp; --?[$FailTotal] -ge 1|Failure &nbsp; --?[$SuccessTotal] -ge 1|Success &nbsp; --/FAILURE &nbsp; --:Failure| &nbsp; --+Total Threats:|[$FailTotal] &nbsp; --X| &nbsp; --/SUCCESS &nbsp; --:Success| &nbsp; --+Total Advantages:|[$SuccessTotal] &nbsp; --X| }}
1672780080

Edited 1672781881
Kurt J.
Pro
API Scripter
Tom Toynton said: I am using .Ones and .Aces to count 1s and 6s on a dice pool of d6s. It works just fine for normal dice, and for the initial 1s rolled on an exploding die, but sixes rolled on the exploding die do not get counted. Nor do any 1s rolled as part of an explosion. Is there a way to get the exploding numbers to be counted? Here is the code—it has some extra lines for testing purposes: This isn't currently supported, but I'll be releasing an update on my github this evening that implements this feature. This feature has now been included in the 2.2.4c update on the github and is scheduled for OneClick inclusion in the next update. This also fixes an issue where Aces wouldn't be counted since the exploding die would always total more than the dice sides value and fail the aces check. You'll need to set --#explodingonesandaces|1 somewhere before the dice roll to enable the feature in a given script, as it is off by default.
That's fantastic. Thank so much, Kurt!
Hi, I've got a question: If I wanted to clamp a rollvariable so that it would be between two values, how would I go about doing that in the easiest way? I'm trying to port over an old script from powercards and in that one I used the keep highest and keep lowest functions to keep the values within a certain number range, but it seems like in scriptcards those functions don't quite work for this?