Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[Script] ScriptCards - My "Spiritual Successor" to PowerCards

1625165419
David M.
Pro
API Scripter
Will M. said: Just tested and the Dice Fonts do work on Buttons.     --+|[rbutton][d6]1[/d6] Reroll?::REROLL[/rbutton] Nice!
Kurt J. said: Michael C. said: @David - Sorry, been out of town for the weekend.  Yes, I forgot the original thing I was working on - and it may have been an idiot question - but the idea was to take an input and make a direct assignment from a number of possible values in a single line rather than branching to get the value.  Something like: --=Weapon|?{WhatWeapon|Dagger,1|Mace,2|Sickle,3|Bazooka,4} --c[$Weapon.Total]|1:&WeaponType,"Piercing"|2:&WeaponType,"Bludgeoning"|3:&WeaponType,"Slashing"|4:&WeaponType,"Kablooie" If there were only two choices a simple If...Then...Else would work: --?[%Weapon] -eq 1|&WeaponType,"Piercing"|&WeaponType,"Bludgeoning"} but that would be the extent of it. This should work almost exactly as you have described except with semi-colons where you have commas, and no need for the quotes: --c[$Weapon.Total]|1:&WeaponType;Piercing;|2:&WeaponType;Bludgeoning|3:&WeaponType;Slashing|4:&WeaponType;Kablooie; @Kurt - Thanks, learned something new (though the comma was a silly mistake on my part.)  So the case statement isn't limited to conditional branching but can also be used to assign variables...?  I did not know that.  
Ah! I was not doing that in the button context. Will reexamine! David M.  said: Will M.  said: Just tested and the Dice Fonts do work on Buttons.     --+|[rbutton][d6]1[/d6] Reroll?::REROLL[/rbutton] Nice! David M. said: EDIT - ninja'd I think the issue is that the sorcerer ability is optional (and uses a resource) and can be used on any die rolls - it's not an auto-reroll of 1's & 2's. Colin, I'm not sure if the visual dice can be made into a button in scriptcards. One of the CSS wizards would have to chime in. One thing you could do is to write the results of your damage rolls to persistent storage using the stateitem function. You could store it as a comma-delimited string (maybe roll1, die1, roll2, die2, etc.), and I would sort the die rolls first. Output an Empowered Spell button along with your initial damage output. On click, query for the number of rolls to re-roll, load the previous rolls  and dice from the state object, and replace the N lowest rolls in the array before outputting again.  I'm working on this as a means to accomplish this, but I think it might be too many clicks, so I will probably try the stateitem function. I have not played with that yet. --:Empower|base die qty;base die size;upcast dice qty; spellcaster charisma mod --/|Setting minimum of 1 reroll --~Reroll|math;max;1;[%4%] -->Lib5E_FindResource|[*S:character_id];Sorcery Points;SorPntName;SorPntsLeft --?[$SorPntsLeft.Total] -ge 1|[ --iYou have [$SorPntsLeft.Total] Sorcery Points;Empowered Spell|q;UseEmpowered;Do you want to use 1 Sorcery Point?|Yes|No --]|[--^EndEmpowered| --]| --?[&UseEmpowered] -eq Yes|>RerollSub;[%1%];[%2%];[%3%];[$Reroll.Total] --:EndEmpowered| --<| --:RerollSub|base die qty;base die size;upcast dice qty;possible rerolls --@modattr|_charid [*S:character_id] _[&SorPntName]|-1 _silent --&ButtonString| --#reentrant|Empower --=dSize|[%2%] --=i|1 --=BaseDice|[%1%] --=MaxDice|[%1%] + [%3%] --=CMod|[%4%] --=Rerolls|[%4%] --:EmpowerLoop| --=Die[$i.Total]|[T#D[%2%]] --&ButtonImg[$i.Total]|[img width=24][$Die[$i.Total].tableEntryImgURL][/img] --&ButtonString|+[rbutton][&ButtonImg[$i.Total]]::Reroll;[$i.Total][/rbutton] --=i|[$i] + 1 --?[$i.Total] -lt [$MaxDice.Total]|EmpowerLoop --:DisplayDiceButtons| --+[%4%] Rerolls Possible|[&ButtonString] [rbutton]Done Rerolling::DoneReroll[/rbutton] --X| await reroll selections --:Reroll| --~ButtonString|string;replace;[&ButtonImg[&reentryval]]::Reroll;Used::;[&ButtonString] --=Die[&reentryval]|d[$dSize.Total] --=Rerolls|[$Rerolls.Total] - 1 --^DisplayDiceButtons| --:DoneReroll| assemble dice totals for new damage value --=i|1 --&BaseDamageDice|0 --&UpcastDamage|0 --:AddLoop| --?[$Die[$i.Total]] -gt 0|&BaseDamageDice;+ + [$Die[$i.Total].Total] [✊]|&BaseDamageDice;+ + [$Die.[$i.Total].tableEntryValue] --=i|[$i] + 1 --?[$i] -gt [$BaseDice]|UpcastAdd --?[$i] -le [$MaxDice]|AddLoop --~BaseDamageDice|string;replace;0 + ;;[&BaseDamageDice] --^DoneEmpower| --:UpcastAdd| --?[$i] -gt [$MaxDice]|DoneEmpower --?[$Die[$i.Total]] -gt 0|&UpcastDamage;+ + [$Die[$i.Total].Total] [✊]|&UpcastDamage;+ + [$Die.[$i.Total].tableEntryValue] --=i|[$i] + 1 --?[$i] -le [$MaxDice]|UpcastAdd --~UpcastDamage|string;replace;0 + ;;[&UpcastDamage] --&UpcastDamage|+ [Upcast] --^DoneEmpower I honestly don't know if this works yet, though! I've been working on a different section of the script. The overall project is to make Kurt's fireball script into a generic library item that can be referenced separately with parameters input based on a given spell. Right now, I'm doing extensive troubleshooting! After I've figured out how to make "sphere/circle" spells work, it should theoretically be simple enough to translate the generalized stuff to line, cone, and cube shapes.
Darn! I hit a wall: I get this error: I use this card: !script {{ +++5E Spells;5E Tools+++ --/|?{Spell Slot Level?|3|4|5|6|7|8|9} --#sourceToken|@(selected|token_id) {& select @{selected|token_id} } --#whisper|gm --?[*S:lvl?{Spell Slot Level?}_slots_expended] -lt 1|[ --#title|Out of Juice! --#whisper|self --+|No level ?{Spell Slot Level?} slots left! --X| --]| --/|LibSpells_Sphere|1) spellname; 2) base spell slot; 3) used slot; 4) base die qty;5) base die size; 6) upcast level margin; 7) dam type; 8) caster center v. SpellToken center; 9) radius in grid units; 11) save attr; 12) save attr abbr; 13) token v-fx; 14) spell center v-fx; 15) spell to token v-fx -->LibSpells_Sphere|Fireball;3;?{Spell Slot Level?};8;6;1;fire;@{target|Fireball Center|token_id};4;dexterity;dex;burn-fire;nova-fire;beam-fire --?[*S:npc_type] -eq 1|[ --X --]|[ --@modbattr|_charid [*S:character_id] _lvl?{Spell Slot Level?}_slots_expended|-1 --]| }} And here is the relevant library: --:LibSpells_Sphere|1) spellname; 2) base spell slot; 3) used slot; 4) base die qty;5) base die size; 6) upcast level margin; 7) dam type; 8) caster center v. SpellToken center; 9) radius in grid units; 11) save attr; 12) save attr abbr; 13) token v-fx; 14) spell center v-fx; 15) spell to token v-fx --/Description|handles spherical damage spells to all tokens that represent creatures in a given radius around target token --/Later Project|accompanying Spawn call --/|Accounts for Sculpt Spells, Empowered Evocation, and Overchannel for Evokers --/|Accounts for Sorcerer Metamagic: Careful Spell; Heightened Spell; Empowered Spell --/|Set up the card appearance --#title|[*S:t-name] casts [%1%]! --#bodyFontSize|12px --#titlecardbackground|#800000 --#leftsub|Save DC [*S:spell_save_dc] --/|Get a spell slot level from the caster. --=SpellLevel|[%3%] --#rightsub|Slot Level: [$SpellLevel] --/|Account for different upcast margins --=UpcastDice|[%3%] - [%2%] \ [%6%] --/|Calculate damage based on spell slot. --&AddMod| --/|Empowered Evocation and Overchannel check --Rfind|[*S:character_id];Empowered Evocation;repeating_traits;name --?"[*R:name]" -ne NoRepeatingAttributeLoaded|&AddMod;+ + [*S:intelligence_mod] [INT] --&BaseDamageDice|[%4%]d[%5%][&AddMod] --&UpcastDamage|[$UpcastDice.Total]d[%5%] [Upcast] --/|Checking for empowered spell --Rfind|[*S:character_id];Metamagic: Empowered Spell;repeating_traits;name --?"[*R:name]" -ne NoRepeatingAttributeLoaded|>Empower;[%4%];[%6%];[$UpcastDice.Total];[*S:charisma_mod] --:DoneEmpower| --/|Checking for overchannel --Rfind|[*S:character_id];Overchannel;repeating_traits;name --?"[*R:name]" -ne NoRepeatingAttributeLoaded -and [%2%] -le 5|>Overchannel;[*S:character_id];[%3%];[%4%];[%5%] --=BaseDamageDice|[&BaseDamageDice] --=UpcastDamage|[&UpcastDamage] --=Damage|[$BaseDamageDice.Total] --?[$UpcastDice] -gt 0|=Damage;[$BaseDamageDice.Total] + [$UpcastDamage.Total] --/=HalfDamage|[$Damage.Total] \ 2 --&Meta| --/|Checking for heightened spell --Rfind|[*S:character_id];Metamagic: Heightened Spell;repeating_traits;name --?"[*R:name]" -ne NoRepeatingAttributeLoaded|>Heightened --/|Since we want to be able to hover over a roll and see the dice details, output the rolled damage at the --/|top of the card. If all critters make their save, the half damage roll won't contain the details. --+|[c][b]Damage Roll: [/b][$Damage][/c] --+|  --#debug|1 --/|Get all tokens on the page into the "alltokens" array --&SpellCenter|[%8%] --~|array;pagetokens;alltokens;[%8%] --/|Create the "inRange" array. It will have a blank item in it to begin with, which we will remove later. --~|array;define;inRange; --/|Loop through all of the tokens in "alltokens" to check their distance --~tokenid|array;getfirst;alltokens --?[&tokenid] -eq ArrayError|endOutput --:loopCheck| --/|Skip targets that are not on the token or gm layer or that don't represent creatures --?[*[&tokenid]:t-layer] -ne objects -and [*[&tokenid]:t-layer] -ne gmlayer|continue --?"[*[&tokenid]:t-represents]" -ninc "-"|continue --/|Check the distance between the target token and the current array token. 5 feet is 1 unit --=radius|[%9%] --~dist|distance;[%8%];[&tokenid] --?[$dist] -gt [$radius]|continue --/|If we didn't skip over this part, the token is within range, so add it to the inRange array --~|array;add;inRange;[&tokenid] --:continue| --~tokenid|array;getnext;alltokens --?[&tokenid] -ne ArrayError|loopCheck --/|Remove the dummy first item in the inRange array --~|array;removeat;inRange;0 --/|Check for Sculpt Spells and Careful Spell Metamagic --Rfind|[*S:character_id];[%1%];repeating_spell-[%2%];spellname --&School|[*R:spellschool] --Rfind|[*S:character_id];Sculpt Spells;repeating_traits;name --?"[&School]" -eq evocation -and "[*R:name]" -ne NoRepeatingAttributeLoaded|>Sculpt;[%3%] --&CarefulTokens| --Rfind|[*S:character_id];Metamagic: Careful Spell;repeating_traits;name --?"[*R:name]" -ne NoRepeatingAttributeLoaded -and [&Meta] -ne yes|>Careful;[*S:charisma_mod] --/|Loop through the inRange tokens and roll saves for each one and apply damage --~tokenid|array;getfirst;inRange --?[&tokenid] -eq ArrayError|endOutput --:loopDisplay| -->MakeSavingThrow|[&tokenid];[%10%];[*S:spell_save_dc];[$Damage.Total];[%8%];thisTokenDamage;saveResult;[%11%] --+[*[&tokenid]:t-name]:|Save [$savingThrow] [r][$thisTokenDamage] [%7%] damage[/r] --/|Put a burn-fire visual effect on impacted tokens --vtoken|[&tokenid] [%12%] --/|Get the next token and continue the loop until we run out. --~tokenid|array;getnext;inRange --?[&tokenid] -ne ArrayError|loopDisplay --/|Add some extra visual effects - a nova-fire at the target, and a beam-fire from source to target --vtoken|[&SpellCenter] [%13%] --?[&SpellCenter] -ne [*S:t-id]|[--vbetweentokens|[*S:t-id] [&SpellCenter] [%14%] --]| --:endOutput| --<| --/|Subroutine to make saving throws and calculate damage amounts --:MakeSavingThrow|tokenid;savetype;dc;damage;damagetype;damagevariable;saveresultvariable;shortabilityname --?"X[*[%1%]:npc_[%8%]_save_base]" -eq "X"|>set_string;baseSaveBonus;|>set_string;baseSaveBonus; + + [*[%1%]:npc_[%8%]_save_base] --=savingThrow|1d20 + [*[%1%]:[%2%]_save_bonus] [&baseSaveBonus] --&dmgmult| --&Evade| --&Adv| -->AdvantageCheck|[*[%1%]:character_id];[*%1%]:[%2%]_save_bonus] [&baseSaveBonus];[%8%] --/|Check for Heightened Spell disadvantage --?[&HeightTarget] -eq [%1%] -and [&Adv] -eq yes|=savingThrow|1d20 + [*[%1%]:[%2%]_save_bonus] [&baseSaveBonus] --?[&HeightTarget] -eq [%1%] -and [&Adv] -ne yes|=savingThrow|2d20kl1 + [*[%1%]:[%2%]_save_bonus] [&baseSaveBonus] --?[%8%] -eq dex|>EvasionCheck|[*[%1%]:character_id] --?"[&CarefulTokens]" -inc [%1%]|=savingThrow;1000 --?[$savingThrow] -ge [%3%]|>set_string;dmgmult; \ 2 --?[$savingThrow] -lt [%3%]|>set_string;[%7%];fail --?[$savingThrow] -ge [%3%]|>set_string;[%7%];success --?"[*[%1%]:npc_resistances]" -inc "[%5%]" -and [$savingThrow] -lt [%3%]|>set_string;dmgmult; \ 2 --?"[*[%1%]:npc_resistances]" -inc "[%5%]" -and [$savingThrow] -ge [%3%]|>set_string;dmgmult; \ 2 \ 2 --?"[*[%1%]:npc_vulnerabilities]" -inc "[%5%]" -and [$savingThrow] -ge [%3%]|>set_string;dmgmult; * 2 \ 2 --?"[*[%1%]:npc_vulnerabilities]" -inc "[%5%]" -and [$savingThrow] -lt [%3%]|>set_string;dmgmult; * 2 --?"[*[%1%]:npc_immunities]" -inc "[%5%]"|>set_string;dmgmult; * 0 --?[&Evade] -eq yes -and [$savingThrow] -ge [%3%]|>set_string;dmgult;+ * 0 --?[&Evade] -eq yes -and [$savingThrow] -lt [%3%]|>set_string;dmgult;+ \ 2 --=[%6%]|[%4%] [&dmgmult] --<| --:set_string|mod_variable;value --&[%1%]|[%2%] --<| --/|Subroutine to apply damage with TokenMod. Could be replcaed with alterbars or chatsetattr --:ApplyDamageTokenmod|Parameters are tokenid;bar#;amount --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%] --<| --/|Subroutine to account for magic resistance, uncanny dodge, magic items granting spell resistance --:AdvantageCheck|character_id;savingThrow formula --?[*[%1%]:npc_type] -eq 0|>PCAdv;[%1%];[%2%]|>NPCAdv;[%1%];[%2%] --<| --:PCAdv|character_id;savingThrow formula;short save attr --Rfind|[%1%];Danger Sense;repeating_traits;name --?"[*R:name]" -ne NoRepeatingAttributeLoaded -and [%3%] -eq dexterity|[ --=savingThrow;2d20kh1 + [%2%] --&Adv|yes --]| --Rfirst|[%1%];repeating_inventory --"[*R:itemcontent]" -eq NoRepeatingAttributeLoaded|DonePCChecks --:MagicItemLoop| --?"[*R:itemcontent]" -inc "advantage on saving throws against spells"|[ --=savingThrow;2d20kh1 + [%2%] --&Adv|yes --]| --Rnext| --?"[*R:itemcontent]" -ne NoRepeatingAttributeLoaded|MagicItemLoop --:DonePCChecks| --<| --:NPCAdv|character_id;savingThrow formula --Rfirst|[%1%];repeating_npctrait --:MagicResistance| --?"[*R:description]" -eq NoRepeatingAttributeLoaded|[ --<| --]| --?"[*R:description]" -inc "advantage on saving throws against spells"|[ --=savingThrow|2d20kh1 + [%2%] --&Adv|yes --]| --^MagicResistance| --/|Subroutine to check for Evasion --:EvasionCheck|character_id --?[*[%1%]:npc_type] -eq 1|[ --Rfind|[%1%];Evasion;repeating_npctrait;name --]|[ --Rfind|[%1%];Evasion;repeating_traits;name --]| --?"[*R:name]" -ne NoRepeatingAttributeLoaded|&Evade]|yes --< --/|Subroutine to apply overchannel --:Overchannel|charid;used slot;base die qty; base die type -->Lib5E_FindResource|[%1%];Overchannel [l];OCName;OCUses --?[$OCUses] -eq 1|[ --&Used|You have not used overchannel today --]|[ --&OCDam|[$OCUses.Total] {NEGATE} + 2 --=OCDam|[&OCDam] * [%2%] --&Used|You will take [$OCDam.Total]d12 necrotic damage if you overchannel again --]| --iOverchannel;[&Used]|q;OC;Do you want to maximize your Damage?|Yes|No --?[&OC] -eq Yes|[ --&BaseDamageDice|[%3%] * [%4%][&AddMod] --&UpcastDamage|[$UpcastDice.Total] * [%4%] [Upcast] --]| --&OCMessage|Drawing on your arcane reserves, you maximize damage! --?[&OC] -eq Yes -and [$OCUses] -ne 1|[ --=OCDam|[$OCDam.Total]d12 --&OCMessage|+ Feeling the toll of drawing heavily on the Weave, you take [$OCDam.Total] necrotic damage! --@modbattr|_charid [%1%] _hp|-[$OCDam.Total] _silent --]| --?[&OC] -eq Yes|[ --+OVERCHANNEL!!|[&OCMessage] --@modattr|_charid [%1%] _[&OCName]|-1 --]| --<| --/|Subroutine to remove allies from inRange array --:Sculpt|spell level --=SculptTgts|[%1%] + 1 -->BuildAndAskTargets|[$SculptTgts.Total] --=i|1 --:RemoveSculpted| --~SculptInd|array;indexof;inRange;[&target[$i.Total]] --~|array;removeat;[&SculptInd] --=i|[$i] + 1 --?[$i.Total] -le [$SculptTgts.Total]|RemoveSculpted --<| --/|Subroutine to have allies auto-save from inRange array --:Careful|caster charisma mod --/|Setting minimum of 1 for targets --~Care|math;max;1;[%1%] -->Lib5E_FindResource|[*S:character_id];Sorcery Points;SorPntName;SorPntsLeft --?[$SorPntsLeft.Total] -ge 1|[ --iYou have [$SorPntsLeft.Total] Sorcery Points;Careful Spell|q;UseCareful;Do you want to use 1 Sorcery Point?|Yes|No --]| --?[&UseCareful] -eq Yes|>BuildAndAskTargets;[$Care.Total]|EndCare --/|Built string of protected tokens --=i|0 --:CareLoop| --=i|[$i.Total] + 1 --?[$i.Total] -gt [$Care.Total]|EndCare --&CarefulTokens|+[&target[$i.Total]], --^CareLoop| --@modattr|_charid [*S:character_id] _[&SorPntName]|-1 _silent --&Meta|yes --:EndCare| --<| --:BuildAndAskTargets|# of targets --&TargetString| --=targetCount|1 --:TargetLoop| --&TargetString|+t;target[$targetCount.Total];Protected Target [$targetCount.Total] --=targetCount|[$targetCount.Total] + 1 --?[$targetCount.Total] -le [%1%]|[ --&TargetString|+|| --^TargetLoop| --iProtect your friends!;The same token can be selected multiple times;Select [%1%] Targets|[&TargetString] --/| --<| --:Heightened| -->Lib5E_FindResource|[*S:character_id];Sorcery Points;SorPntName;SorPntsLeft --?[$SorPntsLeft.Total] -ge 3|[ --iYou have [$SorPntsLeft.Total] Sorcery Points;Heightened Spell|q;UseHeightened;Do you want to use 3 Sorcery Points?|Yes|No --]|[--^EndHeightened| --]| --?[&UseHeightened] -eq Yes|[ --iBe the bane of your enemies!;Choose one target|t;HeightTarget;Select Target --@modattr|_charid [*S:character_id] _SorPntName|-3 _silent --&Meta|yes --]| --:EndHeightened| --<| --:Empower|base die qty;base die size;upcast dice qty; spellcaster charisma mod --/|Setting minimum of 1 reroll --~Reroll|math;max;1;[%4%] -->Lib5E_FindResource|[*S:character_id];Sorcery Points;SorPntName;SorPntsLeft --?[$SorPntsLeft.Total] -ge 1|[ --iYou have [$SorPntsLeft.Total] Sorcery Points;Empowered Spell|q;UseEmpowered;Do you want to use 1 Sorcery Point?|Yes|No --]|[--^EndEmpowered| --]| --?[&UseEmpowered] -eq Yes|>RerollSub;[%1%];[%2%];[%3%];[$Reroll.Total] --:EndEmpowered| --<| --:RerollSub|base die qty;base die size;upcast dice qty;possible rerolls --@modattr|_charid [*S:character_id] _[&SorPntName]|-1 _silent --&ButtonString| --#reentrant|Empower --=dSize|[%2%] --=i|1 --=BaseDice|[%1%] --=MaxDice|[%1%] + [%3%] --=CMod|[%4%] --=Rerolls|[%4%] --:EmpowerLoop| --=Die[$i.Total]|[T#D[%2%]] --&ButtonImg[$i.Total]|[img width=24][$Die[$i.Total].tableEntryImgURL][/img] --&ButtonString|+[rbutton][&ButtonImg[$i.Total]]::Reroll;[$i.Total][/rbutton] --=i|[$i] + 1 --?[$i.Total] -lt [$MaxDice.Total]|EmpowerLoop --:DisplayDiceButtons| --+[%4%] Rerolls Possible|[&ButtonString] [rbutton]Done Rerolling::DoneReroll[/rbutton] --X| await reroll selections --:Reroll| --~ButtonString|string;replace;[&ButtonImg[&reentryval]]::Reroll;Used::;[&ButtonString] --=Die[&reentryval]|d[$dSize.Total] --=Rerolls|[$Rerolls.Total] - 1 --^DisplayDiceButtons| --:DoneReroll| assemble dice totals for new damage value --=i|1 --&BaseDamageDice|0 --&UpcastDamage|0 --:AddLoop| --?[$Die[$i.Total]] -gt 0|&BaseDamageDice;+ + [$Die[$i.Total].Total] [✊]|&BaseDamageDice;+ + [$Die.[$i.Total].tableEntryValue] --=i|[$i] + 1 --?[$i] -gt [$BaseDice]|UpcastAdd --?[$i] -le [$MaxDice]|AddLoop --~BaseDamageDice|string;replace;0 + ;;[&BaseDamageDice] --^DoneEmpower| --:UpcastAdd| --?[$i] -gt [$MaxDice]|DoneEmpower --?[$Die[$i.Total]] -gt 0|&UpcastDamage;+ + [$Die[$i.Total].Total] [✊]|&UpcastDamage;+ + [$Die.[$i.Total].tableEntryValue] --=i|[$i] + 1 --?[$i] -le [$MaxDice]|UpcastAdd --~UpcastDamage|string;replace;0 + ;;[&UpcastDamage] --&UpcastDamage|+ [Upcast] --^DoneEmpower The bolded area seems to be giving me the trouble, which makes no sense to me since I lifted it directly out of other scripts that work!
How long does it take for the one-click to update? I am still on 1.31. 
The bolded area seems to be giving me the trouble, which makes no sense to me since I lifted it directly out of other scripts that work! Scratch that: the error occurs in varying places as a I run the script. It always occurs in the general area of those lines, but not necessarily exactly there.
1625175682
David M.
Pro
API Scripter
Craven said: How long does it take for the one-click to update? I am still on 1.31.  One-click updates of submitted script revisions get pushed out by the devs every Tuesday, but script authors often wait a bit to make sure that there are no hidden bugs before submitting to the official repo. Then there are those like me that wait, and when they finally do submit them, a typo in the json file kills the one-click version completely ;)
1625222958

Edited 1625234723
Kurt J.
Pro
API Scripter
Sorry I haven't been around much the last few days... I've been super busy, and haven't been feel well to boot. Colin, can you post the "startup" line for ScriptCards in the console? It should end with an offset value that can be subtracted from the line number that is reported in the sandbox crash to get the line number in ScriptCards where the error is showing up.
I think this is what you're looking for? Hope you get better soon!
1625234552

Edited 1625234709
Kurt J.
Pro
API Scripter
@Colin: I'll update the script to prevent the sandbox crash, but the line in the script that look to be problematic is: --/|Subroutine to remove allies from inRange array --:Sculpt|spell level --=SculptTgts|[%1%] + 1 -->BuildAndAskTargets|[$SculptTgts.Total] --=i|1 --:RemoveSculpted| --~SculptInd|array;indexof;inRange;[&target[$i.Total]] --~|array;removeat;[&SculptInd] --=i|[$i] + 1 --?[$i.Total] -le [$SculptTgts.Total]|RemoveSculpted --<| The bolded item above. I believe the array name (inRange) is missing from the removeat call and should be: --~|array;removeat;inRange;[&SculptInd]
This appears to be my next problem: --:BuildAndAskTargets|# of targets --#debug|1 --&TargetString| --=targetCount|1 --:TargetLoop| --&TargetString|+t;target[$targetCount.Total];Protected Target [$targetCount.Total] --=targetCount|[$targetCount.Total] + 1 --?[$targetCount.Total] -le [%1%]|[ --&TargetString|+|| --^TargetLoop| --]| --iProtect your friends! The same token can be selected multiple times; Select [%1%] targets|[&TargetString] --/| --<| This appears in the console log: "ContentIn: [&TargetString] Match: [&TargetString], vName: TargetString, replacement t;target<span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 1<br /><br />Result: 1 '>1</span>;Protected Target <span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 1<br /><br />Result: 1 '>1</span>||t;target<span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 1 + 1<br /><br />Result: 1 + 1 '>2</span>;Protected Target <span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 1 + 1<br /><br />Result: 1 + 1 '>2</span>||t;target<span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 2 + 1<br /><br />Result: 2 + 1 '>3</span>;Protected Target <span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 2 + 1<br /><br />Result: 2 + 1 '>3</span>||t;target<span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 3 + 1<br /><br />Result: 3 + 1 '>4</span>;Protected Target <span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 3 + 1<br /><br />Result: 3 + 1 '>4</span>" "Line Counter: 252, Tag:iProtect your friends! The same token can be selected multiple times; Select 4 targets, Content:t;target<span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 1<br /><br />Result: 1 '>1</span>;Protected Target <span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 1<br /><br />Result: 1 '>1</span>||t;target<span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 1 + 1<br /><br />Result: 1 + 1 '>2</span>;Protected Target <span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 1 + 1<br /><br />Result: 1 + 1 '>2</span>||t;target<span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 2 + 1<br /><br />Result: 2 + 1 '>3</span>;Protected Target <span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 2 + 1<br /><br />Result: 2 + 1 '>3</span>||t;target<span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 3 + 1<br /><br />Result: 3 + 1 '>4</span>;Protected Target <span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 3 + 1<br /><br />Result: 3 + 1 '>4</span>" I've tried everything I can think of to remove any formatting from the code before plugging it into the Handout, but this keeps coming up. So far, it appears to be the only place this type of problem shows up. As a result of all that extra formatting, the button to select targets doesn't work.
1625241215
Kurt J.
Pro
API Scripter
Colin C. said: This appears to be my next problem: --:BuildAndAskTargets|# of targets --#debug|1 --&TargetString| --=targetCount|1 --:TargetLoop| --&TargetString|+t;target[$targetCount.Total];Protected Target [$targetCount.Total] --=targetCount|[$targetCount.Total] + 1 --?[$targetCount.Total] -le [%1%]|[ --&TargetString|+|| --^TargetLoop| --]| --iProtect your friends! The same token can be selected multiple times; Select [%1%] targets|[&TargetString] --/| --<| This appears in the console log: "ContentIn: [&TargetString] Match: [&TargetString], vName: TargetString, replacement t;target<span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 1<br /><br />Result: 1 '>1</span>;Protected Target <span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 1<br /><br />Result: 1 '>1</span>||t;target<span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 1 + 1<br /><br />Result: 1 + 1 '>2</span>;Protected Target <span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 1 + 1<br /><br />Result: 1 + 1 '>2</span>||t;target<span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 2 + 1<br /><br />Result: 2 + 1 '>3</span>;Protected Target <span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 2 + 1<br /><br />Result: 2 + 1 '>3</span>||t;target<span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 3 + 1<br /><br />Result: 3 + 1 '>4</span>;Protected Target <span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 3 + 1<br /><br />Result: 3 + 1 '>4</span>" "Line Counter: 252, Tag:iProtect your friends! The same token can be selected multiple times; Select 4 targets, Content:t;target<span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 1<br /><br />Result: 1 '>1</span>;Protected Target <span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 1<br /><br />Result: 1 '>1</span>||t;target<span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 1 + 1<br /><br />Result: 1 + 1 '>2</span>;Protected Target <span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 1 + 1<br /><br />Result: 1 + 1 '>2</span>||t;target<span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 2 + 1<br /><br />Result: 2 + 1 '>3</span>;Protected Target <span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 2 + 1<br /><br />Result: 2 + 1 '>3</span>||t;target<span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 3 + 1<br /><br />Result: 3 + 1 '>4</span>;Protected Target <span style=' font-family: undefined; font-size: 1.2em; font-weight: normal; font-style: normal; text-align: center; font-size: 100%; display: inline-block; font-weight: bold; height: 1em; min-width: 1.75em; margin-top: -1px; margin-bottom: 1px; padding: 0px 2px; border: 1px solid; border-radius: 3px; background-color: #FFFEA2; border-color: #87850A; color: #000000; ' class='showtip tipsy' title='Roll: 3 + 1<br /><br />Result: 3 + 1 '>4</span>" I've tried everything I can think of to remove any formatting from the code before plugging it into the Handout, but this keeps coming up. So far, it appears to be the only place this type of problem shows up. As a result of all that extra formatting, the button to select targets doesn't work. Instead of .Total, use .Raw to remove all formatting from the $ variable references.
Kurt J. said: Sorry I haven't been around much the last few days... I've been super busy, and haven't been feel well to boot. Colin, can you post the "startup" line for ScriptCards in the console? It should end with an offset value that can be subtracted from the line number that is reported in the sandbox crash to get the line number in ScriptCards where the error is showing up. Hope you feel better soon. 
Hello all again, I fell you all are doing things way beyond my ability and hesitate to ask questions. In case I am not the only one out there... I think I have a simple issue that I am just not getting. !scriptcard {{ --#title|Adamantine Greataxe --#titlecardbackground|#FFD700 --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#emoteText|NPC attacks @{target|token_name} --=TargetAC|@{target|npc_ac} --?[$TargetAC.Total] -gt 0|DoneWithAC --=TargetAC|@{target|ac} --:DoneWithAC| --=AttackRoll|?{Attack|Normal,1d20 + @{selected|strength_mod} [STR] + @{selected|pb} [PROF]|Advantage,2d20kh1 + @{selected|strength_mod} [STR] + @{selected|pb} [PROF]|Disadvantage,2d20kl1 + @{selected|strength_mod} [STR] + @{selected|pb} [PROF]} --+Attack|@{selected|token_name} rolls [$AttackRoll] vs AC [$TargetAC]. --?[$AttackRoll.Base] -eq 20|Crit --?[$AttackRoll.Base] -eq 1|Fumble --?[$AttackRoll.Total] -ge [$TargetAC.Total]|Hit --+Miss|The attack missed. --X| --:Fumble| --+Fumble!|The attack went horribly wrong. --X| --:Hit| --=Damage|1D12 + 3 + [*S:strength_mod] --=TwoHanded|2D12 + 3 + [*S:strength_mod] --+Hit!|The attack hit @{target|token_name} for [$Damage] Slashing damage. --+TwoHanded!|The attack hit @{target|token_name} for [$TwoHanded] Slashing damage. --X| --:Crit| --=Damage|1D12*2 + 3 + [*S:strength_mod] --=TwoHanded|2D12*2 + 3 + [*S:strength_mod] --+Hit!|The attack hit @{target|token_name} for [$Damage] Slashing damage. --+Hit!|The attack hit @{target|token_name} for [$TwoHanded] Slashing damage. --X| }} Thank you all for your help and time. I appreciate it greatly
1625287701

Edited 1625287939
@Mongo - Try using Small Ds (d) in your dice rolls.  So 1d12 instead of 1D12.  Also, shouldn't crit damage be 2d12 + [mods]  and not 1d12*2 + [mods].  That way you get two independent rolls, instead of doubling a single roll.  Mongo said: Hello all again, I fell you all are doing things way beyond my ability and hesitate to ask questions. In case I am not the only one out there... I think I have a simple issue that I am just not getting.
@Mongo - at risk of adding a long post here, I have enclosed my stock weapon attack for you to review.  It is not, by far, the scale of Kurt or the other Brainiacs but it may be useful.  At the least, as it is simplistic (and could be improved in many ways), it may be instructive as to how the scripts work. (Note that the macro uses token bar1 for HP.) !scriptcard  {{   --#title|Weapon Attack   --#sourceToken|@{selected|token_id}   --#targetToken|@{target|token_id}   --#emoteText|[*S:character_name] attacks [*T:character_name]   --#titleCardFont|#ffff00   --#titleCardBackground|#90BB2B   --#evenRowBackground|#3D4E06   --#evenRowFontColor|#ffff00   --#oddRowBackground|#C2DB20   --#oddRowFontColor|#267150 --#debug|1 --:Attack|     --=TargetAC|@{target|npc_ac}     --?[$TargetAC.Total] -gt 0|DoneWithAC     --=TargetAC|@{target|ac}     --:DoneWithAC| --:Set Weapon Info|     --=WeaponStats|?{Weapon?|Dagger,0|Quarterstaff +1,1|Light Crossbow,2}     --?[$WeaponStats] -eq 0|>SetWeapon;Dagger;1d8;piercing;@{selected|dexterity_mod};0     --?[$WeaponStats] -eq 1|>SetWeapon;Quarterstaff +1;1d8+1;bludgeon+1;@{selected|strength_mod};1     --?[$WeaponStats] -eq 2|>SetWeapon;Light Crossbow;1d8;piercing;@{selected|dexterity_mod};0 --:Roll Attack|     --&Globe|?{Any Global Attack Modifier?|None,0|Bless, 1d4|Other 1d4,1d4|Other 1d6,1d6|Other 1d8,1d8|Other 1d10,1d10|Other 1d12,1d12}     --&RollType|?{Advantage or Disadvantage?|Normal,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1}     --=AttackRoll|[&RollType] [BASE] + [$MagicPlus] [MAGIC] + [&Attribute] [MOD] + @{selected|pb} [PROF] + [&Globe] [GLOBE]      --+Attack|@{selected|character_name} rolls [$AttackRoll] vs AC [$TargetAC]. --:Determine results|   --?[$AttackRoll.Base] -eq 1|Fumble   --?[$AttackRoll.Total] -lt [$TargetAC.Total]|Miss   --?"[*T:npc_immunities]" -inc [&DamageType]|>AttackFails   --?[$AttackRoll.Total] -ge [$TargetAC.Total] -and "[*T:npc_resistances]" -inc [&DamageType]|>DamageResist;[&WeaponDmg]   --?[$AttackRoll.Total] -ge [$TargetAC.Total] -and "[*T:npc_vulnerabilities]" -inc [&DamageType]|>DamageVuln;[&WeaponDmg]   --?[$AttackRoll.Base] -eq 20|>Crit;[&WeaponDmg]   --?[$AttackRoll.Total] -ge [$TargetAC.Total]|>Hit;[&WeaponDmg]   --:EndMacro|   --X|   --:AttackFails|     --+[b]Attack Fails![/b]|[b][*T:character_name] is Immune![/b]   --X| --:PROCEDURES:|   --:SetWeapon| pass weapon, dmg, dmg_type, attribute mod magic plus       --&WeaponName|[%1%]       --&WeaponDmg|[%2%]       --&DamageType|[%3%]        --&Attribute|[%4%]       --=MagicPlus|[%5%]   --<|   --:Fumble|       --+Fumble!|The attack went horribly wrong.   --X|   --:Miss|       --+Miss!|The attack missed.   --X|   --:Hit| pass WeaponDmg string     --=Damage| [%1%] [BASE MAGIC] + [&Attribute] [MOD] + @{selected|global_damage_mod_roll} [GLOBE]     --+Hit!|[*S:character_name] hits [*T:character_name] with a [&WeaponName] for [$Damage] [&DamageType] damage.     --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage]   --^EndMacro|   --:Crit| pass WeaponDmg string     --=Damage|@{selected|global_damage_mod_roll} [GLOBE] * 2 + [%1%] [BASE MAGIC] + [%1%] [EX DIE MAGIC] + [$[&Attribute]] [MOD]      --+Critical Hit!|[*S:character_name] hits [*T:character_name] with a [&WeaponName] for [$Damage] [&DamageType] damage.     --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage]   --^EndMacro|  --:DamageResist|     --=Damage|[%1%] \ 2     --+[b]Resistant![/b]|[b][*T:character_name] takes half damage![/b]   --<|   --:DamageVuln|     --=Damage|[%1%] * 2     --+[b]Vulnerable![/b]|[b][*T:character_name] takes double damage![/b]   --<|  }}
Greetings again people! I have a couple questions about the distance functions.  Which one should I be using for Pathfinder/Starfinder as those systems count every other diagonal as 10 ft. So if you were moving on a diagonal path your distance traveled would be 5ft-15ft-20ft-30ft-35ft-45ft and so on. I've tried euclidean distance, euclidean long, and euclidean pixel. All are fairly accurate within about 60-70 ft but after that there start to be errors off by about 5-10 feet for each.  Also, would these functions work for a hex grid as well? Starfinder uses that for starship combat and there seems to be a bit off there as well.  Thanks!
1625494389

Edited 1625510247
@Kurt - I believe the GetRaw date/time function is returning the number of milliseconds (not seconds) since Jan 1, 1970.  I was writing a Wait function to delay script execution to give TokenMod and SpawnToken API functions time to do their thing.  I'll post the Wait function in the Sharing forum when I've perfected it.     SpawnToken     Wait 5 seconds     Rename New Token based on user input Update:  My wait function is not really working the way I hoped it would.  Seems that the Spawn and TokenMod api functions kick off after ScriptCards is done.  It appears that waiting after the API Call also puts it in a hold state and the API functions don't get called until the ScriptCard execution is complete. Kurt J. said: ScriptCards version 1.3.8 Now Available The Development GIST has been updated with version 1.3.8. Primarily this is a bug fix release: Bug Fix : --& lines now include roll variable formatting for .Total (or blank) roll formats. This was the default behavior before the variable substitution rewrite, and .Base or .Raw should be used if these values are needed in string assignments without roll formatting. Bug Fix : Fixed a sandbox crash when using a non-existant variable name in a line that does roll formatting. New Function : Added "getraw" to the system/date function set. This returns the raw date/time as a number of seconds since Jan 1, 1970 at Midnight. Convenience : Added support for setting name aliases... since I can't seem to keep "nominmaxhilight" and "nominmaxhighlight" straight... There are a handful of settings that now accept different names, like "nominmaxhilight" (as opposed to highlight). Functionally they just set the base "correct" setting name when used. Cleanup : Minor code formatting changes to make things more readable.
Is there an equivalent to the --titlefontshadow| (powercards) command in scriptcards?  I've also tried several things to get the emote text color to change without success including:   --#emoteFontColor|   --emoteColorFont|   --#emoteFontCard|   --#emoteTextColor|   --#emoteColorCard|   --#emoteCardColor| Anyone know the actual command?
1625509860

Edited 1625510057
Chad
Plus
Sheet Author
Will M. said: Chad, you might check the TokenMod setting "Player can IDs" and make sure it's turned ON.   !token-mod --help Then toggle the button " Players can IDs is currently  On/Off" [TOGGLE] so that the setting is turned ON. Tried that. No luck. There is something about the way the id shows up when sent to tokenmod by scriptcards, even though copying and pasting the exact text does work It really really doesn't like the hyphen in _ignore-selected
@Chad - What is the TokenId you are trying to effect?  I wonder if it has a random set of bad characters like "--" that scriptcards is choking on.  
1625510610
Chad
Plus
Sheet Author
Will M. said: @Chad - What is the TokenId you are trying to effect?  I wonder if it has a random set of bad characters like "--" that scriptcards is choking on.    -Mdrty-oVaNLDd_rm4Fg Also, I just ran into a new issue. Now I can't get tokenmod to work at all with scriptcards. Something must have changed. A test macro I've been using that has always worked is no longer working at all.
1625513510
Chad
Plus
Sheet Author
Chad said: Also, I just ran into a new issue. Now I can't get tokenmod to work at all with scriptcards. Something must have changed. A test macro I've been using that has always worked is no longer working at all. Fascinating. Apparently some other script was interfering with it. I removed all scripts, added just tokenmod and scriptcard, and the test started working again :) Now I need to go through all of them and see if one was the cause :)
Let me know if you figure out which scripts are colliding.  
1625523655

Edited 1625524077
Finally saw a couple episodes of Loki last night.  Was inspired by the look and feel of the show and designed this based on the Amber CRT look introduced for a new ScriptCard macro utility I wrote today: Here are the settings a simple function i use to add header rows: --&FColor1|#FFCC00 --&FColor2|#FFB000 --&BColor1|#282828 --&BColor2|#282828 --#titlecardbackground|[&BColor1] --#titlecardbackgroundimage| linear-gradient(to bottom, #FFB000, #282828) --#titlefontsize|2.0em --#titlefontlineheight|1.2em --#titlefontface|Courier --#norollhighlight| 0 --#hideTitleCard| 0 --#bodyfontsize| 10px --#bodyfontface|Courier --#oddrowbackground|[&BColor1] --#oddrowfontcolor|[&FColor2] --#evenrowbackground|[&BColor1] --#evenrowfontcolor|[&FColor1] --#buttonbackground|[&BColor1] --#buttontextcolor|[&FColor1] --#buttonbordercolor|[&BColor1] --#buttonfontsize|x-small --#buttonfontface|Courier Section Header Function: -->SECTION_HEADER|Macros --:SECTION_HEADER|Title --&hdrstyle_T|style="width:100%;padding:1px;border-spacing:0px;border-collapse:collapse;text-shadow: 0px 0px 0px [&BColor1];border:1px solid [&FColor2];" --&hdrstyle_TR|style="border:0px solid [&FColor2];" --&hdrstyle_TD|style="width:100%;background-color:[&BColor1]; color:[&FColor1]; font-size:110%;font-weight:bold;text-align:center" --+|[t [&hdrstyle_T]][tr [&hdrstyle_TR]][td [&hdrstyle_TD]][c][%1%][/c][/td][/tr][/t] --<|
@Michael C. I need to thank you tons for the macro. I have been playing with it since you posted it. I was curious with one part of it.  I am not sure how to ask without reposting the macro and taking up a ton of room. If you have a cleaner option (I am Mongo on discord on this server) let me know. or I can just post it here since this is the digital class room. Thank your for your time.
1625558897

Edited 1625559572
Sticking with the CRT theme, this time the old Green CRTs.  Here's an old Scriptcard utility I wrote reskinned as an old PC/Applle2C look: Functionality: Clicking on the NPC Name, Moves the map so that it's visible and pings it on the map [+] lets me add a quick note: stored in Bar3_value Monkey Icon: Toggles token between GM and Objects Layer (via !token-mod) Paper:  Quick NPC Sheet (See below) Bow: Actions, Reactions, Attacks, Legendary Action List Magic Circle: Spell book Bio-Hazard: Dumps NPC Bio to the chat window (via !gmnotes) Chain: Links to D&DBeyond for Monster Description Camera: Dumps NPC Image to the Chat window with option to show players (via !gmnotes) Stoplight: Add to turn order list 10-box: add number to uniquify when there are multiple monsters of the same kind Numbers across the top (10, 20, 50, ...) Limits the list of NPCs based on distance from selected token.  Very handy for large maps with dozens of monsters. All other icons link to my suite of utility macros.  Here is the formatting for this look: --&FColor1|#f0fff8 --&FColor2|#00FF66 --&BColor1|#282828 --&BColor2|#282828 --#titlecardbackgroundimage| linear-gradient( to bottom, #f0fff8, #282828 ) --#titlefontsize|2.0em --#titlefontlineheight|1.2em --#titlefontface|Courier --#norollhighlight| 0 --#hideTitleCard| 0 --#bodyfontsize| 12px --#bodyfontface|Courier --#oddrowbackground|[&BColor1] --#oddrowfontcolor|[&FColor2] --#evenrowbackground|[&BColor1] --#evenrowfontcolor|[&FColor1] --#buttonbackground|[&BColor1] --#buttontextcolor|[&FColor1] --#buttonbordercolor|[&BColor1] --#buttonfontsize|small --#buttonfontface|Courier Table Cell Style properties to give that blur effect.  The magic is in the text-shadow definition:    --&tStyle|style="border:1px solid black;width:100%"   --&trStyle1|style="background-color:[&BColor1]"   --&trStyle2|style="background-color:[&BColor1]"   --&tdStyle1|style="width:25%;text-align:right;font-weight:bold; color: [&FColor1];text-shadow: 0 0 2px #80ffc0, 0 0 4px #00ff66, 0 0 8px #00ff66, 0 0 14px #00ff66;"   --&tdStyle2|style="width:25%;text-align:left;font-size:smaller; color: [&FColor2]"   --&tdStyle3|style="width:25%;text-align:right;font-weight:bold; color: [&FColor1];text-shadow: 0 0 2px #80ffc0, 0 0 4px #00ff66, 0 0 8px #00ff66, 0 0 14px #00ff66;"    --&tdStyle4|style="width:25%;text-align:center;font-weight:bold; color: [&FColor2]" Then just use your defined styles in your html table based output: --+|[t [&tStyle]] [tr [&trStyle1]][td [&tdStyle1]][u]Attr[/u][/td] [td style="width:50%;text-align:center;font-weight:bold" colspan=2] [u]Score[/u][/td] [td [&tdStyle4]][u]Save[/u][/td][/tr] [tr [&trStyle2]][td [&tdStyle1]]Str[/td] [td [&tdStyle3]] [&StrMod][/td] [td [&tdStyle2]]([*[&CharId]:strength]) [/td] [td [&tdStyle4]][button][&StrSave]::~[*[&CharId]:character_name]|npc_str_save[/button][/td][/tr] [tr [&trStyle1]][td [&tdStyle1]]Dex[/td] [td [&tdStyle3]] [&DexMod][/td] [td [&tdStyle2]]([*[&CharId]:dexterity]) [/td] [td [&tdStyle4]][button][&DexSave]::~[*[&CharId]:character_name]|npc_dex_save[/button][/td][/tr] [tr [&trStyle2]][td [&tdStyle1]]Con[/td] [td [&tdStyle3]] [&ConMod][/td] [td [&tdStyle2]]([*[&CharId]:constitution]) [/td] [td [&tdStyle4]][button][&ConSave]::~[*[&CharId]:character_name]|npc_con_save[/button][/td][/tr] [tr [&trStyle1]][td [&tdStyle1]]Int[/td] [td [&tdStyle3]] [&IntMod][/td] [td [&tdStyle2]]([*[&CharId]:intelligence]) [/td] [td [&tdStyle4]][button][&IntSave]::~[*[&CharId]:character_name]|npc_int_save[/button][/td][/tr] [tr [&trStyle2]][td [&tdStyle1]]Wis[/td] [td [&tdStyle3]] [&WisMod][/td] [td [&tdStyle2]]([*[&CharId]:wisdom]) [/td][td [&tdStyle4]][button][&WisSave]::~[*[&CharId]:character_name]|npc_wis_save[/button][/td][/tr] [tr [&trStyle1]][td [&tdStyle1]]Cha[/td] [td [&tdStyle3]] [&ChaMod][/td] [td [&tdStyle2]]([*[&CharId]:charisma]) [/td][td [&tdStyle4]][button][&ChaSave]::~[*[&CharId]:character_name]|npc_cha_save[/button][/td][/tr] [/t]
1625570911
David M.
Pro
API Scripter
I like the structure of your CSS formatting, Will! I'm assuming this will all make it into the "Working & Sharing" thread, if it hasn't already (I don't recall seeing NPC Tools there)? The last part of your post with the CSS table construction would be great as a Tricks/tips/algorithms index entry. Nice work!
@Will M.  Just awesome!  Your NPC tools green scheme works excellently.  One small, weird, problem on the amber CRT.  I opened a new macro and copy/pasted it into the macro (just as I did with the NPC tools) and did a test macro button push.  Works wondrously.  Set it as a token action, open to all players, clicked a token then clicked the token action tab.  CRASH!  No error but I get the blue printout of the macro in the chat area.  Never seen that before.  Do you know what is wrong?
1625591064

Edited 1625591434
@Michael C. - Are you running at least version 1.3.7? Sounds like you may be missing the bang(!) in front of "!Script {{" or may be missing the final set of curly brackets "}}".  That happens to me all the time when I copy/paste a lot from my editor.
1625604217

Edited 1625604327
Hello all you wonderful script wizards, I've been playing around with converting a Bless script into a Bardic Inspiration script and step by step I'm getting closer and closer to getting it to do what I want. But a couple of things are still thwarting me; first I want to check whether the character still has Bardic Inspiration available, second if they do I want to be able to deduct 1 use from their character sheet and if they don't then I want to kick back a message in chat that they have no Bardic Inspirations left. Here's what I've managed to put together so far, which does work to cast and mark the target token's token and turn on the global save, attack, and ability on the character sheet so that when they roll it automatically includes the bardic die. !scriptcard {{ --#title|You've been inspired by some very stirring words and music --#titlecardbackground|#FF00FE --#evenrowbackground|#FF60FE --#oddrowbackground|#FFDFFF --#evenrowfontcolor|#020202 --#oddrowfontcolor|#020202 --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --config players-can-ids|on. -->GetAndCheckSlotInformation| --=BardicCount|[$SlotLevel] -->BuildAndAskTargets|[$BardicCount.Total] --=DisplayCount|1 --#leftsub|Buff: 10 minutes --#rightsub|Range: 60 ft. --#emoteText|@{selected|character_name} plays a Bardic Melody --:BardicLoop| -->FireMissile|[$DisplayCount.Total] --=DisplayCount|[$DisplayCount] +1 --?[$DisplayCount] -le [$BardicCount]|BardicLoop -->DeductInspiration| --#rightsub| --X| --:FireMissile| --&ThisTarget|[&target[%1%]] --+|[c][b]**[*[&ThisTarget]:character_name]**[/b][/c] --@act| -1| 100| _Bardic [*[&ThisTarget]:character_name] -->PlayEffects|@{selected|token_id};[&ThisTarget];glow-charm;nova-charm;none;spell-bardicinspiration --<| --:GetAndCheckSlotInformation| -->Lib5E_FindResource|@{selected|character_id};Bardic Inspiration;ResName;ResValue --=InspirationTotal|0 --=InspirationExpended|[*S:[&ResValue]_inspiration_expended] --?[$InspirationExpended.Total] -eq [*S:[&ResValue]]|NoInspirationLeft --<| --:NoSlotsLeft| --+|[*S:character_name] You have no Bardic Inspirations left. --#emoteText|[*S:character_name] tries to cast a spell but farts in instead. --X| --:DeductInspiration| --=InspirationExpended|[*S:[&ResValue]] - 1 --@setattr|_charid [*S:character_id] _class_resource[*S:[&ResValue]_class_resource_expended] |[&ResName] _silent --+|[c][b]Bardic Inspiration Left: [*S:[&ResValue]] [/c][/b] --X|Full Stop --:PlayEffects|Parameters are : sourcetoken; targettoken; source effect; target effect; line effect; sound effect --@setattr|_charid [*[%2%]:character_id] _repeating_savemod_$1_global_save_active_flag|1 _silent --@setattr|_charid [*[%2%]:character_id] _repeating_tohitmod_$1_global_attack_active_flag|1 _silent --@setattr|_charid [*[%2%]:character_id] _repeating_skillmod_$0_global_skill_active_flag|1 _silent --@token-mod| _ids [*[%2%]:character_id] _set statusmarkers|bardic-inspiration::4106668 --vtoken|[%1%] [%3%] --vtoken|[%2%] [%4%] --vbetweentokens|[%1%] [%2%] [%5%] --@roll20AM|_audio,play,nomenu|[%6%] --<| --:BuildAndAskTargets| --&TargetString| --=targetCount|1 --&TargetString|+t;target[$targetCount.Total];Missile [$targetCount.Total] Target --iPlease click the button below to select target to inspire.;Select [%1%] Targets|[&TargetString] --<| }} Any assistance you might offer this mere adept would be greatly appreciated. I probably have some lines that I don't need in my script, but I gotten this far by deleting or adding one line at a time and checking whether it still works, before moving on.
Will M. said: @Michael C. - Are you running at least version 1.3.7? Sounds like you may be missing the bang(!) in front of "!Script {{" or may be missing the final set of curly brackets "}}".  That happens to me all the time when I copy/paste a lot from my editor. Hey Will - I have the latest which is 1.3.8 I believe.  The scriptcard delimiters, of course, were my first thought also (having done that before on several occasions) and I wish the solution had been that easy but it also wouldn't explain why the test macro button  did  work.  (And beautifully, I might add.)  I checked to the macro (and blue chat print out) just to be sure and the "!" and "{{" and "}}" were present in the right places.  In fact, that is what makes the least sense of all - why would it work when I open the macro from the Collection tab and run the macro using the test macro button but not when clicking on the macro in the Collection tab directly or clicked as a token action macro?  That's just bizarre.
1625618929

Edited 1625620478
Kurt, when I upgraded Scriptcards from 1.3.1 to 1.3.8, I noticed that my Magic Missile Macro stopped working, or to be more precise, the Select 3 Targets button changed to just text and I can't press it. Below are some pictures to show you what I mean.  Using Version 1.3.1: Using 1.3.8:
@ez2rpg - One thing, the line   --config players-can-ids|on.  won't work as it is not a command line.    --@token-mod _config|players-can-ids (without the period at the end) should work.
@Michael - Send me a copy of your script through private message and I'll see if I can replicate.
I've been thinking it might be fun and interesting to set up a series of ongoing online sessions for us ScriptCard script writers to show some of our work,  share some tips and tricks and how we've leveraged ScriptCards in combination with the various other utility API scripts like TokenMod and Spawn.  I'm not sure what the best setup would be, maybe create a new Test/Demo campaign, schedule a session, invite everyone in that is interested an making them co-GMs.  Or just setup a time and use Discord for audio and screen-sharing.   Let me know if anyone might be interested.  If there is interest, we can plan it from the Working and Sharing forum.  
1625715654

Edited 1625722393
Ivo
Pro
I know that --= lets you set a variable, and --+ executes or outputs, so is there anyway to execute a roll formula but not have it show, just go into some variable that can be used later, ie Roll for perception + bonuses(roll), compare that to passive perception(fixed), and use the higher result as the "roll" or is this as simple as --=PerceptionRoll|[$Perception_Roll_Forumla] Where the $ triggers the execution of the formula and stores it in PerceptionRoll So the following works as I expect !scriptcards {{   --=Perception_Roll_Base|1d20   --=Perception_Passive|12   --=PerceptionRoll|[$Perception_Roll_Base]   --?[$PerceptionRoll] -ge [$Perception_Passive]|Roll|Passive    --^Exit| --:Roll|   --+Perception(Roll) is|[$PerceptionRoll]   --^Exit| --:Passive|   --+Perception(Passive) is|[$Perception_Passive]   --^Exit| --:Exit| --X| }} But if I remove line 4, I would expect it to resolve in the --?, like it seems to for a --c (case statement) but it doesn't? !scriptcards {{   --=Perception_Roll_Base|1d20   --=Perception_Passive|12   --?[$Perception_Roll_Base] -ge [$Perception_Passive]|Roll|Passive    --^Exit| --:Roll|   --+Perception(Roll) is|[$PerceptionRoll]   --^Exit| --:Passive|   --+Perception(Passive) is|[$Perception_Passive]   --^Exit| --:Exit| --X| }} Btw the discord invite is invalid
1625743013

Edited 1625743704
David M.
Pro
API Scripter
Ivo, your description sounds different from the code you posted. Assuming your text description is what you want (use the higher of the total roll or passive) I think the following does what you want. It uses attribute names from the 5e OGL sheet, so you can modify for different sheet as needed or hardcode (character name vs "selected", or use target) or replace values with a query, etc. !scriptcards {{ --=Perception_Passive|@{selected|passive_wisdom} --=Perception_Roll|1d20 + @{selected|perception_bonus} --?[$Perception_Roll] -ge [$Perception_Passive]|Roll|Passive --^Exit| --:Roll| --+Perception(Roll) is|[$Perception_Roll] --^Exit| --:Passive| --+Perception(Passive) is|[$Perception_Passive] --^Exit| --:Exit| --X| }} EDIT - when you assign a roll variable, it performs the die rolls (if any) at the time of assignment, whether it is displayed or not. The value of the variable can be accessed at any time after assignment. You can access just the die roll portion by using the [$rollVariable.Base] syntax as described here . In your first code block, the line  --=PerceptionRoll|[$Perception_Roll_Base]  is redundant. Finally, you can also add tooltip text so when you mouseover the roll it will tell you where the numbers came from, e.g.   --=Perception_Passive|@{selected|passive_wisdom}[PASSIVE]   --=Perception_Roll|1d20 + @{selected|perception_bonus}[MOD]
Many thanks David, I can see now that in that 2nd block it was a typo, must have been tired :). Thanks also for the tip re tooltips and attribute names!
1625837499

Edited 1625837575
Ivo
Pro
I'm finding a consistent result if I check for "", ie --?|"[*R:dmg2flag]" -eq ""|Jump to whatever This fails the test(doesnt jump) if dmg2flag doesn't exist or is null, it happens in other tests as well, when testing eq "" However using -inc "" gets around this Is this normal behaviour?
Ivo - you might try doing something like this to test for empty results: --?|X"[*R:dmg2flag]" -eq X|Jump
@Michael C. Thank you for the amazing script. I have been playing with it since you posted it and I really want to say thank you. I have one thing that I would like to know if it is doable. I posted what I have done with the script (I removed the magic check for this one) and would like to know how I can add something to one of the damages.  For Precision Shot it adds the following  The Precision shot takes two actions to do. Your aim is true and you look for the opening in your target. They suffer 1d8 bleeding at the end of their turn until they stop the bleeding (DC 12 Medicine Check), or they are healed. How do I add an additional line for the 1d8 and the text? !scriptcard {{ --#title|West Sisters --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#emoteText|[*S:character_name] attacks [*T:character_name] --#titleCardFont|#ffff00 --#titleCardBackground|#ff9000 --#evenRowBackground|#ff9000 --#evenRowFontColor|#ffffff --#oddRowBackground|#633a05 --#oddRowFontColor|#ffffff --#debug|1 --:Attack| --=TargetAC|@{target|npc_ac} --?[$TargetAC.Total] -gt 0|DoneWithAC --=TargetAC|@{target|ac} --:DoneWithAC| --:Set Weapon Info| --=WeaponStats|?{Weapon?|Rifled Musket,0|Dead Shot,1|Precison Shot,2} --?[$WeaponStats] -eq 0|>SetWeapon;Rifled Musket;3d10+8;piercing;@{selected|dexterity_mod};0 --?[$WeaponStats] -eq 1|>SetWeapon;Dead Shot;5d10+8;piercing;@{selected|dexterity_mod};0 --?[$WeaponStats] -eq 2|>SetWeapon;Precision Shot;4d10+16;piercing;@{selected|dexterity_mod};0 --:Roll Attack| --&Globe|?{Any Global Attack Modifier?|None,0|Bless, 1d4|Dead Shot,-5} --&RollType|?{Advantage or Disadvantage?|Normal,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1} --=AttackRoll|[&RollType] [BASE] + [&Attribute] [MOD] + @{selected|pb} [PROF] + [&Globe] [GLOBE] --+Attack|@{selected|character_name} rolls [$AttackRoll] vs AC [$TargetAC]. --:Determine results| --?[$AttackRoll.Base] -eq 1|Fumble --?[$AttackRoll.Total] -lt [$TargetAC.Total]|Miss --?[$AttackRoll.Base] -eq 20|>Crit;[&WeaponDmg]AC --?[$AttackRoll.Total] -ge [$TargetAC.Total]|>Hit;[&WeaponDmg] --:EndMacro| --X| --:PROCEDURES:| --:SetWeapon| pass weapon, dmg, dmg_type, attribute mod --&WeaponName|[%1%] --&WeaponDmg|[%2%] --&DamageType|[%3%] --&Attribute|[%4%] --<| --:Fumble| --+Fumble!|The attack went horribly wrong. --X| --:Miss| --+Miss!|The attack missed. --X| --:Hit| pass WeaponDmg string --=Damage| [%1%] + [&Attribute] [MOD] + @{selected|global_damage_mod_roll} [GLOBE] --+Hit!|[*S:character_name] hits [*T:character_name] with a [&WeaponName] for [$Damage] [&DamageType] damage. --^EndMacro| --:Crit| pass WeaponDmg string --=Damage|@{selected|global_damage_mod_roll} [GLOBE] * 2 + [%1%] + [%1%] + [$[&Attribute]] [MOD] --+Critical Hit!|[*S:character_name] hits [*T:character_name] with a [&WeaponName] for [$Damage] [&DamageType] damage. --^EndMacro| }} Thank you for all your help and time.
@Mongo - Thanks for the compliment but I can't take full credit as I have had the benefit of many conversations here and have "borrowed" much of the macro from people here.  As to your question, this script didn't have my damage modifiers subroutines included and it sounds like that is what you are looking for.  Note, however, that I don't have a macro that applies damage, attacks or saves automatically after the initial macro (i.e. effects on subsequent turns) and don't know that it is possible.  What I usually do is have a macro for each player that list abilities and stack it with after-effect macros. Rather than tie up this thread with more macros, I will send you a private message with some of my other attack macros to look through.  
Will M. said: Ivo - you might try doing something like this to test for empty results: --?|X"[*R:dmg2flag]" -eq X|Jump Great, works like a charm, so basically you set the output to a variable, and if the variable hasn't changed, its invalid, I like it!
1625873782

Edited 1625873985
It's an old dos batch file trick.  Testing for empty can sometimes be tricky.  So X+"" -eq X becomes X -eq X which evaluates True where as X+"T" -eq X becomes XT -eq X, which evaluates to False.  Also Scriptcards doesn't require you to have quotes around string variables which can get a little confusing sometimes.  X in this case is not a variable, it's just a string being concatenated to whatever value (if any) is in your dmg2flag attribute.    
Dos back in the day when you had to know how to use a PC and configure the port your self. Com 1 and com2 LPT1 etc. I miss those days. 
1625965905
Andrew R.
Pro
Sheet Author
<Old Man Voice> It predates MS-DOS, I'm afraid. I learned it on Unix Bourne Shell in 1981. 
1626179256

Edited 1626179398
Hi, I'm trying to make a scriptcard to output a bunch of infos on an hexcrawl section of a game I'm gonna run soon. What I'm trying to achieve is to skip entierly the --:Canoe sub if the biome is dry. When I run this code, I'm still prompted with the canoe query, if the Dry Biome is selected and in that case, if Canoe is answered by Yes, the output is still "on foot", so I know the sub is not processed. What can I do to not be prompted with the query that is inside the inactive sub? What am I doing wrong? Thanks !script {{ --&Transport|"on foot" --:ChoiceBiome| --&Biome|?{Biome?|Wet|Dry} --?[&Biome] -inc "Wet"|>Canoe --?[&Biome] -ninc "Wet"|ChoiceRythme --:ChoiceRythme| --&Rythme|?{Rythme?|Normal|Slow} --?[&Rythme] -inc "Normal"|&RythmeOutput;"at a normal pace" --?[&Rythme] -ninc "Normal"|&RythmeOutput;"Slowly carfuling" --^Output| --:Output| --+|[&RythmeOutput] [&Transport] [&Biome] --^Fin| --:Fin| --X| --:Canoe| --&Canoe|?{Canoe?|Yes|No} --?[&Canoe] -inc "Yes"|&Transport;"in a canoe" --<| }}
1626183580

Edited 1626183632
Walexmith said: Hi, I'm trying to make a scriptcard to output a bunch of infos on an hexcrawl section of a game I'm gonna run soon. What I'm trying to achieve is to skip entierly the --:Canoe sub if the biome is dry. When I run this code, I'm still prompted with the canoe query, if the Dry Biome is selected and in that case, if Canoe is answered by Yes, the output is still "on foot", so I know the sub is not processed. What can I do to not be prompted with the query that is inside the inactive sub? What am I doing wrong? Thanks !script {{ --&Transport|"on foot" --:ChoiceBiome| --&Biome|?{Biome?|Wet|Dry} --?[&Biome] -inc "Wet"|>Canoe --?[&Biome] -ninc "Wet"|ChoiceRythme --:ChoiceRythme| --&Rythme|?{Rythme?|Normal|Slow} --?[&Rythme] -inc "Normal"|&RythmeOutput;"at a normal pace" --?[&Rythme] -ninc "Normal"|&RythmeOutput;"Slowly carfuling" --^Output| --:Output| --+|[&RythmeOutput] [&Transport] [&Biome] --^Fin| --:Fin| --X| --:Canoe| --&Canoe|?{Canoe?|Yes|No} --?[&Canoe] -inc "Yes"|&Transport;"in a canoe" --<| }} Actually, you are doing nothing wrong.  One of the quirks that one learns is that macro building is not the same as language programming. Any ?{} command will be processed regardless of whether the subroutine is active or not during operation.  There are a couple of work arounds using buttons or the --i command but no way to bypass that I know of.
There are a couple of work arounds using buttons or the --i command but no way to bypass that I know of. Thanks. I hadn't dug that far in the documentation. Ha! So I rewrote the --:Canoe part --:Canoe| --I is the party in a ;Canoë?|q;Transport;Canoe?|in a canoe|on foot Though now it seems I cannot reference this variable anymore after the --i command. For example, I'd like to be abble to tell my script that if the party is in a canoe, they can have a normal movement speed of 2, a slow speed of 1-(0 or 1), and a haste speed of 2+(0 or 1), both being defined at random (50% chance). This last line doesn't seem to be working --:Canoe| --I is the party in a ;Canoë?|q;Transport;Canoe?|in a canoe|on foot --?[&Transport] -inc "canoe"|=Avancement;2 --<| I did try this, as well. Doesn't seem to work either. --I The party is in a ;Canoë?|q;Avancement;Canoe?|in a canoe,2|on foot,1 Any idea?