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

!Scriptcard Help on building a Persona macro

Hey, I'm currently working on building ScriptCard macro's for a Persona TTRPG game I'm playing in, and I'm having trouble getting the macro to properly work. I'm trying to get the macro to roll an attack roll, and go: "It's a miss" if it's 6 or less Mixed Successes (7 ~ 9) that would roll 3 sets of damage dice Additional check if the character is in the "Infernal Rage" state, which would add a modifier to the dice rolls. Multiply the ( Damage Dice rolls + Infernal Rage Buff ) by the "StatBuffDiff" Value. Complete Success  (10 ~ 11) that would roll 3 sets of damage dice Additional check if the character is in the "Infernal Rage" state, which would add a modifier to the dice rolls. Check "SPSnipe" and make the dice roll capable of exploding . Multiply the ( Damage Dice rolls + Infernal Rage Buff ) by the "StatBuffDiff" Value. Crit (12 ~ 23) that would roll 3 sets of damage dice Additional check if the character is in the "Infernal Rage" state, which would add a modifier to the dice rolls. Check "SPSnipe" and make the dice roll capable of exploding. Multiply the ( Damage Dice rolls + Infernal Rage Buff ) by the "StatBuffDiff" Value. Then Check if "CritEffect" is set to 2, for Double Damage Super Crit (+24) that would roll simply multiply 3 * 6 as the dice for the damage Additional check if the character is in the "Infernal Rage" state, which would add a modifier to the dice rolls. Multiply the ( Damage Dice rolls + Infernal Rage Buff ) by the "StatBuffDiff" Value. Double the total due to a Crit It might be a lot, but if anyone can help me through this, I would GREATLY appreciate it. -w-; !script {{ --#title|Tripple Down --=Raging|?{Raging?|Yes,( ( [[ floor(@{Kotaro Muramoto|level}/3) ]] * 4 ) * 2 )|No,[[ 0 ]]} --\|The value of Raging is [$Raging] --=StatBuffDiff|?{Stat Buff Difference:|0,1|1,1.25|2,1.50|3,1.75|4,2|5,2.25|6,2.5|} --\|The value of StatBuffDiff is [$StatBuffDiff] --=SPSnipe|?{SNIPE SP Move Used?|Yes,1|No,0} --\|The value of SPSnipe is [$SPSnipe] --=CritEffect|?{Crit Effect:|Immune,0|Down,1|Double Damage,2} --\|The value of CritEffect is [$CritEffect] --=Atk1| [[ 2d6 + @{proficiency} + @{proficiencytemp} + ?{Accuracy Buff Rank Level:|0,0|1,2|2,4|3,6|-1,-2|-2,-4|-3,-6} ]] --\|The value of Atk1 is [$Atk1] --+Attack Roll|[$Atk1] --+Attack Total|[$Atk1.Total] --?[$Atk1.Total] -lt 7|[ --&Value|Miss! --+|We are inside the MISSED portion of the block --]|[ --?[$Atk1] -lt 10|[ --+|We are inside the MIXED SUCCESS portion of the block --?[$Raging] -eqi 0|[ --&Value|Mixed Success & NOT Raging! --=Hit1|(3d6 + @{proficiency} + @{proficiencytemp}) --=Hit2|(3d6 + @{proficiency} + @{proficiencytemp}) --=Hit3|(3d6 + @{proficiency} + @{proficiencytemp}) --]|[ --&Value|Mixed Success & Raging! --=Hit1|(3d6 + @{proficiency} + @{proficiencytemp}) --=Hit2|(3d6 + @{proficiency} + @{proficiencytemp}) --=Hit3|(3d6 + @{proficiency} + @{proficiencytemp}) --]| --]|[ --?[$Atk1] -lt 12|[ --?[$Raging] -eqi 0|[ --?[$SPSnipe] -eqi 0|[ --&Value|Complete Success & Not Snipe & NOT Raging! --=Hit1|(3d6 + @{proficiency} + @{proficiencytemp}) --=Hit2|(3d6 + @{proficiency} + @{proficiencytemp}) --=Hit3|(3d6 + @{proficiency} + @{proficiencytemp}) --]|[ --&Value|Complete Success & Snipe & NOT Raging! --=Hit1|(3d6! + @{proficiency} + @{proficiencytemp}) --=Hit2|(3d6! + @{proficiency} + @{proficiencytemp}) --=Hit3|(3d6! + @{proficiency} + @{proficiencytemp}) --]| --]|[ --?[$SPSnipe] -eqi 0|[ --&Value|Complete Success & Not Snipe & Raging! --=Hit1|(3d6 + @{proficiency} + @{proficiencytemp}) --=Hit2|(3d6 + @{proficiency} + @{proficiencytemp}) --=Hit3|(3d6 + @{proficiency} + @{proficiencytemp}) --]|[ --&Value|Complete Success & Snipe & Raging! --=Hit1|(3d6! + @{proficiency} + @{proficiencytemp}) --=Hit2|(3d6! + @{proficiency} + @{proficiencytemp}) --=Hit3|(3d6! + @{proficiency} + @{proficiencytemp}) --]| --]| --]|[ --?[$Atk1] -lt 24|[ --?[$Raging] -eqi 0|[ --?[$SPSnipe] -eqi 0|[ --&Value|Crit & Not Snipe & Not Raging! --=Hit1|(3d6 + @{proficiency} + @{proficiencytemp}) --=Hit2|(3d6 + @{proficiency} + @{proficiencytemp}) --=Hit3|(3d6 + @{proficiency} + @{proficiencytemp}) --]|[ --&Value|Crit & Snipe & Not Raging! --=Hit1|(3d6! + @{proficiency} + @{proficiencytemp}) --=Hit2|(3d6! + @{proficiency} + @{proficiencytemp}) --=Hit3|(3d6! + @{proficiency} + @{proficiencytemp}) --]| --]|[ --?[$SPSnipe] -eqi 0|[ --&Value|Crit & Not Snipe & Raging! --=Hit1|(3d6 + @{proficiency} + @{proficiencytemp}) --=Hit2|(3d6 + @{proficiency} + @{proficiencytemp}) --=Hit3|(3d6 + @{proficiency} + @{proficiencytemp}) --]|[ --&Value|Crit & Snipe & Raging! --=Hit1|(3d6! + @{proficiency} + @{proficiencytemp}) --=Hit2|(3d6! + @{proficiency} + @{proficiencytemp}) --=Hit3|(3d6! + @{proficiency} + @{proficiencytemp}) --]| --]| --]|[ --?[$Raging] -eqi 0|[ --&Value|Super Crit & Not Raging! --=Hit1|( (3 * 6) + @{proficiency} + @{proficiencytemp}) --=Hit2|( (3 * 6) + @{proficiency} + @{proficiencytemp}) --=Hit3|( (3 * 6) + @{proficiency} + @{proficiencytemp}) --]|[ --&Value|Super Crit & Raging! --=Hit1|( (3 * 6) + @{proficiency} + @{proficiencytemp}) --=Hit2|( (3 * 6) + @{proficiency} + @{proficiencytemp}) --=Hit3|( (3 * 6) + @{proficiency} + @{proficiencytemp}) --]| --]| --]| --]| --]| --+After|the blocks! --+Value|[&Value] --+Hit1|[&Hit1] --+Hit2|[&Hit2] --+Hit3|[&Hit3] --+Raging|[$Raging] --+StatBuffDiff|[$StatBuffDiff] --+SPSnipe|[$SPSnipe] --+CritEffect|[$CritEffect] }}
As of now, you cannot nest  code blocks . So you probably going to need to have a multiple conditionals or a case statement that sends to appropriate branches instead of doing it all in order like you have above.
Ooooooh, okay, that clears things up. Question, is it possible to set ranges for the different outcomes for a case statement?
Actually I was wrong about the case statement in my response. It appears from the docs that it only tests for equality and doesn't have a way to test greater or less than. So I think you'd probably pull the conditionals that you have in the nested code blocks to the top level. I haven't looked super deep at your ScriptCard but you can probably just move the code around and reorganize along the lines like so with a list of conditionals moving to named branches: --?[$Atk1.Total] -lt 7|Miss --?[$Atk1] -lt 10|Mixed --?[$Atk1] -lt 12|Success --?[$Atk1] -lt 24|Crit --?[$Atk1] -ge 24|SuperCrit --:Done| --X| --:Miss| --/|Do the miss code here -->Done| --:Mixed| --/|Do the mixed code here -->Done| --:Success| --/|Do the success code here -->Done| --:Crit| --/|Do the crit code here -->Done| --:SuperCrit| --/|Do the super crit code here -->Done|
1701672377

Edited 1701672415
Andrew R.
Pro
Sheet Author
Your ScriptCards code needs refactoring as Joshua says. <a href="https://refactoring.com/" rel="nofollow">https://refactoring.com/</a>