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've a bit of a question regarding the output of the scriptCards.  I've examined the wiki entry and I cant find any way to further format the output beyond the most basic formatting.  Is there a way to add tooltips, or title information to the output.  For example, I have a table with attack/damage information for Dark Heresy.  Lets say I want to add a tooltip to help new players and let them know what exactly "Soak" means.  They mouseover (or click) the word "Soak" and it explains it briefly. Also, I've been struggling with using  --~sqRange|distance;@{selected|token_id};@{target|token_id} --=Range|[$sqRange] [Squares] * 1 [meters] the problem is it seems to calculate from the CENTER of a token.  Is there any code for this to calculate from the EDGE of a token.  Otherwise if creatures are not a standard size, the range is very inaccurate.  I was given code to do this manually previously but it completely breaks the entire ScriptCards. Thank you in advance for help.
I also have another question... sorry for two right back to back.  But I am trying to code a particullarly nasty segment.  I'm not really good with loops, but in this case I cant see a way around them.  I copy/pasted most of what I need from the previous ScriptCards thread. The code below mostly does what I need but it is missing some key elements.  In addition to showing the value of each dice roll Xd10+Willpower Modifier.  I need it to total all of them and COUNT the number of times a 9 comes up.  If possible I'd like 9's to be colored RED instead of 1's. The code I have is: !scriptcards {{ --#title|Psychic Powers --#titlecardbackground|#993333 --#leftsub|Discipline (Sub-Discipline) --#rightsub|Threshold ##   --=NumDice|?{How Many Dice?|1}   --+Rolling|[$NumDice.Total]d10      --=DieCount|0   --:Loop|   --=DieCount|[$DieCount] + 1   -->RollADie|   --?[$DieCount] -lt [$NumDice]|Loop   --+Results|[&DieSummary]   --X|   --:RollADie|   --=ThisRoll|1d6   --&DieSummary|+ [$ThisRoll]   --<| }} The number of 9's and the total of ALL dice need to be used elsewhere in the scriptCards so it needs to be saved to a variable that is usable EVERYWHERE in the scriptcard.
Toby you could do something like this to get the total for the dice and the number of nines rolled !script {{ --=roll|8d10 --~str|string;replace;(;;[$roll.Text] --~str|string;replace;);;[&str] --~|array;fromstring;rollArr;,;[&str] --~|array;numericsort;rollArr;descending --=Nines|0 --%roll|foreach;rollArr --?[&roll] -lt 9|%! --?[&roll] -eq 9|=Nines;[$Nines]+1 --%| --+|Total: [$roll] Rolls: [$roll.Text] Nines: [$Nines] }} That should get you the number of nines rolled and the total set in variables to use. As for how to turn the 9's red, I am not sure about the formatting there and maybe someone else can answer that. I tend to turn minmax highlighting off in many of my multidice roll scripts. But turning the roll into a numerically sorted array should get you the number of 9's rolled. Toby said: I also have another question... sorry for two right back to back.  But I am trying to code a particullarly nasty segment.  I'm not really good with loops, but in this case I cant see a way around them.  I copy/pasted most of what I need from the previous ScriptCards thread. The code below mostly does what I need but it is missing some key elements.  In addition to showing the value of each dice roll Xd10+Willpower Modifier.  I need it to total all of them and COUNT the number of times a 9 comes up.  If possible I'd like 9's to be colored RED instead of 1's. The code I have is: !scriptcards {{ --#title|Psychic Powers --#titlecardbackground|#993333 --#leftsub|Discipline (Sub-Discipline) --#rightsub|Threshold ##   --=NumDice|?{How Many Dice?|1}   --+Rolling|[$NumDice.Total]d10      --=DieCount|0   --:Loop|   --=DieCount|[$DieCount] + 1   -->RollADie|   --?[$DieCount] -lt [$NumDice]|Loop   --+Results|[&DieSummary]   --X|   --:RollADie|   --=ThisRoll|1d6   --&DieSummary|+ [$ThisRoll]   --<| }} The number of 9's and the total of ALL dice need to be used elsewhere in the scriptCards so it needs to be saved to a variable that is usable EVERYWHERE in the scriptcard.
1695180767

Edited 1695180790
Andrew R.
Pro
Sheet Author
There's a .RolledDice(x) modifier for Roll Variables so you don't have to do all that string manipulation. Sadly, you can't use it as the Array for a foreach, so you have to do it like this:  !script {{ --/| Initialize Variables --=Nines|0 --=ManyDice|?{How Many Dice?|1} --=Rolls|[$ManyDice.Total]d10 --/| Loop Over Array of Rolled Dice --%Loop|1;[$ManyDice.Total];1   --?[$Rolls.RolledDice([&Loop])] -eq 9|=Nines;[$Nines] + 1 --%|End of Loop --/| Print Results --+|Total: [$Rolls.Total] Rolls: [$Rolls.Text] Nines: [$Nines.Total] }}
1695181741
Andrew R.
Pro
Sheet Author
As for making your 9 rolls show as critical failures, that's what the Inline Formatting [roll:f] [/roll] is for. 
I'm trying to set the value a repeating attribute with direct object modification with the code below. Specifically I'm trying to set an existing 5e resource to zero. Pretty sure the attribute name is correct, as I've used the same with ChatSetAttr. What am I missing here? Is there something extra I need to do for modifying an existing repeating attribute? --!a:[*S:character_id]|repeating_resource_$0_resource_left:0 I managed a crude workaround by calling ChatSetAttr from inside, but obviously I would prefer a direct modification.
Erudo said: I'm trying to set the value a repeating attribute with direct object modification with the code below. Specifically I'm trying to set an existing 5e resource to zero. --!a:[*S:character_id]|repeating_resource_$0_resource_left:0 I managed a crude workaround by calling ChatSetAttr from inside, but obviously I would prefer a direct modification. I don't believe you can directly set/change an attribute with ONLY scriptcards.  Therefore, ChatSetAttr is the correct way to do this.
Andrew R. said: There's a .RolledDice(x) modifier for Roll Variables so you don't have to do all that string manipulation. Sadly, you can't use it as the Array for a foreach, so you have to do it like this:  !script {{ --/| Initialize Variables --=Nines|0 --=ManyDice|?{How Many Dice?|1} --=Rolls|[$ManyDice.Total]d10 --/| Loop Over Array of Rolled Dice --%Loop|1;[$ManyDice.Total];1   --?[$Rolls.RolledDice([&Loop])] -eq 9|=Nines;[$Nines] + 1 --%|End of Loop --/| Print Results --+|Total: [$Rolls.Total] Rolls: [$Rolls.Text] Nines: [$Nines.Total] }} This is nice, it is very succinct, however the output is as raw numbers not shown as rolls.  I specifically need each roll to show with the roll formatting.  Spending time examining the code, which I don't fully understand.  It seems that it cannot be done with this style of code.  Would that be a correct assessment?  I say that because the reason the numbers show up is because the output uses [$Rolls.Text] and using just [$Rolls] would simply have a single roll.
1695628143
Andrew R.
Pro
Sheet Author
I used the .Text modifier because Joshua did so.  Modifying the code to match your output expectations is left as an exercise for the reader.  ;)
Andrew R. said: I used the .Text modifier because Joshua did so.  Modifying the code to match your output expectations is left as an exercise for the reader.  ;) Huh?  I'm confused.
Do you mean that we can't use ScriptCards to do direct modification for repeating attributes? Because you can do that with 'normal' attributes with --!, which I have done and is documented. Toby said: Erudo said: I'm trying to set the value a repeating attribute with direct object modification with the code below. Specifically I'm trying to set an existing 5e resource to zero. --!a:[*S:character_id]|repeating_resource_$0_resource_left:0 I managed a crude workaround by calling ChatSetAttr from inside, but obviously I would prefer a direct modification. I don't believe you can directly set/change an attribute with ONLY scriptcards.  Therefore, ChatSetAttr is the correct way to do this.
Hi everyone, I have been tinkering with Scriptcards to emulate monster cooldowns on certain abilities and have been able to make some interesting progress. The only issue is that I don't want my players to know the cooldowns of these abilities. Is there anyway to change this: --~|turnorder;addcustom;Breath of fire;5;-1 to make the created turn order item "invisible" (or from the GM layer) Thanks in advance, Boris.
I am running into some issues with a rather long scriptcard for DarkHeresy 1e attack/damage rolls.  It is full of if..else statements to handle different weapon special abilities as well as to display what part of the body is struck based on the outcome of a d100 roll (as per the dark heresy rules).  The issue is, I'm getting some wierd issues as of late that whenever I make a change to the sheet, the code will not function unless I copy/paste the code directly into EVERY single repeating section <textbox> for the weapon macro individually. I think I have narrowed the code down to the problem area  which is... !ScriptCards {{ .... Code Before ....     --?[$revRoll] -le 10|>SetHitLocation;"Head"     --?[$revRoll] -ge 11 -and -le 20|>SetHitLocation;"Right Arm"     --?[$revRoll] -ge 21 -and -le 30|>SetHitLocation;"Left Arm"     --?[$revRoll] -ge 31 -and -le 70|>SetHitLocation;"Body"     --?[$revRoll] -ge 71 -and -le 85|>SetHitLocation;"Right Leg"     --?[$revRoll] -ge 86|>SetHitLocation;"Left Leg"     --?[$revRoll] -ge 101|>SetHitLocation;"Error - Out of Range"         --:SetHitLocation| accepts hit location as parameter         --?"[&BodyHit]" -eqi "Head"|H         --?"[&BodyHit]" -eqi "Left Arm"|LA         --?"[&BodyHit]" -eqi "Body"|B         --?"[&BodyHit]" -eqi "Right Arm"|RA         --?"[&BodyHit]" -eqi "Left Leg"|LL         --?"[&BodyHit]" -eqi "Right Leg"|RL              --:H|             --&LocDisplay|Head             --=LocAV|[$HAV]             --=LocSoak|[$HSoak]             --^LocationDone|         --:LA|             --&LocDisplay|Left Arm             --=LocAV|[$LAAV]             --=LocSoak|[$LASoak]             --^LocationDone|         --:RA|             --&LocDisplay|Right Arm             --=LocAV|[$RAAV]             --=LocSoak|[$RASoak]             --^LocationDone|         --:B|             --&LocDisplay|Body             --=LocAV|[$BAV]             --=LocSoak|[$BSoak]             --^LocationDone|         --:LL|             --&LocDisplay|Left Leg             --=LocAV|[$LLAV]             --=LocSoak|[$LLSoak]             --^LocationDone|         --:RL|             --&LocDisplay|Right Leg             --=LocAV|[$RLAV]             --=LocSoak|[$RLSoak]             --^LocationDone|         --:LocationDone|          --&BodyHit|[%1%] --<| ... Code After .... This has been plaguing me for WEEKS and preventing me from making any forward progress with my character sheet.  I am getting somewhat desperate for assistance.  And I am beginning to think that this is a complicated issue I'll need direct 1on1 help with.  Which I've had mixed luck with in the past.  I am reaching a time sensitive point because the game is about to enter the next phase (moving from DH1e into DH 1e (Ascension).  Please, I could really use the assistance. If you need additional screenshots, or the full text of the code for the character sheet to test, feel free to reach out to me on discord @TobyFox2002#1527.  Also, yes.  I have no problem with my Discord being public please don't ask me if I'm sure.
1697897022
Kurt J.
Pro
API Scripter
@Toby - I don't really know anything about character sheet development other than it is always mentioned that using API stuff in a character sheet is discouraged... Though this might just be because no one without a Pro subscription can use the sheet. If you are only using it yourself, that obviously isn't an issue :) A more detailed description of " some weird issues" might be helpful to diagnose a problem as well. Are you seeing anything in the console log? What exactly is happening? Have you tried placing the weapon code in a "mule" character's ability list and just calling that from your character sheet buttons? It may be something in the character sheet build/compile/whatever process that is getting thrown off by the script code being embedded into it. Looking at the code, I can say that if can be drastically shortened by using nested variables for setting your various return variables: --?[$revRoll] -le 10|&LocCode;H --?[$revRoll] -ge 11|&LocCode;RA --?[$revRoll] -ge 21|&LocCode;LA --?[$revRoll] -ge 31|&LocCode;B --?[$revRoll] -ge 71|&LocCode;RL --?[$revRoll] -ge 86|&LocCode;LL --c[&LocCode]|H:&LocDisplay;Head|LA:&LocDisplay;Left Arm|RA:&LocDisplay;Right Arm|LL:&LocDisplay;Left Leg|RL:&LocDisplay;Right Leg|B:&LocDisplay;Body --=LocAV|[$[&LocCode]AV] --=LocSoak|[$[&LocCode]Soak] --<|
1) This is exclusively for my use only.  So PRO isnt an issue. 2) A "more detailed description" of the "wierd problems" is why I suggested that 1 on 1 might be the only way to diagnose.  The code for the ScriptCards is rather extensive and to see whats going on you'd need to join the game, or have all the code for you to reproduce.  As best I can, in brief, what I am seeing is as follows: When I press the button to roll the for the weapon attack and damage (a single button on the character sheet).  It simply spews the Scriptcards code into chat.  Period.  if I remove the --<| at the end of the SetHitLocation proceedure it will function as intended and output the scriptcard correctly.  However, the output will ALWAYS be labeled as targeting the target creature's HEAD rather than any other bodypart. Therefore, I know the exact line of code causing the issue.  Somehow, it is considering that --<| as the end of the entire script and does not acknowledge anthing after that as exisisting in the script code including the closing }} tags.  Including the html end tag of the </textarea> which is highlighted as gray in Notepad++.  It functionally makes the entire scriptcards unusable. The console log gives NOTHING, no errors, text no anything of any kind.  Which in and of itself is rather odd. I dont have any mules characters.  I dont really know how to use them properly.  As for, using character sheet buttons, I have tried that.  It works on the Custom Sandbox creator, but when I move it to the live game.. It simply stops functioning.  I haven't had a chance to reach out on the PRO forums.  Since its clearly not a Scriptcards Issue. And finally, that code may be more succinct; but I dont understand it enough to use it in my code.  Not even enough to copy and paste, if you could explain it step by step or give me the link to a youtube that uses it and explains it I'd love to learn more about how it works.
1697913106
Kurt J.
Pro
API Scripter
Toby said: 1) This is exclusively for my use only.  So PRO isnt an issue. 2) A "more detailed description" of the "wierd problems" is why I suggested that 1 on 1 might be the only way to diagnose.  The code for the ScriptCards is rather extensive and to see whats going on you'd need to join the game, or have all the code for you to reproduce.  As best I can, in brief, what I am seeing is as follows: When I press the button to roll the for the weapon attack and damage (a single button on the character sheet).  It simply spews the Scriptcards code into chat.  Period.  if I remove the --<| at the end of the SetHitLocation proceedure it will function as intended and output the scriptcard correctly.  However, the output will ALWAYS be labeled as targeting the target creature's HEAD rather than any other bodypart. Therefore, I know the exact line of code causing the issue.  Somehow, it is considering that --<| as the end of the entire script and does not acknowledge anthing after that as exisisting in the script code including the closing }} tags.  Including the html end tag of the </textarea> which is highlighted as gray in Notepad++.  It functionally makes the entire scriptcards unusable. The console log gives NOTHING, no errors, text no anything of any kind.  Which in and of itself is rather odd. I dont have any mules characters.  I dont really know how to use them properly.  As for, using character sheet buttons, I have tried that.  It works on the Custom Sandbox creator, but when I move it to the live game.. It simply stops functioning.  I haven't had a chance to reach out on the PRO forums.  Since its clearly not a Scriptcards Issue. And finally, that code may be more succinct; but I dont understand it enough to use it in my code.  Not even enough to copy and paste, if you could explain it step by step or give me the link to a youtube that uses it and explains it I'd love to learn more about how it works. That makes me think the problem you are running into is almost definitely related to the editor/builder for character sheets. The --<| is probably being confused for the beginning of an HTML tag which is never closed, meaning the rest of the content is ignored as the parser looks for the closing of the HTML tag. It therefore never hits the }}, so ScriptCards isn't seeing it as a valid script. Roll20 has this problem in several areas, and is likely escaping the code to store it (changing the < to an <) but upon editing and resaving it doesn't properly convert them again. This is a big issue with the Roll20 editor itself and short of moving code to a library or a mule character there isn't a good way around it. It *might* be possible to fool it by adding something like --\|> after that line (so the whole line would be --<| --\|> so the html parser things there is a (nonsensical) completed tag there, but it may just get even more confused :) Adding that won't bother the ScriptCards parser, so it might be worth a try. As for the code above, here is a detailed description: --?[$revRoll] -le 10|&LocCode;H --?[$revRoll] -ge 11|&LocCode;RA --?[$revRoll] -ge 21|&LocCode;LA --?[$revRoll] -ge 31|&LocCode;B --?[$revRoll] -ge 71|&LocCode;RL --?[$revRoll] -ge 86|&LocCode;LL This is fairly close to what you had, but with two changes: First, instead of setting the LocDescription to the full wording we are just setting LocCode to the letter(s) that correspond to the body parts. This is just to make things easier later. When using conditional statements, while blocks (--[ and --]) certainly work, they aren't needed if you are only doing 1 (or zero) things in response to the condition being true or false. The "&variableName;Value" syntax of the conditional statement takes care of that. The conditionals themselves eliminate the -and xxx part because it will fall through and always end up with the final result being the intended value. For example, if the roll is 45, the first line will be false, the second will be true, setting LocCode to RA. but then the next one will be true, setting it to LA. Then again, the next one will be true setting it to B. The last two will be false, meaning the LocCode won't be changed again. Now that we have a LocCode that will be H, RL, B, etc. we need to get the full description. This uses a case (--c) statement: --c[&LocCode]|H:&LocDisplay;Head|LA:&LocDisplay;Left Arm|RA:&LocDisplay;Right Arm|LL:&LocDisplay;Left Leg|RL:&LocDisplay;Right Leg|B:&LocDisplay;Body This is similar to a conditional except that it takes the value after --c (in this case whatever ended up in LocCode) and looks at each of the section after that on the line for a match. "H:&LocDisplay;Head" says if the LocCode is "H", set LocDisplay to "Head". Each possible component is separated by  vertical bar. This is useful when there are a known set of choices to distinguish between. Finally, we need to set your two return values (LocAV and LocSoak) --=LocAV|[$[&LocCode]AV] --=LocSoak|[$[&LocCode]Soak] From your original code, it looks like you already hve variables like [$HAV] and [$BSoak] where the "AV" and "Soak" are suffixes to the body parts. Since that is the case, you can avoid the multiple statements by using nested variable names. --=LocAV|[$[&LocCode]AV] will be processed by the variable replacement code into: --=LocAV|[$HAV] because [&LocCode] has an H in it. (The embedded [&LocCode] simply gets replaced with H, resulting in HAV)
Posting the full code here as: !scriptcard {{ --/| === ScriptCard Layout for Combined Hit/Damage === |\-- --/| === Version 1.0                               === |\-- --/| === Date: 10/20/2023                          === |\-- --/| Local Variables --|\ --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --/| ===== Roll Queries / Information Lookup =========== |\ --&AimType|?{Aim | No aim (+0),+0 | Half aim (+10),+10| Full aim (+20),+20} --&RoFType|?{Rate of Fire/Attack Type| Standard (+0),+0 | Semi auto (+10),+10 | Full Auto (+20),+20 | Called Shot (-20),-20 | Suppressing Fire (-20),-20} --&AtkMod|?{Modifier|0} --/| ===== Convert RQ Value into int variables --=AtkModNum|[&AtkMod] --=AimTypeNum|[&AimType] --=RangeNum|[&RangeType] --=RoFNum|[&RoFType] --/| ===== Strings =========== |\ --&AtkName|@{atkName} --&WeapNotes|@{notes} --&DamageMod|@{damagemod} --&TotalDam|@{damage}!+@{damagemod} --/| ===== Numbers =========== |\ --=AtkType|0 --=DmgPen|@{penetration} --=clip|@{clip} --=clipMax|@{clip|max} --/| ====== Damage Calculations |\ --&DamMod|@{damageMod} --&RollBase|@{damage} --&Count|[&RollBase(before,d)] --&DieType|[&RollBase(after,d)] --&TearingRoll|[=[&Count]*2]d[&DieType]kh[&Count]!+[&DamMod] --=TearingDamage|[&TearingRoll] --&NormalRoll|[=[&Count]]d[&DieType]! --=NormalDamage|[&NormalRoll]+[&DamMod] --/| ====== Damage Output Debug Text & Console Log ======= |\ --/| +Count|[&Count] d [b] Die Type [/b][&DieType] --/| +TearingRoll|[&TearingRoll] --/| +Tearing Damage|[$TearingDamage] --/| +Normal Damage |[$NormalDamage] --/|[b]Console Log (Hit/Dam Combined): Count [&Count] d [b] Die Type [/b] [&DieType] --/|[b]Console Log (Hit/Dam Combined): [b]Tearing Roll[/b] [&TearingRoll] [b]Tearing Damage[/b] [&TearingDamage] --/|[b]Console Log (Hit/Dam Combined): [b]Normal Damage[/b] [&NormalDamage] --/| Toughness --=TBon|[*T:tou-mod]+[*T:tou-unnatural-mod] --/| Unnatural Toughness --/| Unnatural Toughness Bonus minus regular toughness (for display and math) --=UnTOnly|[*T:tou-unnatural-only] --=HAV|[*T:headArmourvalue] --=LAAV|[*T:LeftArmArmourvalue] --=BAV|[*T:BodyArmourvalue] --=RAAV|[*T:RightArmArmourvalue] --=LLAV|[*T:LeftLegArmourvalue] --=RLAV|[*T:RightLegArmourvalue] --=HSoak|[*T:LeftArmArmourvalue] - [$DmgPen] --=LASoak|[*T:LeftArmArmourvalue] - [$DmgPen] --=BSoak|[*T:BodyArmourvalue] - [$DmgPen] --=RASoak|[*T:RightArmArmourvalue] - [$DmgPen] --=LLSoak|[*T:LeftLegArmourvalue] - [$DmgPen] --=RLSoak|[*T:RightLegArmourvalue] - [$DmgPen] --=HCrit|[*T:headCritDam] --=LACrit|[*T:LeftArmCritDam] --=BCrit|[*T:BodyCritDam] --=RACrit|[*T:RightArmCritDam] --=LLCrit|[*T:LeftLegCritDam] --=RLCrit|[*T:RightLegCritDam] --=HCritM|[*T:headCritDam^] --=LACritM|[*T:LeftArmCritDam^] --=BCritM|[*T:BodyCritDam^] --=RACritM|[*T:RightArmCritDam^] --=LLCritM|[*T:LeftLegCritDam^] --=RLCritM|[*T:RightLegCritDam^] --/| ===== Weapon Proficiency Full Display =========== |\ --?@{wProficiency} -eq Yes|Yes --?@{wProficiency} -eq No|No --:Yes| --&wProficiency|Yes --^wProficiencyDisplayDone| --:No| --&wProficiency|No --^wProficiencyDisplayDone| --:wProficiencyDisplayDone| --/| ===== Weapon Damage TYPE Code =========== |\ --?@{wType} -eq E|E --?@{wType} -eq I|I --?@{wType} -eq R|R --?@{wType} -eq X|X --?@{wType} -eq N|N --:E| --&DmgTypeDisplay|Energy --^DMGTypeDone| --:I| --&DmgTypeDisplay|Impact --^DMGTypeDone| --:R| --&DmgTypeDisplay|Rending --^DMGTypeDone| --:X| --&DmgTypeDisplay|Explosive --^DMGTypeDone| --:N| --&DmgTypeDisplay|None --^DMGTypeDone| --:DMGTypeDone| --/| ===== Weapon CLASS Code =========== |\ --?@{wClass} -eqi basic|Basic --?@{wClass} -eqi heavy|Heavy --?@{wClass} -eqi melee|Melee --?@{wClass} -eqi pistol|Pistol --?@{wClass} -eqi thrown|Thrown --:Basic| --&wClassDisplay|Basic --&AtkType|[*S:bs-base] [BS] --^wClassDisplayDone| --:Heavy| --&wClassDisplay|Heavy --&AtkType|[*S:bs-base] [BS] --^wClassDisplayDone| --:Melee| --&wClassDisplay|Melee --&AtkType|[*S:ws-base] [WS] --&MeleePenalty|-30 --^wClassDisplayDone| --:Pistol| --&wClassDisplay|Pistol --&AtkType|[*S:bs-base] [BS] --^wClassDisplayDone| --:Thrown| --&wClassDisplay|Thrown --&AtkType|[*S:bs-base] [BS] --^wClassDisplayDone| --:wClassDisplayDone| --/| ===== Functions =========== |\ --~sqRange|distance;@{selected|token_id};@{target|token_id} --=Range|[$sqRange] [Squares] * 1 [meters] --?[$Range] -le 3|RngPB --?[$Range] -ge 3 -and [$Range] -le @{range-s}|RngShort --?[$Range] -ge @{range-s} -and [$Range] -le @{range-n}|RngNormal --?[$Range] -ge @{range-n} -and [$Range] -le @{range-m}|RngMed --?[$Range] -ge @{range-m} -and [$Range] -le @{range-l}|RngLong --?[$Range] -ge @{range-e}|RngExtreme --:RngPB| --&AtkRange|30+[&MeleePenalty] [Point Blank] --&RngDisplay|Point Blank --^RngDone|Done --:RngShort| --&AtkRange|10 [Short] --^RngDone|Done --&RngDisplay|Short --:RngNormal| --&AtkRange|0 [Normal] --&RngDisplay|Normal --^RngDone|Done --:RngMed| --&AtkRange|0 [Medium] --&RngDisplay|Medium --^RngDone|Done --:RngLong| --&AtkRange|-10 [Long] --&RngDisplay|Long --^RngDone|Done --:RngExtreme| --&AtkRange|-30 [Extreme] --&RngDisplay|Extreme --^RngDone|Done --:RngDone| --/| ==============  DAMAGE CALCULATIONS ========== --/| ======== Sheet Workers Title/Subtitle Code ======== |\ --#title|@{atkName} --#titlecardbackground|#993333 --#leftsub|[$Range] m. [&RngDisplay] --#rightsub|Ammo @{clip}/@{clip|max} --#emoteText|[*S:t-name] attacks [*T:t-name] --/| ===== Special Qualites that effect the attack roll ====== |\ --/| ===== Tearing QUALITY =========== |\ --?@{q-tearing} -eq 1|Tearing --?@{q-tearing} -eq 0|NoTearing --:Tearing| --&DmgTearing| --&BaseDamage|[$TearingDamage] --^TearingDone| --:NoTearing| --&DmgTearing|0 --&BaseDamage|[$NormalDamage] --^TearingDone| --:TearingDone| --=DmgTearing|[&DmgTearing] --/| ===== SANCTIFIED QUALITY =========== |\ --/|Sanctified negates daemonic toughness values |\ --/| Daemonic Toughness --=DaeTBon|[*T:tou-daemonic] --?@{q-Sanctified} -eq 1|Sanctified --?@{q-Sanctified} -eq 0|NoSanctified --:Sanctified| --&DaemonicAB|0 --^SanctifiedDone| --:NoSanctified| --&DaemonicAB|[$DaeTBon] --^SanctifiedgDone| --:SanctifiedDone| --=DaeTBFinal|[&DaemonicAB] --+Daemonic TB|[$DaeTBFinal] --/| ===== Inaccurate QUALITY =========== |\ --/| @@ DETAILS: This overides the AIMTYPE variable to ZERO (0) instead of adding a new component to the AtkTarget string. --?@{q-inaccurate} -eq 1|Inaccurate --?@{q-inaccurate} -eq 0|NoInaccurate --?@{q-defensive} -eq 1|Defensive --?@{q-defensive} -eq 0|NoDefensive --:Inaccurate| --&AimType|0 --^InaccurateDone| --:NoInaccurate| --^InaccurateDone| --:InaccurateDone| --?@{q-defensive} -eq 1|Defensive --?@{q-defensive} -eq 0|NoDefensive| --:Defensive| --&AtkDefensive|-10 [Defensive] --^DefensiveDone| --:NoDefensive| --&AtkDefensive|0 --^DefensiveDone| --:DefensiveDone| --=AtkTarget|[&AtkType] + [&AimType] [Aim] + [&AtkAccurate] [Accuracy] + [&AtkRange] + [&RoFType] [Rate of Fire] + [&AtkDefensive] + [&AtkMod] [Modifier] --=AtkRoll|1d100 --&BodyHit|Null --=DegSuccess|[$AtkTarget] - [$AtkRoll] \ 10 --&DegSuccessText|[$DegSuccess] --\|[b]Console Log (Hit/Dam Combined): Degrees of Success [b]Text[/b] [&DegSuccessText] [b]Number[/b] [$DegSuccess.Total] --/| +Deg of Success|  Text [&DegSuccessText]  Number [$DegSuccess.Total] --/| === WEAPON DETAILS === --+|[c]● Weapon Details ●[/c] --+[t border=1 width=100%][tr][td][c]Class[/c][/td][td][c]Type[/c][/td][td][c]Damage[/c][/td][td][c]Pen[/c][/td][/tr][tr][td][c][&wClassDisplay][/c][/td][td][c][&DmgTypeDisplay][/c][/td][td][c]@{damage}[/c][/td][td][c][$DmgPen][/c][/td][/tr][/t]| --/| === Roll Details Tables --+|[c]● Roll Details ●[/c] --+[c][t border=2 width=95% align=center][tr][td][b]Skill    [/b][/td][td][b]Aim      [/b][/td][td][b]Range    [/b][/td][td][b]RoF      [/b][/td][td][b]Modifier [/b][/td][/tr][tr][td][&AtkType][/td][td][&AimType][/td][td][&AtkRange][/td][td][&RoFType][/td][td][&AtkMod][/td][/tr][/t][/c]| --/| ======= Test Output for Debugging (Hide When Code is Complete)  ======== --+|[c][t border=2 width=95% align=center][tr][td][b]Total  [/b][/td][td][b]Target [/b][/td][/tr][tr][td][$AtkRoll]   [/td][td][$AtkTarget] [/td][/tr][/t][/c] --/| ====== Count the Number of Allowed Attacks --/| The Rate of fire is 1 + [Rate of Fire Modifier] + [Scatter Modifier] * [Storm Weapon Modifier] --/| Rate of Fire Mods -> --/| Automatic                  = 1 per 1 degrees of success --/| Semi-Automatic             = 1 per 2 degrees of success --/| Point-Blank + Scatter      = Base * 2 --/| Storm (Blood of Martyrs)   = Base * 2 (Doubles the Number of Shots Fired) --/| The number of extra shots fired is cannot exceed the number of rounds in the gun (its overall rate of fire) or charge capacity for energy weapons. --/| Regardless of successful hits the amount of ammo expended is 1 per shot fired. --/| ====== Check And Assign Number of Attacks based on rate of fire. --/| Number of Attacks  - Addititve --?[$RoFNum] -le 0|NoExtra --?[$RoFNum] -eq 10 -and [$DegSuccess.Total] -ge 0|SemiAuto --?[$RoFNum] -eq 20 -and [$DegSuccess.Total] -ge 0|FullAuto --:SemiAuto| --=MaxAtk|@{rof2} --=RoFMod|[$DegSuccess.Total] [Successes] / 2 {CEIL} {MAX:@{rof2}} [Semi Auto] --^RoFDone| --:FullAuto| --=MaxAtk|@{rof3} --=RoFMod|[$DegSuccess.Total] [Successes] / 1 {CEIL} {MAX:@{rof3}} [Full Auto] --^RoFDone| --/| Reserved for possible Future Use and Error Checking --:NoExtra| --=MaxAtk|@{rof1} --=RoFMod|0 [No Extra Attacks] --^RoFDone| --:RoFDone| --/| ====== Check if the number of sucesses is at least 0 (a non-negative number) --?[$DegSuccess.Total] -le -1|DegDone --?[$DegSuccess.Total] -ge 0|Continue --:Continue| --=NumAtkBase|1 --^DegDone| --/| ==== Reserved for possible Future Use and Error Checking --:DegError| --^DegDone| --:DegDone| --/| Number of Attacks  - Multiplicative  --=NumAtks|[$NumAtkBase.Total] [Base] + [$RoFMod.Total] [Rate of Fire] --/| ====== Check and assign number of attacks based on SCATTER and RANGE. --/| @@ DETAILS: It is set to "30" because the output of the Roll Query is +30, as in thats how much the bonus to hit is. --/| @@ DETAILS: The equation basically is checking if the range is Point Blank and is Scatter selected. --?[$RangeNum] -ge 30 -and @{q-scatter} -eq 1|Scatter --?[$RangeNum] -lt 30 -or @{q-scatter} -eq 0|NoScatter --:Scatter| --=NumAtkScatter|[$NumAtks] * 2 --^ScatterDone| --:NoScatter| --=NumAtkScatter|0 --^ScatterDone| --:ScatterDone| --/| ====== Check and assign number of attacks based on STORM --?@{q-storm} -eq 1|Storm --?@{q-storm} -eq 0|NoStorm --:Storm| --=MaxAtk|[$MaxAtk]*2 --=NumAtkStorm|[$NumAtks] * 2 --^StormDone| --:NoStorm| --=NumAtkStorm|0 --^StormDone| --:StormDone| --+[c] ●  Number of HITS  ●[/c]| --=NumAtksTotal|[$RoFMod] [RoF] + [$NumAtkBase.Total] [Base] + [$NumAtkScatter] [Scatter] + [$NumAtkStorm] [Storm] {MAX:[$MaxAtk]}     --/| +Num|[$RoFMod] [RoF] + [$NumAtkBase.Total] [Base] + [$NumAtkScatter] [Scatter] + [$NumAtkStorm] [Storm] =  --+|[c][b][$NumAtksTotal.Total][/b][/c] --/| ===== ACCURATE QUALITY =========== |\ --=AccuracyNumDice|[$DegSuccess] / 2 {MAX:2} --=AccuracyNumDice|[$AccuracyNumDice] {ROUND} --?[$AimTypeNum] -gt 0 -and @{q-accurate} -eq 1|Accurate --?[$AimTypeNum] -eq 0 -or  @{q-accurate} -eq 0|NoAccurate --:Accurate| --=DmgAccurate|[$AccuracyNumDice]d10! {MIN:0} --^AccurateDone| --/| Fail Catch not working..... --:NoAccurate| --=DmgAccurate|0 --^AccurateDone| --:AccurateDone| --&AccuracyDmg|[$DmgAccurate]  --/| ====== Check if AttackRoll is less than the test THRESHOLD --?[$AtkRoll.Total] -le [$AtkTarget.Total]|Success --?[$AtkRoll.Total] -gt [$AtkTarget.Total]|Failure --:Success| --+[c][#3FB315]HIT! ([$DegSuccess.Total])[/#][/c]| --^Done| --:Failure| --+[c][#B31515]MISS! ([$DegSuccess.Total])[/#][/c]| --^Done| --:Jam| --+[c]JAM![/c]| --^Done| --:Done| --?[$AtkRoll] -lt 10|[ --&rollStr|0[$AtkRoll.Raw] --]|[ --&rollStr|[$AtkRoll.Raw] --]| --~len|string;length;[&rollStr] --%i|[$len];1;-1 --~s|string;substring;[&i];1;[&rollStr] --&revStr|+[&s] --%| --=revRoll|[&revStr] --<|     --?[$revRoll] -le 10|&LocCode;H --?[$revRoll] -ge 11|&LocCode;RA --?[$revRoll] -ge 21|&LocCode;LA --?[$revRoll] -ge 31|&LocCode;B --?[$revRoll] -ge 71|&LocCode;RL --?[$revRoll] -ge 86|&LocCode;LL --c[&LocCode]|H:&LocDisplay;Head|LA:&LocDisplay;Left Arm|RA:&LocDisplay;Right Arm|LL:&LocDisplay;Left Leg|RL:&LocDisplay;Right Leg|B:&LocDisplay;Body --=LocAV|[$[&LocCode]AV] --=LocSoak|[$[&LocCode]Soak] --<| --\|> --/| === DAMAGE CALCULATIONS === --=DmgPen|@{penetration} --=LocPen|[$LocAV] - [$DmgPen] {MIN:0} --/| @@@ FINAL DAMAGE ROLL ===================================== |\ --=TotalSoak|[$TBon]+[$DaeTBFinal]-[$LocPen] --=TotalDamage|[&BaseDamage]+[&AccuracyDmg]-[$TotalSoak] {MIN:0} --+[c] ● [&LocDisplay] ●[/c]| --+[t border=1 width=100%] [tr] [td][c]Toughness[/c][/td] [td][c]Armor[/c][/td] [td][c]Pen[/c][/td] [td][c]Soak[/c][/td] [/tr] [tr] [td][c][$TBon]+[$DaeTBFinal][/c][/td] [td][c] [$LocAV] [/c][/td] [td][c][$DmgPen][/c][/td] [td][c][$TotalSoak][/c][/td] [/tr] [/t]| --+[c] ● DMG Details ●[/c]| --+[t border=1 width=100%] [tr] [td][c]Base[/c][/td] [td][c]Accuracy[/c][/td] [td][c]Extra[/c][/td] [td][c]Total[/c][/td] [/tr] [tr] [td][c][&BaseDamage][/c][/td] [td][c][&AccuracyDmg] [/c][/td] [td][c][&ExtraDam][/c][/td] [td][c][$TotalDamage][/c][/td] [/tr] [/t]| }} I understand this is disgustingly overwrought and probably spaghetti code of the highest magnitude.  Using the above code, it does not output the correct  output.  Underneath the world "Miss" the two bullets should be surrounding the current body part location and beneath that the Toughness Armor, Penetration, and Soak values should all reflect which part of the body the targeted token directs to.
1698030958

Edited 1698071313
DM
Pro
I have been working with Scriptcards for about a week and I've run into problems with a macromule. I have this line in a Scriptcard macro: --+| [f6] [br] [/f] [c] [sheetbutton:#ffffff:#000000] Abysmal::Results::Abysmal[/sheetbutton]   [sheetbutton:#ffffff:#951f16]Crit Fail::Results::Crit-Fail[/sheetbutton]  [sheetbutton:#ffffff:#ff0000]Res Fail::Results::Res-Fail[/sheetbutton] [/c] [f6] [br] [/f] That successfully generates the intended card Pressing any of the bottom 9 buttons (the 'Abysmal' button in this example) should (and usually does) trigger an ability on a macromule: !scriptcard {{ --/| FORMATTING --#title| Abysmal Failure!!  --#titleCardBackground|#000000 --/| Title Card --#leftsub| [&SendingPlayerName] --+| [c] Take 4 additional points of Strain Damage [/c] --+| [c] Spend your Reaction to Defend against a Riposte. [br]   If you have no Reaction to spend, [br] you are Flat-Footed. [br] If you survive, you are disarmed or knocked prone [br] (Narrator's Choice) [/c] }} When a player (not DM) clicks on the same button, however, they get an error message (even if they trigger the first card themselves):   This behavior persists regardless of which button is pressed (with the exception of 'Attack Again' which doesn't access the mule)  Until that player manually goes into the marcromule and triggers any  ability.  After that point, the scriptcard works as intended (for that player) for the rest of the session.  Refreshing the session causes the error to recur. I'm glad for a consistent workaround, but I play with a group of older individuals that are not particularly tech-savvy (myself included) so the more this could be automated, the better.
1698101560
Kurt J.
Pro
API Scripter
@Toby - Looking at your script, I don't actually see you using a gosub (--> or > in a conditional), so the return (--<|) won't actually do anything. You should be able to take out both the --<| and the corresponding --\|> without impacting the functionality of the script.
@Kurt Well, Playing around with this I've noticed several issues.  When I remove the --<| and the --\|> the script displays, but it doesn't actually calculate any of the new code.  Neither displaying the location struck nor the armor of the target (in the location struck) nor the armor soak total based on penetration. If I look at the code that gets put into the textbox after saving (and after removing those two pieces of code).  It is missing the entirety of the code block and looks like this: --/| ====== Check if AttackRoll is less than the test THRESHOLD --?[$AtkRoll.Total] -le [$AtkTarget.Total]|Success --?[$AtkRoll.Total] -gt [$AtkTarget.Total]|Failure --:Success| --+[c][#3FB315]HIT! ([$DegSuccess.Total])[/#][/c]| --^Done| --:Failure| --+[c][#B31515]MISS! ([$DegSuccess.Total])[/#][/c]| --^Done| --:Jam| --+[c]JAM![/c]| --^Done| --:Done| --?[$AtkRoll] -lt 10|[ --&rollStr|0[$AtkRoll.Raw] --]|[ --&rollStr|[$AtkRoll.Raw] --]| --~len|string;length;[&rollStr] --%i|[$len];1;-1 --~s|string;substring;[&i];1;[&rollStr] --&revStr|+[&s] --%| --=revRoll|[&revStr] -- --/| === DAMAGE CALCULATIONS === --=DmgPen|@{penetration} --=LocPen|[$LocAV] - [$DmgPen] {MIN:0} --/| @@@ FINAL DAMAGE ROLL ===================================== |\ --=TotalSoak|[$TBon]+[$DaeTBFinal]-[$LocPen] --=TotalDamage|[&BaseDamage]+[&AccuracyDmg]-[$TotalSoak] {MIN:0} --+[c] ● [&LocDisplay] ●[/c]| --+[t border=1 width=100%] [tr] [td][c]Toughness[/c][/td] [td][c]Armor[/c][/td] [td][c]Pen[/c][/td] [td][c]Soak[/c][/td] [/tr] [tr] [td][c][$TBon]+[$DaeTBFinal][/c][/td] [td][c] [$LocAV] [/c][/td] [td][c][$DmgPen][/c][/td] [td][c][$TotalSoak][/c][/td] [/tr] [/t]| --+[c] ● DMG Details ●[/c]| --+[t border=1 width=100%] [tr] [td][c]Base[/c][/td] [td][c]Accuracy[/c][/td] [td][c]Extra[/c][/td] [td][c]Total[/c][/td] [/tr] [tr] [td][c][&BaseDamage][/c][/td] [td][c][&AccuracyDmg] [/c][/td] [td][c][&ExtraDam][/c][/td] [td][c][$TotalDamage][/c][/td] [/tr] [/t]| }} Since the code is removed nothing is calculated.  I then tried adding the --\|> immediately after the  --%| --=revRoll|[&revStr] --<| And that seems to correct the issue which means the problem is with the previous code section, where it reverses the result of the roll and uses that to determine the location struck.  I am not sure what might be causing that.  I've spent some time troubleshooting.  But still nothing.  However, another issue has arisen.. When I save the new code to the game, (either in the sandbox or in the live game).  It will not refresh in the textbox, and therefore won't roll correctly unless I open each repeating section manually, click in the textbox delete what is there and then refresh the page..  Which makes any updates effectively impossible because of the number of NPCs and character sheets I have.  Any possible way to address this?  This has been a persistent problem that seems to crop up from time to time.
1698779513
Kurt J.
Pro
API Scripter
ScriptCards 2.4.8 Live on OneClick The latest version of ScriptCards (2.4.8) is now live on Roll20 OneClick. Here are the changes since the last OneClick push: New string subfunction: replaceencoding will replace %xx codes in strings with their actual character equivalents. Currently supports angle, square, curly brackets, quotes, commas, percent, ampersand, parens, plus, minus, divide, and equals. Potentially additional codes could be added in the future. Fixes for formatting syntax and [*...] referencing special cases Object creation can now create rollable tables and table entries with the --!o# and --!oe commands. Added a new events to the ScriptCards Trigger functionlity: change:door, add:door, and destroy:door Enhancements to stored settings management (!sc-liststoredsettings) Added a reverse function for string referencing (ex: [&MyString(reverse)] which will return the string reversed front to back, so "Hello" will become "olleH") Added "bysectionid" to the --R repeating section command set. This will search a given repeating section for an ID set specified, which allows you to find repeating section entries that might be referenced elsewhere.  Added "reverse" string function: Hello World -> dlroW olleH
I'm trying to do a nested loop in ScriptCards - a for each loop containing a while loop. It seems to not work as expected - the outer for each loop is run only once, as if the inner while loop 'skips' the remaining iterations. The code itself is too probably too long and messy to include here, so I just want to ask if there are common gotchas with nested loops that I should be aware of?
1698876341
Kurt J.
Pro
API Scripter
Erudo said: I'm trying to do a nested loop in ScriptCards - a for each loop containing a while loop. It seems to not work as expected - the outer for each loop is run only once, as if the inner while loop 'skips' the remaining iterations. The code itself is too probably too long and messy to include here, so I just want to ask if there are common gotchas with nested loops that I should be aware of? Nested loops should work fine. This code runs as expected: !script {{ --&fruits(999)|Apple --&fruits(999)|Orange --&fruits(999)|Banana --&fruits(999)|Pineapple --&fruits(999)|Grape --&count(999)|1 --&count(999)|2 --&count(999)|3 --&count(999)|4 --%fruitloop|foreach;fruits --%countloop|foreach;count --+FruitCount|[&fruitloop][&countloop] --%| --%| }} I would need more details on what you are doing to see if there is anything going wrong.
1698879308
Andrew R.
Pro
Sheet Author
Just a suggestion, but I always mark the matching —% with the loop variable so I can keep track of which is which. For example,  --%fruitloop|foreach;fruits --%countloop|foreach;count --+FruitCount|[&fruitloop][&countloop] --%|countloop --%|fruitloop
1698885958

Edited 1698892246
I see what Erudo is talking about with the a while loop inside. Pulled the fruitloop from your example and the while loop example from the wiki !script {{ --&fruits(999)|Apple --&fruits(999)|Orange --&fruits(999)|Banana --&fruits(999)|Pineapple --&fruits(999)|Grape --%fruitloop|foreach;fruits --+StartLoop|[&fruitloop] --=Iteration|0 --&MyString|[=1d10 - 1] --%loop|while;[&MyString(length)] -lt 12 --=Iteration|[$Iteration] + 1 --+Iteration [$Iteration.Raw]|[&MyString] --&MyString|[&MyString][=1d10 - 1] --%| --+Final [&fruitloop]|[&MyString], [&MyString(length)] --%| }} That generates the following: So I don't see the loop going, in fact the Final line isn't printed so it's like the inner loop closes the loop EDIT: So setting the #debug setting shows that the script does just terminate after the inner while loop. I snipped some of the inner looped output but you can see that it starts with the loop fruitloop and then just ends at the end of loop loop, the inner while loop. "Setting parameter debug to value 1 - 1" "Line Counter: 2, Tag:&fruits(999), Content:Apple" "Line Counter: 3, Tag:&fruits(999), Content:Orange" "Line Counter: 4, Tag:&fruits(999), Content:Banana" "Line Counter: 5, Tag:&fruits(999), Content:Pineapple" "Line Counter: 6, Tag:&fruits(999), Content:Grape" "Line Counter: 7, Tag:%fruitloop, Content:foreach;fruits" "ScriptCards: Info - Beginning of loop fruitloop" "ContentIn: [&fruitloop] Match: [&fruitloop], vName: fruitloop, replacement Apple" "Line Counter: 8, Tag:+StartLoop, Content:Apple" "Line Counter: 9, Tag:=Iteration, Content:0" "Line Counter: 10, Tag:&MyString, Content:9" "Line Counter: 11, Tag:%loop, Content:while;1 -lt 12" "ScriptCards: Info - Beginning of loop loop" "ContentIn: [$Iteration] + 1 Match: [$Iteration], vName: Iteration, vSuffix: Total, replacement 0" < SNIP > "Line Counter: 12, Tag:=Iteration, Content:9 + 1" "ContentIn: +Iteration [$Iteration.Raw] Match: [$Iteration.Raw], vName: Iteration, vSuffix: Raw, replacement 10" "ContentIn: [&MyString] Match: [&MyString], vName: MyString, replacement 9836476192" "Line Counter: 13, Tag:+Iteration 10, Content:9836476192" "ContentIn: [&MyString][=1d10 - 1] Match: [&MyString], vName: MyString, replacement 9836476192" "Line Counter: 14, Tag:&MyString, Content:98364761926" "Line Counter: 15, Tag:%, Content:" "ContentIn: [$Iteration] + 1 Match: [$Iteration], vName: Iteration, vSuffix: Total, replacement 10" "Line Counter: 12, Tag:=Iteration, Content:10 + 1" "ContentIn: +Iteration [$Iteration.Raw] Match: [$Iteration.Raw], vName: Iteration, vSuffix: Raw, replacement 11" "ContentIn: [&MyString] Match: [&MyString], vName: MyString, replacement 98364761926" "Line Counter: 13, Tag:+Iteration 11, Content:98364761926" "ContentIn: [&MyString][=1d10 - 1] Match: [&MyString], vName: MyString, replacement 98364761926" "Line Counter: 14, Tag:&MyString, Content:983647619262" "Line Counter: 15, Tag:%, Content:" "ScriptCards: Info - End of loop loop"
1698929048
Kurt J.
Pro
API Scripter
I'll take a look at mixed nested loops and see if there is something I can do with them.
1698943548
Kurt J.
Pro
API Scripter
I had an opportunity to track down the problem here, and it has to do with how I was ending while/until loops in the code. I've made updates to the GitHub version of the script (<a href="https://github.com/kjaegers/ScriptCards/tree/main/ScriptCards_API" rel="nofollow">https://github.com/kjaegers/ScriptCards/tree/main/ScriptCards_API</a>) and will queue a push for OneClick.
Thank you Joshua for clarifying and reproducing the issue, and of course Kurt for the quick fix. I need to prep my session so I won't have time to test the fix until a week or so, will report if there are any issues but I assume it will all work.
1699052310

Edited 1699052438
Kurt J.
Pro
API Scripter
Thanks for finding this :) The fix has been queued for OneClick so hopefully will be live next week.
Heya I want to thank you all helping me with the Psyker Powers rolling sheet.&nbsp; It is mostly working great however I've weird math glitch in how things are being calculated.&nbsp; And, well surprising no-one I'm not sure why the display isnt as expected. What I have is a script that calculates the success or failure of a Psy Powers roll.&nbsp; First the user tells the script how many times to roll a d10 and it does so.&nbsp; The results of each dice are rolled and it is displayed to the chat (formatted as rolls not straight text).&nbsp; However, thats only part of whats needed.&nbsp; The result of the roll must be added to the correct ability score and the current Psy Rating of the player. My issue is that result isn't calculated correctly.&nbsp; The script fails to total all of the dice roll correctly.&nbsp; With the relevant section of the script made bold and underlined, my code is as follows: !scriptcard {{ --/| === ScriptCard Layout for Psychic Powers/Sorcery === |\-- --/| === System: WH Dark Heresy 1e/Ascention&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; === |\-- --/| === Version 1.0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; === |\-- --/| === Date: 09/26/2023&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=== |\-- --#sourceToken|@{selected|token_id} --/| String Variables --|\ --&amp;abilName|@{psyName} --&amp;abilDesc|@{psyPowersEffect} --&amp;abilDisc|@{psyDisc} --&amp;abilSubDisc|@{psySubDisc} --&amp;abilAct|@{psyAction} --&amp;abilSustain|@{psySustained} --&amp;abilUsed|@{psyFocusPower} --/| Numeric Variables --|\ --=attrMod|[*S:wp-unnatural-mod] --/| This what attribute is used in the power check --=psyMod|[*S:psyPowerMod] --=abilThreshold|@{psyThreshold} --/| Roll Queries / Lookup --|\ --=NumDice|?{How Many Dice?|1} &nbsp; --/| ======== Sheet Workers Title/Subtitle Code ======== |\ --#nominmaxhighlight|1 --#title|[&amp;abilName] --#titlecardbackground|#993333 --#leftsub|[&amp;abilDisc] ([&amp;abilSubDisc]) --#rightsub|Threshold [$abilThreshold] ** Overbleed ## --+Rolling|[$NumDice.Total]d10 &nbsp;&nbsp; --=CountNines|0 --=TotalRoll|0 --&amp;DieResults| --%i|1;[$NumDice];1 --=ThisRoll|1d10 --/|&nbsp; Total Roll is the final calculated roll plus/minus modifiers. --=TotalRoll|[$TotalRoll] + [$ThisRoll] + [$attrMod] + [$psyMod] --?[$ThisRoll] -eq 9|[ --=CountNines|[$CountNines] + 1 --&amp;DieResults|+ [roll:f][$ThisRoll.Raw][/roll] --]|[ --&amp;DieResults|+ [roll][$ThisRoll.Raw][/roll] --]| --%| &nbsp; &nbsp; --+[c] ● Results ●[/c]| --+[&amp;DieResults]| --+Total|Total Dice [$TotalRoll] [b] Nines: [/b] [$CountNines] --+[c] ● Description ●[/c]| --+[c][t border=1 style='width:100%; color:#FFFFFF; background:#993333'] [tr] [td]Action[/td] [td]Sustained[/td] [td]Dice[/td] [td]Focus Power[/td] [/tr] [tr] [td][&amp;abilAct][/td] [td][&amp;abilSustain][/td] [td][$NumDice][/td] [td][&amp;abilUsed][/td] [/tr] [/t]|[/c] --+|[&amp;abilDesc] }} Thanks in advance for the tremendous help.
Toby, what sort of issues are you seeing where it's not adding up correctly? Sums too high? Too low? Not a number? If you print out the modifiers: --*DEBUG|Attr [$attrMod] Psy: [$psyMod] before the loop, do they look correct to you? Has this ever worked correctly? How about if you hardcode numbers in and make them both 1? Does the die result come out correct if you make them both 0, just to confirm the actual die results are summed correctly?
Hmm I have tried that and it did reveal there was an issue with one of the variables not being assigned. I fixed that issue, then real life got in the way of working.&nbsp; Have just had a chance to post my results and deeper explanation of my issue. Here is a screenshot of the chat output, yeah I know the formatting is rather ugly.&nbsp; Will fix that eventually. As you see the total dice is not reflecting the actual total of the dice being rolled.&nbsp; Since its not calculating that number correctly nothing else after hat seems to be correct.&nbsp; I have a feeling its because the total dice (&amp;DieResults) is being handled as a string to accommodate the success/fail colors.&nbsp; It is somehow messing with the script's ability to total those dice.&nbsp; But I am not entirely sure.
Can you post your most recent code then? In the code above, DieResults are a not used in the calculation. They are used to display after the loop is over. Using your code above, and statically assigning some values since I don't have those attributes, I see the calculation working fine. Rolling 3d10 resulted in a 13 total from the dice and then an 18 from the 4 and 2 getting applied to each roll and the total as 31. Like I said I did hardcode the 4 and 2 to emulate your values above and then added a debug statement in the loop to confirm. --=CountNines|0 --=TotalRoll|0 --&amp;DieResults| --%i|1;[$NumDice];1 --=ThisRoll|1d10 --/| Total Roll is the final calculated roll plus/minus modifiers. --=TotalRoll|[$TotalRoll] + [$ThisRoll] + [$attrMod] + [$psyMod] --?[$ThisRoll] -eq 9|[ --=CountNines|[$CountNines] + 1 --&amp;DieResults|+ [roll:f][$ThisRoll.Raw][/roll] --]|[ --&amp;DieResults|+ [roll][$ThisRoll.Raw][/roll] --]| --+DEBUG Roll [&amp;i]|Roll:[$ThisRoll] Total so far:[$TotalRoll] --%| So the DieResults are not used in any calculation there. Not sure if you have altered the code though since the original post but from the original post I don't see any mistakes in summing the values.
Oh my.. I think I see a flaw...&nbsp; The addition of the AttrMod and psyMod are inside the loop..&nbsp; &nbsp;They shouldnt be adding their value during each iteration.&nbsp; Instead only once.&nbsp; I'll have to see if changing this makes a difference.&nbsp; But here, as requested is the code segment you desired: --=CountNines|0 --=TotalRoll|0 --&amp;DieResults| --%i|1;[$NumDice];1 --=ThisRoll|1d10 --=TotalRoll|[$TotalRoll] + [$attrMod] + [$psyMod] --?[$ThisRoll] -eq 9|[ --=CountNines|[$CountNines] + 1 --&amp;DieResults|+ [roll:f][$ThisRoll.Raw][/roll] --]|[ --&amp;DieResults|+ [roll][$ThisRoll.Raw][/roll] --]| --%| &nbsp; &nbsp; --+[c] ● Results ●[/c]| --+[&amp;DieResults]| --+Total|Total Dice [$TotalRoll] [b] Nines: [/b] [$CountNines] --+[c] ● Description ●[/c]| --+[c][t border=1 style='width:100%; color:#FFFFFF; background:#993333'] [tr] [td]Action[/td] [td]Sustained[/td] [td]Dice[/td] [td]Focus Power[/td] [/tr] [tr]1 [td][&amp;abilAct][/td] [td][&amp;abilSustain][/td] [td][$NumDice][/td] [td][&amp;abilUsed][/td] [/tr] [/t]|[/c] --*DEBUG|Dicepool [&amp;DieResults] Willpower [$attrMod] Psy: [$psyMod] --+|[&amp;abilDesc]
1700149092

Edited 1700149440
Ahh ok. Glad you found that. I would say then the loop should probably look more like this then: --=CountNines|0 --=TotalRoll|[$attrMod] + [$psyMod] --&amp;DieResults| --%i|1;[$NumDice];1 --=ThisRoll|1d10 --=TotalRoll|[$TotalRoll] + [$ThisRoll] --?[$ThisRoll] -eq 9|[ --=CountNines|[$CountNines] + 1 --&amp;DieResults|+ [roll:f][$ThisRoll.Raw][/roll] --]|[ --&amp;DieResults|+ [roll][$ThisRoll.Raw][/roll] --]| --%| Hopefully that will take care of the incorrect sums you see. EDIT: Move to just add the mods at the first declaration of TotalRoll instead of the end. More concise.
I'm just barely starting to dip my toes into scripts and Scriptcards. I'm trying to make sense of the 5e Action Menu as found on the Github. In my tests, whenever I use one token to cause damage, such as a Dagger or Ray of Frost, it pops up a GM menu that asks how to apply damage, and it seems to deal damage to the 'attacker' rather than the actual target. It only applies the damage to the target if I have the targeted enemy selected. Does this mean that when running the actual game, I have to select the PC's target each time, or is there a way for it to know how to apply it to the target with no selection necessary (outside of the initial targeting parameters)?
Hey Warren, That ScriptCard has other configuration options available to apply damage if you prefer. It defaults to giving the DM control before applying damage but if you look into the configuration settings you'll find: --/|Set this to either "scriptcards", "token-mod", "alterbars", "damagebuttons" or anything else to not apply damage --&amp;damageApplyScript|damagebuttons It's in the section that says: --/| More generalized settings. You may not need to change these. So if you don't want to review before applying damage you can change that setting from damagebuttons to scriptcards and it will bypass whispering the buttons.
Hello there. Here's a scriptcard that took me quite a long time to write. I'm sure the structure could be better, but maybe you can still find it useful in some way. Enjoy :) !scriptcard&nbsp; {{ +++5E Tools+++ &nbsp; --#debug|0 &nbsp; --&amp;ReentrantName|[&amp;SendingPlayerID] &nbsp; --#reentrant|[&amp;ReentrantName] Features &amp; Traits &nbsp; --#title|🎭Features &amp; Traits&nbsp; &nbsp; --#whisper|self,gm &nbsp; --#buttonFontFace|Helvetica &nbsp; --#buttonFontSize|small &nbsp; --#bodyFontSize|12px &nbsp; --#titlecardbackground|#993333 &nbsp; --#oddRowBackground|#d6d4d5 &nbsp; --#evenRowBackground|#d6d4d5 &nbsp; --#evenRowFontColor|#000000 &nbsp; --#oddRowFontColor|#000000 &nbsp; --#buttonBorderColor|#d6d4d5 &nbsp; --#buttonBackground|#d6d4d5 &nbsp; --#buttonTextColor|#000 &nbsp; --#buttonPadding|3px &nbsp; --#tableShadow|5px 3px 3px 0px #121212 &nbsp; --#rollhilightcolornormal|#d6d4d5 &nbsp; --#rollhilightlineheight|1.2em &nbsp;--/|Build resource arrays &nbsp;--?"@{selected|class_resource_name}" -ninc ""|&amp;AddResource;+,@{selected|class_resource_name} &nbsp;--?"@{selected|other_resource_name} " -ninc ""|&amp;AddResource;+,@{selected|other_resource_name} &nbsp;--Rfirst|@{selected|character_id};repeating_resource &nbsp;--:resourceLoop| &nbsp;--?"[*R:name]" -eq NoRepeatingAttributeLoaded|endresourceloop &nbsp;--?"[*R:resource_left_name]" -ninc ""|&amp;AddResource;+,[*R:resource_left_name] &nbsp;--?"[*R:resource_right_name]" -ninc ""|&amp;AddResource;+,[*R:resource_right_name] &nbsp;--Rnext| &nbsp;--&gt;resourceLoop|&nbsp;&nbsp; &nbsp;--:endresourceloop| &nbsp;--~|array;fromstring;ResourceArray;,;[&amp;AddResource] &nbsp;--/|Build features &amp; traits arrays &nbsp;--Rfirst|@{selected|character_id};repeating_traits &nbsp;--:featurestraitsLoop| &nbsp;--?"[*R:name]" -eq NoRepeatingAttributeLoaded|endfeaturestraitsloop &nbsp;--?"[*R:name]" -eq NoRepeatingAttributeLoaded|endfeaturestraitsloop &nbsp;--?"[*R:source]" -inc "Racial"|&amp;NameRacial;Racial &nbsp;--?"[*R:source]" -inc "Class"|&amp;NameClass;Class &nbsp;--?"[*R:source]" -inc "Feat"|&amp;NameFeat;Feat &nbsp;--?"[*R:source]" -inc "Background"|&amp;NameBackground;Background &nbsp;--?"[*R:source]" -inc "Racial"|&amp;AddRacial;+,[*R:name] &nbsp;--?"[*R:source]" -inc "Class"|&amp;AddClass;+,[*R:name] &nbsp;--?"[*R:source]" -inc ""|&amp;AddClass;+,[*R:name] &nbsp;--?"[*R:source]" -inc "Feat"|&amp;AddFeat;+,[*R:name] &nbsp;--?"[*R:source]" -inc "Background"|&amp;AddBackground;+,[*R:name] &nbsp;--Rnext| &nbsp;--&gt;featurestraitsLoop|&nbsp;&nbsp; &nbsp;--:endfeaturestraitsloop| &nbsp;--~|array;fromstring;RacialArray;,;[&amp;AddRacial] &nbsp;--~|array;fromstring;ClassArray;,;[&amp;AddClass] &nbsp;--~|array;fromstring;FeatArray;,;[&amp;AddFeat] &nbsp;--~|array;fromstring;BackgroundArray;,;[&amp;AddBackground] &nbsp;--/|Build modifier arrays &nbsp;--Rfirst|@{selected|character_id};repeating_damagemod &nbsp;--:damgemodLoop| &nbsp;--?"[*R:global_damage_name]" -eq NoRepeatingAttributeLoaded|enddamagemod &nbsp;--&amp;DamageName|+,[*R:global_damage_name] &nbsp;--&amp;DamageFlag|+,[*R:global_damage_active_flag] &nbsp;--&amp;DamageStringFlag|+,[*R&gt;global_damage_active_flag] &nbsp;--Rnext| &nbsp;--&gt;damgemodLoop|&nbsp;&nbsp; &nbsp;--:enddamagemod| &nbsp;--~|array;fromstring;DamageFlagArray;,;[&amp;DamageFlag] &nbsp;--~|array;fromstring;DamageFlagStringArray;,;[&amp;DamageStringFlag] &nbsp;--~|array;fromstring;DamageNameArray;,;[&amp;DamageName] &nbsp;--Rfirst|@{selected|character_id};repeating_savemod &nbsp;--:savemodLoop| &nbsp;--?"[*R:global_save_name]" -eq NoRepeatingAttributeLoaded|endsavemod &nbsp;--&amp;SaveName|+,[*R:global_save_name] &nbsp;--&amp;SaveFlag|+,[*R:global_save_active_flag] &nbsp;--&amp;SaveStringFlag|+,[*R&gt;global_save_active_flag] &nbsp;--Rnext| &nbsp;--&gt;savemodLoop|&nbsp;&nbsp; &nbsp;--:endsavemod| &nbsp;--~|array;fromstring;SaveFlagArray;,;[&amp;SaveFlag] &nbsp;--~|array;fromstring;SaveFlagStringArray;,;[&amp;SaveStringFlag] &nbsp;--~|array;fromstring;SaveNameArray;,;[&amp;SaveName] &nbsp;--Rfirst|@{selected|character_id};repeating_tohitmod &nbsp;--:attackmodLoop| &nbsp;--?"[*R:global_attack_name]" -eq NoRepeatingAttributeLoaded|endattackmod &nbsp;--&amp;AttackName|+,[*R:global_attack_name] &nbsp;--&amp;AttackFlag|+,[*R:global_attack_active_flag] &nbsp;--&amp;AttackStringFlag|+,[*R&gt;global_attack_active_flag] &nbsp;--Rnext| &nbsp;--&gt;attackmodLoop|&nbsp;&nbsp; &nbsp;--:endattackmod| &nbsp;--~|array;fromstring;AttackFlagArray;,;[&amp;AttackFlag] &nbsp;--~|array;fromstring;AttackFlagStringArray;,;[&amp;AttackStringFlag] &nbsp;--~|array;fromstring;AttackNameArray;,;[&amp;AttackName] &nbsp;--Rfirst|@{selected|character_id};repeating_skillmod &nbsp;--:skillmodLoop| &nbsp;--?"[*R:global_skill_name]" -eq NoRepeatingAttributeLoaded|endskillmod &nbsp;--&amp;SkillName|+,[*R:global_skill_name] &nbsp;--&amp;SkillFlag|+,[*R:global_skill_active_flag] &nbsp;--&amp;SkillStringFlag|+,[*R&gt;global_skill_active_flag] &nbsp;--Rnext| &nbsp;--&gt;skillmodLoop|&nbsp;&nbsp; &nbsp;--:endskillmod| &nbsp;--~|array;fromstring;SkillFlagArray;,;[&amp;SkillFlag] &nbsp;--~|array;fromstring;SkillFlagStringArray;,;[&amp;SkillStringFlag] &nbsp;--~|array;fromstring;SkillNameArray;,;[&amp;SkillName] &nbsp;--Rfirst|@{selected|character_id};repeating_acmod &nbsp;--:acmodLoop| &nbsp;--?"[*R:global_ac_name]" -eq NoRepeatingAttributeLoaded|endacmod &nbsp;--&amp;ACName|+,[*R:global_ac_name] &nbsp;--&amp;ACFlag|+,[*R:global_ac_active_flag] &nbsp;--&amp;ACStringFlag|+,[*R&gt;global_ac_active_flag] &nbsp;--Rnext| &nbsp;--&gt;acmodLoop|&nbsp;&nbsp; &nbsp;--:endacmod| &nbsp;--~|array;fromstring;ACFlagArray;,;[&amp;ACFlag] &nbsp;--~|array;fromstring;ACFlagStringArray;,;[&amp;ACStringFlag] &nbsp;--~|array;fromstring;ACNameArray;,;[&amp;ACName] &nbsp;--/|Start race loop &nbsp;--~Racial|array;getfirst;RacialArray &nbsp;--?"[&amp;NameRacial]" -inc "Racial"|&gt;racialname &nbsp;--?"[&amp;Racial]" -inc ""|skipracial &nbsp;--:RacialArrayLoop| &nbsp;--&amp;name|[&amp;Racial] &nbsp;--&amp;titlename|[&amp;Racial] &nbsp;--/|Circle through mule options &nbsp;--&amp;UseMule| &nbsp;--/|Circle through modifier arrays &nbsp;--&amp;ACMOD| &nbsp;--&amp;ATTACKMOD| &nbsp;--&amp;DAMAGEMOD| &nbsp;--&amp;SAVEMOD| &nbsp;--&amp;SKILLMOD| &nbsp;--&amp;Resource| &nbsp;--~NameLoop|array;getfirst;DamageNameArray &nbsp;--:RacialDamageNameLoop| &nbsp;--~NameIndexLoop|array;getindex;DamageNameArray &nbsp;--&amp;NameValue|[&amp;NameIndexLoop] &nbsp;--?"[&amp;Racial]" -inc "[&amp;NameLoop]"|&gt;Damage &nbsp;--~NameLoop|array;getnext;DamageNameArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|RacialDamageNameLoop &nbsp;--~NameLoop|array;getfirst;SaveNameArray &nbsp;--:RacialSaveNameLoop| &nbsp;--~NameIndexLoop|array;getindex;SaveNameArray &nbsp;--&amp;NameValue|[&amp;NameIndexLoop] &nbsp;--?"[&amp;Racial]" -inc "[&amp;NameLoop]"|&gt;Save &nbsp;--~NameLoop|array;getnext;SaveNameArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|RacialSaveNameLoop &nbsp;--~NameLoop|array;getfirst;AttackNameArray &nbsp;--:RacialAttackNameLoop| &nbsp;--~NameIndexLoop|array;getindex;AttackNameArray &nbsp;--&amp;NameValue|[&amp;NameIndexLoop] &nbsp;--?"[&amp;Racial]" -inc "[&amp;NameLoop]"|&gt;Attack &nbsp;--~NameLoop|array;getnext;AttackNameArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|RacialAttackNameLoop &nbsp;--~NameLoop|array;getfirst;SkillNameArray &nbsp;--:RacialSkillNameLoop| &nbsp;--~NameIndexLoop|array;getindex;SkillNameArray &nbsp;--&amp;NameValue|[&amp;NameIndexLoop] &nbsp;--?"[&amp;Racial]" -inc "[&amp;NameLoop]"|&gt;Skill &nbsp;--~NameLoop|array;getnext;SkillNameArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|RacialSkillNameLoop &nbsp;--~NameLoop|array;getfirst;ACNameArray &nbsp;--:RacialACNameLoop| &nbsp;--~NameIndexLoop|array;getindex;ACNameArray &nbsp;--&amp;NameValue|[&amp;NameIndexLoop] &nbsp;--?"[&amp;Racial]" -inc "[&amp;NameLoop]"|&gt;AC &nbsp;--~NameLoop|array;getnext;ACNameArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|RacialACNameLoop &nbsp;--~NameLoop|array;getfirst;ResourceArray &nbsp;--:ResourceNameRacialLoop| &nbsp;--?"[&amp;Racial]" -inc "[&amp;NameLoop]" -or "[&amp;NameLoop]" -inc "[&amp;Racial]"|&gt;RetrieveResource &nbsp;--~NameLoop|array;getnext;ResourceArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|ResourceNameRacialLoop &nbsp;--+[rbutton][&amp;titlename]::description;[&amp;name][/rbutton][&amp;Resource]|[&amp;ACMOD][&amp;SKILLMOD][&amp;DAMAGEMOD][&amp;ATTACKMOD][&amp;SAVEMOD][&amp;UseMule] &nbsp;--:endracialmodarray| &nbsp;--:skipracial| &nbsp;--~Racial|array;getnext;RacialArray &nbsp;--?"[&amp;Racial]" -ninc "ArrayError"|RacialArrayLoop &nbsp;--/|Start class loop &nbsp;--~Class|array;getfirst;ClassArray &nbsp;--?"[&amp;NameClass]" -inc "Class"|&gt;classname &nbsp;--?"[&amp;Class]" -inc ""|skipclass &nbsp;--:ClassArrayLoop| &nbsp;--&amp;name|[&amp;Class] &nbsp;--&amp;titlename|[&amp;Class] &nbsp;--/|Class options to skip &nbsp;--?"[&amp;Class]" -inc "Careful Spell" -or "[&amp;Class]" -inc "Distant Spell" -or "[&amp;Class]" -inc "Empowered Spell" -or "[&amp;Class]" -inc "Extended Spell" -or "[&amp;Class]" -inc "Hightened Spell" -or "[&amp;Class]" -inc "Quickened Spell" -or "[&amp;Class]" -inc "Subtle Spell" -or "[&amp;Class]" -inc "Twined Spell" -or "[&amp;Class]" -inc "Trip Attack" -or "[&amp;Class]" -inc "Sweeping Attack" -or "[&amp;Class]" -inc "Riposte" -or "[&amp;Class]" -inc "Rally" -or "[&amp;Class]" -inc "Pushing Attack" -or "[&amp;Class]" -inc "Precision Attack" -or "[&amp;Class]" -inc "Parry" -or "[&amp;Class]" -inc "Menacing Attack" -or "[&amp;Class]" -inc "Maneuvering Attack" -or "[&amp;Class]" -inc "Lunging Attack" -or "[&amp;Class]" -inc "Goading Attack" -or "[&amp;Class]" -inc "Feinting Attack" -or "[&amp;Class]" -inc "Distracting Strike" -or "[&amp;Class]" -inc "Disarming Attack" -or "[&amp;Class]" -inc "Evasive Footwork" -or "[&amp;Class]" -inc "Brace" -or "[&amp;Class]" -inc "Commander's Strike"|skipclass &nbsp;--/|Class options with identical names &nbsp;--?"[&amp;Class]" -inc "Channel divinity"|&gt;channeldivinity &nbsp;--?"[&amp;Class]" -inc "Deft Explorer"|&amp;name;Deft Explorer &nbsp;--?"[&amp;Class]]" -inc "Fighting Style"|&gt;fightingstyle &nbsp;--?"[&amp;Class]" -inc "Favored Enemy"|&gt;favoredenemy &nbsp;--?"[&amp;Class]" -inc "Natural Explorer"|&amp;name;Natural Explorer &nbsp;--?"[&amp;Class]" -inc "Eldritch Invocation"|&gt;eldritchinvocation &nbsp;--/|Circle through mule options &nbsp;--&amp;UseMule| &nbsp;--?"[&amp;Class]" -inc "Action Surge" -or "[&amp;Class]" -inc "Second Wind" -or "[&amp;Class]" -inc "Might" -or "[&amp;Class]" -inc "Cloud Rune" -or "[&amp;Class]" -inc "Fire Rune" -or "[&amp;Class]" -inc "Reckless Attack" -or "[&amp;Class]" -inc "Eldritch Cannon" -or "[&amp;Class]" -inc "Hexblade" -or "[&amp;Class]" -inc "Pact of the Blade" -or "[&amp;Class]" -inc "Metamagic" -or "[&amp;Class]" -inc "Flexible Casting" -or "[&amp;Class]" -inc "Wild Shape" -or "[&amp;Class]" -inc "Flurry of Blows" -or "[&amp;Class]" -inc "Patient Defense" -or "[&amp;Class]" -inc "Step of the Wind" -or "[&amp;Class]" -inc "Deflect Missiles" -or "[&amp;Class]" -inc "Stunning Strike" -or "[&amp;Class]" -inc "Diamond Soul" -or "[&amp;Class]" -inc "Empty Body" -or "[&amp;Class]" -inc "Song of Rest" -or "[&amp;Class]" -inc "Countercharm" -or "[&amp;Class]" -inc "Gathered Swarm" -or "[&amp;Class]" -inc "Divine Smite" -or "[&amp;Class]" -inc "Lay on Hands" -or "[&amp;Class]" -inc "Wild Surge" -or "[&amp;Class]" -inc "Bardic Inspiration" -or "[&amp;Class]" -inc "Manifest Echo" -or "[&amp;Class]" -inc "Divine Sense" -or "[&amp;Class]" -inc "Maneuvers" -or "[&amp;Class]" -inc "Wild Surge" -or "[&amp;Class]" -inc "Turn Undead" -or "[&amp;Class]" -inc "Unleash Incarnation" -or "[&amp;Class]" -inc "Arcane Ward" -or "[&amp;Class]" -inc "Tireless"|&gt;UseMule &nbsp;--/|Circle through modifier arrays &nbsp;--&amp;ACMOD| &nbsp;--&amp;ATTACKMOD| &nbsp;--&amp;DAMAGEMOD| &nbsp;--&amp;SAVEMOD| &nbsp;--&amp;SKILLMOD| &nbsp;--&amp;Resource| &nbsp;--~NameLoop|array;getfirst;DamageNameArray &nbsp;--:ClassDamageNameLoop| &nbsp;--~NameIndexLoop|array;getindex;DamageNameArray &nbsp;--&amp;NameValue|[&amp;NameIndexLoop] &nbsp;--?"[&amp;Class]" -inc "[&amp;NameLoop]"|&gt;Damage &nbsp;--:SkipRacialDamageMod| &nbsp;--~NameLoop|array;getnext;DamageNameArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|ClassDamageNameLoop &nbsp;--~NameLoop|array;getfirst;SaveNameArray &nbsp;--:ClassSaveNameLoop| &nbsp;--~NameIndexLoop|array;getindex;SaveNameArray &nbsp;--&amp;NameValue|[&amp;NameIndexLoop] &nbsp;--?"[&amp;Class]" -inc "[&amp;NameLoop]"|&gt;Save &nbsp;--~NameLoop|array;getnext;SaveNameArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|ClassSaveNameLoop &nbsp;--~NameLoop|array;getfirst;AttackNameArray &nbsp;--:ClassAttackNameLoop| &nbsp;--~NameIndexLoop|array;getindex;AttackNameArray &nbsp;--&amp;NameValue|[&amp;NameIndexLoop] &nbsp;--?"[&amp;Class]" -inc "[&amp;NameLoop]"|&gt;Attack &nbsp;--~NameLoop|array;getnext;AttackNameArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|ClassAttackNameLoop &nbsp;--~NameLoop|array;getfirst;SkillNameArray &nbsp;--:ClassSkillNameLoop| &nbsp;--~NameIndexLoop|array;getindex;SkillNameArray &nbsp;--&amp;NameValue|[&amp;NameIndexLoop] &nbsp;--?"[&amp;Class]" -inc "[&amp;NameLoop]"|&gt;Skill &nbsp;--~NameLoop|array;getnext;SkillNameArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|ClassSkillNameLoop &nbsp;--~NameLoop|array;getfirst;ACNameArray &nbsp;--:ClassACNameLoop| &nbsp;--~NameIndexLoop|array;getindex;ACNameArray &nbsp;--&amp;NameValue|[&amp;NameIndexLoop] &nbsp;--?"[&amp;Class]" -inc "[&amp;NameLoop]"|&gt;AC &nbsp;--~NameLoop|array;getnext;ACNameArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|ClassACNameLoop &nbsp;--~NameLoop|array;getfirst;ResourceArray &nbsp;--:ResourceNameClassLoop| &nbsp;--?"[&amp;NameLoop]" -eq "Tinkers" -and "[&amp;Class]" -eq "Magical Tinkering"|&gt;RetrieveResource &nbsp;--?"[&amp;NameLoop]" -eq "Infused Items" -and "[&amp;Class]" -eq "Infuse Item"|&gt;RetrieveResource &nbsp;--?"[&amp;Class]" -inc "[&amp;NameLoop]" -or "[&amp;NameLoop]" -inc "[&amp;Class]"|&gt;RetrieveResource &nbsp;--~NameLoop|array;getnext;ResourceArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|ResourceNameClassLoop &nbsp;--+[rbutton][&amp;titlename]::description;[&amp;name][/rbutton][&amp;Resource]|[&amp;ACMOD][&amp;SKILLMOD][&amp;DAMAGEMOD][&amp;ATTACKMOD][&amp;SAVEMOD][&amp;UseMule] &nbsp;--:endclasslmodarray| &nbsp;--:skipclass| &nbsp;--~Class|array;getnext;ClassArray &nbsp;--?"[&amp;Class]" -ninc "ArrayError"|ClassArrayLoop &nbsp;--/|Start feat loop &nbsp;--~Feat|array;getfirst;FeatArray &nbsp;--?"[&amp;NameFeat]" -inc "Feat"|&gt;featname &nbsp;--?"[&amp;Feat]" -inc ""|skipfeat &nbsp;--:FeatArrayLoop| &nbsp;--&amp;name|[&amp;Feat] &nbsp;--&amp;titlename|[&amp;Feat] &nbsp;--/|Circle through mule options &nbsp;--&amp;UseMule| &nbsp;--?"[&amp;Feat]" -inc "Lucky"|&gt;UseMule &nbsp;--/|Circle through modifier arrays &nbsp;--&amp;ACMOD| &nbsp;--&amp;ATTACKMOD| &nbsp;--&amp;DAMAGEMOD| &nbsp;--&amp;SAVEMOD| &nbsp;--&amp;SKILLMOD| &nbsp;--&amp;Resource| &nbsp;--~NameLoop|array;getfirst;DamageNameArray &nbsp;--:FeatDamageNameLoop| &nbsp;--~NameIndexLoop|array;getindex;DamageNameArray &nbsp;--&amp;NameValue|[&amp;NameIndexLoop] &nbsp;--?"[&amp;Feat]" -inc "[&amp;NameLoop]"|&gt;Damage &nbsp;--~NameLoop|array;getnext;DamageNameArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|FeatDamageNameLoop &nbsp;--~NameLoop|array;getfirst;SaveNameArray &nbsp;--:FeatSaveNameLoop| &nbsp;--~NameIndexLoop|array;getindex;SaveNameArray &nbsp;--&amp;NameValue|[&amp;NameIndexLoop] &nbsp;--?"[&amp;Feat]" -inc "[&amp;NameLoop]"|&gt;Save &nbsp;--~NameLoop|array;getnext;SaveNameArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|FeatSaveNameLoop &nbsp;--~NameLoop|array;getfirst;AttackNameArray &nbsp;--:FeatAttackNameLoop| &nbsp;--~NameIndexLoop|array;getindex;AttackNameArray &nbsp;--&amp;NameValue|[&amp;NameIndexLoop] &nbsp;--?"[&amp;Feat]" -inc "[&amp;NameLoop]"|&gt;Attack &nbsp;--~NameLoop|array;getnext;AttackNameArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|FeatAttackNameLoop &nbsp;--~NameLoop|array;getfirst;SkillNameArray &nbsp;--:FeatSkillNameLoop| &nbsp;--~NameIndexLoop|array;getindex;SkillNameArray &nbsp;--&amp;NameValue|[&amp;NameIndexLoop] &nbsp;--?"[&amp;Feat]" -inc "[&amp;NameLoop]"|&gt;Skill &nbsp;--~NameLoop|array;getnext;SkillNameArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|FeatSkillNameLoop &nbsp;--~NameLoop|array;getfirst;ACNameArray &nbsp;--:FeatACNameLoop| &nbsp;--~NameIndexLoop|array;getindex;ACNameArray &nbsp;--&amp;NameValue|[&amp;NameIndexLoop] &nbsp;--?"[&amp;Feat]" -inc "[&amp;NameLoop]"|&gt;AC &nbsp;--~NameLoop|array;getnext;ACNameArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|FeatACNameLoop &nbsp;--~NameLoop|array;getfirst;ResourceArray &nbsp;--:ResourceNameFeatLoop| &nbsp;--?"[&amp;NameLoop]" -eq "Luck [l]" -and "[&amp;Feat]" -inc "Lucky"|&gt;RetrieveResource &nbsp;--?"[&amp;Feat]" -inc "[&amp;NameLoop]" -or "[&amp;NameLoop]" -inc "[&amp;Feat]"|&gt;RetrieveResource &nbsp;--~NameLoop|array;getnext;ResourceArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|ResourceNameFeatLoop &nbsp;--+[rbutton][&amp;titlename]::description;[&amp;name][/rbutton][&amp;Resource]|[&amp;ACMOD][&amp;SKILLMOD][&amp;DAMAGEMOD][&amp;ATTACKMOD][&amp;SAVEMOD][&amp;UseMule] &nbsp;--:skipfeat| &nbsp;--~Feat|array;getnext;FeatArray &nbsp;--?"[&amp;Feat]" -ninc "ArrayError"|FeatArrayLoop &nbsp;--/|Start background loop &nbsp;--~Background|array;getfirst;BackgroundArray &nbsp;--?"[&amp;NameBackground]" -inc "Background"|&gt;backgroundname &nbsp;--?"[&amp;Background]" -inc ""|skipbackground &nbsp;--:BackgroundArrayLoop| &nbsp;--&amp;name|[&amp;Background] &nbsp;--&amp;titlename|[&amp;Background] &nbsp;--/|Circle through mule options &nbsp;--&amp;UseMule| &nbsp;--/|Circle through modifier arrays &nbsp;--&amp;ACMOD| &nbsp;--&amp;ATTACKMOD| &nbsp;--&amp;DAMAGEMOD| &nbsp;--&amp;SAVEMOD| &nbsp;--&amp;SKILLMOD| &nbsp;--&amp;Resource| &nbsp;--~NameLoop|array;getfirst;DamageNameArray &nbsp;--:BackgroundDamageNameLoop| &nbsp;--~NameIndexLoop|array;getindex;DamageNameArray &nbsp;--&amp;NameValue|[&amp;NameIndexLoop] &nbsp;--?"[&amp;Background]" -inc "[&amp;NameLoop]"|&gt;Damage &nbsp;--~NameLoop|array;getnext;DamageNameArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|BackgroundDamageNameLoop &nbsp;--~NameLoop|array;getfirst;SaveNameArray &nbsp;--:BackgroundSaveNameLoop| &nbsp;--~NameIndexLoop|array;getindex;SaveNameArray &nbsp;--&amp;NameValue|[&amp;NameIndexLoop] &nbsp;--?"[&amp;Background]" -inc "[&amp;NameLoop]"|&gt;Save &nbsp;--~NameLoop|array;getnext;SaveNameArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|BackgroundSaveNameLoop &nbsp;--~NameLoop|array;getfirst;AttackNameArray &nbsp;--:BackgroundAttackNameLoop| &nbsp;--~NameIndexLoop|array;getindex;AttackNameArray &nbsp;--&amp;NameValue|[&amp;NameIndexLoop] &nbsp;--?"[&amp;Background]" -inc "[&amp;NameLoop]"|&gt;Attack &nbsp;--~NameLoop|array;getnext;AttackNameArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|BackgroundAttackNameLoop &nbsp;--~NameLoop|array;getfirst;SkillNameArray &nbsp;--:BackgroundSkillNameLoop| &nbsp;--~NameIndexLoop|array;getindex;SkillNameArray &nbsp;--&amp;NameValue|[&amp;NameIndexLoop] &nbsp;--?"[&amp;Background]" -inc "[&amp;NameLoop]"|&gt;Skill &nbsp;--~NameLoop|array;getnext;SkillNameArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|BackgroundSkillNameLoop &nbsp;--~NameLoop|array;getfirst;ACNameArray &nbsp;--:BackgroundACNameLoop| &nbsp;--~NameIndexLoop|array;getindex;ACNameArray &nbsp;--&amp;NameValue|[&amp;NameIndexLoop] &nbsp;--?"[&amp;Background]" -inc "[&amp;NameLoop]"|&gt;AC &nbsp;--~NameLoop|array;getnext;ACNameArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|BackgroundACNameLoop &nbsp;--~NameLoop|array;getfirst;ResourceArray &nbsp;--:ResourceNameBackgroundLoop| &nbsp;--?"[&amp;Background]" -inc "[&amp;NameLoop]" -or "[&amp;NameLoop]" -inc "[&amp;Background]"|&gt;RetrieveResource &nbsp;--~NameLoop|array;getnext;ResourceArray &nbsp;--?"[&amp;NameLoop]" -ninc "ArrayError"|ResourceNameBackgroundLoop &nbsp;--+[rbutton][&amp;titlename]::description;[&amp;name][/rbutton][&amp;Resource]|[&amp;ACMOD][&amp;SKILLMOD][&amp;DAMAGEMOD][&amp;ATTACKMOD][&amp;SAVEMOD][&amp;UseMule] &nbsp;--:skipbackground| &nbsp;--~Background|array;getnext;BackgroundArray &nbsp;--?"[&amp;Background]" -ninc "ArrayError"|BackgroundArrayLoop &nbsp;--/|Refresh option &nbsp; --#buttonFontSize|x-small --+|[hr #000000] --+|[r][button]🔄&nbsp; &nbsp;️Refresh::!&amp;#13;#🎭Features_&amp;_Traits[/button][/r] &nbsp;--x| &nbsp;--:UseMule| &nbsp;--&amp;UseMule|/[button]Use::!&amp;#13;&amp;#37;{Macro Class|[&amp;name]}[/button] &nbsp; --&lt;| &nbsp;--:featmule| &nbsp;--+[rbutton][&amp;titlename]::description;[&amp;name][/rbutton][&amp;Resource]|/ [button]Use::!&amp;#13;&amp;#37;{Macro Class|[&amp;name]}[/button] &nbsp;--^featmuledone| &nbsp;--:description| &nbsp;--#whisper|self &nbsp;--Rfirst|@{selected|character_id};repeating_traits &nbsp;--:descriptionloop| &nbsp;--?"[*R:name]" -inc "[&amp;reentryval]"|descriptiontext &nbsp;--Rnext| &nbsp;--&gt;descriptionloop|&nbsp;&nbsp; &nbsp;--x| &nbsp;--:descriptiontext| &nbsp; --#bodyFontSize|14px &nbsp; --#buttonBorderColor|#000 &nbsp;--#hideTitleCard|1 &nbsp;--+[*R:name]:| [*R:description] &nbsp;--+|[c][rbutton]Show Chat::showchat[/rbutton][/c] &nbsp;--x| &nbsp;--:showchat| &nbsp;--#whisper| &nbsp;--+[*R:name]:| [*R:description] &nbsp;--x| &nbsp;--:fightingstyle| &nbsp;--?"[&amp;name]" -inc "Archery"|&amp;name;Archery &nbsp;--?"[&amp;name]" -inc "Defense"|&amp;name;Defense &nbsp;--?"[&amp;name]" -inc "Dueling"|&amp;name;Dueling &nbsp;--?"[&amp;name]" -inc "Great Weapon Fighting"|&amp;name;Great Weapon Fighting &nbsp;--?"[&amp;name]" -inc "Protection"|&amp;name;Protection &nbsp; --&lt;| &nbsp;--:eldritchinvocation| &nbsp;--?"[&amp;name]" -inc "Agonizing Blast"|&amp;name;Agonizing Blast &nbsp;--?"[&amp;name]" -inc "Armor of Shadows"|&amp;name;Armor of Shadows &nbsp;--?"[&amp;name]" -inc "Ascendant Step"|&amp;name;Ascendant Step &nbsp;--?"[&amp;name]" -inc "Beast Speech"|&amp;name;Beast Speech &nbsp;--?"[&amp;name]" -inc "Beguiling Influence"|&amp;name;Beguiling Influence &nbsp;--?"[&amp;name]" -inc "Bewitching Whispers"|&amp;name;Bewitching Whispers &nbsp;--?"[&amp;name]" -inc "Book of Ancient Secrets"|&amp;name;Book of Ancient Secrets &nbsp;--?"[&amp;name]" -inc "Chains of Carceri"|&amp;name;Chains of Carceri &nbsp;--?"[&amp;name]" -inc "Devil’s Sight"|&amp;name;Devil’s Sight &nbsp;--?"[&amp;name]" -inc "Dreadful Word"|&amp;name;Dreadful Word &nbsp;--?"[&amp;name]" -inc "Eldritch Sight"|&amp;name;Eldritch Sight &nbsp;--?"[&amp;name]" -inc "Eldritch Spear"|&amp;name;Eldritch Spear &nbsp;--?"[&amp;name]" -inc "Eyes of the Rune Keeper"|&amp;name;Eyes of the Rune Keeper &nbsp;--?"[&amp;name]" -inc "Fiendish Vigor"|&amp;name;Fiendish Vigor &nbsp;--?"[&amp;name]" -inc "Gaze of Two Minds"|&amp;name;Gaze of Two Minds &nbsp;--?"[&amp;name]" -inc "Lifedrinker"|&amp;name;Lifedrinker &nbsp;--?"[&amp;name]" -inc "Mask of Many Faces"|&amp;name;Mask of Many Faces &nbsp;--?"[&amp;name]" -inc "Master of Myriad Forms"|&amp;name;Master of Myriad Forms &nbsp;--?"[&amp;name]" -inc "Minions of Chaos"|&amp;name;Minions of Chaos &nbsp;--?"[&amp;name]" -inc "Mire the Mind"|&amp;name;Mire the Mind &nbsp;--?"[&amp;name]" -inc "Misty Visions"|&amp;name;Misty Visions &nbsp;--?"[&amp;name]" -inc "One with Shadows"|&amp;name;One with Shadows &nbsp;--?"[&amp;name]" -inc "Otherworldly Leap"|&amp;name;Otherworldly Leap &nbsp;--?"[&amp;name]" -inc "Repelling Blast"|&amp;name;Repelling Blast &nbsp;--?"[&amp;name]" -inc "Sculptor of Flesh"|&amp;name;Sculptor of Flesh &nbsp;--?"[&amp;name]" -inc "Sign of Ill Omen"|&amp;name;Sign of Ill Omen &nbsp;--?"[&amp;name]" -inc "Thief of Five Fates"|&amp;name;Thief of Five Fates &nbsp;--?"[&amp;name]" -inc "Thirsting Blade"|&amp;name;Thirsting Blade &nbsp;--?"[&amp;name]" -inc "Visions of Distant Realms"|&amp;name;Visions of Distant Realms &nbsp;--?"[&amp;name]" -inc "Voice of the Chain Master"|&amp;name;Voice of the Chain Master &nbsp;--?"[&amp;name]" -inc "Whispers of the Grave"|&amp;name;Whispers of the Grave &nbsp;--?"[&amp;name]" -inc "Witch Sight"|&amp;name;Witch Sight &nbsp; --&lt;| &nbsp;--:favoredenemy| &nbsp;--?"[&amp;name]" -inc "Aberrations"|&amp;name;Aberrations &nbsp;--?"[&amp;name]" -inc "Beasts"|&amp;name;Beasts &nbsp;--?"[&amp;name]" -inc "Celestials"|&amp;name;Celestials &nbsp;--?"[&amp;name]" -inc "Constructs"|&amp;name;Constructs &nbsp;--?"[&amp;name]" -inc "Dragons"|&amp;name;Dragons &nbsp;--?"[&amp;name]" -inc "Elementals"|&amp;name;Elementals &nbsp;--?"[&amp;name]" -inc "Fey"|&amp;name;Fey &nbsp;--?"[&amp;name]" -inc "Fiends"|&amp;name;Fiends &nbsp;--?"[&amp;name]" -inc "Giants"|&amp;name;Giants &nbsp;--?"[&amp;name]" -inc "Monstrosities"|&amp;name;Monstrosities &nbsp;--?"[&amp;name]" -inc "Ooze"|&amp;name;Ooze &nbsp;--?"[&amp;name]" -inc "Plants"|&amp;name;Plants &nbsp;--?"[&amp;name]" -inc "Undead"|&amp;name;Undead &nbsp; --&lt;| &nbsp;--:channeldivinity| &nbsp;--?"[&amp;name]" -inc "Watcher's Will"|&amp;name;Watcher's Will &nbsp;--?"[&amp;name]" -inc "War God's Blessing"|&amp;name;War God's Blessing &nbsp;--?"[&amp;name]" -inc "Vow of Enmity"|&amp;name;Vow of Enmity &nbsp;--?"[&amp;name]" -inc "Twilight Sanctuary"|&amp;name;Twilight Sanctuary &nbsp;--?"[&amp;name]" -inc "Turn the Unholy"|&amp;name;Turn the Unholy &nbsp;--?"[&amp;name]" -inc "Turn the Tide"|&amp;name;Turn the Tide &nbsp;--?"[&amp;name]" -inc "Turn the Faithless"|&amp;name;Turn the Faithless &nbsp;--?"[&amp;name]" -inc "Touch of Death"|&amp;name;Touch of Death &nbsp;--?"[&amp;name]" -inc "Sacred Weapon"|&amp;name;Sacred Weapon &nbsp;--?"[&amp;name]" -inc "Rebuke the Violent"|&amp;name;Rebuke the Violent &nbsp;--?"[&amp;name]" -inc "Read Thoughts"|&amp;name;Read Thoughts &nbsp;--?"[&amp;name]" -inc "Radiance of the Dawn"|&amp;name;Radiance of the Dawn &nbsp;--?"[&amp;name]" -inc "Preserve Life"|&amp;name;Preserve Life &nbsp;--?"[&amp;name]" -inc "Peerless Athlete"|&amp;name;Peerless Athlete &nbsp;--?"[&amp;name]" -inc "Path to the Grave"|&amp;name;Path to the Grave &nbsp;--?"[&amp;name]" -inc "Order's Demand"|&amp;name;Order's Demand &nbsp;--?"[&amp;name]" -inc "Nature's Wrath"|&amp;name;Nature's Wrath &nbsp;--?"[&amp;name]" -inc "Knowledge of the Ages"|&amp;name;Knowledge of the Ages &nbsp;--?"[&amp;name]" -inc "Invoke Duplicity"|&amp;name;Invoke Duplicity &nbsp;--?"[&amp;name]" -inc "Inspiring Smite"|&amp;name;Inspiring Smite &nbsp;--?"[&amp;name]" -inc "Guided Strike"|&amp;name;Guided Strike &nbsp;--?"[&amp;name]" -inc "Emissary of Peace"|&amp;name;Emissary of Peace &nbsp;--?"[&amp;name]" -inc "Dreadful Aspect"|&amp;name;Dreadful Aspect &nbsp;--?"[&amp;name]" -inc "Destructive Wrath"|&amp;name;Destructive Wrath &nbsp;--?"[&amp;name]" -inc "Control Undead"|&amp;name;Control Undead &nbsp;--?"[&amp;name]" -inc "Conquering Presence"|&amp;name;Conquering Presence &nbsp;--?"[&amp;name]" -inc "Cloak of Shadows"|&amp;name;Cloak of Shadows &nbsp;--?"[&amp;name]" -inc "Animals and Plants"|&amp;name;Charm Animals and Plants &nbsp;--?"[&amp;name]" -inc "Champion Challenge"|&amp;name;Champion Challenge &nbsp;--?"[&amp;name]" -inc "Balm of Peace"|&amp;name;Balm of Peace &nbsp;--?"[&amp;name]" -inc "Artisan's Blessing"|&amp;name;Artisan's Blessing &nbsp;--?"[&amp;name]" -inc "Arcane Abjuration"|&amp;name;Arcane Abjuration &nbsp;--?"[&amp;name]" -inc "Abjure the Extraplanar"|&amp;name;Abjure the Extraplanar &nbsp;--?"[&amp;name]" -inc "Turn Undead"|&amp;name;Turn Undead &nbsp;--?"[&amp;name]" -inc "Abjure Enemy"|&amp;name;Abjure Enemy &nbsp; --&lt;| &nbsp;--:classname| &nbsp; --#oddRowBackground|#993333 &nbsp; --#evenRowBackground|#993333 &nbsp; --#evenRowFontColor|#FFF &nbsp; --#oddRowFontColor|#FFF &nbsp;--+[c]Class[/c]| &nbsp; --#oddRowBackground|#d6d4d5 &nbsp; --#evenRowBackground|#d6d4d5 &nbsp; --#evenRowFontColor|#000000 &nbsp; --#oddRowFontColor|#000000 &nbsp; --&lt;| &nbsp;--:featname| &nbsp; --#oddRowBackground|#993333 &nbsp; --#evenRowBackground|#993333 &nbsp; --#evenRowFontColor|#FFF &nbsp; --#oddRowFontColor|#FFF &nbsp;--+[c]Feat[/c]| &nbsp; --#oddRowBackground|#d6d4d5 &nbsp; --#evenRowBackground|#d6d4d5 &nbsp; --#evenRowFontColor|#000000 &nbsp; --#oddRowFontColor|#000000 &nbsp; --&lt;| &nbsp;--:backgroundname| &nbsp; --#oddRowBackground|#993333 &nbsp; --#evenRowBackground|#993333 &nbsp; --#evenRowFontColor|#FFF &nbsp; --#oddRowFontColor|#FFF &nbsp;--+[c]Background[/c]| &nbsp; --#oddRowBackground|#d6d4d5 &nbsp; --#evenRowBackground|#d6d4d5 &nbsp; --#evenRowFontColor|#000000 &nbsp; --#oddRowFontColor|#000000 &nbsp; --&lt;| &nbsp;--:racialname| &nbsp; --#oddRowBackground|#993333 &nbsp; --#evenRowBackground|#993333 &nbsp; --#evenRowFontColor|#FFF &nbsp; --#oddRowFontColor|#FFF &nbsp;--+[c]Race[/c]| &nbsp; --#oddRowBackground|#d6d4d5 &nbsp; --#evenRowBackground|#d6d4d5 &nbsp; --#evenRowFontColor|#000000 &nbsp; --#oddRowFontColor|#000000 &nbsp; --&lt;| &nbsp;--:Damage| &nbsp;--~FlagStringLoop|array;getfirst;DamageFlagStringArray &nbsp;--:DamageFlagStringLoop| &nbsp;--~FlagString|array;getindex;DamageFlagStringArray &nbsp;--?[&amp;FlagString] -eq [&amp;NameValue]|&amp;FlagStringFinal;[&amp;FlagStringLoop] &nbsp;--~FlagStringLoop|array;getnext;DamageFlagStringArray &nbsp;--?"[&amp;FlagStringLoop]" -ninc "ArrayError"|DamageFlagStringLoop &nbsp;--~FlagLoop|array;getfirst;DamageFlagArray &nbsp;--:DamageFlagLoop| &nbsp;--~Flag|array;getindex;DamageFlagArray &nbsp;--?[&amp;Flag] -eq [&amp;NameValue]|&amp;FlagFinal;[&amp;FlagLoop] &nbsp;--~FlagLoop|array;getnext;DamageFlagArray &nbsp;--?"[&amp;FlagLoop]" -ninc "ArrayError"|DamageFlagLoop &nbsp;--&amp;OnOff|🚫 &nbsp;--?[&amp;FlagFinal]&nbsp; -eq 1|&amp;OnOff;✅&nbsp; &nbsp;--&amp;DAMAGEMOD|/[rbutton][&amp;OnOff]::togglemod;[&amp;FlagStringFinal] [/rbutton] &nbsp; --&lt;| &nbsp;--:Save| &nbsp;--~FlagStringLoop|array;getfirst;SaveFlagStringArray &nbsp;--:SaveFlagStringLoop| &nbsp;--~FlagString|array;getindex;SaveFlagStringArray &nbsp;--?[&amp;FlagString] -eq [&amp;NameValue]|&amp;FlagStringFinal;[&amp;FlagStringLoop] &nbsp;--~FlagStringLoop|array;getnext;SaveFlagStringArray &nbsp;--?"[&amp;FlagStringLoop]" -ninc "ArrayError"|SaveFlagStringLoop &nbsp;--~FlagLoop|array;getfirst;SaveFlagArray &nbsp;--:SaveFlagLoop| &nbsp;--~Flag|array;getindex;SaveFlagArray &nbsp;--?[&amp;Flag] -eq [&amp;NameValue]|&amp;FlagFinal;[&amp;FlagLoop] &nbsp;--~FlagLoop|array;getnext;SaveFlagArray &nbsp;--?"[&amp;FlagLoop]" -ninc "ArrayError"|SaveFlagLoop &nbsp;--&amp;OnOff|🚫 &nbsp;--?[&amp;FlagFinal]&nbsp; -eq 1|&amp;OnOff;✅&nbsp; &nbsp;--&amp;SAVEMOD|/[rbutton][&amp;OnOff]::togglemod;[&amp;FlagStringFinal] [/rbutton] &nbsp; --&lt;| &nbsp;--:Attack| &nbsp;--~FlagStringLoop|array;getfirst;AttackFlagStringArray &nbsp;--:AttackFlagStringLoop| &nbsp;--~FlagString|array;getindex;AttackFlagStringArray &nbsp;--?[&amp;FlagString] -eq [&amp;NameValue]|&amp;FlagStringFinal;[&amp;FlagStringLoop] &nbsp;--~FlagStringLoop|array;getnext;AttackFlagStringArray &nbsp;--?"[&amp;FlagStringLoop]" -ninc "ArrayError"|AttackFlagStringLoop &nbsp;--~FlagLoop|array;getfirst;AttackFlagArray &nbsp;--:AttackFlagLoop| &nbsp;--~Flag|array;getindex;AttackFlagArray &nbsp;--?[&amp;Flag] -eq [&amp;NameValue]|&amp;FlagFinal;[&amp;FlagLoop] &nbsp;--~FlagLoop|array;getnext;AttackFlagArray &nbsp;--?"[&amp;FlagLoop]" -ninc "ArrayError"|AttackFlagLoop &nbsp;--&amp;OnOff|🚫 &nbsp;--?[&amp;FlagFinal]&nbsp; -eq 1|&amp;OnOff;✅&nbsp; &nbsp;--&amp;ATTACKMOD|/[rbutton][&amp;OnOff]::togglemod;[&amp;FlagStringFinal] [/rbutton] &nbsp; --&lt;| &nbsp;--:Skill| &nbsp;--~FlagStringLoop|array;getfirst;SkillFlagStringArray &nbsp;--:SkillFlagStringLoop| &nbsp;--~FlagString|array;getindex;SkillFlagStringArray &nbsp;--?[&amp;FlagString] -eq [&amp;NameValue]|&amp;FlagStringFinal;[&amp;FlagStringLoop] &nbsp;--~FlagStringLoop|array;getnext;SkillFlagStringArray &nbsp;--?"[&amp;FlagStringLoop]" -ninc "ArrayError"|SkillFlagStringLoop &nbsp;--~FlagLoop|array;getfirst;SkillFlagArray &nbsp;--:SkillFlagLoop| &nbsp;--~Flag|array;getindex;SkillFlagArray &nbsp;--?[&amp;Flag] -eq [&amp;NameValue]|&amp;FlagFinal;[&amp;FlagLoop] &nbsp;--~FlagLoop|array;getnext;SkillFlagArray &nbsp;--?"[&amp;FlagLoop]" -ninc "ArrayError"|SkillFlagLoop &nbsp;--&amp;OnOff|🚫 &nbsp;--?[&amp;FlagFinal]&nbsp; -eq 1|&amp;OnOff;✅ &nbsp;--&amp;SKILLMOD||/[rbutton][&amp;OnOff]::togglemod;[&amp;FlagStringFinal] [/rbutton] &nbsp; --&lt;| &nbsp;--:AC| &nbsp;--~FlagStringLoop|array;getfirst;ACFlagStringArray &nbsp;--:ACFlagStringLoop| &nbsp;--~FlagString|array;getindex;ACFlagStringArray &nbsp;--?[&amp;FlagString] -eq [&amp;NameValue]|&amp;FlagStringFinal;[&amp;FlagStringLoop] &nbsp;--~FlagStringLoop|array;getnext;ACFlagStringArray &nbsp;--?"[&amp;FlagStringLoop]" -ninc "ArrayError"|ACFlagStringLoop &nbsp;--~FlagLoop|array;getfirst;ACFlagArray &nbsp;--:ACFlagLoop| &nbsp;--~Flag|array;getindex;ACFlagArray &nbsp;--?[&amp;Flag] -eq [&amp;NameValue]|&amp;FlagFinal;[&amp;FlagLoop] &nbsp;--~FlagLoop|array;getnext;ACFlagArray &nbsp;--?"[&amp;FlagLoop]" -ninc "ArrayError"|ACFlagLoop &nbsp;--&amp;OnOff|🚫 &nbsp;--?[&amp;FlagFinal] -eq 1|&amp;OnOff;✅ &nbsp;--&amp;ACMOD|/ [rbutton][&amp;OnOff]::togglemod;[&amp;FlagStringFinal] [/rbutton] &nbsp; --&lt;| &nbsp;--:togglemod| &nbsp;--#bodyFontSize|14px &nbsp;--#hideTitleCard|1 &nbsp;--Rfirst|@{selected|character_id};repeating_savemod &nbsp;--&amp;MODNAME|Global Save Modifier &nbsp;--:savetogglemodloop| &nbsp;--?"[*R:global_save_name]" -eq NoRepeatingAttributeLoaded|saveendtogglemodloop &nbsp;--&amp;Name|[*R:global_save_name] &nbsp;--&amp;TestToggle|[*R:global_save_active_flag] &nbsp;--?"[&amp;reentryval]" -eq "[*R&gt;global_save_active_flag]"|endtogglemodloop &nbsp;--Rnext| &nbsp;--&gt;savetogglemodloop|&nbsp;&nbsp; &nbsp;--:saveendtogglemodloop| &nbsp;--Rfirst|@{selected|character_id};repeating_tohitmod &nbsp;--&amp;MODNAME|Global Attack Modifier &nbsp;--:attacktogglemodloop| &nbsp;--?"[*R:global_attack_name]" -eq NoRepeatingAttributeLoaded|attackendtogglemodloop &nbsp;--&amp;Name|[*R:global_attack_name] &nbsp;--&amp;TestToggle|[*R:global_attack_active_flag] &nbsp;--?"[&amp;reentryval]" -eq "[*R&gt;global_attack_active_flag]"|endtogglemodloop &nbsp;--Rnext| &nbsp;--&gt;attacktogglemodloop|&nbsp;&nbsp; &nbsp;--:attackendtogglemodloop| &nbsp;--Rfirst|@{selected|character_id};repeating_skillmod &nbsp;--&amp;MODNAME|Global Skill Modifier &nbsp;--:skilltogglemodloop| &nbsp;--?"[*R:global_skill_name]" -eq NoRepeatingAttributeLoaded|skillendtogglemodloop &nbsp;--&amp;Name|[*R:global_skill_name] &nbsp;--&amp;TestToggle|[*R:global_skill_active_flag] &nbsp;--?"[&amp;reentryval]" -eq "[*R&gt;global_skill_active_flag]"|endtogglemodloop &nbsp;--Rnext| &nbsp;--&gt;skilltogglemodloop|&nbsp;&nbsp; &nbsp;--:skillendtogglemodloop| &nbsp;--Rfirst|@{selected|character_id};repeating_damagemod &nbsp;--&amp;MODNAME|Global Damage Modifier &nbsp;--:damagetogglemodloop| &nbsp;--?"[*R:global_damage_name]" -eq NoRepeatingAttributeLoaded|damageendtogglemodloop &nbsp;--&amp;Name|[*R:global_damage_name] &nbsp;--&amp;TestToggle|[*R:global_damage_active_flag] &nbsp;--?"[&amp;reentryval]" -eq "[*R&gt;global_damage_active_flag]"|endtogglemodloop &nbsp;--Rnext| &nbsp;--&gt;damagetogglemodloop|&nbsp;&nbsp; &nbsp;--:damageendtogglemodloop| &nbsp;--Rfirst|@{selected|character_id};repeating_acmod &nbsp;--&amp;MODNAME|Global AC Modifier &nbsp;--:actogglemodloop| &nbsp;--?"[*R:global_ac_name]" -eq NoRepeatingAttributeLoaded|acendtogglemodloop &nbsp;--&amp;Name|[*R:global_ac_name] &nbsp;--&amp;TestToggle|[*R:global_ac_active_flag] &nbsp;--?"[&amp;reentryval]" -eq "[*R&gt;global_ac_active_flag]"|endtogglemodloop &nbsp;--Rnext| &nbsp;--&gt;actogglemodloop|&nbsp;&nbsp; &nbsp;--:acendtogglemodloop| &nbsp;--:endtogglemodloop| &nbsp;--?"[&amp;TestToggle]" -ne "1"|&amp;Flip;1 &nbsp;--?"[&amp;TestToggle]" -eq "1"|&amp;Flip;0 &nbsp;--?"[&amp;TestToggle]" -ne "1"|&amp;fliptext;Activate &nbsp;--?"[&amp;TestToggle]" -eq "1"|&amp;fliptext;Deactivate &nbsp;--?"[&amp;Name]" -eq "Rage" -and [&amp;Flip] -eq 1|&gt;ExpendResource --@setattr|_name @{selected|character_name} _silent&nbsp; &nbsp;_[&amp;reentryval]|[&amp;Flip]&nbsp; &nbsp;--+[&amp;MODNAME]:|@{selected|character_name} [&amp;fliptext] [&amp;Name]&nbsp; &nbsp;--?"[&amp;Name]" -eq "Rage" -and [&amp;Flip] -eq 1|RageOn &nbsp;--?"[&amp;Name]" -eq "Rage" -and [&amp;Flip] -eq 0|RageOff &nbsp; --X| &nbsp;--:RageOn| &nbsp; --@token-mod|_ids @{selected|token_id} _ignore-selected _set statusmarkers|Rage &nbsp; --vtoken|@{selected|token_id} bomb-death &nbsp; --a|rage &nbsp;--x|&nbsp;&nbsp; &nbsp;--:RageOff| &nbsp; --@token-mod|_ids @{selected|token_id} _ignore-selected _set statusmarkers|-Rage &nbsp;--x|&nbsp;&nbsp; &nbsp;--:ExpendResource| &nbsp;--&gt;Lib5E_FindResource|@{selected|character_id};[&amp;Name];AmmoAttr;AmmoValue &nbsp;--?[$AmmoValue.Total] -le 0|NoRessource &nbsp; --@setattr|_name @{selected|character_name} _silent _modb _[&amp;AmmoValue]|-1 &nbsp; --&lt;| &nbsp; --:NoRessource| &nbsp;--?"[&amp;Name]" -eq "Rage"|&amp;RestType;long &nbsp; --+Out of [&amp;Name]:|@{selected|character_name} must finish a [&amp;RestType] rest to use this ability again. &nbsp; --X| &nbsp; --:RetrieveResource| &nbsp;--=AmmoValue|false &nbsp;--&amp;ResourceName|[&amp;NameLoop] &nbsp;--?"[&amp;titlename]" -inc "Channel Divinity"|&amp;ResourceName;Channel Divinity &nbsp;--?"[&amp;titlename]" -inc "Giant" -and "[&amp;titlename]" -inc "Might"|&amp;ResourceName;Might &nbsp;--?"[&amp;titlename]" -inc "Hexblade" -and "[&amp;titlename]" -inc "Curse"|&amp;ResourceName;Hexblade &nbsp;--&gt;Lib5E_FindResource|@{selected|character_id};[&amp;ResourceName];AmmoAttr;AmmoValue &nbsp;--?"[$AmmoValue.Text]" -ninc "false" -and [$AmmoValue.Total] -gt 0|&amp;Resource;[u][#008000][$AmmoValue.Raw][/#][/u] &nbsp;--?"[$AmmoValue.Text]" -ninc "false" -and [$AmmoValue.Total] -le 0|&amp;Resource;[u][#ff0000][$AmmoValue.Raw][/#][/u] &nbsp; --&lt;| }}
I got this macro somewhere, I don't know where. It is supposed to calculate attack and damage and apply the damage to the target. It uses Scriptcards and Alterbar. Everything except the apply damage part works. Actually it used to display the attacker and defender's pictures but that has stopped working this week for some reason.&nbsp; This would really be helpful running large battles. I don't know much about ALterbar, I have used token mod and hoped a solution using token mod would work, but either my incompetence or some error in the code makes no solution work.&nbsp; Can one of you code wizards help? 5E D&amp;D Roll20 sheets being used. !scriptcard {{ --#title|Longsword --#leftsub|Melee Attack --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#emoteText|@{selected|token_name} attacks @{target|token_name} --=TargetAC|@{target|npc_ac} --?[$TargetAC.Total] -gt 0|DoneWithAC --=TargetAC|@{target|ac} --:DoneWithAC| --=AttackRoll|1d20 + @{selected|strength_mod} [STR] + @{selected|pb} [PROF] --+Attack|@{selected|token_name} rolls [$AttackRoll] vs AC . --?[$AttackRoll.Base] -eq 20|Crit --?[$AttackRoll.Base] -eq 1|Fumble --?[$AttackRoll.Total] -ge [$TargetAC.Total]|Hit --+Miss|The attack missed. --^Final| --:Fumble| --+Fumble!|The attack went horribly wrong. --^Final| --:Hit| --=Damage|1d8 + @{selected|strength_mod} [STR] --+Hit!|The attack hit @{target|token_name} for [$Damage] slashing damage. --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --^Final| --:Crit| --=Damage|1d8 + @{selected|strength_mod} [STR] + 1d8 [CRIT] --+Critical Hit!|The attack hit @{target|token_name} for [$Damage] slashing damage. --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --:Final| }} /fx glow-blood @{target|token_id}
1701534686

Edited 1701535033
Hey al e., I made some changes and it works in my test game with the following: !scriptcard {{ --#title|Longsword --#leftsub|Melee Attack --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#emoteText|[*S:t-name] attacks [*T:t-name] --=TargetAC|[*T:npc_ac] --?[$TargetAC.Total] -gt 0|DoneWithAC --=TargetAC|[*T:ac] --:DoneWithAC| --=AttackRoll|1d20 + [*S:strength_mod] [STR] + [*S:pb] [PROF] --+Attack|[*S:t-name] rolls [$AttackRoll] vs AC . --?[$AttackRoll.Base] -eq 20|Crit --?[$AttackRoll.Base] -eq 1|Fumble --?[$AttackRoll.Total] -ge [$TargetAC.Total]|Hit --+Miss|The attack missed. --^Final| --:Fumble| --+Fumble!|The attack went horribly wrong. --^Final| --:Hit| --=Damage|1d8 + [*S:strength_mod] [STR] --+Hit!|The attack hit [*T:t-name] for [$Damage] slashing damage. --!t:[*T:t-id]|bar1_value:-=[$Damage] --^PlayEffect| --:Crit| --=Damage|1d8 + [*S:strength_mod] [STR] + 1d8 [CRIT] --+Critical Hit!|The attack hit [*T:t-name] for [$Damage] slashing damage. --!t:[*T:t-id]|bar1_value:-=[$Damage] --:PlayEffect| --vtoken|[*T:t-id] glow-blood --:Final| }} I took out the alterbars and just use&nbsp; ScriptCards object modification. &nbsp;I also replaced all the @{} references with [*S and [*T references based on the sourceToken and targetToken set at the start. I also moved the visual effect into the ScriptCard so that it should only display on a hit. With those changes the HP was deducted from the target token on a hit with&nbsp;ScriptCards version 2.4.9a EDIT: I guess I will add that there are additional changes that might make some improvements. It could fetch the damage from various weapons on the character, giving them a choice. Also the token bar with the HP could be made into a variable and set at the top of the script so that if that ever changes in a game you only have to change it in one place. --/|VARIABLES TO SET --&amp;HPBar|1 which would make the object modification lines into --!t:[*T:t-id]|bar[&amp;HPBar]_value|-=[$Damage] Small changes but makes the ScriptCard more flexible and hopefully less prone to breakages.
Thank you, I realized what the problem was after posting the question. It was my incompetence, as I suspected. Alterbar is not in the OneClick, so I had a very old version. when I updated it, it worked, but the changes for the effect were very good.
1702358635

Edited 1704151165
Flurry of Blows So I took the OGL Fury of Blows for a monk from the shared examples and tweaked it.&nbsp; That thread is closed, so I posted it here. If anyone with better scripting skills than me has suggestions to streamline or make better, please let me know so that I can make that corrections. !scriptcard {{ --#reentrant|@{selected|character_id} --/|Script Name : Flurry of Blows --/|Version : 2.1 --/|Requires SC : TokenMod, Chatsetattr --/|Author : JustinG --/|Modified By : Farsidegallery --/| --/| Script automatically finds Monk level (including multiclass characters)and Bard level (when needed and including multiclass characters). Bard level can be found by either using selection (target prompt) or --/| by using attributes on the source character attributes placed there by associated Bardic Inspiration script. Script checks for status of Bless, Bardic Inspiration (using Token Markers), and Clockwork Amulet --/| and prompts player for use. On hit, player is prompted for selection of Open Hand technique and Stunning Strike. Ki points are automatically deducted. --/| &gt;&gt;&gt;&gt;&gt; Formatting &lt;&lt;&lt;&lt;&lt; --#emoteBackground|#transparent --#titleCardBackground|#2bff00 --#titlefontsize|1.75em --#titlefontlineheight|1.75em --#titleFontColor|white --#titlefontface|Shadows Into Light --#subtitleFontSize|12px --#subtitleFontFace|Verdana --#evenRowBackground|#B6AB91 --#evenRowFontColor|#000000 --#oddRowBackground|#CEC7B6 --#oddRowFontColor|#000000 --#whisper|self,gm --#title|Flurry of Blows --#sourceToken|@{selected|token_id} --#leftsub|Ki --#rightsub|Melee Attack --/| ____________________ Begin Global User Variables -Update the variables below to your game settings. ___________________________________ --/|Are you using the matching Bardic Inspiration Script? (Default is No using 0. Change to 1 if using the script.) --=Scriptcheck|0 --/|Enter the Token Markers you use for each condition --&amp;BardicMarker|BardicInspiration --&amp;BlessedMarker|angel-outfit --&amp;ProneMarker|back-pain --&amp;StunMarker|fist --/| ____________________ End Global User Variables ___________________________________________________________________________________________ --&gt;GetAndCheckSlotInformation| --=TargetCount|2 --#emoteText|@{selected|character_name} uses ki for a flurry of blows on nearby enemies! --?[*S:class] -inc "Monk"|=MonkLevel;@{selected|base_level} |&gt;Multi;@{selected|token_id};Monk --=DisplayCount|1 --&gt;TargetLoop| --:TargetLoop| --?[$DisplayCount] -gt 1|NextTarget --+Target|[rbutton]Click this button to select your first target.::DoIt;&amp;#64;{target|token_id}[/rbutton] --X| --:NextTarget| --+Target|[rbutton]Click this button to select your next target.::DoIt;&amp;#64;{target|token_id}[/rbutton] --X| --:DoIt| --&gt;MeleeAttack|[$DisplayCount.Raw] --:AfterMelee| --=DisplayCount|[$DisplayCount] + 1 --?[$DisplayCount] -le [$TargetCount]|TargetLoop --&gt;DeductKiSlot| --X| --:MeleeAttack| --&amp;ThisTarget|[&amp;reentryval] --#targettoken|[&amp;reentryval] --&amp;DamageType|bludgeoning --=DamageDice|@{selected|level} \ 5 * 2 + 4 --#whisper|self,gm --&gt;Clockwork| --:knowYourRoll1| --&amp;AttackRoll|[&amp;reentryval] --&gt;inspiration| --=AttackRoll|[&amp;AttackRoll] + @{dexterity_mod} [DEX] + @{pb} [PROF] --:AfterAmulet| --&gt;CheckTokenMarkers| --:DoneTalking| --?[$AttackRoll.Base] -eq 20|Crit --?[$AttackRoll.Base] -eq 1|Fumble --=AttackRoll|[$AttackRoll] + [$BlessRoll] + [$BardicRoll] --=NPCAC|[*[&amp;ThisTarget]:npc_ac] --?[$AttackRoll.Raw] -lt [$NPCAC]|Miss|Hit --:Hit| --&gt;RollDamage| --:AfterDamageNorm| --+Hit!|Your attack hit for [$Damage] [%2%] damage! --&gt;ApplyDamageTokenmod|[&amp;ThisTarget];1;-[$Damage] --&gt;OpenHand| --:AfterOPHNorm| --&gt;StunningStrike| --&gt;AfterMelee| --:Miss| --+Miss|Your attack missed! --&gt;AfterMelee| --:Fumble| --=Fumblet|[T#Fumble-Table] --+Fumble|The attack went really bad! --+Bad Stuff| [$Fumblet.tableEntryText] --=FDamage|[&amp;DamageAmount] + [*S:dexterity_mod] [DEX] --=FCrit|[&amp;DamageAmount] + [*S:dexterity_mod] [DEX] + [&amp;DamageAmount] [CRIT] --*Possible Damage| Normal Damage is [$FDamage] and Crit Damage is [$FCrit]. --&gt;AfterMelee| --:Crit| --&gt;RollDamage|crit --:AfterDamageCrit| --+Critical Hit|You deal [$Damage] [&amp;DamageType] damage CRITICAL HIT! --&gt;ApplyDamageTokenmod|[&amp;ThisTarget];1;-[$Damage] --&gt;OpenHand|Crit --:AfterOPHCrit| --&gt;StunningStrike| --&gt;AfterMelee| --:RollDamage| --?[%1%] -eq crit|CritDamage --=Damage|1d[$DamageDice] + [*S:dexterity_mod] --?[$MonkLevel] -gt 5 |&amp;Magical;yes|&amp;Magical;no --&gt;Lib5E_Vulnerable| --&gt;AfterDamageNorm| --:Multi|character_id;ClassName --=Iteration|1 --=LoopFlag|0 --%loop|until;[$LoopFlag] -eq 1 --&amp;MultiClassFlag|multiclass[$Iteration.Raw]_flag --&amp;MultiClassName|multiclass[$Iteration.Raw] --&amp;MultiClassLevel|multiclass[$Iteration.Raw]_lvl --?[*[%1%]:[&amp;MultiClassFlag]] -ne 0 |[ --?[*[%1%]:[&amp;MultiClassName]] -inc "Monk" |[ --=MonkLevel|[*[%1%]:[&amp;MultiClassLevel]] --=LoopFlag|1 --]|[ --?[*[%1%]:[&amp;MultiClassName]] -inc "Bard" |[ --=BardLevel|[*[%1%]:[&amp;MultiClassLevel]] --=LoopFlag|1 --]| --]| --]| --=Iteration|[$Iteration] + 1 --?[$Iteration.Raw] -ge 15 | =LoopFlag;1 --%| --&lt;| --:Lib5E_Vulnerable| --?"[*[&amp;ThisTarget]:npc_vulnerabilities]" -inc "[&amp;DamageType]"|DoubleD --?"[*[&amp;ThisTarget]:npc_resistances]" -inc "[&amp;DamageType]"|HalfD --?"[*[&amp;ThisTarget]:npc_immunities]" -inc "[&amp;DamageType]"|immune --&lt;| --:HalfD| --?"[*[&amp;ThisTarget]:npc_resistances]" -inc "from nonmagical attacks" -and [&amp;Magical] -eq "yes"|&lt;| --=Damage|[$Damage] \ 2 [Resistant] --&lt;| --:DoubleD| --=Damage|[$Damage] * 2 [Vulnerable] --&lt;| --:immune| --+|[*[&amp;ThisTarget]:token_name] is immune to [&amp;DamageType] damage. --=Damage|0 --&gt;AfterMelee| --&lt;| --:CritDamage| --=Damage|1d[$DamageDice] + [*S:dexterity_mod] [DEX] + 1d[$DamageDice] [CRIT] --?[$MonkLevel] -gt 5 |&amp;Magical;yes|&amp;Magical;no --&gt;Lib5E_Vulnerable| --&gt;AfterDamageCrit| --:GetAndCheckSlotInformation| --=SlotsTotal|0 --&gt;GetAndCheckAmmoInformation|[*S:character_id];Ki;Slotname;SlotAmmo --?[$SlotAmmo] -eq 0|NoSlotsLeft --=SlotAmmo|[$SlotAmmo] - 1 --&lt;| --:DeductKiSlot| --@setattr|_charid [*S:character_id] _[&amp;SlotAmmo]|[$SlotAmmo] _silent --+|Ki Left: [$SlotAmmo] --X|Full Stop --:NoSlotsLeft| --+|[*S:character_name] has no Ki available. --#emoteText|[*S:character_name] tries to to use Ki, but has none left. --X|NoSlotsLeftStop --:PlayEffects|Parameters are : sourcetoken; targettoken; source effect; target effect; line effect; sound effect --vtoken|[%1%] [%3%] --vtoken|[%2%] [%4%] --vbetweentokens|[%1%] [%2%] [%5%] --a|[%6%] --&lt;| --:ApplyDamageTokenmod|Parameters are tokenid;bar#;amount --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%] --&lt;| --:BuildAndAskTargets| --&amp;TargetString| --=targetCount|1 --:AddSeparator| --&amp;TargetString|+|| --&lt;| --:OpenHand| --&amp;ifCrit|[%1%] --+You hit [*[&amp;ThisTarget]:character_name]. Do you want to knock down, back, or remove its reaction?|[rbutton]Down::OpenFist;Down[/rbutton][rbutton]Back::OpenFist;Back[/rbutton][rbutton]Remove Reaction::OpenFist;No Reaction[/rbutton] --X| --:OpenFist| --&amp;maybe|[&amp;reentryval] --?"[&amp;maybe]" -inc "Down"|Down --?"[&amp;maybe]" -inc "Back"|Back --?"[&amp;maybe]" -inc "Reaction"|noReaction --:AfterOpen| --?"[&amp;ifCrit] -inc "crit"|AfterOPHCrit --&gt;AfterOPHNorm| --:Back| --#whisper| --=DC|8 + [*S:wisdom_mod] + [*S:pb] --?[*[&amp;ThisTarget]:npc] -eq 1 -and [*[&amp;ThisTarget]:npc_str_save_flag] -gt 0|&amp;save;npc_str_save|&amp;save;strength_save_bonus --=savingThrow|1d20 + [*[&amp;ThisTarget]:[&amp;save]] [STR] --+|[*[&amp;ThisTarget]:character_name] made a [$savingThrow] Strength saving throw against [$DC] DC. --?[$savingThrow] -ge [$DC]|missabilityD --i[*[&amp;ThisTarget]:character_name] failed his saving throw, how far back do you want to knock them;Click this button to choose how far to knock them back|q;howFar;Choose between 5, 10, and 15 ft.|5|10|15| --=PushBack|[&amp;howFar] \ 5 --&amp;STid|@{selected|token_id} --&amp;TTid|[*[&amp;ThisTarget]:t-id] --&gt;PUSH| --:AfterPush| --&gt;AfterOpen| --:Down| --#whisper| --=DC|8 + [*S:wisdom_mod] + [*S:pb] --?[*[&amp;ThisTarget]:npc] -eq 1 -and [*[&amp;ThisTarget]:npc_dex_save_flag] -gt 0|&amp;save;npc_dex_save|&amp;save;dexterity_save_bonus --=savingThrow|1d20 + [*[&amp;ThisTarget]:[&amp;save]] [DEX] --?"[*[&amp;ThisTarget]:npc_condition_immunities]" -inc "prone"|immunetoprone --+|[*[&amp;ThisTarget]:character_name] made a [$savingThrow] Dexterity saving throw against [$DC] DC. --?[$savingThrow] -ge [$DC]|missabilityD --+|[*[&amp;ThisTarget]:character_name] has been knocked prone. --@token-mod| _ignore-selected _ids [*[&amp;ThisTarget]:t-id] _set statusmarkers|[&amp;ProneMarker] --&gt;AfterOpen| --:missabilityD| --+Miss|Your open hand had to affect. --&gt;AfterOpen| --:immunetoprone| --+Immune|[*[&amp;ThisTarget]:character_name] can't be knocked down. --&gt;AfterOpen| --:noReaction| --#whisper| --+|[*[&amp;ThisTarget]:character_name] has no reaction until the start of @{selected|token_name}'s next turn. --&gt;AfterOpen| --:CheckTokenMarkers| --=BardicStatus|0 --=BlessedStatus|0 --~|array;statusmarkers;TokenStatus;[*S:t-id] --%loop|foreach;TokenStatus --?[&amp;loop] -inc "[&amp;BardicMarker]"|=BardicStatus;1 --?[&amp;loop] -inc "[&amp;BlessedMarker]"|=BlessedStatus;1 --%| --&gt;CheckBless| --&gt;CheckBardic| --&lt;| --:CheckBardic| --=BardicRoll|0 --?[$BardicStatus] -eq 1|BardOn --&gt;AfterBardic| --&lt;| --:BardOn| --?[$BlessedStatus] -ne 0|BardBlessed --+AttackRoll|You rolled a [$AttackRoll.Base] for attack for a total of [$AttackRoll]. --+Do you want to use Bardic Inspiration?|[rbutton]Yes::BardYes[/rbutton][rbutton]No::AfterBardic[/rbutton] --X| DONE --:BardYes| --C[$Scriptcheck]|1:&gt;ScriptBard --+Bard|[rbutton]Click this button to select your Bard.::BardEntry;&amp;#64;{target|token_id}[/rbutton] --X| --:ScriptBard| --&amp;Bardtoken|[*S:InspireByTID] --&amp;ThisBard|[*S:InspireByTID] --&gt;FindBardLevel|[&amp;Bardtoken];[&amp;ThisBard] --X| --:BardEntry| --&amp;Bardtoken|[&amp;reentryval] --&amp;ThisBard|[&amp;reentryval] --&gt;FindBardLevel|[&amp;Bardtoken];[&amp;ThisBard] --X| --:FindBardLevel|BardTID;BardStringID --&amp;BardClass|[*[%2%]:class] --?[&amp;BardClass] -inc "Bard"|=BardLevel;[*[%2%]:level] | &gt;Multi;[%1%];Bard --?[$BardLevel] -ge 15 |=BardicRoll;1d12 --?[$BardLevel] -lt 15 |=BardicRoll;1d10 --?[$BardLevel] -lt 10 |=BardicRoll;1d8 --?[$BardLevel] -lt 5 |=BardicRoll;1d6 --?[$BlessRoll] -ne 0 |=BardicAttack; [$AttackRoll]+[$BlessRoll] [Bless]+[$BardicRoll] [Bardic] |=BardicAttack; [$AttackRoll]+[$BardicRoll] --+Bardic Inspiration|You rolled [$BardicRoll] for Bardic Inspiration. You rolled a [$AttackRoll] for attack for a total of [$BardicAttack]. --@token-mod|_set statusmarkers|-BardicInspiration _ids @{selected|character_id} --!a:[*S:character_id]|InspireByName: ** |InspireByTID: ** --&gt;AfterBardic| --:AfterBardic| --#whisper| --&gt;RollResults| --&lt;| --:RollResults| --&amp;BardicRollResult| --&amp;BlessRollResult| --?[$BardicRoll] -eq 0|NoBardResult --&amp;BardicRollResult|You rolled [$BardicRoll] from bardic inspiration. --&lt;| --:CheckBless| --?[$BlessedStatus] -ne 0|Blessed --=BlessRoll|0 --&lt;| --:Blessed| --=BlessRoll|1d4 --&lt;| --:NoBardResult| --?[$BlessRoll] -eq 0|NoBlessTalk --&amp;BlessRollResult|You rolled [$BlessRoll] from being blessed. --=BlessAttack|[$AttackRoll]+[$BlessRoll] --+Attack Roll|You rolled [$BlessRoll] for Bless. You rolled a [$AttackRoll] for attack for a total of [$BlessAttack]. --&lt;| --:BardBlessed| --=BlessAttack|[$AttackRoll]+[$BlessRoll] --+Attack Roll|You rolled [$BlessRoll] for Bless. You rolled a [$AttackRoll] for attack for a total of [$BlessAttack]. --+Do you want to use Bardic Inspiration?|[rbutton]Yes::BardYes[/rbutton][rbutton]No::AfterBardic[/rbutton] --X| DONE --:NoBlessTalk| --+Attack Roll|You rolled a [$AttackRoll] to hit.[&amp;BardicRollResult][&amp;BlessRollResult] --&lt;| --:PUSH| --&gt;MOVE_TOKEN|[&amp;STid];[&amp;TTid];[$PushBack] --+|[*[&amp;STid]:t-name] has pushed [*[&amp;TTid]:t-name] back [&amp;howFar] feet! --:MOVE_TOKEN|STokenid, TTokenId, Units --&amp;TId1|[%1%] --&amp;TId2|[%2%] --&amp;Units|[%3%] --/| Angle function returns a string variable (&amp;) with lots of decimal points. --~A|math;angle;[&amp;TId1];[&amp;TId2] --/| I've found that TokenMod chokes on a movement angle with lots of decimal points, so rounding is needed --/|$Ar will now contain a rounded integer version of &amp;A --~Ar|math;round;[&amp;A] --/|&amp;Angle will end up being one of the common directions which may work better for grids --?[$Ar] -gt 337.5 -or [$Ar] -le 22.5|&amp;Angle;0 --?[$Ar] -gt 22.5 -and [$Ar] -le 67.5|&amp;Angle;45 --?[$Ar] -gt 67.5 -and [$Ar] -le 112.5|&amp;Angle;90 --?[$Ar] -gt 112.5 -and [$Ar] -le 157.5|&amp;Angle;135 --?[$Ar] -gt 157.5 -and [$Ar] -le 202.5|&amp;Angle;180 --?[$Ar] -gt 202.5 -and [$Ar] -le 247.5|&amp;Angle;225 --?[$Ar] -gt 247.5 -and [$Ar] -le 292.5|&amp;Angle;270 --?[$Ar] -gt 292.5 -and [$Ar] -le 337.5|&amp;Angle;315 --/| Added for dealing with a SC 1.39a bug (returns negative angles beteen 270 and 360) --?[$Ar] -gt -90 -and [$Ar] -le -67.5|&amp;Angle;270 --?[$Ar] -gt -67.5 -and [$Ar] -le -22.5|&amp;Angle;315 --?[$Ar] -gt -22.5 -and [$Ar] -le 0|&amp;Angle;0 --&amp;UnitsFactor|1 --?[&amp;Angle] -eq 45|&amp;UnitsFactor;1.4142 --?[&amp;Angle] -eq 135|&amp;UnitsFactor;1.4142 --?[&amp;Angle] -eq 225|&amp;UnitsFactor;1.4142 --?[&amp;Angle] -eq 315|&amp;UnitsFactor;1.4142 --=U|[&amp;Units] * [&amp;UnitsFactor] --*Angles|[&amp;Angle] ([&amp;A]) ([$Ar]) --/| Time to call the magic TokenMod function to make the target token move across the screen --@token-mod|_move =[&amp;Angle]|[$U.Raw]g _ids [&amp;TId2] _ignore-selected --&gt;AfterPush|Return --:StunningStrike| --?[$SlotsExpended] -eq 0|NoStrike --?"[&amp;AttackType]" -inc "range"|NoStrike --+Stunning Strike|Do you want to spend a Ki Point to attempt to stun your target? --+|[rbutton]yes::dothestrike[/rbutton][rbutton]no::NoStrike[/rbutton] --X| --:dothestrike| --#whisper|self,GM --+Saving Throw|Ask the DM if the target is making a saving throw at advantage, disadvantage, or standard. --+|[rbutton]Standard::StrikeSave;1d20[/rbutton][rbutton]Advantage::StrikeSave;2d20kh1[/rbutton][rbutton]Disadvantage::StrikeSave;2d20kl1[/rbutton] --X| --:StrikeSave| --#whisper| --?[*[&amp;ThisTarget]:npc] -eq 1 -and [*[&amp;ThisTarget]:npc_con_save_flag] -gt 0|&amp;save;npc_con_save|&amp;save;constitution_save_bonus --=StriveSave|[&amp;reentryval] + [*T:[&amp;save]] [CON] --=StrikeDC|8 + [*S:pb] [PB] + [*S:wisdom_mod] [WIS] --?[$StriveSave.Total] -ge [$StrikeDC.Total]|SaveStun --?"[*[&amp;ThisTarget]:npc_condition_immunities]" -inc "stun"|StunImmune --+Stunned|[*[&amp;ThisTarget]:t-name] rolled a [$StriveSave], and it needed [$StrikeDC]. [*[&amp;ThisTarget]:t-name] is stunned. --=SlotsExpended|[$SlotsExpended] - 1 --@token-mod| _ignore-selected _ids [*[&amp;ThisTarget]:t-id] _set statusmarkers|[&amp;StunMarker] --&lt;| --:SaveStun| --+Saved|[*[&amp;ThisTarget]:t-name] rolled a [$StriveSave], and it needed [$StrikeDC]. [*S:t-name] did not stun [*[&amp;ThisTarget]:t-name]. --=SlotsExpended|[$SlotsExpended] - 1 --&lt;| --:StunImmune| --+Immune|[*[&amp;ThisTarget]:t-name] rolled a [$StriveSave], and it needed [$StrikeDC]. [*[&amp;ThisTarget]:t-name] is immune to stun. --=SlotsExpended|[$SlotsExpended] - 1 --:NoStrike| --&lt;| --:GetAndCheckAmmoInformation|character_id;resourceName;Ammoname;Ammo;$Ammo --?"[%2%]" -eq "[*[%1%]:class_resource_name]"|_Lib5E_IsResourceClass --?"[%2%]" -eq "[*[%1%]:other_resource_name]"|_Lib5E_IsResourceOther --Rfirst|[%1%];repeating_resource --:_Lib5E_ResourceLoop| --?"[*R:resource_left_name]" -eq "[%2%]"|_Lib5E_IsResourceLeft --?"[*R:resource_right_name]" -eq "[%2%]"|_Lib5E_IsResourceRight --Rnext| --?"[*R:resource_left_name]" -ne "NoRepeatingAttributeLoaded"|_Lib5E_ResourceLoop --&amp;[%3%]|NotFound --&amp;[%4%]|NotFound --=[%4%]|0 --&lt;| --:_Lib5E_IsResourceClass| --*IsClass| --&amp;[%3%]|class_resource_name --&amp;[%4%]|class_resource --=[%4%]|[*[%1%]:class_resource] --&lt;| --:_Lib5E_IsResourceOther| --*IsOther!| --&amp;[%3%]|other_resource_name --&amp;[%4%]|other_resource --=[%4%]|[*[%1%]:other_resource] --&lt;| --:_Lib5E_IsResourceLeft| --*IsLeft| --&amp;[%3%]|[*R&gt;resource_left_name] --&amp;[%4%]|[*R&gt;resource_left] --=[%4%]|[*R:resource_left] --&lt;| --:_Lib5E_IsResourceRight| --*IsRight| --&amp;[%3%]|[*R&gt;resource_right_name] --&amp;[%4%]|[*R&gt;resource_right] --=[%4%]|[*R:resource_right] --&lt;| --&lt;| --:Clockwork| --&gt;GetAndCheckAmmoInformation|[*S:character_id];Clockwork Amulet;Amuletname;AmuletAmmo --?[$AmuletAmmo] -eq 0|NoAmmulet --+Do you want to use the clockwork Amulet to roll a 10 against [*T:t-name]?|[rbutton]Yes::YesAmulet[/rbutton][rbutton]No::NoAmmulet[/rbutton] --X| --:YesAmulet| --=AttackRoll|10 + [*S:dexterity_mod] + [*S:pb] --@setattr|_charid [*S:character_id] _[&amp;AmuletAmmo]|0 _silent --+Clockwork Amulet|[*S:t-name] uses the Clockwork Amulet to roll a 10. --^AfterAmulet| --:NoAmmulet| --+Choose an attack roll type for [*[&amp;ThisTarget]:t-name].|[rbutton]Standard::knowYourRoll1;1d20[/rbutton][rbutton]Advantage::knowYourRoll1;2d20kh1[/rbutton][rbutton]Disadvantage::knowYourRoll1;2d20kl1[/rbutton] --X| DONE --:inspiration| --?[*S:inspiration] -eq 0 -or "[&amp;AttackRoll]" -eq "2d20kh1"|noInspiration --+Do you want to use inspiration?|[rbutton]Yes::KnowYourRollInsp[/rbutton][rbutton]No::noInspiration;[/rbutton] --X| --:KnowYourRollInsp| --?[&amp;AttackRoll] -inc "1d20"|&amp;AttackRoll; 2d20kh1 --?[&amp;AttackRoll] -inc "2d20kl1"|&amp;AttackRoll; 1d20 --!a:[*S:character_id]|inspiration:0 --!t:@{selected|token_id}|status_trophy:false --&lt;| --:noInspiration| --#debug|0 --&lt;| }}
Anyone know of a scriptcard for Rod of Lordly Might? My search has come up blank.
1702665309

Edited 1702665878
Hey all,&nbsp; I have a question about Mod timing and reading attributes within a ScriptCard. So I have a mod that does some (unrelated to the question) dice rolling and creates/sets the following attributes on the character that called the mod: diceResults rerollResults totalSuccesses When I call this mod via ScriptCards using the --@ notation, Scriptcards seems to be unable to read the attributes created during the mod command.&nbsp; "Line Counter: 39, Tag:@nWODroll, Content:4 8 10 -NPndswd3q9cc59_3rgt" "ScriptCards: Making API call - !nWODroll 4 8 10 -NPndswd3q9cc59_3rgt" --@nWODroll| [$TotalDice.Raw] [$Difficulty.Raw] [$RerollNumber.Raw] [*S:character_id] --=TotalSuccess|[*S:totalSuccesses] --&amp;Rolls|[*S:diceResults] --&amp;Rerolls|[*S:rerollResults] "Error: No attribute or sheet field found for character_id -NPndswd3q9cc59_3rgt named totalSuccesses" "Line Counter: 40, Tag:=TotalSuccess, Content:undefined" "Error: No attribute or sheet field found for character_id -NPndswd3q9cc59_3rgt named diceResults" "Line Counter: 41, Tag:&amp;Rolls, Content:undefined" "Error: No attribute or sheet field found for character_id -NPndswd3q9cc59_3rgt named rerollResults" "Line Counter: 42, Tag:&amp;Rerolls, Content:undefined" However, when I look at the character sheet, the appropriate attributes are there.&nbsp; If I debug, I see the log statements for the mod displayed after the card has been fully processed and completed.&nbsp; Is there a way to get these results from the mod and use them in the future of the card? Thanks!
Hey Erik, ScriptCards calls to other mods are done&nbsp;asynchronously so you aren't going to be able to get access to those in the same execution. This is a major advantage that&nbsp; ScriptCards native object modification &nbsp;has in that it can access the modified attributes in the same script execution. One possible workaround that should work, is to use re-entrant buttons to start the ScriptCard at a label that should be able to resume after the other mod has set attributes and read them in. I have used a similar method with DefaultSpawnToken mod calls during a ScriptCard to resume the ScriptCard after the tokens have been spawned.
Bah, humbug! A synchronous! The re-entrant button process worked beautifully.&nbsp; Thanks, Joshua!
I'm trying to play around with the hidden check capabilities with Script Cards for 5e, but my coding skills are nonexistent and can't seem to wrap my head around getting dropdown menus to work with what I'm trying to do. What I'd like is for a player to have access to a token action that would call up a dropdown menu that would roll a secret check for a particular skill (i.e., Arcana, History, Investigation, etc.) using their bonus for that skill. !script {{ --#title|Secret Check --+|@{selected|token_name} makes a secret check... --&amp;Skill|?{Skill?|Acrobatics|Animal Handling|Arcana|Athletics|Deception|History|Insight|Intimidation|Investigation|Medicine|Nature|Perception|Performance|Persuasion|Religion|Sleight of Hand|Stealth|Survival} --=Roll|1d20 + @{selected|[&amp;Skill]_bonus} --*GMLine |@{selected|token_name} rolled a [$Roll] for [&amp;Skill] }} Unfortunately, the best I've been able to come up with is a token action that makes secret checks for all of their skills, which is serviceable but doesn't feel particularly elegant. !script {{ --#title|Secret Check --+|@{selected|token_name} makes a secret check. --=Roll|1d20 + @{selected|acrobatics_bonus} --*GMLine|@{selected|token_name} rolled a [$Roll] for Acrobatics --=Roll|1d20 + @{selected|animal_handling_bonus} --*GMLine|@{selected|token_name} rolled a [$Roll] for Animal Handling --=Roll|1d20 + @{selected|arcana_bonus} --*GMLine|@{selected|token_name} rolled a [$Roll] for Arcana --=Roll|1d20 + @{selected|athletics_bonus} --*GMLine|@{selected|token_name} rolled a [$Roll] for Athletics --=Roll|1d20 + @{selected|deception_bonus} --*GMLine|@{selected|token_name} rolled a [$Roll] for Deception --=Roll|1d20 + @{selected|history_bonus} --*GMLine|@{selected|token_name} rolled a [$Roll] for History --=Roll|1d20 + @{selected|insight_bonus} --*GMLine|@{selected|token_name} rolled a [$Roll] for Insight --=Roll|1d20 + @{selected|intimidation_bonus} --*GMLine|@{selected|token_name} rolled a [$Roll] for Intimidation --=Roll|1d20 + @{selected|investigation_bonus} --*GMLine|@{selected|token_name} rolled a [$Roll] for Investigation --=Roll|1d20 + @{selected|medicine_bonus} --*GMLine|@{selected|token_name} rolled a [$Roll] for Medicine --=Roll|1d20 + @{selected|nature_bonus} --*GMLine|@{selected|token_name} rolled a [$Roll] for Nature --=Roll|1d20 + @{selected|perception_bonus} --*GMLine|@{selected|token_name} rolled a [$Roll] for Perception --=Roll|1d20 + @{selected|performance_bonus} --*GMLine|@{selected|token_name} rolled a [$Roll] for Performance --=Roll|1d20 + @{selected|persuasion_bonus} --*GMLine|@{selected|token_name} rolled a [$Roll] for Persuasion --=Roll|1d20 + @{selected|religion_bonus} --*GMLine|@{selected|token_name} rolled a [$Roll] for Religion --=Roll|1d20 + @{selected|sleight_of_hand_bonus} --*GMLine|@{selected|token_name} rolled a [$Roll] for Sleight of Hand --=Roll|1d20 + @{selected|stealth_bonus} --*GMLine|@{selected|token_name} rolled a [$Roll] for Stealth --=Roll|1d20 + @{selected|survival_bonus} --*GMLine|@{selected|token_name} rolled a [$Roll] for Survival }}
1702999542
Kurt J.
Pro
API Scripter
@DM Robert - What you are running into here is an order of operations issue, but you can get round it with just a couple of minor changes. When Roll20 processes a command, it first goes through and replaces any @{...} references with raw text values, so @{selected|token_name} actually becomes the name of the token in the text that gets sent to ScriptCards, so even though you have something like: --+|@{selected|token_name} makes a secret check... in your script, what Roll20 actually sends to ScriptCards is: --+|Bob makes a secret check... This means that this line: --=Roll|1d20 + @{selected|[&amp;Skill]_bonus} Ends up becoming --=Roll|1d20 + since "[&amp;Skill]_bonus" isn't a valid attribute (at the time Roll20 does this substitution, nothing has run in SC yet, so [&amp;Skill] is empty. The easiest way around this is to use ScriptCards built-in referencing capabilities instead of relying on the Roll20 chat server: !script {{ &nbsp; --#title|Secret Check &nbsp; --#sourcetoken|@{selected|token_id} &nbsp; --+|@{selected|token_name} makes a secret check... &nbsp; --&amp;Skill|?{Skill?|Acrobatics|Animal Handling|Arcana|Athletics|Deception|History|Insight|Intimidation|Investigation|Medicine|Nature|Perception|Performance|Persuasion|Religion|Sleight of Hand|Stealth|Survival} &nbsp; --=Roll|1d20 + [*S:[&amp;Skill]_bonus] &nbsp; --*GMLine |@{selected|token_name} rolled a [$Roll] for [&amp;Skill] }} Will do what you are looking for. There are two changes here. The first is to set the sourcetoken setting to the selected token id. This isn't *strictly* necessary, as we could simply use @{selected|token_id} later, but it makes things easier to read. The other change is the Roll ine, which is now: --=Roll|1d20 + [*S:[&amp;Skill]_bonus] The change here is using [*S:...] instead of @{selected...} which tells SC to go get the skill bonus from the character. The chat server won't interfere with this, so we will get the value we expect. To expand on what I said above about not needing to use sourcetoken, we could also write this line as: --=Roll|1d20 + [*@{selected|token_id}:[&amp;Skill]_bonus] and accomplish the same thing. For a small script, there isn't much difference between the two, but once you start building larget scripts using [*S: instead of [*@{selected|token_id} becomes a bit cleaner.
1703005683

Edited 1703005736
Warren the Hero said: I'm just barely starting to dip my toes into scripts and Scriptcards. I'm trying to make sense of the 5e Action Menu as found on the Github. In my tests, whenever I use one token to cause damage, such as a Dagger or Ray of Frost, it pops up a GM menu that asks how to apply damage, and it seems to deal damage to the 'attacker' rather than the actual target. It only applies the damage to the target if I have the targeted enemy selected. Does this mean that when running the actual game, I have to select the PC's target each time, or is there a way for it to know how to apply it to the target with no selection necessary (outside of the initial targeting parameters)? Yes, something is definitely not right with the script. I've seen the example video and it shows the behavior that you're expecting. I can't find a reason why it would function like it does now on purpose. I'm taking a look at it now, but it's a big macro...
Ok, so the issue is that on line 101 you need to select which script you are going to use to apply damage. The options are listed.