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

Using a Roll Token from table for attack roll using scriptcards.

1706579606

Edited 1706579947
Hi all, Definitely having an off day today, can't seem to wrap my head around anything(quitting cold turkey from a severe nicotine habit, my head feels like an overfilled balloon). I'm trying to fancy up the 'ol scriptcard attack roll using a d20 image. The way in which I'm trying to do that is calling to a roll table, there might be a better way, open to anything. Currently, the attack roll and table roll are seperate, as I can't even think of a way to combine them, atm. Here's the current code... !scriptcard {{ --/|**********Customizable Variables*************** --#overridetemplate|mydnd --:DoSetup| --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --&SpellLevel|cantrip --&SpellName|Chill Touch --Rfind|@{selected|character_id};[&SpellName];repeating_spell-[&SpellLevel];spellname --#emoteText|[*S:character_name] Casts [*R:spellname]. --#title|[*R:spellname] [*R:innate] --#leftsub|@{selected|character_name} (@{selected|caster_level}) --?[*R:spelllevel] -eq cantrip|&spllvl;cantrip --?[*R:spelllevel] -eq 1|&spllvl;1st-level --?[*R:spelllevel] -eq 2|&spllvl;2nd-level --?[*R:spelllevel] -eq 3|&spllvl;3rd-level --?[*R:spelllevel] -eq 4|&spllvl;4th-level --?[*R:spelllevel] -eq 5|&spllvl;5th-level --?[*R:spelllevel] -eq 6|&spllvl;6th-level --?[*R:spelllevel] -eq 7|&spllvl;7th-level --?[*R:spelllevel] -eq 8|&spllvl;8th-level --?[*R:spelllevel] -eq 9|&spllvl;9th-level --#rightsub|[i][&spllvl] [*R:spellschool][/i] --+Casting Time:|[*R:spellcastingtime] --+Range:|[*R:spellrange] --+Target:|[*R:spelltarget] --&zSCV|V --?"[*R:spellcomp_v]" -inc "v=1"|ENDSCV --&zSCV| --:ENDSCV| --&zSCS|S --?"[*R:spellcomp_s]" -inc "s=1"|ENDSCS --&zSCS| --:ENDSCS| --&zSCM|M --?"[*R:spellcomp_m]" -inc "m=1"|ENDSCM --&zSCM| --:ENDSCM| --?"[*R:spellcomp_m]" -ninc "m=1"|[ --&materials| --]|[ --&materials|([*R:spellcomp_materials]) --]| --+Components:|[&zSCV][&zSCS][&zSCM] [&materials] --+Duration:|[*R:spellduration] --+|[*R:spelldescription] --~Len|string;length;[*R:spellathigherlevels] --?[$Len] -le 5|END_HV_CHECK --+|[b][i]At Higher Levels.[/i][/b][*R:spellathigherlevels] --:END_HV_CHECK| --~HowFarAway|distance;@{selected|token_id};@{target|token_id} --=HowFar|[$HowFarAway] * 5 --?[$HowFar] -gt 120|tooFar --=CritRoll|20 --=AttackModifier|@{selected|spellcasting_ability} --=DamageModifier|0 --&AttackModifierType|[WIS] --=FeatDamage|0 --&FeatDamageType|[FEAT] --=ProficiencyBonus|@{selected|pb} --=DamageDice|1d8 --=CritDice|1d8 --&DamageType|necrotic --&DamageFX|burn-death --&MarkerA|chilltouch --&MarkerB|Disadvantage --/|****************DO NOT CHANGE****************** --=TargetAC|@{target|npc_ac} --=Damage|0 --=Resistance|0 --=Immunity|0 --=Vulnerability|0 --=TotalDamage|0 --=AttackRoll|?{Attack|Standard,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1} --/|*******************Main************************ -->MakeAttack| -->PlayEffects| -->CalculateDamage| -->ApplyDamage|@{target|token_id};1;-[$TotalDamage] --X| --/|****************Subroutines******************** --:MakeAttack| --=Attack|[$AttackRoll] + [$AttackModifier] [&AttackModifierType] + [$ProficiencyBonus] [PROF] --=AttackTable|[T#D20] --&AttackDie|[$AttackTable] --&D20Text|[$AttackTable.tableEntryText] --&D20Image|[$AttackTable.tableEntryImgURL] --+|[c][img height=100 width=100][&D20Image][/img][/c] --+|Attack Roll:[$Attack], Base: [$AttackRoll] --+|[br] --?[$AttackRoll.Base] -eq [$CritRoll]|Crit --?[$Attack.Total] -ge [$TargetAC]|Hit --?[$Attack.Total] -lt [$TargetAC]|Miss --<| --:Crit| --=Damage|[$DamageDice] + [$CritDice] [CRIT] + [$DamageModifier] [&AttackModifierType] + [$FeatDamage] [&FeatDamageType] --+[#ff0000]Critical Hit[/#]| for [$Damage] [&DamageType] damage! --a|chill_touch --@token-mod|_ids @{target|token_id} _ingore-selected _set statusmarkers|[&MarkerA] -->CheckResistances| -->CheckUndead| --<| --:Hit| --=Damage|[$DamageDice] + [$DamageModifier] [&AttackModifierType] + [$FeatDamage] [&FeatDamageType] --+Hit| for [$Damage] [&DamageType] damage! --a|chill_touch --@token-mod|_ids @{target|token_id} _ingore-selected _set statusmarkers|[&MarkerA] -->CheckResistances| -->CheckUndead| --<| --:Miss| --a|chill_touch --=Damage|0 --+|[f18]The attack [#ff0000]missed[/#]![/f] --<| --:CheckResistances| --?"[*T:npc_resistances]" -inc [&DamageType]|ApplyResistance --?"[*T:npc_immunities]" -inc [&DamageType]|ApplyImmunity --?"[*T:npc_vulnerabilities]" -inc [&DamageType]|ApplyVulnerability --<| --:ApplyResistance| --=Resistance|[$Damage] \ 2 --*|Creature is resistant to [&DamageType] damage! --<| --:ApplyImmunity| --=Immunity|[$Damage] --*|Creature is immune to [&DamageType] damage! --<| --:ApplyVulnerability| --=Vulnerability|[$Damage] --*|Creature is vulnerable to [&DamageType] damage! --<| --:CheckUndead| --?"@{target|npc_type}" -inc "undead" |ApplyDisadvantage --<| --:ApplyDisadvantage| --*|Creature is undead, and has disadvantage until the end of the players next turn! --~|turnorder;addcustom;Disadvantage;1;-1 --a|chill_touch --@token-mod|_ids @{target|token_id} _ingore-selected _set statusmarkers|[&MarkerB] --<| --:PlayEffects| --vtoken|@{target|token_id} [&DamageFX] --<| --:CalculateDamage| --=TotalDamage|[$Damage]-[$Resistance]-[$Immunity]+[$Vulnerability] --<| --:ApplyDamage| --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%] --<| --:tooFar| --+|The target is too far away. --X| }}
So I've got it working, but the code isn't exactly pretty. It needs some polish, but it works. The first image is of the spell, it asks if the attack is standard, at advantage or at disadvantage. The second image is of the spell actually being cast. I cast it at advantage with a critical hit to show what everything looks like. Any formatting/style advice is definitely welcome. Also, any coding advice would be great too. Like I said, the code isn't pretty. !scriptcard {{ --/|**********Customizable Variables*************** --#overridetemplate|mydnd --#Debug|1 --:DoSetup| --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --&SpellLevel|cantrip --&SpellName|Chill Touch --Rfind|@{selected|character_id};[&SpellName];repeating_spell-[&SpellLevel];spellname --#emoteText|[*S:character_name] Casts [*R:spellname]. --#title|[*R:spellname] [*R:innate] --#leftsub|@{selected|character_name} (@{selected|caster_level}) --?[*R:spelllevel] -eq cantrip|&spllvl;cantrip --?[*R:spelllevel] -eq 1|&spllvl;1st-level --?[*R:spelllevel] -eq 2|&spllvl;2nd-level --?[*R:spelllevel] -eq 3|&spllvl;3rd-level --?[*R:spelllevel] -eq 4|&spllvl;4th-level --?[*R:spelllevel] -eq 5|&spllvl;5th-level --?[*R:spelllevel] -eq 6|&spllvl;6th-level --?[*R:spelllevel] -eq 7|&spllvl;7th-level --?[*R:spelllevel] -eq 8|&spllvl;8th-level --?[*R:spelllevel] -eq 9|&spllvl;9th-level --#rightsub|[i][&spllvl] [*R:spellschool][/i] --+Casting Time:|[*R:spellcastingtime] --+Range:|[*R:spellrange] --+Target:|[*R:spelltarget] --&zSCV|V --?"[*R:spellcomp_v]" -inc "v=1"|ENDSCV --&zSCV| --:ENDSCV| --&zSCS|S --?"[*R:spellcomp_s]" -inc "s=1"|ENDSCS --&zSCS| --:ENDSCS| --&zSCM|M --?"[*R:spellcomp_m]" -inc "m=1"|ENDSCM --&zSCM| --:ENDSCM| --?"[*R:spellcomp_m]" -ninc "m=1"|[ --&materials| --]|[ --&materials|([*R:spellcomp_materials]) --]| --+Components:|[&zSCV][&zSCS][&zSCM] [&materials] --+Duration:|[*R:spellduration] --+|[*R:spelldescription] --~Len|string;length;[*R:spellathigherlevels] --?[$Len] -le 5|END_HV_CHECK --+|[b][i]At Higher Levels.[/i][/b][*R:spellathigherlevels] --:END_HV_CHECK| --=CritRoll|20 --=AttackModifier|@{selected|spellcasting_ability} --=DamageModifier|0 --&AttackModifierType|[WIS] --=FeatDamage|0 --&FeatDamageType|[FEAT] --=ProficiencyBonus|@{selected|pb} --=DamageDice|[T#D8] --=CritDice|[T#D8] --&DamageType|necrotic --&DamageFX|burn-death --&MarkerA|chilltouch --&MarkerB|Disadvantage --/|****************DO NOT CHANGE****************** --=TargetAC|@{target|npc_ac} --=Damage|0 --=Resistance|0 --=Immunity|0 --=Vulnerability|0 --=TotalDamage|0 --~HowFarAway|distance;@{selected|token_id};@{target|token_id} --=HowFar|[$HowFarAway] * 5 --?[$HowFar] -gt 120|tooFar --+|[c]What type of attack?[/c] --+|[c][rbutton]Standard::Standard[/rbutton][rbutton]Advantage::Advantage[/rbutton][rbutton]Disadvantage::Disadvantage[/rbutton][/c] --/|*******************Main************************ --X| --/|****************Subroutines******************** --:Standard| --=AttackRoll|[T#D20] --=Attack|[$AttackRoll] + [$AttackModifier] [&AttackModifierType] + [$ProficiencyBonus] [PB] --&D20Image|[$AttackRoll.tableEntryImgURL] --+|[c][img height=60 width=60][&D20Image][/img][br][b] + [$AttackModifier] [&AttackModifierType] + [$ProficiencyBonus] [PB][/b][/c][c]=[br][/c][c][F:Contrail One:24][$Attack][/F][/c] --+|[br] --?[$AttackRoll.Base] -eq [$CritRoll]|Crit --?[$Attack.Total] -ge [$TargetAC]|Hit --?[$Attack.Total] -lt [$TargetAC]|Miss --X| --:Advantage| --=AttackRoll|[T#D20] --=AttackRoll2|[T#D20] --?[$AttackRoll.Raw] -gt [$AttackRoll2.Raw]|[ --&AttackRoll3|[$AttackRoll.Raw] --]|[ --&AttackRoll3|[$AttackRoll2.Raw] --]| --=Attack|[&AttackRoll3] + [$AttackModifier] [&AttackModifierType] + [$ProficiencyBonus] [PB] --&D20Image1|[$AttackRoll.tableEntryImgURL] --&D20Image2|[$AttackRoll2.tableEntryImgURL] --+|[c][img height=60 width=60][&D20Image1][/img][img height=60 width=60][&D20Image2][/img][br][b] + [$AttackModifier] [&AttackModifierType] + [$ProficiencyBonus] [PB][/b][/c][c]=[br][/c][c][F:Contrail One:24][$Attack][/F][/c] --+|[br] --?[&AttackRoll3] -eq [$CritRoll]|Crit --?[$Attack.Total] -ge [$TargetAC]|Hit --?[$Attack.Total] -lt [$TargetAC]|Miss --X| --:Disadvantage| --=AttackRoll|[T#D20] --=AttackRoll2|[T#D20] --?[$AttackRoll.Raw] -lt [$AttackRoll2.Raw]|[ --&AttackRoll3|[$AttackRoll.Raw] --]|[ --&AttackRoll3|[$AttackRoll2.Raw] --]| --=Attack|[&AttackRoll3] + [$AttackModifier] [&AttackModifierType] + [$ProficiencyBonus] [PB] --&D20Image1|[$AttackRoll.tableEntryImgURL] --&D20Image2|[$AttackRoll2.tableEntryImgURL] --+|[c][img height=60 width=60][&D20Image1][/img][img height=60 width=60][&D20Image2][/img][br][b] + [$AttackModifier] [&AttackModifierType] + [$ProficiencyBonus] [PB][/b][/c][c]=[br][/c][c][F:Contrail One:24][$Attack][/F][/c] --?[$AttackRoll.Base] -eq [$CritRoll]|Crit --?[$Attack.Total] -ge [$TargetAC]|Hit --?[$Attack.Total] -lt [$TargetAC]|Miss --X| --:Crit| --=Damage|[$DamageDice] + [$CritDice] [CRIT] + [$DamageModifier] [&AttackModifierType] + [$FeatDamage] [&FeatDamageType] --+|[c][img height=50 width=50][$DamageDice.tableEntryImgURL][/img] [img height=50 width=50][$CritDice.tableEntryImgURL][/img][/c] --+|[c][b][#1c7539]Critical Hit[/#] for [$Damage] [&DamageType] damage![/b][/c] --a|chill_touch --@token-mod|_ignore-selected _ids @{target|token_id} _set statusmarkers|[&MarkerA] -->CheckResistances| -->CheckUndead| -->PlayEffects| -->CalculateDamage| -->ApplyDamage|@{target|token_id};1;-[$TotalDamage] --X| --:Hit| --=Damage|[$DamageDice] + [$DamageModifier] [&AttackModifierType] + [$FeatDamage] [&FeatDamageType] --+|[c][img height=50 width=50][$DamageDice.tableEntryImgURL][/img][/c] --+|[c][b]Hit for [$Damage] [&DamageType] damage![/b][/c] --a|chill_touch --@token-mod|_ignore-selected _ids @{target|token_id} _set statusmarkers|[&MarkerA] -->CheckResistances| -->CheckUndead| -->PlayEffects| -->CalculateDamage| -->ApplyDamage|@{target|token_id};1;-[$TotalDamage] --X| --:Miss| --a|chill_touch --=Damage|0 --+|[c][b][f18]The attack [#ff0000]missed[/#]![/f][/b][/c] --X| --:CheckResistances| --?"[*T:npc_resistances]" -inc [&DamageType]|ApplyResistance --?"[*T:npc_immunities]" -inc [&DamageType]|ApplyImmunity --?"[*T:npc_vulnerabilities]" -inc [&DamageType]|ApplyVulnerability --<| --:ApplyResistance| --=Resistance|[$Damage] \ 2 --*|Creature is resistant to [&DamageType] damage! --<| --:ApplyImmunity| --=Immunity|[$Damage] --*|Creature is immune to [&DamageType] damage! --<| --:ApplyVulnerability| --=Vulnerability|[$Damage] --*|Creature is vulnerable to [&DamageType] damage! --<| --:CheckUndead| --?"@{target|npc_type}" -inc "undead" |ApplyDisadvantage --<| --:ApplyDisadvantage| --*|Creature is undead, and has disadvantage until the end of the players next turn! --~|turnorder;addcustom;Disadvantage;1;-1 --a|chill_touch --@token-mod|_ignore-selected _ids @{target|token_id} _set statusmarkers|[&MarkerB] --<| --:PlayEffects| --vtoken|@{target|token_id} [&DamageFX] --<| --:CalculateDamage| --=TotalDamage|[$Damage]-[$Resistance]-[$Immunity]+[$Vulnerability] --<| --:ApplyDamage| --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%] --<| --:tooFar| --+|The target is too far away. --X| }}
1706766974

Edited 1706767644
So ScriptCards surprises me again, it already has built-in dice. Either that or it's a function of the API, not sure. It changes things, though. Now I don't need a Rollable table, but I need to add conditionals for colors ie 20 as green, 1 as red, which I haven't done yet. !scriptcard {{ --/|**********Customizable Variables*************** --#overridetemplate|mydnd --#dicefontcolor| Black --#dicefontsize| 5.0em --#usehollowdice|1 --:DoSetup| --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --&SpellLevel|cantrip --&SpellName|Chill Touch --Rfind|@{selected|character_id};[&SpellName];repeating_spell-[&SpellLevel];spellname --#emoteText|[*S:character_name] Casts [*R:spellname]. --#title|[*R:spellname] [*R:innate] --#leftsub|@{selected|character_name} (@{selected|caster_level}) --?[*R:spelllevel] -eq cantrip|&spllvl;cantrip --?[*R:spelllevel] -eq 1|&spllvl;1st-level --?[*R:spelllevel] -eq 2|&spllvl;2nd-level --?[*R:spelllevel] -eq 3|&spllvl;3rd-level --?[*R:spelllevel] -eq 4|&spllvl;4th-level --?[*R:spelllevel] -eq 5|&spllvl;5th-level --?[*R:spelllevel] -eq 6|&spllvl;6th-level --?[*R:spelllevel] -eq 7|&spllvl;7th-level --?[*R:spelllevel] -eq 8|&spllvl;8th-level --?[*R:spelllevel] -eq 9|&spllvl;9th-level --#rightsub|[i][&spllvl] [*R:spellschool][/i] --+Casting Time:|[*R:spellcastingtime] --+Range:|[*R:spellrange] --+Target:|[*R:spelltarget] --&zSCV|V --?"[*R:spellcomp_v]" -inc "v=1"|ENDSCV --&zSCV| --:ENDSCV| --&zSCS|S --?"[*R:spellcomp_s]" -inc "s=1"|ENDSCS --&zSCS| --:ENDSCS| --&zSCM|M --?"[*R:spellcomp_m]" -inc "m=1"|ENDSCM --&zSCM| --:ENDSCM| --?"[*R:spellcomp_m]" -ninc "m=1"|[ --&materials| --]|[ --&materials|([*R:spellcomp_materials]) --]| --+Components:|[&zSCV][&zSCS][&zSCM] [&materials] --+Duration:|[*R:spellduration] --+|[*R:spelldescription] --~Len|string;length;[*R:spellathigherlevels] --?[$Len] -le 5|END_HV_CHECK --+|[b][i]At Higher Levels.[/i][/b][*R:spellathigherlevels] --:END_HV_CHECK| --=CritRoll|20 --=AttackModifier|@{selected|spellcasting_ability} --=DamageModifier|0 --&AttackModifierType|[WIS] --=FeatDamage|0 --&FeatDamageType|[FEAT] --=ProficiencyBonus|@{selected|pb} --=DamageDice|1d8 --=CritDice|1d8 --&DamageType|necrotic --&DamageFX|burn-death --&MarkerA|chilltouch --&MarkerB|Disadvantage --/|****************DO NOT CHANGE****************** --=TargetAC|@{target|npc_ac} --=Damage|0 --=Resistance|0 --=Immunity|0 --=Vulnerability|0 --=TotalDamage|0 --~HowFarAway|distance;@{selected|token_id};@{target|token_id} --=HowFar|[$HowFarAway] * 5 --?[$HowFar] -gt 120|tooFar --+|[c]What type of attack?[/c] --+|[c][rbutton]Standard::Standard;1d20[/rbutton][rbutton]Advantage::AdvDis;2d20kh1[/rbutton][rbutton]Disadvantage::AdvDis;2d20kl1[/rbutton][/c] --/|*******************Main************************ --X| --/|****************Subroutines******************** --:Standard| --=AttackRoll|[&reentryval] --=Attack|[$AttackRoll] + [$AttackModifier] [&AttackModifierType] + [$ProficiencyBonus] [PB] --+|[br] --+|[c][d20][$AttackRoll.Raw][/d20][br][br][b] + [$AttackModifier] [&AttackModifierType] + [$ProficiencyBonus] [PB][/b][/c][c]=[br][/c][c][F:Contrail One:22][$Attack][/F][/c] --?[$AttackRoll.Base] -eq [$CritRoll]|Crit --?[$Attack.Total] -ge [$TargetAC]|Hit --?[$Attack.Total] -lt [$TargetAC]|Miss --X| --:AdvDis| --=AttackRoll|[&reentryval] --=Attack|[$AttackRoll] --+|[br] --+|[c][d20][$AttackRoll.KeptDice(1)][/d20][d20][$AttackRoll.DroppedDice(1)][/d20][br][br][b] + [$AttackModifier] [&AttackModifierType] + [$ProficiencyBonus] [PB][/b][/c][c]=[br][/c][c][F:Contrail One:22][$Attack][/F][/c] --?[$AttackRoll.Base] -eq [$CritRoll]|Crit --?[$Attack.Total] -ge [$TargetAC]|Hit --?[$Attack.Total] -lt [$TargetAC]|Miss --X| --:Crit| --=Damage|[$DamageDice] + [$CritDice] [CRIT] --+|[br] --+|[c][d8][$DamageDice.Raw][/d8][d8][$CritDice.Raw][/d8][/c] --+|[c][b][#1c7539]Critical Hit[/#] for [$Damage] [&DamageType] damage![/b][/c] --a|chill_touch --@token-mod|_ignore-selected _ids @{target|token_id} _set statusmarkers|[&MarkerA] -->CheckResistances| -->CheckUndead| -->PlayEffects| -->CalculateDamage| -->ApplyDamage|@{target|token_id};1;-[$TotalDamage] --X| --:Hit| --=Damage|[$DamageDice] + [$DamageModifier] [&AttackModifierType] + [$FeatDamage] [&FeatDamageType] --&DieD8|[$Damage.Raw] --+|[br] --+|[c][d8][&DieD8][/d8][/c] --+|[c][b]Hit for [$Damage] [&DamageType] damage![/b][/c] --a|chill_touch --@token-mod|_ignore-selected _ids @{target|token_id} _set statusmarkers|[&MarkerA] -->CheckResistances| -->CheckUndead| -->PlayEffects| -->CalculateDamage| -->ApplyDamage|@{target|token_id};1;-[$TotalDamage] --X| --:Miss| --a|chill_touch --=Damage|0 --+|[c][b][f18]The attack [#ff0000]missed[/#]![/f][/b][/c] --X| --:CheckResistances| --?"[*T:npc_resistances]" -inc [&DamageType]|ApplyResistance --?"[*T:npc_immunities]" -inc [&DamageType]|ApplyImmunity --?"[*T:npc_vulnerabilities]" -inc [&DamageType]|ApplyVulnerability --<| --:ApplyResistance| --=Resistance|[$Damage] \ 2 --*|Creature is resistant to [&DamageType] damage! --<| --:ApplyImmunity| --=Immunity|[$Damage] --*|Creature is immune to [&DamageType] damage! --<| --:ApplyVulnerability| --=Vulnerability|[$Damage] --*|Creature is vulnerable to [&DamageType] damage! --<| --:CheckUndead| --?"@{target|npc_type}" -inc "undead" |ApplyDisadvantage --<| --:ApplyDisadvantage| --*|Creature is undead, and has disadvantage until the end of the players next turn! --~|turnorder;addcustom;Disadvantage;1;-1 --a|chill_touch --@token-mod|_ignore-selected _ids @{target|token_id} _set statusmarkers|[&MarkerB] --<| --:PlayEffects| --vtoken|@{target|token_id} [&DamageFX] --<| --:CalculateDamage| --=TotalDamage|[$Damage]-[$Resistance]-[$Immunity]+[$Vulnerability] --<| --:ApplyDamage| --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%] --<| --:tooFar| --+|The target is too far away. --X| }}
I'm not getting a whole lot of interaction in this thread, but I'm stubborn so I'm gonna keep going. I'm looking for advice on how to highlight critical hits and misses. Currently, I have it so that when there's a critical hit the dice turn green and when there's a critical miss the dice turn red. Unfortunately, all the dice change color, I can't think of a way to get just the the dice that reflect the criticals to change color. In the following image I changed the crit range down to 15 so that it was easier to test. I also changed the dice to not be hollow and the color of the highlighted rolls to be a little different. I've cleaned up the code quite a bit, so I'll repost it. !scriptcard {{ --/|Formatting --#overridetemplate|mydnd --#dicefontsize| 5.0em --#rollHilightColorNormal|#d3b63b --/|SpellSetup --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --&SpellLevel|cantrip --&SpellName|Chill Touch --Rfind|@{selected|character_id};[&SpellName];repeating_spell-[&SpellLevel];spellname --#emoteText|[*S:character_name] Casts [*R:spellname]. --#title|[*R:spellname] [*R:innate] --#leftsub|@{selected|character_name} (@{selected|caster_level}) --?[*R:spelllevel] -eq cantrip|&spllvl;cantrip --?[*R:spelllevel] -eq 1|&spllvl;1st-level --?[*R:spelllevel] -eq 2|&spllvl;2nd-level --?[*R:spelllevel] -eq 3|&spllvl;3rd-level --?[*R:spelllevel] -eq 4|&spllvl;4th-level --?[*R:spelllevel] -eq 5|&spllvl;5th-level --?[*R:spelllevel] -eq 6|&spllvl;6th-level --?[*R:spelllevel] -eq 7|&spllvl;7th-level --?[*R:spelllevel] -eq 8|&spllvl;8th-level --?[*R:spelllevel] -eq 9|&spllvl;9th-level --#rightsub|[i][&spllvl] [*R:spellschool][/i] --+Casting Time:|[*R:spellcastingtime] --+Range:|[*R:spellrange] --+Target:|[*R:spelltarget] --&zSCV|V --?"[*R:spellcomp_v]" -inc "v=1"|ENDSCV --&zSCV| --:ENDSCV| --&zSCS|S --?"[*R:spellcomp_s]" -inc "s=1"|ENDSCS --&zSCS| --:ENDSCS| --&zSCM|M --?"[*R:spellcomp_m]" -inc "m=1"|ENDSCM --&zSCM| --:ENDSCM| --?"[*R:spellcomp_m]" -ninc "m=1"|[ --&materials| --]|[ --&materials|([*R:spellcomp_materials]) --]| --+Components:|[&zSCV][&zSCS][&zSCM] [&materials] --+Duration:|[*R:spellduration] --+|[*R:spelldescription] --~Len|string;length;[*R:spellathigherlevels] --?[$Len] -le 5|END_HV_CHECK --+|[b][i]At Higher Levels.[/i][/b][*R:spellathigherlevels] --:END_HV_CHECK| --=TargetAC|@{target|npc_ac} --=CritRoll|20 --=AttackModifier|@{selected|spellcasting_ability} --=DamageModifier|0 --&AttackModifierType|[WIS] --=FeatDamage|0 --=ProficiencyBonus|@{selected|pb} --=DamageDice|1d8 --=CritDice|1d8 --&DamageType|necrotic --&DamageFX|burn-death --&MarkerA|chilltouch --&MarkerB|Disadvantage --&Range|120 --&SoundFX|chill_touch --/|****************DO NOT CHANGE****************** --=Damage|0 --=Resistance|0 --=Immunity|0 --=Vulnerability|0 --=TotalDamage|0 --~HowFarAway|distance;@{selected|token_id};@{target|token_id} --=HowFar|[$HowFarAway] * 5 --?[$HowFar] -gt [&Range]|tooFar --+|[c]What type of attack?[/c] --+|[c][rbutton]Standard::MakeAttack;1d20[/rbutton][rbutton]Advantage::MakeAttack;2d20kh1[/rbutton][rbutton]Disadvantage::MakeAttack;2d20kl1[/rbutton][/c] --X| --:MakeAttack| --=AttackRoll|[&reentryval] --=Attack|[$AttackRoll] + [$AttackModifier] [&AttackModifierType] + [$ProficiencyBonus] [PB] --?[$AttackRoll.Total] -ge [$CritRoll]|&DieColor;Green --?[$AttackRoll.Total] -eq 1|&DieColor;Red --?[$AttackRoll.Total] -ge 2 -and [$AttackRoll.Total] -lt [$CritRoll]|&DieColor;Black --#dicefontcolor|[&DieColor] --+|[br] --?"[$AttackRoll.RollText]" -eq "1d20"|[ --+|[c][d20][$AttackRoll.Raw][/d20][br][br][b] + [$AttackModifier] [&AttackModifierType] + [$ProficiencyBonus] [PB][/b][/c][c]=[br][/c][c][F:Contrail One:22][$Attack][/F][/c] --]|[ --+|[c][d20][$AttackRoll.KeptDice(1)][/d20][d20][$AttackRoll.DroppedDice(1)][/d20][br][br][b] + [$AttackModifier] [&AttackModifierType] + [$ProficiencyBonus] [PB][/b][/c][c]=[br][/c][c][F:Contrail One:22][$Attack][/F][/c] --]| --?[$Attack.Total] -ge [$TargetAC]|Hit --?[$Attack.Total] -lt [$TargetAC]|Miss --X| --:Hit| --?[$AttackRoll.Base] -ge [$CritRoll]|[ --=Damage|[$DamageDice] + [$CritDice] [CRIT] --+|[br] --+|[c][d8][$DamageDice.Raw][/d8][d8][$CritDice.Raw][/d8][/c] --+|[c][b][#1c7539]Critical Hit[/#] for [$Damage] [&DamageType] damage![/b][/c] --]|[ --=Damage|[$DamageDice] --+|[br] --+|[c][d8][$Damage.Raw][/d8][/c] --+|[c][b]Hit for [$Damage] [&DamageType] damage![/b][/c] --]| --a|chill_touch --@token-mod|_ignore-selected _ids @{target|token_id} _set statusmarkers|[&MarkerA] -->CheckResistances| -->CheckUndead| -->PlayEffects| -->CalculateDamage| -->ApplyDamage|@{target|token_id};1;-[$TotalDamage] --X| --:Miss| --a|[&SoundFX] --=Damage|0 --+|[c][b][f18]The attack [#ff0000]missed[/#]![/f][/b][/c] --X| --:CheckResistances| --?"[*T:npc_resistances]" -inc [&DamageType]|ApplyResistance --?"[*T:npc_immunities]" -inc [&DamageType]|ApplyImmunity --?"[*T:npc_vulnerabilities]" -inc [&DamageType]|ApplyVulnerability --<| --:ApplyResistance| --=Resistance|[$Damage] \ 2 --*|Creature is resistant to [&DamageType] damage! --<| --:ApplyImmunity| --=Immunity|[$Damage] --*|Creature is immune to [&DamageType] damage! --<| --:ApplyVulnerability| --=Vulnerability|[$Damage] --*|Creature is vulnerable to [&DamageType] damage! --<| --:CheckUndead| --?"@{target|npc_type}" -inc "undead" |ApplyDisadvantage --<| --:ApplyDisadvantage| --*|[c][b]Creature is undead, and has disadvantage until the end of the players next turn![/b][/c] --a|[&SoundFX] --@token-mod|_ignore-selected _ids @{target|token_id} _set statusmarkers|[&MarkerB] --<| --:PlayEffects| --vtoken|@{target|token_id} [&DamageFX] --<| --:CalculateDamage| --=TotalDamage|[$Damage]-[$Resistance]-[$Immunity]+[$Vulnerability] --<| --:ApplyDamage| --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%] --<| --:tooFar| --+|The target is too far away. --X| }}
And now another thought occurs, I haven't taken into account increasing the number of dice at higher levels. Suggestions about that would be great too. I'm lost when it comes to loops and arrays.
1706907972

Edited 1706912059
Continuing on this lonely trek through ScriptCard land... So, I've tried my hand at loops, cause it's the only way I could think of adding dice rolls for levels etc. while still seeing the output as dice. The only issue is now because it's looping, each loop is a new line and so we get a vertical stack of dice. I mean, it's not the worst thing in the world, but it could become pretty cumbersome at higher levels when characters start rolling "handfulls" of dice. And, I'd like to implement this method and styling throughout my entire game, so I can't get too complicated. One of the only ways I can think of displaying the results differently would be to store the data on a Storage Mule and then display it by calling to said Storage Mule. Anyone have any ideas? !scriptcard {{ --/|Formatting --#Debug|1 --#overridetemplate|mydnd --#dicefontsize| 5.0em --#rollHilightColorNormal|#d3b63b --#rollHilightColorCrit|#1c7539 --#rollHilightColorFumble|#ff0000 --/|SpellSetup --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --&SpellLevel|cantrip --&SpellName|Chill Touch --Rfind|@{selected|character_id};[&SpellName];repeating_spell-[&SpellLevel];spellname --#emoteText|[*S:character_name] Casts [*R:spellname]. --#title|[*R:spellname] [*R:innate] --#leftsub|@{selected|character_name} (@{selected|caster_level}) --?[*R:spelllevel] -eq cantrip|&spllvl;cantrip --?[*R:spelllevel] -eq 1|&spllvl;1st-level --?[*R:spelllevel] -eq 2|&spllvl;2nd-level --?[*R:spelllevel] -eq 3|&spllvl;3rd-level --?[*R:spelllevel] -eq 4|&spllvl;4th-level --?[*R:spelllevel] -eq 5|&spllvl;5th-level --?[*R:spelllevel] -eq 6|&spllvl;6th-level --?[*R:spelllevel] -eq 7|&spllvl;7th-level --?[*R:spelllevel] -eq 8|&spllvl;8th-level --?[*R:spelllevel] -eq 9|&spllvl;9th-level --#rightsub|[i][&spllvl] [*R:spellschool][/i] --+Casting Time:|[*R:spellcastingtime] --+Range:|[*R:spellrange] --+Target:|[*R:spelltarget] --&zSCV|V --?"[*R:spellcomp_v]" -inc "v=1"|ENDSCV --&zSCV| --:ENDSCV| --&zSCS|S --?"[*R:spellcomp_s]" -inc "s=1"|ENDSCS --&zSCS| --:ENDSCS| --&zSCM|M --?"[*R:spellcomp_m]" -inc "m=1"|ENDSCM --&zSCM| --:ENDSCM| --?"[*R:spellcomp_m]" -ninc "m=1"|[ --&materials| --]|[ --&materials|([*R:spellcomp_materials]) --]| --+Components:|[&zSCV][&zSCS][&zSCM] [&materials] --+Duration:|[*R:spellduration] --+|[*R:spelldescription] --~Len|string;length;[*R:spellathigherlevels] --?[$Len] -le 5|END_HV_CHECK --+|[b][i]At Higher Levels.[/i][/b][*R:spellathigherlevels] --:END_HV_CHECK| --=TargetAC|@{target|npc_ac} --=CritRoll|10 --=AttackModifier|@{selected|spellcasting_ability} --=DamageModifier|0 --&AttackModifierType|[WIS] --=FeatDamage|0 --=ProficiencyBonus|@{selected|pb} --?@{selected|level} -lt 5|&Dice;1 --?@{selected|level} -ge 5 -and -le 10|&Dice;2 --?@{selected|level} -ge 11 -and -le 16|&Dice;3 --?@{selected|level} -ge 17|&Dice;4 --&DamageDice|[&Dice]d8 --&DamageType|necrotic --&DamageFX|burn-death --&MarkerA|chilltouch --&MarkerB|Disadvantage --&Range|120 --&SoundFX|chill_touch --/|****************DO NOT CHANGE****************** --=Damage|0 --=Resistance|0 --=Immunity|0 --=Vulnerability|0 --=TotalDamage|0 --~HowFarAway|distance;@{selected|token_id};@{target|token_id} --=HowFar|[$HowFarAway] * 5 --?[$HowFar] -gt [&Range]|tooFar --+|[c]What type of attack?[/c] --+|[c][rbutton]Standard::MakeAttack;1d20[/rbutton][rbutton]Advantage::MakeAttack;2d20kh1[/rbutton][rbutton]Disadvantage::MakeAttack;2d20kl1[/rbutton][/c] --X| --:MakeAttack| --=AttackRoll|[&reentryval] --=Attack|[$AttackRoll] + [$AttackModifier] [&AttackModifierType] + [$ProficiencyBonus] [PB] --?[$AttackRoll.Total] -ge [$CritRoll]|&DieColor;#1c7539 --?[$AttackRoll.Total] -eq 1|&DieColor;#ff0000 --?[$AttackRoll.Total] -ge 2 -and [$AttackRoll.Total] -lt [$CritRoll]|&DieColor;Black --#dicefontcolor|[&DieColor] --+|[br] --?"[$AttackRoll.RollText]" -eq "1d20"|[ --+|[c][d20][$AttackRoll.Raw][/d20][br][br] + [$AttackModifier] [b][&AttackModifierType][/b] + [$ProficiencyBonus] [b][PB][/b][/c][c]=[br][/c][c][F:Contrail One:22][$Attack][/F][/c] --]|[ --+|[c][d20][$AttackRoll.KeptDice(1)][/d20][d20][$AttackRoll.DroppedDice(1)][/d20][br][br][b] + [$AttackModifier] [&AttackModifierType] + [$ProficiencyBonus] [PB][/b][/c][c]=[br][/c][c][F:Contrail One:22][$Attack][/F][/c] --]| --?[$Attack.Total] -ge [$TargetAC]|Hit --?[$Attack.Total] -lt [$TargetAC]|Miss --X| --:Hit| --+|[br] --?[$AttackRoll.Base] -ge [$CritRoll]|[ --=Damage|[&DamageDice] [&DamageDice] -->DieLoop| --+|[c][b][#1c7539]Critical Hit[/#] for [$Damage] [&DamageType] damage![/b][/c] --]|[ --=Damage|[&DamageDice] -->DieLoop| --+|[c][b]Hit for [$Damage] [&DamageType] damage![/b][/c] --]| --a|chill_touch --@token-mod|_ignore-selected _ids @{target|token_id} _set statusmarkers|[&MarkerA] -->CheckResistances| -->CheckUndead| -->PlayEffects| -->CalculateDamage| -->ApplyDamage|@{target|token_id};1;-[$TotalDamage] --X| --:DieLoop| --%RollC|1;[$Damage.RollCount] --+|[c][d8][$Damage.RolledDice([&RollC])][/d8][/c] --%| --<| --:Miss| --a|[&SoundFX] --=Damage|0 --+|[c][b][f18]The attack [#ff0000]missed[/#]![/f][/b][/c] --X| --:CheckResistances| --?"[*T:npc_resistances]" -inc [&DamageType]|ApplyResistance --?"[*T:npc_immunities]" -inc [&DamageType]|ApplyImmunity --?"[*T:npc_vulnerabilities]" -inc [&DamageType]|ApplyVulnerability --<| --:ApplyResistance| --=Resistance|[$Damage] \ 2 --*|Creature is resistant to [&DamageType] damage! --<| --:ApplyImmunity| --=Immunity|[$Damage] --*|Creature is immune to [&DamageType] damage! --<| --:ApplyVulnerability| --=Vulnerability|[$Damage] --*|Creature is vulnerable to [&DamageType] damage! --<| --:CheckUndead| --?"@{target|npc_type}" -inc "undead" |ApplyDisadvantage --<| --:ApplyDisadvantage| --*|[c][b]Creature is undead, and has disadvantage until the end of the players next turn![/b][/c] --a|[&SoundFX] --@token-mod|_ignore-selected _ids @{target|token_id} _set statusmarkers|[&MarkerB] --<| --:PlayEffects| --vtoken|@{target|token_id} [&DamageFX] --<| --:CalculateDamage| --=TotalDamage|[$Damage]-[$Resistance]-[$Immunity]+[$Vulnerability] --<| --:ApplyDamage| --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%] --<| --:tooFar| --+|The target is too far away. --X| }}
Hey Timothy, Sorry that I can't really help you with formatting. My formatting is awful. I just use basic Supernotes for now so I can't help you with that aspect. As for loops and displaying, one option you can do is to append to a StringVariable and then display the String at the end. This can be done to display multiple items on a single line. I do this with buttons for actions. --&buttonsPerRow|4 --:DisplayOtherAbilites| --?"[&EnableDebugLogging]" -eq "true"|>LogDebug;Processing other abilities [@PCOtherAbilityArr(length)] --?"[@PCOtherAbilityArr(length)]" -eq 0|EndOtherAbilitySub --+|[c][b]Other Abilities[/b][/c] --&pcotherCounter|1 --&pcotherMsg|[t][tr] --%pcother|foreach;PCOtherAbilityArr --&pcotherSource|[&pcother(split,%,0)] --&pcotherID|[&pcother(split,%,1)] --&pcothername|[*O:[&pcotherID]:ability:name] --&pcotherDisplayName|[&pcothername(replace,[&otherAbilityPrefix],)] --&pcotherMsg|+[td][button][&pcotherDisplayName(replaceall,-, )]::~[&pcotherSource]|[&pcotherID][/button][/td] --?[= [&pcotherCounter] % [&buttonsPerRow] ] -eq 0|&pcotherMsg;+[/tr][tr] -->PCPromptIncrementCounter|pcotherCounter --%| --&pcotherMsg|+[/tr][/t] --+|[&pcotherMsg] --:EndOtherAbilitySub| --<| --:PCPromptIncrementCounter|StringVariableToIncrement --?"[&EnableDebugLogging]" -eq "true"|>LogDebug;Incrementing [%1%] counter --&[%1%]|[= [&[%1%]] + 1] --<| so that's a portion of my script that does something similar. The specifics aren't super important but it will form a table and then put up to &buttonsPerRow on a line and then add a new row in the table. You can use a table like this or you can just have it add a line break at some point. You don't need to have --+| in your loop. You can just append new rolls to an existing StringVar and then display that StringVar at the end. The above example is overly complicated to illustrate that point but it's what I had handy. --&messageVar| --%item|foreach;LoopArray --&messageVar|+[d20][&item][/d20] --%| --+|[&messageVar] That is an overly simple and contrived basic example of what I'm talking about. You build the message result with the loop and display after instead of displaying each loop run. Gives more control over the output.
1706938674

Edited 1706939095
Hey, another human! Thanks, Joshua. I admit I still don't fully understand the code, but I did manage to sift through it to get the desired result. So, if 15 were a critical hit and the total number of d8's rolled was 8, it would look like the following. A more likely output with the character at level 4 and it being a standard attack. Now I just need to somehow apply this to all attack rolls throughout my game... !scriptcard {{ --/|Formatting --#Debug|1 --#overridetemplate|mydnd --#dicefontsize| 5.0em --#rollHilightColorNormal|#d3b63b --#rollHilightColorCrit|#1c7539 --#rollHilightColorFumble|#ff0000 --/|SpellSetup --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --&amp;SpellLevel|cantrip --&amp;SpellName|Chill Touch --Rfind|@{selected|character_id};[&amp;SpellName];repeating_spell-[&amp;SpellLevel];spellname --#emoteText|[*S:character_name] Casts [*R:spellname]. --#title|[*R:spellname] [*R:innate] --#leftsub|@{selected|character_name} (@{selected|caster_level}) --?[*R:spelllevel] -eq cantrip|&amp;spllvl;cantrip --?[*R:spelllevel] -eq 1|&amp;spllvl;1st-level --?[*R:spelllevel] -eq 2|&amp;spllvl;2nd-level --?[*R:spelllevel] -eq 3|&amp;spllvl;3rd-level --?[*R:spelllevel] -eq 4|&amp;spllvl;4th-level --?[*R:spelllevel] -eq 5|&amp;spllvl;5th-level --?[*R:spelllevel] -eq 6|&amp;spllvl;6th-level --?[*R:spelllevel] -eq 7|&amp;spllvl;7th-level --?[*R:spelllevel] -eq 8|&amp;spllvl;8th-level --?[*R:spelllevel] -eq 9|&amp;spllvl;9th-level --#rightsub|[i][&amp;spllvl] [*R:spellschool][/i] --+Casting Time:|[*R:spellcastingtime] --+Range:|[*R:spellrange] --+Target:|[*R:spelltarget] --&amp;zSCV|V --?"[*R:spellcomp_v]" -inc "v=1"|ENDSCV --&amp;zSCV| --:ENDSCV| --&amp;zSCS|S --?"[*R:spellcomp_s]" -inc "s=1"|ENDSCS --&amp;zSCS| --:ENDSCS| --&amp;zSCM|M --?"[*R:spellcomp_m]" -inc "m=1"|ENDSCM --&amp;zSCM| --:ENDSCM| --?"[*R:spellcomp_m]" -ninc "m=1"|[ --&amp;materials| --]|[ --&amp;materials|([*R:spellcomp_materials]) --]| --+Components:|[&amp;zSCV][&amp;zSCS][&amp;zSCM] [&amp;materials] --+Duration:|[*R:spellduration] --+|[*R:spelldescription] --~Len|string;length;[*R:spellathigherlevels] --?[$Len] -le 5|END_HV_CHECK --+|[b][i]At Higher Levels.[/i][/b][*R:spellathigherlevels] --:END_HV_CHECK| --=TargetAC|@{target|npc_ac} --=CritRoll|20 --=AttackModifier|@{selected|spellcasting_ability} --=DamageModifier|0 --&amp;AttackModifierType|[WIS] --=FeatDamage|0 --=ProficiencyBonus|@{selected|pb} --?@{selected|level} -lt 5|&amp;Dice;1 --?@{selected|level} -ge 5 -and -le 10|&amp;Dice;2 --?@{selected|level} -ge 11 -and -le 16|&amp;Dice;3 --?@{selected|level} -ge 17|&amp;Dice;4 --&amp;DamageDice|[&amp;Dice]d8 --&amp;DamageType|necrotic --&amp;DamageFX|burn-death --&amp;MarkerA|chilltouch --&amp;MarkerB|Disadvantage --&amp;Range|120 --&amp;SoundFX|chill_touch --/|****************DO NOT CHANGE****************** --=Damage|0 --=Resistance|0 --=Immunity|0 --=Vulnerability|0 --=TotalDamage|0 --~HowFarAway|distance;@{selected|token_id};@{target|token_id} --=HowFar|[$HowFarAway] * 5 --?[$HowFar] -gt [&amp;Range]|tooFar --+|[c]What type of attack?[/c] --+|[c][rbutton]Standard::MakeAttack;1d20[/rbutton][rbutton]Advantage::MakeAttack;2d20kh1[/rbutton][rbutton]Disadvantage::MakeAttack;2d20kl1[/rbutton][/c] --X| --:MakeAttack| --=AttackRoll|[&amp;reentryval] --=Attack|[$AttackRoll] + [$AttackModifier] [&amp;AttackModifierType] + [$ProficiencyBonus] [PB] --?[$AttackRoll.Total] -ge [$CritRoll]|&amp;DieColor;#1c7539 --?[$AttackRoll.Total] -eq 1|&amp;DieColor;#ff0000 --?[$AttackRoll.Total] -ge 2 -and [$AttackRoll.Total] -lt [$CritRoll]|&amp;DieColor;Black --#dicefontcolor|[&amp;DieColor] --+|[br] --?"[$AttackRoll.RollText]" -eq "1d20"|[ --+|[c][d20][$AttackRoll.Raw][/d20][br][br] + [$AttackModifier] [b][&amp;AttackModifierType][/b] + [$ProficiencyBonus] [b][PB][/b][/c][c]=[br][/c][c][F:Contrail One:22][$Attack][/F][/c] --]|[ --+|[c][d20][$AttackRoll.KeptDice(1)][/d20][d20][$AttackRoll.DroppedDice(1)][/d20][br][br][b] + [$AttackModifier] [&amp;AttackModifierType] + [$ProficiencyBonus] [PB][/b][/c][c]=[br][/c][c][F:Contrail One:22][$Attack][/F][/c] --]| --?[$Attack.Total] -ge [$TargetAC]|Hit --?[$Attack.Total] -lt [$TargetAC]|Miss --X| --:Hit| --+|[br] --?[$AttackRoll.Base] -ge [$CritRoll]|[ --=Damage|[&amp;DamageDice] [&amp;DamageDice] --&gt;DieLoop| --+|[c][b][#1c7539]Critical Hit[/#] for [$Damage] [&amp;DamageType] damage![/b][/c] --]|[ --=Damage|[&amp;DamageDice] --&gt;DieLoop| --+|[c][b]Hit for [$Damage] [&amp;DamageType] damage![/b][/c] --]| --a|chill_touch --@token-mod|_ignore-selected _ids @{target|token_id} _set statusmarkers|[&amp;MarkerA] --&gt;CheckResistances| --&gt;CheckUndead| --&gt;PlayEffects| --&gt;CalculateDamage| --&gt;ApplyDamage|@{target|token_id};1;-[$TotalDamage] --X| --:DieLoop| --&amp;DicePerRow|4 --&amp;DieCounter|1 --&amp;AllDice|[c][t width=100%][tr] --%RollC|1;[$Damage.RollCount] --&amp;AllDice|+[td height=60px][d8][$Damage.RolledDice([&amp;RollC])][/d8][/td] --?[= [&amp;DieCounter] % [&amp;DicePerRow] ] -eq 0|&amp;AllDice;+[/tr][tr] --&gt;IncrementCounter|DieCounter --%| --&amp;AllDice|+[/tr][/t][/c] --+|[&amp;AllDice] --&lt;| --:IncrementCounter| --&amp;[%1%]|[= [&amp;[%1%]] + 1] --&lt;| --:Miss| --a|[&amp;SoundFX] --=Damage|0 --+|[c][b][f18]The attack [#ff0000]missed[/#]![/f][/b][/c] --X| --:CheckResistances| --?"[*T:npc_resistances]" -inc [&amp;DamageType]|ApplyResistance --?"[*T:npc_immunities]" -inc [&amp;DamageType]|ApplyImmunity --?"[*T:npc_vulnerabilities]" -inc [&amp;DamageType]|ApplyVulnerability --&lt;| --:ApplyResistance| --=Resistance|[$Damage] \ 2 --*|Creature is resistant to [&amp;DamageType] damage! --&lt;| --:ApplyImmunity| --=Immunity|[$Damage] --*|Creature is immune to [&amp;DamageType] damage! --&lt;| --:ApplyVulnerability| --=Vulnerability|[$Damage] --*|Creature is vulnerable to [&amp;DamageType] damage! --&lt;| --:CheckUndead| --?"@{target|npc_type}" -inc "undead" |ApplyDisadvantage --&lt;| --:ApplyDisadvantage| --*|[c][b]Creature is undead, and has disadvantage until the end of the players next turn![/b][/c] --a|[&amp;SoundFX] --@token-mod|_ignore-selected _ids @{target|token_id} _set statusmarkers|[&amp;MarkerB] --&lt;| --:PlayEffects| --vtoken|@{target|token_id} [&amp;DamageFX] --&lt;| --:CalculateDamage| --=TotalDamage|[$Damage]-[$Resistance]-[$Immunity]+[$Vulnerability] --&lt;| --:ApplyDamage| --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%] --&lt;| --:tooFar| --+|The target is too far away. --X| }} If anyone wants to use this for whatever reason and you want to use my template I'll post it below. It's very much a copy of the dnd5e built-in template, but I changed some of the coloring to better match the 5e book(according to my monitor, everybody's is gonna be different) and I changed the buttons to look better and be usable. The buttons of the dnd5e are much too small to use. To use this you need the template mule in accordance with the ScriptCard instructions. boxcode::{div style='background-image: linear-gradient( rgb(237,232,207,0.5) , rgb(237,232,207,0.5) ) , url(&amp;quot;<a href="https://imgsrv.roll20.net/?src=https%3A//i.imgur.com/8Mm94QY.png&amp;quot" rel="nofollow">https://imgsrv.roll20.net/?src=https%3A//i.imgur.com/8Mm94QY.png&amp;quot</a>;) ; background-size: 100% 100% ; box-shadow: 0 0 3px #fff ; display: block ; text-align: left ; font-size: 14px ; padding: 5px ; margin-bottom: 2px ; color: black ; font-family: &amp;quot;bookmania&amp;quot; , serif ; white-space: pre-wrap ; line-height: 1.2em ; font-style: normal'}|| titlecode::{div style='margin: 0.5em 1em 0.25em 1em ; font-size: 22px ; font-variant: small-caps ; border-bottom: 2px solid #d3b63b ; font-family: &amp;quot;mrseavessmallcaps&amp;quot; , &amp;quot;monsterrat&amp;quot; , serif ; color: rgba(103,34,35,1) ; display: block ; font-weight: normal ; font-style: normal ;'}|| textcode::{/div}{div}{div style='font-weight: normal; display: block; margin: 0 1em 0 1em;'}|| buttonwrapper::{div style='display: inline-block ;'}|| buttonstyle::style='background-color: rgba( 103 , 34 , 35 , 1 ) ; display: inline-block ; padding: 3px ; color: white ; text-align: center ; vertical-align: middle ; border-radius: 3px ; border-color: #999999 ; font-family: &amp;quot;mrseavessmallcaps&amp;quot; , &amp;quot;monsterrat&amp;quot; , serif ; font-size: 12px; margin: 0px 2px;'|| footer::
1706970150
David M.
Pro
API Scripter
Regarding getting critical hit and fumble dice to show up as different colors, you could to use a combination of [img] and [d20] tags along with a conditional. The example below kinda works, though there's some funky styling going on with padding or margins (html/css is not my strong suit). You might be able to work something out from here. As I'm writing this, I realized that instead you could create a single rollable table with all the dice formatted as you wanted (20 green, 1 red, others black), then use --~array|fromtable to create a lookup based on your die roll(s) to get the image urls. This is probably a cleaner way to go, though I'll leave the example below just in case. !script {{ --#dicefontcolor|black --#dicefontsize| 5.0em --&amp;nat20URL|<a href="https://files.d20.io/images/378533356/NOkbCjGy-AvRsbdmF2w7wA/original.png" rel="nofollow">https://files.d20.io/images/378533356/NOkbCjGy-AvRsbdmF2w7wA/original.png</a> --&amp;nat1URL|<a href="https://files.d20.io/images/378533348/cqH3_vtwgjNHfj3PioI4ZA/original.png" rel="nofollow">https://files.d20.io/images/378533348/cqH3_vtwgjNHfj3PioI4ZA/original.png</a> --%i|1;5 --=dieRoll|1d20 --&amp;rollStr|+[$dieRoll] --?[$dieRoll] -eq 1|&gt;Fumble --?[$dieRoll] -eq 20|&gt;Crit --?[$dieRoll] -gt 1 -and [$dieRoll] -lt 20|&gt;Normal --%| --+|[&amp;rollStr] --+|[&amp;dieStr] --X| --:Normal| --&amp;dieStr|+[d20][$dieRoll.Raw][/d20] --&lt;| --:Crit| --&amp;dieStr|+[img width=54em height=54em][&amp;nat20URL][/img] --&lt;| --:Fumble| --&amp;dieStr|+[img width=54em height=54em][&amp;nat1URL][/img] --&lt;| }}
1706992398
David M.
Pro
API Scripter
Ok, came back to this after running some errands. Using the rollable table method was pretty straightforward. Example code: !script {{ --%i|1;5 --=dieRoll|[T#d20_highlight] --&amp;rollStr|+[$dieRoll] --&amp;dieStr|+[img width=54em height=54em][$dieRoll.tableEntryImgURL][/img] --%| --+|[&amp;rollStr] --+|[&amp;dieStr] }} Example output: If you have the Table Export script installed, this should generate the d20_highlight table for you to roll on in your game (assuming no dropped api calls). You can obviously rename it to anything you want. If you don't want to rely on me never deleting these images from my test game, you can paste the urls into your browser, save them locally, and upload to your game. You'd need to create your rollable table manually in that case. !import-table --d20_highlight --show !import-table-item --d20_highlight --1 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599760/yBp4_OD_ia8ChMyPBX-ylg/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599760/yBp4_OD_ia8ChMyPBX-ylg/max.png?1706991353</a> !import-table-item --d20_highlight --2 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599759/fVpVMEeS00uBmxeILlREkg/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599759/fVpVMEeS00uBmxeILlREkg/max.png?1706991353</a> !import-table-item --d20_highlight --3 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599763/ae07puh6STVEkfUyF1vciw/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599763/ae07puh6STVEkfUyF1vciw/max.png?1706991353</a> !import-table-item --d20_highlight --4 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599764/WZJyPLodxVv4VoEJCmnuNA/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599764/WZJyPLodxVv4VoEJCmnuNA/max.png?1706991353</a> !import-table-item --d20_highlight --5 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599765/i1VWFw__xRBQuHrrdz--pw/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599765/i1VWFw__xRBQuHrrdz--pw/max.png?1706991353</a> !import-table-item --d20_highlight --6 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599749/LthwUh4idIGoGMCfVueZ9A/max.png?1706991352" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599749/LthwUh4idIGoGMCfVueZ9A/max.png?1706991352</a> !import-table-item --d20_highlight --7 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599750/daOxWsuGjDGYo3vEeomwsw/max.png?1706991352" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599750/daOxWsuGjDGYo3vEeomwsw/max.png?1706991352</a> !import-table-item --d20_highlight --8 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599751/LHyGM1wd0ijhGJNChrPGQw/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599751/LHyGM1wd0ijhGJNChrPGQw/max.png?1706991353</a> !import-table-item --d20_highlight --9 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599753/tec7NDCEw2KQy4nvnBldaA/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599753/tec7NDCEw2KQy4nvnBldaA/max.png?1706991353</a> !import-table-item --d20_highlight --10 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599761/PidV80sm832YuNKU800MTg/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599761/PidV80sm832YuNKU800MTg/max.png?1706991353</a> !import-table-item --d20_highlight --11 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599752/PGtcbAZcggfOC9lDuc-7FQ/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599752/PGtcbAZcggfOC9lDuc-7FQ/max.png?1706991353</a> !import-table-item --d20_highlight --12 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599762/vRxuKTxgPeYqqHv56X9pUQ/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599762/vRxuKTxgPeYqqHv56X9pUQ/max.png?1706991353</a> !import-table-item --d20_highlight --13 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599754/fvu611oVwfoic6mrEiSMDA/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599754/fvu611oVwfoic6mrEiSMDA/max.png?1706991353</a> !import-table-item --d20_highlight --14 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599755/msR8nCfkTZf3at4WQhMniQ/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599755/msR8nCfkTZf3at4WQhMniQ/max.png?1706991353</a> !import-table-item --d20_highlight --15 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599769/YYOqbDm1SZBKESIeC9Ia0w/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599769/YYOqbDm1SZBKESIeC9Ia0w/max.png?1706991353</a> !import-table-item --d20_highlight --16 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599757/wiPGMBK7qay67J3rvyBo8A/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599757/wiPGMBK7qay67J3rvyBo8A/max.png?1706991353</a> !import-table-item --d20_highlight --17 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599768/qjLyiID_ufBckbRsOkkQww/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599768/qjLyiID_ufBckbRsOkkQww/max.png?1706991353</a> !import-table-item --d20_highlight --18 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599766/WmVQpesxJWXPohYmIb9AnQ/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599766/WmVQpesxJWXPohYmIb9AnQ/max.png?1706991353</a> !import-table-item --d20_highlight --19 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599756/peLO8Jmfe6ZcbJvO_TQZ7Q/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599756/peLO8Jmfe6ZcbJvO_TQZ7Q/max.png?1706991353</a> !import-table-item --d20_highlight --20 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599758/j3rF5_E09vfaNwh_MsMbbQ/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599758/j3rF5_E09vfaNwh_MsMbbQ/max.png?1706991353</a>
1707023747
timmaugh
Pro
API Scripter
ZeroFrame batching (from the MetaScriptToolbox) can ensure no dropped commands:&nbsp; !{{ !import-table --d20_highlight --show !import-table-item --d20_highlight --1 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599760/yBp4_OD_ia8ChMyPBX-ylg/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599760/yBp4_OD_ia8ChMyPBX-ylg/max.png?1706991353</a> !import-table-item --d20_highlight --2 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599759/fVpVMEeS00uBmxeILlREkg/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599759/fVpVMEeS00uBmxeILlREkg/max.png?1706991353</a> !import-table-item --d20_highlight --3 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599763/ae07puh6STVEkfUyF1vciw/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599763/ae07puh6STVEkfUyF1vciw/max.png?1706991353</a> !import-table-item --d20_highlight --4 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599764/WZJyPLodxVv4VoEJCmnuNA/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599764/WZJyPLodxVv4VoEJCmnuNA/max.png?1706991353</a> !import-table-item --d20_highlight --5 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599765/i1VWFw__xRBQuHrrdz--pw/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599765/i1VWFw__xRBQuHrrdz--pw/max.png?1706991353</a> !import-table-item --d20_highlight --6 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599749/LthwUh4idIGoGMCfVueZ9A/max.png?1706991352" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599749/LthwUh4idIGoGMCfVueZ9A/max.png?1706991352</a> !import-table-item --d20_highlight --7 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599750/daOxWsuGjDGYo3vEeomwsw/max.png?1706991352" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599750/daOxWsuGjDGYo3vEeomwsw/max.png?1706991352</a> !import-table-item --d20_highlight --8 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599751/LHyGM1wd0ijhGJNChrPGQw/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599751/LHyGM1wd0ijhGJNChrPGQw/max.png?1706991353</a> !import-table-item --d20_highlight --9 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599753/tec7NDCEw2KQy4nvnBldaA/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599753/tec7NDCEw2KQy4nvnBldaA/max.png?1706991353</a> !import-table-item --d20_highlight --10 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599761/PidV80sm832YuNKU800MTg/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599761/PidV80sm832YuNKU800MTg/max.png?1706991353</a> !import-table-item --d20_highlight --11 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599752/PGtcbAZcggfOC9lDuc-7FQ/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599752/PGtcbAZcggfOC9lDuc-7FQ/max.png?1706991353</a> !import-table-item --d20_highlight --12 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599762/vRxuKTxgPeYqqHv56X9pUQ/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599762/vRxuKTxgPeYqqHv56X9pUQ/max.png?1706991353</a> !import-table-item --d20_highlight --13 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599754/fvu611oVwfoic6mrEiSMDA/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599754/fvu611oVwfoic6mrEiSMDA/max.png?1706991353</a> !import-table-item --d20_highlight --14 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599755/msR8nCfkTZf3at4WQhMniQ/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599755/msR8nCfkTZf3at4WQhMniQ/max.png?1706991353</a> !import-table-item --d20_highlight --15 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599769/YYOqbDm1SZBKESIeC9Ia0w/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599769/YYOqbDm1SZBKESIeC9Ia0w/max.png?1706991353</a> !import-table-item --d20_highlight --16 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599757/wiPGMBK7qay67J3rvyBo8A/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599757/wiPGMBK7qay67J3rvyBo8A/max.png?1706991353</a> !import-table-item --d20_highlight --17 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599768/qjLyiID_ufBckbRsOkkQww/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599768/qjLyiID_ufBckbRsOkkQww/max.png?1706991353</a> !import-table-item --d20_highlight --18 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599766/WmVQpesxJWXPohYmIb9AnQ/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599766/WmVQpesxJWXPohYmIb9AnQ/max.png?1706991353</a> !import-table-item --d20_highlight --19 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599756/peLO8Jmfe6ZcbJvO_TQZ7Q/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599756/peLO8Jmfe6ZcbJvO_TQZ7Q/max.png?1706991353</a> !import-table-item --d20_highlight --20 --1 --<a href="https://s3.amazonaws.com/files.d20.io/images/378599758/j3rF5_E09vfaNwh_MsMbbQ/max.png?1706991353" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/378599758/j3rF5_E09vfaNwh_MsMbbQ/max.png?1706991353</a> }}
1707077400

Edited 1707077552
Hi all, thanks for the help everybody! I was hoping to avoid using tables once I learned that ScriptCards had a built-in feature. There's obvious advantages to not using tables, and that is the plug and play nature of it being built-in. Anyone can just copy and paste the code into their game, or personally I can copy and paste from game to game wihtout having to make a table in each game. Unfortunately, the disadvantages to using the built-in dice are starting to show, as it gets complicated if you try to roll multiple die types. For instance, there's a lot of abilities and spells in D&amp;D 5e that add 1d6 to the damage roll. Well, I haven't discovered a way to neatly plug and play a 1d6 damage die output, not easily at least. I think it comes down to having the roll in an array that complicates it for me. Is there a reason to use an array over just rolling on the table itself? For example, in my second post I simply use the following to roll on the table, no array and for advantage and disadvantage I just double up the rolls and use conditionals for the outcome. It's very simple, I just don't know enough about all this stuff to know if it's an incorrect way of going about it. As in, is there something about this that's going to bite me in the behind later on or something in the background that is currently biting me? --:Standard| --=AttackRoll|[T#D20] --=Attack|[$AttackRoll] + [$AttackModifier] [&amp;AttackModifierType] + [$ProficiencyBonus] [PB] --&amp;D20Image|[$AttackRoll.tableEntryImgURL] --+|[c][img height=60 width=60][&amp;D20Image][/img][br][b] + [$AttackModifier] [&amp;AttackModifierType] + [$ProficiencyBonus] [PB][/b][/c][c]=[br][/c][c][F:Contrail One:24][$Attack][/F][/c] --+|[br] --?[$AttackRoll.Base] -eq [$CritRoll]|Crit --?[$Attack.Total] -ge [$TargetAC]|Hit --?[$Attack.Total] -lt [$TargetAC]|Miss --X|
1707078927

Edited 1707079166
David M.
Pro
API Scripter
The rollable table method makes the code a little easier to put together and might be more intuitive to read/modify if arrays are confusing to you.&nbsp; Using an array can eliminate the need for creating a rollable table, which could be an advantage if you're porting this to other games. Though with the TableExport script that isn't much of a hassle (especially using Tim's modification with the ZeroFrame script to ensure none of the TableExport commands get dropped). You would define the array with urls corresponding to the die rolls at the start of your macro. I would put a dummy value in for the first element (which is index=0), then add the 20 urls in order 1-20. You would roll a die with std scriptcards rolls, then perform a lookup in the array of urls, using the d20 roll as the index of the array. So something like this (not tested): --~|array;define;d20URLs;DummyValue;URL1;URL2;URL3;etc...&nbsp;&nbsp;&nbsp;&nbsp; --/[&amp;d20URLs(0)] would return the dummy value,&nbsp; [&amp; d20URLs(1)] would return URL1, etc. --=AttackRoll|1d20 +&nbsp; [$AttackModifier] [&amp;AttackModifierType] + [$ProficiencyBonus] [PB] --+|[c][img height=60 width=60] [&amp;d20URLs( [$AttackRoll.Base] )] [/img][br][b] + [$AttackModifier] [&amp;AttackModifierType] + [$ProficiencyBonus] [PB][/b][/c][c]=[br][/c][c][F:Contrail One:24][$Attack][/F][/c] This simple example in the SC wiki might be a little clearer on what is happening above. EDIT - To roll with Adv/Disadv, just make two rolls first, then add your modifiers to the highest or lowest. To display both d20 images, you would reference both&nbsp;[&amp;d20URLs([$Roll1.Raw]) and&nbsp; [&amp;d20URLs([$Roll2.Raw])
So, I wasn't quite ready to give up on the ScriptCards dice, but I may not have a choice now. I'm getting some very strange behavior with conditional rules not being followed. I'll rewrite them to be more explicit and rearrange some things and I might get them to work. Well, now I'm getting weird results for die outputs, d6's where there should be d10's, seemingly at random. &nbsp;So, this test was done on the Cantrip spell Primal Savagery, the d6's are coming from me adding the results of the spell Absorb Elements, which adds 1d6 to the next attack roll. I can see no reason why the first four dice at the top are not d10's. Keep in mind that I've been rewriting this multiple times because of the issues I'm having with conditionals. !scriptcard {{ --/|Customizable Variables --=CritRoll|20 --&amp;AttackModifierType|[WIS] --=FeatDamage|0 --=ProficiencyBonus|@{selected|pb} --&amp;DamageType|necrotic --&amp;DamageFX|burn-acid --&amp;Range|5 --&amp;SoundFX|primal_savagery --&amp;AbsorbElementsStatus|absorb-elements::6498803 --&amp;SpellLevel|cantrip --&amp;SpellName|Primal Savagery --/|Formatting --#overridetemplate|mydnd --#dicefontsize| 5.0em --#rollHilightColorNormal|#d3b63b --#rollHilightColorCrit|#3afc7a --#rollHilightColorFumble|#ff5456 --#Debug|0 --/|Constant Variables --=AttackModifier|@{selected|spellcasting_ability} --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --/|Determine Damage Based on Character level if cantrip. These rules are common but may be different with some cantrips. --?"[&amp;SpellLevel]" -inc "cantrip"|[ --?@{selected|level} -lt 5|&amp;Dice;1 --?@{selected|level} -ge 5 -and -le 10|&amp;Dice;2 --?@{selected|level} -ge 11 -and -le 16|&amp;Dice;3 --?@{selected|level} -ge 17|&amp;Dice;4 --&amp;PullDie|[*R:spelldamage] --?[&amp;PullDie] -eq 1d4|&amp;DieType;d4 --?[&amp;PullDie] -eq 1d6|&amp;DieType;d6 --?[&amp;PullDie] -eq 1d8|&amp;DieType;d8 --?[&amp;PullDie] -eq 1d10|&amp;DieType;d10 --&amp;DamageDice|[&amp;Dice][&amp;DieType] --]| --/|Get Spell information and Determine Die Type for Output --Rfind|@{selected|character_id};[&amp;SpellName];repeating_spell-[&amp;SpellLevel];spellname --?[&amp;PullDie] -eq 1d4|&amp;DieOpen;[d4] --?[&amp;PullDie] -eq 1d4|&amp;DieClose;[/d4] --?[&amp;PullDie] -eq 1d6|&amp;DieOpen;[d6] --?[&amp;PullDie] -eq 1d6|&amp;DieClose;[/d6] --?[&amp;PullDie] -eq 1d8|&amp;DieOpen;[d8] --?[&amp;PullDie] -eq 1d8|&amp;DieClose;[/d8] --?[&amp;PullDie] -eq 1d10|&amp;DieOpen;[d10] --?[&amp;PullDie] -eq 1d10|&amp;DieClose;[/d10] --/|Display Spell --#emoteText|[*S:character_name] Casts [*R:spellname]. --#title|[*R:spellname] [*R:innate] --#leftsub|@{selected|character_name} (@{selected|caster_level}) --?[*R:spelllevel] -eq cantrip|&amp;spllvl;cantrip --?[*R:spelllevel] -eq 1|&amp;spllvl;1st-level --?[*R:spelllevel] -eq 2|&amp;spllvl;2nd-level --?[*R:spelllevel] -eq 3|&amp;spllvl;3rd-level --?[*R:spelllevel] -eq 4|&amp;spllvl;4th-level --?[*R:spelllevel] -eq 5|&amp;spllvl;5th-level --?[*R:spelllevel] -eq 6|&amp;spllvl;6th-level --?[*R:spelllevel] -eq 7|&amp;spllvl;7th-level --?[*R:spelllevel] -eq 8|&amp;spllvl;8th-level --?[*R:spelllevel] -eq 9|&amp;spllvl;9th-level --#rightsub|[i][&amp;spllvl] [*R:spellschool][/i] --+Casting Time:|[*R:spellcastingtime] --+Range:|[*R:spellrange] --+Target:|[*R:spelltarget] --&amp;zSCV|V --?"[*R:spellcomp_v]" -inc "v=1"|ENDSCV --&amp;zSCV| --:ENDSCV| --&amp;zSCS|S --?"[*R:spellcomp_s]" -inc "s=1"|ENDSCS --&amp;zSCS| --:ENDSCS| --&amp;zSCM|M --?"[*R:spellcomp_m]" -inc "m=1"|ENDSCM --&amp;zSCM| --:ENDSCM| --?"[*R:spellcomp_m]" -ninc "m=1"|[ --&amp;materials| --]|[ --&amp;materials|([*R:spellcomp_materials]) --]| --+Components:|[&amp;zSCV][&amp;zSCS][&amp;zSCM] [&amp;materials] --+Duration:|[*R:spellduration] --+|[*R:spelldescription] --~Len|string;length;[*R:spellathigherlevels] --?[$Len] -le 5|END_HV_CHECK --+|[b][i]At Higher Levels.[/i][/b][*R:spellathigherlevels] --:END_HV_CHECK| --=TargetAC|@{target|npc_ac} --=Damage|0 --=Resistance|0 --=Immunity|0 --=Vulnerability|0 --=TotalDamage|0 --~HowFarAway|distance;@{selected|token_id};@{target|token_id} --=HowFar|[$HowFarAway] * 5 --?[$HowFar] -gt [&amp;Range]|tooFar --+|[c]What type of attack?[/c] --+|[c][rbutton]Standard::MakeAttack;1d20[/rbutton][rbutton]Advantage::MakeAttack;2d20kh1[/rbutton][rbutton]Disadvantage::MakeAttack;2d20kl1[/rbutton][/c] --X| --:MakeAttack| --=AttackRoll|[&amp;reentryval] --=Attack|[$AttackRoll] + [$AttackModifier] [&amp;AttackModifierType] + [$ProficiencyBonus] [PB] --?[$AttackRoll.Total] -ge [$CritRoll]|&amp;DieColor;#1c7539 --?[$AttackRoll.Total] -eq 1|&amp;DieColor;#672223 --?[$AttackRoll.Total] -ge 2 -and [$AttackRoll.Total] -lt [$CritRoll]|&amp;DieColor;#000000 --#dicefontcolor|[&amp;DieColor] --+|[br] --?"[$AttackRoll.RollText]" -eq "1d20"|[ --+|[c][d20][$AttackRoll.Raw][/d20][br] + [$AttackModifier] [b][&amp;AttackModifierType][/b] + [$ProficiencyBonus] [b][PB][/b][/c][c]=[br][/c][c][F:Contrail One:22][$Attack][/F][/c][br][hr #d3b63b] --]|[ --+|[c][d20][$AttackRoll.KeptDice(1)][/d20][d20][$AttackRoll.DroppedDice(1)][/d20][br][b] + [$AttackModifier] [&amp;AttackModifierType] + [$ProficiencyBonus] [PB][/b][/c][c]=[br][/c][c][F:Contrail One:22][$Attack][/F][/c][br][hr #d3b63b] --]| --&gt;PlayEffects| --?[$Attack.Total] -ge [$TargetAC]|Hit --?[$Attack.Total] -lt [$TargetAC]|Miss --X| --:Hit| --+|[br] --?[$AttackRoll.Base] -ge [$CritRoll]|[ --=Damage|[&amp;DamageDice] + [&amp;DamageDice] --&gt;DieLoop| --&gt;AbsorbElements| --&amp;Dmessage|[c][b][#1c7539]Critical Hit[/#] for [$Damage] [&amp;DamageType] damage![/b][/c][hr #d3b63b] --]|[ --=Damage|[&amp;DamageDice] --&gt;DieLoop| --&gt;AbsorbElements| --&amp;Dmessage|[c][b]Hit for [$Damage] [&amp;DamageType] damage![/b][/c][hr #d3b63b] --]| --&gt;CheckResistances| --&gt;CalculateDamage| --?[$AbsorbE] -ne 0|[ --&amp;Dmessage|+[c][b]Absorb Elements deals [$AbsorbE] damage![/b][/c] --]| --+|[&amp;Dmessage] --&gt;ApplyDamage|@{target|token_id};1;-[$TotalDamage] --X| --:DieLoop| --&amp;DicePerRow|4 --&amp;DieCounter|1 --&amp;AllDice|[c][t width=100%][tr] --%RollC|1;[$Damage.RollCount] --&amp;AllDice|+[td height=60px][&amp;DieOpen][$Damage.RolledDice([&amp;RollC])][&amp;DieClose][/td] --?[= [&amp;DieCounter] % [&amp;DicePerRow] ] -eq 0|&amp;AllDice;+[/tr][tr] --&gt;IncrementCounter|DieCounter --%| --&amp;AllDice|+[/tr][/t][/c] --+|[&amp;AllDice] --&lt;| --:IncrementCounter| --&amp;[%1%]|[= [&amp;[%1%]] + 1] --&lt;| --:AbsorbElements| --?"[*S:t-statusmarkers]" -inc "absorb-elements" -and [$AttackRoll.Base] -ge [$CritRoll]|[ --=AbsorbE|[*S:absorb]d6[SE] + [*S:absorb]d6[SE] --]| --?"[*S:t-statusmarkers]" -inc "absorb-elements" -and [$AttackRoll.Base] -lt [$CritRoll]|[ --=AbsorbE|[*S:absorb]d6[SE] --]| --?"[*S:t-statusmarkers]" -inc "absorb-elements"|[ --&amp;AbsorbDice|[c][t width=100%][tr] --%AbsorbC|1;[$AbsorbE.RollCount] --&amp;AbsorbDice|+[td height=60px][d6][$AbsorbE.RolledDice([&amp;AbsorbC])][/d6][/td] --%| --&amp;AbsorbDice|+[/tr][/t][/c] --+|[&amp;AbsorbDice][hr #d3b63b] --]| --!a:[*S:character_id]|!absorb:0 --@token-mod| _ids [*S:character_id] _set statusmarkers|-[&amp;AbsorbElementsStatus] --&lt;| --:Miss| --!a:[*S:character_id]|!absorb:0 --@token-mod| _ids [*S:character_id] _set statusmarkers|-[&amp;AbsorbElementsStatus] --a|[&amp;SoundFX] --=Damage|0 --+|[c][b][f18]The attack [#ff0000]missed[/#]![/f][/b][/c] --X| --:CheckResistances| --?"[*T:npc_resistances]" -inc [&amp;DamageType]|ApplyResistance --?"[*T:npc_immunities]" -inc [&amp;DamageType]|ApplyImmunity --?"[*T:npc_vulnerabilities]" -inc [&amp;DamageType]|ApplyVulnerability --&lt;| --:ApplyResistance| --=Resistance|[$Damage] \ 2 --*|Creature is resistant to [&amp;DamageType] damage! --&lt;| --:ApplyImmunity| --=Immunity|[$Damage] --*|Creature is immune to [&amp;DamageType] damage! --&lt;| --:ApplyVulnerability| --=Vulnerability|[$Damage] --*|Creature is vulnerable to [&amp;DamageType] damage! --&lt;| --:PlayEffects| --a|[&amp;SoundFX] --vtoken|@{target|token_id} [&amp;DamageFX] --&lt;| --:CalculateDamage| --=TotalDamage|[$Damage]-[$Resistance]-[$Immunity]+[$Vulnerability]+[$AbsorbE] --&lt;| --:ApplyDamage| --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%] --&lt;| --:tooFar| --+|The target is too far away. --X| }}
This is what is happening with just a critical hit. It should be 2d10, but it's rolling three d10's and only counting the third? I didn't think I had changed anything with the base attack. I was on such a roll at one point, I thought it was all working out and them... bam, stuff not working.
1707173174

Edited 1707173992
I seem to have fixed critical hits by just moving some code around, I dunno. I am utterly confused by this. So I Rfind Primal Savagery, which has a 1d10 damage die. I do some conditionals to adjust the damage die based on character level. It all works out fine and I save the result to the &amp;DamageDice string. It can't be anything other than a d10, because I'm Rfind'ing for Primal Savagery. I also use that information to dynamically create the [d10] tag for the die output. As soon as I include the die roll for Absorb Elements(which adds a 1d6 to the attack), Rfind now finds a d6. I'm not at any point actually doing anything with the Absorb Elements spell. The Absorb Elements spell, when run simply gives the token the Absorb Elements status marker and writes an attribute called "absorb" to the caster's character sheet with the value of the level of spell cast. That number is then used to determine how many d6's are rolled for damage. So, at no point should the macro even look for anything d6. The only mention of d6 is in the loop for the Absorb Element damage roll, and even then the d6 is directly input, there's no lookup and so I don't see where wires could be getting crossed? If I hard code the d10, in both the damage and the [d10] tag, everything works as expected. Did I find a bug, or am I just not seeing something? tl;dr I don't know how it's determining that the Primal Savagery cantrip is a d6 when I include the Absorb Elements die roll. EDIT: Turns out it was me, as it usually is... !scriptcard {{ --/|Customizable Variables --=CritRoll|20 --&amp;AttackModifierType|[WIS] --=FeatDamage|0 --=ProficiencyBonus|@{selected|pb} --&amp;DamageType|necrotic --&amp;DamageFX|burn-acid --&amp;Range|5 --&amp;SoundFX|primal_savagery --&amp;AbsorbElementsStatus|absorb-elements::6498803 --&amp;SpellLevel|cantrip --&amp;SpellName|Primal Savagery --/|Formatting --#overridetemplate|mydnd --#dicefontsize| 5.0em --#rollHilightColorNormal|#d3b63b --#rollHilightColorCrit|#3afc7a --#rollHilightColorFumble|#ff5456 --#Debug|0 --/|Constant Variables --=AttackModifier|@{selected|spellcasting_ability} --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --/|Determine Damage Based on Character level if cantrip. These rules are common but may be different with some cantrips. --Rfind|@{selected|character_id};[&amp;SpellName];repeating_spell-[&amp;SpellLevel];spellname --?"[&amp;SpellLevel]" -inc "cantrip"|[ --?@{selected|level} -lt 5|&amp;Dice;1 --?@{selected|level} -ge 5 -and -le 10|&amp;Dice;2 --?@{selected|level} -ge 11 -and -le 16|&amp;Dice;3 --?@{selected|level} -ge 17|&amp;Dice;4 --&amp;PullDie|[*R:spelldamage] --?[&amp;PullDie] -eq 1d4|&amp;DieType;d4 --?[&amp;PullDie] -eq 1d6|&amp;DieType;d6 --?[&amp;PullDie] -eq 1d8|&amp;DieType;d8 --?[&amp;PullDie] -eq 1d10|&amp;DieType;d10 --&amp;DamageDice|[&amp;Dice][&amp;DieType] --]| --/|Get Spell information and Determine Die Type for Output --?[&amp;PullDie] -eq 1d4|&amp;DieOpen;[d4] --?[&amp;PullDie] -eq 1d4|&amp;DieClose;[/d4] --?[&amp;PullDie] -eq 1d6|&amp;DieOpen;[d6] --?[&amp;PullDie] -eq 1d6|&amp;DieClose;[/d6] --?[&amp;PullDie] -eq 1d8|&amp;DieOpen;[d8] --?[&amp;PullDie] -eq 1d8|&amp;DieClose;[/d8] --?[&amp;PullDie] -eq 1d10|&amp;DieOpen;[d10] --?[&amp;PullDie] -eq 1d10|&amp;DieClose;[/d10] --/|Display Spell --#emoteText|[*S:character_name] Casts [*R:spellname]. --#title|[*R:spellname] [*R:innate] --#leftsub|@{selected|character_name} (@{selected|caster_level}) --?[*R:spelllevel] -eq cantrip|&amp;spllvl;cantrip --?[*R:spelllevel] -eq 1|&amp;spllvl;1st-level --?[*R:spelllevel] -eq 2|&amp;spllvl;2nd-level --?[*R:spelllevel] -eq 3|&amp;spllvl;3rd-level --?[*R:spelllevel] -eq 4|&amp;spllvl;4th-level --?[*R:spelllevel] -eq 5|&amp;spllvl;5th-level --?[*R:spelllevel] -eq 6|&amp;spllvl;6th-level --?[*R:spelllevel] -eq 7|&amp;spllvl;7th-level --?[*R:spelllevel] -eq 8|&amp;spllvl;8th-level --?[*R:spelllevel] -eq 9|&amp;spllvl;9th-level --#rightsub|[i][&amp;spllvl] [*R:spellschool][/i] --+Casting Time:|[*R:spellcastingtime] --+Range:|[*R:spellrange] --+Target:|[*R:spelltarget] --&amp;zSCV|V --?"[*R:spellcomp_v]" -inc "v=1"|ENDSCV --&amp;zSCV| --:ENDSCV| --&amp;zSCS|S --?"[*R:spellcomp_s]" -inc "s=1"|ENDSCS --&amp;zSCS| --:ENDSCS| --&amp;zSCM|M --?"[*R:spellcomp_m]" -inc "m=1"|ENDSCM --&amp;zSCM| --:ENDSCM| --?"[*R:spellcomp_m]" -ninc "m=1"|[ --&amp;materials| --]|[ --&amp;materials|([*R:spellcomp_materials]) --]| --+Components:|[&amp;zSCV][&amp;zSCS][&amp;zSCM] [&amp;materials] --+Duration:|[*R:spellduration] --+|[*R:spelldescription] --~Len|string;length;[*R:spellathigherlevels] --?[$Len] -le 5|END_HV_CHECK --+|[b][i]At Higher Levels.[/i][/b][*R:spellathigherlevels] --:END_HV_CHECK| --=TargetAC|@{target|npc_ac} --=Damage|0 --=Resistance|0 --=Immunity|0 --=Vulnerability|0 --=TotalDamage|0 --~HowFarAway|distance;@{selected|token_id};@{target|token_id} --=HowFar|[$HowFarAway] * 5 --?[$HowFar] -gt [&amp;Range]|tooFar --+|[c]What type of attack?[/c] --+|[c][rbutton]Standard::MakeAttack;1d20[/rbutton][rbutton]Advantage::MakeAttack;2d20kh1[/rbutton][rbutton]Disadvantage::MakeAttack;2d20kl1[/rbutton][/c] --X| --:MakeAttack| --=AttackRoll|[&amp;reentryval] --=Attack|[$AttackRoll] + [$AttackModifier] [&amp;AttackModifierType] + [$ProficiencyBonus] [PB] --?[$AttackRoll.Total] -ge [$CritRoll]|&amp;DieColor;#1c7539 --?[$AttackRoll.Total] -eq 1|&amp;DieColor;#672223 --?[$AttackRoll.Total] -ge 2 -and [$AttackRoll.Total] -lt [$CritRoll]|&amp;DieColor;#000000 --#dicefontcolor|[&amp;DieColor] --+|[br] --?"[$AttackRoll.RollText]" -eq "1d20"|[ --+|[c][d20][$AttackRoll.Raw][/d20][br] + [$AttackModifier] [b][&amp;AttackModifierType][/b] + [$ProficiencyBonus] [b][PB][/b][/c][c]=[br][/c][c][F:Contrail One:22][$Attack][/F][/c][br][hr #d3b63b] --]|[ --+|[c][d20][$AttackRoll.KeptDice(1)][/d20][d20][$AttackRoll.DroppedDice(1)][/d20][br][b] + [$AttackModifier] [&amp;AttackModifierType] + [$ProficiencyBonus] [PB][/b][/c][c]=[br][/c][c][F:Contrail One:22][$Attack][/F][/c][br][hr #d3b63b] --]| --&gt;PlayEffects| --?[$Attack.Total] -ge [$TargetAC]|Hit --?[$Attack.Total] -lt [$TargetAC]|Miss --X| --:Hit| --+|[br] --?[$AttackRoll.Base] -ge [$CritRoll]|[ --=Damage|[&amp;DamageDice] [&amp;DamageDice] --&gt;DieLoop| --&amp;Dmessage|[c][b][#1c7539]Critical Hit[/#] for [$Damage] [&amp;DamageType] damage![/b][/c] --]|[ --=Damage|[&amp;DamageDice] --&gt;DieLoop| --&amp;Dmessage|[c][b]Hit for [$Damage] [&amp;DamageType] damage![/b][/c] --]| --&gt;AbsorbElements| --&gt;CheckResistances| --&gt;CalculateDamage| --?[$AbsorbE] -gt 0|&amp;Dmessage;+[c][b]Absorb Elements deals [$AbsorbE] damage![/b][/c] --+|[&amp;Dmessage][hr #d3b63b] --&gt;ApplyDamage|@{target|token_id};1;-[$TotalDamage] --X| --:DieLoop| --&amp;DicePerRow|4 --&amp;DieCounter|1 --&amp;AllDice|[c][t width=100%][tr] --%RollC|1;[$Damage.RollCount] --&amp;AllDice|+[td height=60px][&amp;DieOpen][$Damage.RolledDice([&amp;RollC])][&amp;DieClose][/td] --?[= [&amp;DieCounter] % [&amp;DicePerRow] ] -eq 0|&amp;AllDice;+[/tr][tr] --&gt;IncrementCounter|DieCounter --%| --&amp;AllDice|+[/tr][/t][/c] --+|[&amp;AllDice] --&lt;| --:IncrementCounter| --&amp;[%1%]|[= [&amp;[%1%]] + 1] --&lt;| --:AbsorbElements| --?"[*S:t-statusmarkers]" -inc "absorb-elements"|[ --&amp;AbsorbD|[*S:absorb]d6 --?[$AttackRoll.Base] -ge [$CritRoll]|=AbsorbE;[&amp;AbsorbD] [&amp;AbsorbD] [SE]|=AbsorbE;[&amp;AbsorbD] --&amp;AbsorbDice|[c][t width=100%][tr] --%AbsorbC|1;[$AbsorbE.RollCount] --&amp;AbsorbDice|+[td height=60px][d6][$AbsorbE.RolledDice([&amp;AbsorbC])][/d6][/td] --%| --&amp;AbsorbDice|+[/tr][/t][/c] --+|[&amp;AbsorbDice][hr #d3b63b] --!a:[*S:character_id]|!absorb:0 --@token-mod| _ids [*S:character_id] _set statusmarkers|-[&amp;AbsorbElementsStatus] --]| --&lt;| --:Miss| --!a:[*S:character_id]|!absorb:0 --@token-mod| _ids [*S:character_id] _set statusmarkers|-[&amp;AbsorbElementsStatus] --a|[&amp;SoundFX] --=Damage|0 --+|[c][b][f18]The attack [#ff0000]missed[/#]![/f][/b][/c] --X| --:CheckResistances| --?"[*T:npc_resistances]" -inc [&amp;DamageType]|ApplyResistance --?"[*T:npc_immunities]" -inc [&amp;DamageType]|ApplyImmunity --?"[*T:npc_vulnerabilities]" -inc [&amp;DamageType]|ApplyVulnerability --&lt;| --:ApplyResistance| --=Resistance|[$Damage] \ 2 --*|Creature is resistant to [&amp;DamageType] damage! --&lt;| --:ApplyImmunity| --=Immunity|[$Damage] --*|Creature is immune to [&amp;DamageType] damage! --&lt;| --:ApplyVulnerability| --=Vulnerability|[$Damage] --*|Creature is vulnerable to [&amp;DamageType] damage! --&lt;| --:PlayEffects| --a|[&amp;SoundFX] --vtoken|@{target|token_id} [&amp;DamageFX] --&lt;| --:CalculateDamage| --=TotalDamage|[$Damage]-[$Resistance]-[$Immunity]+[$Vulnerability]+[$AbsorbE] --&lt;| --:ApplyDamage| --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%] --&lt;| --:tooFar| --+|The target is too far away. --X| }} Here's the Absorb Elements spell as well for completion sake. !Scriptcard {{ --:DoFormatting| --#overridetemplate|mydnd --:DoSetup| --#sourceToken|@{selected|token_id} --&amp;SoundEffectTrack|absorb_elements --&amp;SpellLevel|1 --&amp;SpellName|Absorb Elements --Rfind|@{selected|character_id};[&amp;SpellName];repeating_spell-[&amp;SpellLevel];spellname --#emoteText|[*S:character_name] Casts [*R:spellname]. --#title|[*R:spellname] [*R:innate] --#leftsub|@{selected|character_name} (@{selected|caster_level}) --?[*R:spelllevel] -eq cantrip|&amp;spllvl;cantrip --?[*R:spelllevel] -eq 1|&amp;spllvl;1st-level --?[*R:spelllevel] -eq 2|&amp;spllvl;2nd-level --?[*R:spelllevel] -eq 3|&amp;spllvl;3rd-level --?[*R:spelllevel] -eq 4|&amp;spllvl;4th-level --?[*R:spelllevel] -eq 5|&amp;spllvl;5th-level --?[*R:spelllevel] -eq 6|&amp;spllvl;6th-level --?[*R:spelllevel] -eq 7|&amp;spllvl;7th-level --?[*R:spelllevel] -eq 8|&amp;spllvl;8th-level --?[*R:spelllevel] -eq 9|&amp;spllvl;9th-level --#rightsub|[i][&amp;spllvl] [*R:spellschool][/i] --+Casting Time:|[*R:spellcastingtime] --+Range:|[*R:spellrange] --+Target:|[*R:spelltarget] --&amp;zSCV|V --?"[*R:spellcomp_v]" -inc "v=1"|ENDSCV --&amp;zSCV| --:ENDSCV| --&amp;zSCS|S --?"[*R:spellcomp_s]" -inc "s=1"|ENDSCS --&amp;zSCS| --:ENDSCS| --&amp;zSCM|M --?"[*R:spellcomp_m]" -inc "m=1"|ENDSCM --&amp;zSCM| --:ENDSCM| --?"[*R:spellcomp_m]" -ninc "m=1"|[ --&amp;materials| --]|[ --&amp;materials|([*R:spellcomp_materials]) --]| --+Components:|[&amp;zSCV][&amp;zSCS][&amp;zSCM] [&amp;materials] --+Duration:|[*R:spellduration] --+|[*R:spelldescription] --~Len|string;length;[*R:spellathigherlevels] --?[$Len] -le 5|END_HV_CHECK --+|[b][i]At Higher Levels.[/i][/b][*R:spellathigherlevels] --:END_HV_CHECK| --+|[br] --+|[c][b]At what level is the spell being cast?[/b][/c] --+|[c][rbutton]1st::DoSpell;1[/rbutton][rbutton]2nd::DoSpell;2[/rbutton][rbutton]3rd::DoSpell;3[/rbutton][rbutton]4th::DoSpell;4[/rbutton][rbutton]5th::DoSpell;5[/rbutton][/c] --+|[c][rbutton]6th::DoSpell;6[/rbutton][rbutton]7th::DoSpell;7[/rbutton][rbutton]8th::DoSpell;8[/rbutton][rbutton]9th::DoSpell;9[/rbutton][/c] --+|[br] --X| --:DoSpell| --=SlotLevel|[&amp;reentryval] --=SlotsTotal|0 --=SlotsExpended|[*S:lvl[$SlotLevel]_slots_expended] --?[$SlotsExpended.Raw] -eq [$SlotsTotal.Raw]|[ --+|[*S:character_name] has no level [$SlotLevel.Total] spell slots available. --]|[ --=SlotsLeft|[$SlotsExpended] - 1 --!a:[*S:character_id]|lvl[$SlotLevel]_slots_expended:[$SlotsLeft] --+|Level [$SlotLevel] Slots Left: [$SlotsLeft] --!a:[*S:character_id]|!absorb:[$SlotLevel] --@token-mod| _ids [*S:character_id] _set statusmarkers|+absorb-elements::6498803 --a|[&amp;SoundEffectTrack] --X| }}
Oh man... all that ranting and I find the solution immediately after I post... I placed the Rfind too far down in the code after I asked it to find the spelldamage. How it worked at all is beyond me...