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

[Script] ScriptCards - Thread #2

1689883281
Kurt J.
Pro
API Scripter
I have queued ScriptCards 2.4.3 for OneClick, so it should be updated next week. The big inclusion here is new repeating section referencing syntax, but I'll post up change information once the update goes live.
1689977103

Edited 1689977194
Kurt
Pro
does anyone know how to get Scriptcards to change the token image of a player's token?  I've messed around with Rollable Tables token's and I can't get it to set the state to 1,2,3 or whatever I name the images.  I'm sadly at a complete loss and pray for your kind words and a solution. I've tried --!graphic:@{selected|token_id}|blah blah blah I've tired -!a:@{selected|token_id}|blah blah blah I just can't seem to find the right WORD to use to describe the player's token image.  
1690008844
Andrew R.
Pro
Sheet Author
I haven't tested this, but based on reading the Triggers section, I think it might be  --! graphic: @{selected|token_id}| currentSide:1
1690150665

Edited 1690150680
Kurt
Pro
Unfortunately that didn't work.
1690367059

Edited 1690367117
Hello I want to call a macro but without the button, just to get the result. !scriptcard {{ --name|Skill Checks --format|skillatt --charid|@{selected|character_id} --emote|@{selected|character_name} --!Buttons|[Acrobatics](!
#AcrobaticsCheck) [Animal Handling](~selected|AnimalHandling_Check) }}
1690374978

Edited 1690375020
Actualy i get this in  ScriptCards ( down part of the picture) and i want to get like i get when i was using PowerCards (top part of the picture) Because for me the PowerCards look better Can someone help me ? I guess it's better i get make a custom script with the code of  ScriptCards and edit some things into it based of PowerCards code but i don't know how to
1690403561
Andrew R.
Pro
Sheet Author
You can make the number look like a dice roll with the  [roll] [/roll] formatting command.
1690502345

Edited 1690502371
Andrew R.
Pro
Sheet Author
Royii said: hum ? ¿Que?  If you post your ScriptCard here in a Code block we can help you further. 
1690550491

Edited 1690550557
timmaugh
Pro
API Scripter
Andrew is attempting to show you how to handle this particular difference: So it is perhaps less that he has given you a tree in answer to a fish query... more that you asked for something that included both a fish and a tree and you left it to our imagination which you wanted answered. Or perhaps a fish-shaped tree. Or a fish with a tree growing out of its head. If it is something else, you'll have to be more specific. Removing the ScripCards output border? Getting it to have round corners? Removing the drop shadow? Something else?
1690558511

Edited 1690558733
It's ok i noticed how to do it thank you Andrew & Timmaugh New question : How to roll a dice and use the same result in condition like : !scriptcards {{ --corners|10 --format|skillatt --tokenid|@{selected|token_id} --target_list|@{target|token_id} --name|Loot Monstre --emote|**@{selected|token_name}** Cherche du loot sur le cadavre du monstre "@{target|character_name}" --Loot normal : |[[1D20]] if 1D20 == 1 then XXX if 1D20 == 2 then XXX ... } }} I don't know how to write the bolder lines & to reuse the dice result
1690567988
Andrew R.
Pro
Sheet Author
You should use a Roll Variable and a Conditional.  !scriptcards {{ --=Roll|[[1d20]] --corners|10 --format|skillatt --tokenid|@{selected|token_id} --target_list|@{target|token_id} --name|Loot Monstre --emote|**@{selected|token_name}** Cherche du loot sur le cadavre du monstre "@{target|character_name}" --Loot normal : |[$Roll] --?[$Roll.Base] -eq 1|[ XXX --X| --]| --?[$Roll.Base] -eq 2|[ XXX --X| --]| ... }}
Ok thank you i will try to do that :)
1690598160

Edited 1690598217
Andrew R.
Pro
Sheet Author
You could also use a Case statement since you are using all the individual results of the D20 roll. I use Conditional much more than Case in my 13th Age monster abilities. 
I prefer the conditional too :)
1690709936

Edited 1690711998
Ok thank it work
1690808090

Edited 1690909624
Hello i'm doing this : !power {{ --corners|10 --format|skillatt --tokenid|@{selected|token_id} --target_list|@{target|token_id} --name|Quête --emote|**@{selected|character_name}** donne une quête à @{target|NomPersonnage} --$Jet de D5 : |[[ [$D5] 1d5 ]] --$Jet de D3 : |[[ [$D3] 1d3 ]] --Jet de D : |[[ [$Roll] 1d100 ]] --?? $Roll.base >= 91 and $Roll.base <= 100 ?? Quête : |Tuer [[1D5]] [[1t[Nom-de-monstre]]] de rang 1 --?? $Roll.base >= 91 and $Roll.base <= 100 ?? Gains : |[[ $D5.base * 1]] PA & [[ $D5.base * 4]] Réputation & 1 coffre }} The problem is the variable in bold can't be found by Roll20, how to fix the mistake
I'm attempting to make a script that will list the stats for a "creature", and display buttons that lets me roll an attack for the "creature". The attack have two prompts and the problem is that when I run this the prompts come up right after I've run the script, and not only when I press the button. Is there a way to solve this? Thais is a rough scetch: !script {{   --#reentrant|testing --#hideTitleCard|1 --#title|Rules - various --#buttonBackground|#9900ff --#buttonPadding|4px --#buttonBorderColor|#000000 --#titlecardbackground|#404040 --#evenRowBackground|#404040 --#oddRowBackground|#404040 --#bodyFontSize|0.9em --#oddRowFontColor|#FFFFFF --#evenRowFontColor|#FFFFFF --#tableShadow|10px #aaa   --+|   --:Artemis|   --+Ship:|Artemis   --+|[t border=1px width=99% align=center] [tr] [td style="background:#404040; font-size:12px; color:#FFFFFF; text-align:center;width:24%"]Cost[/td] [td style="background:#404040; font-size:12px; color:#FFFFFF; text-align:center;width:13%"]Length[/td] [td style="background:#404040; font-size:12px; color:#FFFFFF; text-align:center;width:13%"]Beam[/td] [td style="background:#404040; font-size:12px; color:#FFFFFF; text-align:center;width:13%"]Depth[/td] [td style="background:#404040; font-size:12px; color:#FFFFFF; text-align:center;width:13%"]Ton[/td] [td style="background:#404040; font-size:12px; color:#FFFFFF; text-align:center;width:24%"]Crew[/td] [/tr] [tr] [td style="background:#FFFFFF; font-size:12px; color:#404040; text-align:center;width:24%"]55000[/td] [td style="background:#FFFFFF; font-size:12px; color:#404040; text-align:center;width:13%"]60[/td] [td style="background:#FFFFFF; font-size:12px; color:#404040; text-align:center;width:13%"]14[/td] [td style="background:#FFFFFF; font-size:12px; color:#404040; text-align:center;width:13%"]7,5[/td] [td style="background:#FFFFFF; font-size:12px; color:#404040; text-align:center;width:13%"]63[/td] [td style="background:#FFFFFF; font-size:12px; color:#404040; text-align:center;width:24%"]4/7/22[/td] [/tr] [tr] [td style="background:#404040; font-size:12px; color:#FFFFFF; text-align:center;width:24%"]SB[/td] [td style="background:#404040; font-size:12px; color:#FFFFFF; text-align:center;width:13%"]TB[/td] [td style="background:#404040; font-size:12px; color:#FFFFFF; text-align:center;width:13%"]AB[/td] [td style="background:#404040; font-size:12px; color:#FFFFFF; text-align:center;width:13%"]M[/td] [td style="background:#404040; font-size:12px; color:#FFFFFF; text-align:center;width:13%"]W[/td] [td style="background:#404040; font-size:12px; color:#FFFFFF; text-align:center;width:24%"]-[/td] [/tr] [tr] [td style="background:#FFFFFF; font-size:12px; color:#404040; text-align:center;width:24%"]6[/td] [td style="background:#FFFFFF; font-size:12px; color:#404040; text-align:center;width:13%"]6[/td] [td style="background:#FFFFFF; font-size:12px; color:#404040; text-align:center;width:13%"]5[/td] [td style="background:#FFFFFF; font-size:12px; color:#404040; text-align:center;width:13%"]5[/td] [td style="background:#FFFFFF; font-size:12px; color:#404040; text-align:center;width:13%"]110[/td] [td style="background:#FFFFFF; font-size:12px; color:#404040; text-align:center;width:24%"]-[/td] [/tr]   [/t] --+|Spare crew members: 0 --+|Spare tonnage: 63 --+|Armament: Medium Ballista (front), small cannon (starboard) [rbutton:#FFFFFF:#555e93]Medium Ballistae::med_bal;9[/rbutton] [rbutton:#FFFFFF:#555e93]Small Cannon::sma_can;9[/rbutton] --X| --:med_bal| --=SkillBase|?{Crew Skill} --=DamageBase|?{Bonus Damage} --=AttackRoll|1d100 --+Weapon:|Medium Ballistae --+Attack:|The crew rolls [$AttackRoll] to hit --?[$AttackRoll.Base] -eq [$SkillBase]|Hit --?[$AttackRoll.Base] -lt [$SkillBase]|Hit --:Miss| --+Miss:|The bolt flies past its target --^Done| --:Hit| --=Damage|1d10! + [$DamageBase] + 10 --+Hit:|The bolt hits it target for [$Damage] damage --^Done| --:Done| --X| }}
Mrfish said: --=SkillBase|?{Crew Skill} --=DamageBase|?{Bonus Damage} This is your problem. This syntax is parsed through Roll20 before ScriptCards gets the command. I'm not sure exactly what you're trying to do, but that's why you're getting the prompts up front. You could try an "--i|" information statement in ScriptCards.
Thanks, ill try that
1691040062
Andrew R.
Pro
Sheet Author
Yes, if you want information prompts to follow the program flow, you have 2 choices:  1. Use the --I command  2. Use a special re-entrant ScriptCard technique that I don't understand yet
1691620427

Edited 1691640561
Toby
Pro
Hello again, I have a reoccuring problem with my script cards that I simply cannot get around.  I have my scriptcard code contained in a <textarea> on my character sheet (if that matters).  And, although my code works when tested by copy/pasting it directly into the <textarea>.  If I try and save it to the character sheet of the page and use it, the scriptcards code simply does not update the text area. Additionally, if I try and delete the code and reset everything it truncates the code.. It seems like the sheet is striping out what it feels are html entities.  And no matter what I do (escape codes, named codes JS escape codes).  It wont include the proper code.  It is beyond frustrating because, I simply cannot copy/past the correct code into the text area one by one because it is in a repeating section for weapons.. and well most characters/npcs have more than one weapon and that would simply take foreeeever. The scriptcard code is as follows: !scriptcard {{ --/| === ScriptCard Layout for Combined Hit/Damage === |\-- --/| === Version 1.0                               === |\-- --/| === Date: 08/09/2023                          === |\-- --/| Local Variables --|\ --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --/| ===== Roll Queries / Information Lookup =========== |\ --&AimType|?{Aim | No aim (+0),+0 | Half aim (+10),+10| Full aim (+20),+20} --&RoFType|?{Rate of Fire/Attack Type| Standard (+0),+0 | Semi auto (+10),+10 | Full Auto (+20),+20 | Called Shot (-20),-20 | Suppressing Fire (-20),-20} --&AtkMod|?{Modifier|0} --/| ===== Convert RQ Value into int variables --=AtkModNum|[&AtkMod] --=AimTypeNum|[&AimType] --=RangeNum|[&RangeType] --=RoFNum|[&RoFType] --/| ===== Strings =========== |\ --&AtkName|@{atkName} --&WeapNotes|@{notes} --&DamageMod|@{damagemod} --&TotalDam|@{damage}!+@{damagemod} --/| ===== Numbers =========== |\ --=AtkType|0 --=DmgPen|@{penetration} --=clip|@{clip} --=clipMax|@{clip|max} --/| ====== Damage Calculations |\ --&DamMod|@{damageMod} --&RollBase|@{damage} --&Count|[&RollBase(before,d)] --&DieType|[&RollBase(after,d)] --&TearingRoll|[=[&Count]*2]d[&DieType]kh[&Count]!+[&DamMod] --=TearingDamage|[&TearingRoll] --&NormalRoll|[=[&Count]]d[&DieType]! --=NormalDamage|[&NormalRoll]+[&DamMod] --/| ====== Damage Output Debug Text & Console Log ======= |\ --/| +Count|[&Count] d [b] Die Type [/b][&DieType] --/| +TearingRoll|[&TearingRoll] --/| +Tearing Damage|[$TearingDamage] --/| +Normal Damage |[$NormalDamage] --/|[b]Console Log (Hit/Dam Combined): Count [&Count] d [b] Die Type [/b] [&DieType] --/|[b]Console Log (Hit/Dam Combined): [b]Tearing Roll[/b] [&TearingRoll] [b]Tearing Damage[/b] [&TearingDamage] --/|[b]Console Log (Hit/Dam Combined): [b]Normal Damage[/b] [&NormalDamage] --/| Toughness --=TBon|[*T:tou-mod] --/| Unnatural Toughness --=UnTBon|[*T:tou-unnatural-mod] --/| Unnatural Toughness Bonus minus regular toughness (for display and math) --=UnTOnly|[*T:tou-unnatural-only] --/| Daemonic Toughness --=DaeTBon|[*T:tou-daemonic] --=HAV|[*T:headArmourvalue] --=LAAV|[*T:LeftArmArmourvalue] --=BAV|[*T:BodyArmourvalue] --=RAAV|[*T:RightArmArmourvalue] --=LLAV|[*T:LeftLegArmourvalue] --=RLAV|[*T:RightLegArmourvalue] --=HSoak|[*T:armor-head-soak] --=LASoak|[*T:armor-leftarm-soak] --=BSoak|[*T:armor-body-soak] --=RASoak|[*T:armor-rightarm-soak] --=LLSoak|[*T:armor-leftleg-soak] --=RLSoak|[*T:armor-rightleg-soak] --=HCrit|[*T:headCritDam] --=LACrit|[*T:LeftArmCritDam] --=BCrit|[*T:BodyCritDam] --=RACrit|[*T:RightArmCritDam] --=LLCrit|[*T:LeftLegCritDam] --=RLCrit|[*T:RightLegCritDam] --=HCritM|[*T:headCritDam^] --=LACritM|[*T:LeftArmCritDam^] --=BCritM|[*T:BodyCritDam^] --=RACritM|[*T:RightArmCritDam^] --=LLCritM|[*T:LeftLegCritDam^] --=RLCritM|[*T:RightLegCritDam^] --/| ===== Weapon Proficiency Full Display =========== |\ --?@{wProficiency} -eq Yes|Yes --?@{wProficiency} -eq No|No --:Yes| --&wProficiency|Yes --^wProficiencyDisplayDone| --:No| --&wProficiency|No --^wProficiencyDisplayDone| --:wProficiencyDisplayDone| --/| ===== Weapon Damage TYPE Code =========== |\ --?@{wType} -eq E|E --?@{wType} -eq I|I --?@{wType} -eq R|R --?@{wType} -eq X|X --?@{wType} -eq N|N --:E| --&DmgTypeDisplay|Energy --^DMGTypeDone| --:I| --&DmgTypeDisplay|Impact --^DMGTypeDone| --:R| --&DmgTypeDisplay|Rending --^DMGTypeDone| --:X| --&DmgTypeDisplay|Explosive --^DMGTypeDone| --:N| --&DmgTypeDisplay|None --^DMGTypeDone| --:DMGTypeDone| --/| ===== Weapon CLASS Code =========== |\ --?@{wClass} -eqi basic|Basic --?@{wClass} -eqi heavy|Heavy --?@{wClass} -eqi melee|Melee --?@{wClass} -eqi pistol|Pistol --?@{wClass} -eqi thrown|Thrown --:Basic| --&wClassDisplay|Basic --&AtkType|[*S:bs-base] [BS] --^wClassDisplayDone| --:Heavy| --&wClassDisplay|Heavy --&AtkType|[*S:bs-base] [BS] --^wClassDisplayDone| --:Melee| --&wClassDisplay|Melee --&AtkType|[*S:ws-base] [WS] --&MeleePenalty|-30 --^wClassDisplayDone| --:Pistol| --&wClassDisplay|Pistol --&AtkType|[*S:bs-base] [BS] --^wClassDisplayDone| --:Thrown| --&wClassDisplay|Thrown --&AtkType|[*S:bs-base] [BS] --^wClassDisplayDone| --:wClassDisplayDone| --/| ===== Functions =========== |\ --~sqRange|distance;@{selected|token_id};@{target|token_id} --=Range|[$sqRange] [Squares] * 1 [meters] --?[$Range] -le 3|RngPB --?[$Range] -ge 3 -and [$Range] -le @{range-s}|RngShort --?[$Range] -ge @{range-s} -and [$Range] -le @{range-n}|RngNormal --?[$Range] -ge @{range-n} -and [$Range] -le @{range-m}|RngMed --?[$Range] -ge @{range-m} -and [$Range] -le @{range-l}|RngLong --?[$Range] -ge @{range-e}|RngExtreme --:RngPB| --&AtkRange|30+[&MeleePenalty] [Point Blank] --&RngDisplay|Point Blank --^RngDone|Done --:RngShort| --&AtkRange|10 [Short] --^RngDone|Done --&RngDisplay|Short --:RngNormal| --&AtkRange|0 [Normal] --&RngDisplay|Normal --^RngDone|Done --:RngMed| --&AtkRange|0 [Medium] --&RngDisplay|Medium --^RngDone|Done --:RngLong| --&AtkRange|-10 [Long] --&RngDisplay|Long --^RngDone|Done --:RngExtreme| --&AtkRange|-30 [Extreme] --&RngDisplay|Extreme --^RngDone|Done --:RngDone| --/| ==============  DAMAGE CALCULATIONS ========== --/| === DAMAGE CALCULATIONS === --=DmgPen|@{penetration} --=LocPen|[$LocAV] - [$DmgPen] {MIN:0} --/| ======== Sheet Workers Title/Subtitle Code ======== |\ --#title|@{atkName} --#titlecardbackground|#993333 --#leftsub|[$Range] m. [&RngDisplay] --#rightsub|Ammo @{clip}/@{clip|max} --#emoteText|[*S:t-name] attacks [*T:t-name] --/| ===== Special Qualites that effect the attack roll ====== |\ --/| ===== Tearing QUALITY =========== |\ --?@{q-tearing} -eq 1|Tearing --?@{q-tearing} -eq 0|NoTearing --:Tearing| --&DmgTearing| --&FinalDamage|[$TearingDamage] --^TearingDone| --:NoTearing| --&DmgTearing|0 --&FinalDamage|[$NormalDamage] --^TearingDone| --:TearingDone| --=DmgTearing|[&DmgTearing] --/| ===== Inaccurate QUALITY =========== |\ --/| @@ DETAILS: This overides the AIMTYPE variable to ZERO (0) instead of adding a new component to the AtkTarget string. --?@{q-inaccurate} -eq 1|Inaccurate --?@{q-inaccurate} -eq 0|NoInaccurate --?@{q-defensive} -eq 1|Defensive --?@{q-defensive} -eq 0|NoDefensive --:Inaccurate| --&AimType|0 --^InaccurateDone| --:NoInaccurate| --^InaccurateDone| --:InaccurateDone| --?@{q-defensive} -eq 1|Defensive --?@{q-defensive} -eq 0|NoDefensive| --:Defensive| --&AtkDefensive|-10 [Defensive] --^DefensiveDone| --:NoDefensive| --&AtkDefensive|0 --^DefensiveDone| --:DefensiveDone| --=AtkTarget|[&AtkType] + [&AimType] [Aim] + [&AtkAccurate] [Accuracy] + [&AtkRange] + [&RoFType] [Rate of Fire] + [&AtkDefensive] + [&AtkMod] [Modifier] --=AtkRoll|1d100 --&BodyHit|Null --=DegSuccess|[$AtkTarget] - [$AtkRoll] \ 10 --&DegSuccessText|[$DegSuccess] --\|[b]Console Log (Hit/Dam Combined): Degrees of Success [b]Text[/b] [&DegSuccessText] [b]Number[/b] [$DegSuccess.Total] --/| +Deg of Success|  Text [&DegSuccessText]  Number [$DegSuccess.Total] --/| @@@ FINAL DAMAGE ROLL ===================================== |\ --=TotalSoak|[$TBon] + [$LocPen] --=FinalDamRoll|@{damage}!+@{damagemod} --/| === WEAPON DETAILS === --+|[c]● Weapon Details ●[/c] --+[t border=1 width=100%][tr][td][c]Class[/c][/td][td][c]Type[/c][/td][td][c]Damage[/c][/td][td][c]Pen[/c][/td][/tr][tr][td][c][&wClassDisplay][/c][/td][td][c][&DmgTypeDisplay][/c][/td][td][c]@{damage}[/c][/td][td][c][$DmgPen][/c][/td][/tr][/t]| --/| === Roll Details Tables --+|[c]● Roll Details ●[/c] --+[c][t border=2 width=95% align=center][tr][td][b]Skill    [/b][/td][td][b]Aim      [/b][/td][td][b]Range    [/b][/td][td][b]RoF      [/b][/td][td][b]Modifier [/b][/td][/tr][tr][td][&AtkType][/td][td][&AimType][/td][td][&AtkRange][/td][td][&RoFType][/td][td][&AtkMod][/td][/tr][/t][/c]| --/| ======= Test Output for Debugging (Hide When Code is Complete)  ======== --+|[c][t border=2 width=95% align=center][tr][td][b]Total  [/b][/td][td][b]Target [/b][/td][/tr][tr][td][$AtkRoll]   [/td][td][$AtkTarget] [/td][/tr][/t][/c] --/| ====== Count the Number of Allowed Attacks --/| The Rate of fire is 1 + [Rate of Fire Modifier] + [Scatter Modifier] * [Storm Weapon Modifier] --/| Rate of Fire Mods -> --/| Automatic                  = 1 per 1 degrees of success --/| Semi-Automatic             = 1 per 2 degrees of success --/| Point-Blank + Scatter      = Base * 2 --/| Storm (Blood of Martyrs)   = Base * 2 (Doubles the Number of Shots Fired) --/| The number of extra shots fired is cannot exceed the number of rounds in the gun (its overall rate of fire) or charge capacity for energy weapons. --/| Regardless of successful hits the amount of ammo expended is 1 per shot fired. --/| ====== Check And Assign Number of Attacks based on rate of fire. --/| Number of Attacks  - Addititve --?[$RoFNum] -le 0|NoExtra --?[$RoFNum] -eq 10 -and [$DegSuccess.Total] -ge 0|SemiAuto --?[$RoFNum] -eq 20 -and [$DegSuccess.Total] -ge 0|FullAuto --:SemiAuto| --=MaxAtk|@{rof2} --=RoFMod|[$DegSuccess.Total] [Successes] / 2 {CEIL} {MAX:@{rof2}} [Semi Auto] --^RoFDone| --:FullAuto| --=MaxAtk|@{rof3} --=RoFMod|[$DegSuccess.Total] [Successes] / 1 {CEIL} {MAX:@{rof3}} [Full Auto] --^RoFDone| --/| Reserved for possible Future Use and Error Checking --:NoExtra| --=MaxAtk|@{rof1} --=RoFMod|0 [No Extra Attacks] --^RoFDone| --:RoFDone| --/| ====== Check if the number of sucesses is at least 0 (a non-negative number) --?[$DegSuccess.Total] -le -1|DegDone --?[$DegSuccess.Total] -ge 0|Continue --:Continue| --=NumAtkBase|1 --^DegDone| --/| ==== Reserved for possible Future Use and Error Checking --:DegError| --^DegDone| --:DegDone| --/| Number of Attacks  - Multiplicative  --=NumAtks|[$NumAtkBase.Total] [Base] + [$RoFMod.Total] [Rate of Fire] --/| ====== Check and assign number of attacks based on SCATTER and RANGE. --/| @@ DETAILS: It is set to "30" because the output of the Roll Query is +30, as in thats how much the bonus to hit is. --/| @@ DETAILS: The equation basically is checking if the range is Point Blank and is Scatter selected. --?[$RangeNum] -ge 30 -and @{q-scatter} -eq 1|Scatter --?[$RangeNum] -lt 30 -or @{q-scatter} -eq 0|NoScatter --:Scatter| --=NumAtkScatter|[$NumAtks] * 2 --^ScatterDone| --:NoScatter| --=NumAtkScatter|0 --^ScatterDone| --:ScatterDone| --/| ====== Check and assign number of attacks based on STORM --?@{q-storm} -eq 1|Storm --?@{q-storm} -eq 0|NoStorm --:Storm| --=MaxAtk|[$MaxAtk]*2 --=NumAtkStorm|[$NumAtks] * 2 --^StormDone| --:NoStorm| --=NumAtkStorm|0 --^StormDone| --:StormDone| --+[c] ●  Number of HITS  ●[/c]| --=NumAtksTotal|[$RoFMod] [RoF] + [$NumAtkBase.Total] [Base] + [$NumAtkScatter] [Scatter] + [$NumAtkStorm] [Storm] {MAX:[$MaxAtk]}     --/| +Num|[$RoFMod] [RoF] + [$NumAtkBase.Total] [Base] + [$NumAtkScatter] [Scatter] + [$NumAtkStorm] [Storm] =  --+|[c][b][$NumAtksTotal.Total][/b][/c] --/| ===== ACCURATE QUALITY =========== |\ --=AccuracyNumDice|[$DegSuccess] / 2 {MAX:2} --=AccuracyNumDice|[$AccuracyNumDice] {ROUND} --?[$AimTypeNum] -gt 0 -and @{q-accurate} -eq 1|Accurate --?[$AimTypeNum] -eq 0 -or  @{q-accurate} -eq 0|NoAccurate --:Accurate| --=DmgAccurate|[$AccuracyNumDice]d10! --^AccurateDone| --/| Fail Catch not working..... --:NoAccurate| --=DmgAccurate|0 --^AccurateDone| --:AccurateDone| --&AccuracyDmgFinal|[$DmgAccurate] --/| ====== Check if AttackRoll is less than the test THRESHOLD --?[$AtkRoll.Total] -le [$AtkTarget.Total]|Success --?[$AtkRoll.Total] -gt [$AtkTarget.Total]|Failure --:Success| --+[c][#3FB315]HIT! ([$DegSuccess.Total])[/#][/c]| --^Done| --:Failure| --+[c][#B31515]MISS! ([$DegSuccess.Total])[/#][/c]| --^Done| --:Jam| --+[c]JAM![/c]| --^Done| --:Done| --?[$AtkRoll] -lt 10|[ --&rollStr|0[$AtkRoll.Raw] --]|[ --&rollStr|[$AtkRoll.Raw] --]| --~len|string;length;[&rollStr] --%i|[$len];1;-1 --~s|string;substring;[&i];1;[&rollStr] --&revStr|+[&s] --%| --=revRoll|[&revStr] --<|     --?[$revRoll] -le 10|>SetHitLocation;"Head"     --?[$revRoll] -ge 11 -and -le 20|>SetHitLocation;"Right Arm"     --?[$revRoll] -ge 21 -and -le 30|>SetHitLocation;"Left Arm"     --?[$revRoll] -ge 31 -and -le 70|>SetHitLocation;"Body"     --?[$revRoll] -ge 71 -and -le 85|>SetHitLocation;"Right Leg"     --?[$revRoll] -ge 86|>SetHitLocation;"Left Leg"     --?[$revRoll] -ge 101|>SetHitLocation;"Error - Out of Range"       --:PROCEDURES|     --:SetHitLocation| accepts hit location as parameter         --?"[&BodyHit]" -eqi "Head"|H         --?"[&BodyHit]" -eqi "Left Arm"|LA         --?"[&BodyHit]" -eqi "Body"|B         --?"[&BodyHit]" -eqi "Right Arm"|RA         --?"[&BodyHit]" -eqi "Left Leg"|LL         --?"[&BodyHit]" -eqi "Right Leg"|RL              --:H|             --&LocDisplay|Head             --=LocAV|[$HAV]             --=LocSoak|[$HSoak]             --^LocationDone|         --:LA|             --&LocDisplay|Left Arm             --=LocAV|[$LAAV]             --=LocSoak|[$LASoak]             --^LocationDone|         --:RA|             --&LocDisplay|Right Arm             --=LocAV|[$RAAV]             --=LocSoak|[$RASoak]             --^LocationDone|         --:B|             --&LocDisplay|Body             --=LocAV|[$BAV]             --=LocSoak|[$BSoak]             --^LocationDone|         --:LL|             --&LocDisplay|Left Leg             --=LocAV|[$LLAV]             --=LocSoak|[$LLSoak]             --^LocationDone|         --:RL|             --&LocDisplay|Right Leg             --=LocAV|[$RLAV]             --=LocSoak|[$RLSoak]             --^LocationDone|         --:LocationDone|          --&BodyHit|[%1%] --<| --+[c] ● [&LocDisplay] ●[/c]| --+[t border=1 width=100%] [tr] [td][c]Toughness[/c][/td] [td][c]Armor[/c][/td] [td][c]<span class="tooltip" title="Penetration subtracts from armor only.">Pen</span>[/c][/td] [td][c]Soak[/c][/td] [/tr] [tr] [td][c][$TBon]+[$UnTOnly]+[$DaeTBon][/c][/td] [td][c] [$LocAV] [/c][/td] [td][c][$DmgPen][/c][/td] [td][c][$TotalSoak][/c][/td] [/tr] [/t]| --+[c] ● DMG Details ●[/c]| --+[t border=1 width=100%] [tr] [td][c]Base[/c][/td] [td][c]Accuracy[/c][/td] [td][c]Extra[/c][/td] [td][c]xx[/c][/td] [/tr] [tr] [td][c][&FinalDamage][/c][/td] [td][c][&AccuracyDmgFinal] [/c][/td] [td][c][&FinalExtraDam][/c][/td] [td][c]xx[/c][/td] [/tr] [/t]|   --:PAGE DETAILS| --#activepage|[*C:playerpageid]   --=pageGridSize|[*P:snapping_increment]   --=pageScaleNumber|[*P:scale_number]  --:DISTANCE CALCULATIONS|   --~distToCenter|distance;[*S:t-id];[*T:t-id]     --=sourceW|[*S:t-width] / 70 / [$pageGridSize]   --=targetW|[*T:t-width] / 70 / [$pageGridSize]   -->GetDistModS|[$sourceW]   -->GetDistModT|[$targetW]   --=closestDist|[$distToCenter] - [$distModS] - [$distModT]      --X| end macro   --:PROCEDURES|   --:GetDistModS| source token size, (calculates squares from center to edge)       --=a|[%1%] \ 2       --=b|[%1%] % 2       --?[$b] -eq 0|=b;-1|=b;0       --=distModS|[$a] + [$b]   --<|   --:GetDistModT| target token size, (calculates squares from center to edge)       --=a|[%1%] \ 2       --=b|[%1%] % 2       --?[$b] -eq 0|=b;-1|=b;0       --=distModT|[$a] + [$b]   --&#60| }} Please, I really need help with this as it completely breaks my character sheet and prevents me from updating, fixing or making any kind of changes.
Hello, i'm still looking to find a solution to solve this problem : I want to use a result to use the value in other calcul !power {{ --corners|10 --format|skillatt --tokenid|@{selected|token_id} --target_list|@{target|token_id} --name|Quête --emote|**@{selected|character_name}** donne une quête à @{target|NomPersonnage} --Jet de D : |[[ [$Roll] 1D110]] -- D5 :|[[ 1D5 ]] --?? $Roll.base >= 1 and $Roll.base <= 110 ?? Quête : |Apporter [[ @{D5} ]] boissons de rang 1 --?? $Roll.base >= 1 and $Roll.base <= 110 ?? Gains : |[[ @{D5} * 3]] PA & [[ @{D5} * 3]] Réputation }}
1693037382

Edited 1693037462
Andrew R.
Pro
Sheet Author
Maybe you should ask in the PowerCards thread, and not in the ScriptCards thread?  If you want to re-use the D5 roll you should treat it like you did the 1D100 roll.  This is much easier in ScriptCards, where you just use a Roll Variable.  —D5|[[ [$D5] 1D5 ]]
1693039693

Edited 1693040112
ok i swapped to scriptcards and made this : !script {{ --#corners|10 --#format|skillatt --#title|Quête --=Roll|: 1D110 --+RollResult| : [$Roll.Base] --=D| : 1D5 --+DiceResult| : [$D.Base] --?[$Roll.base] -ge 1 |CriticalHit --?[$Roll.base] -ge 1 and Roll.base -le 110| Quête : Apporter [$D.Base] boissons de rang 1 --?[$Roll.base] -ge 1 and Roll.base -le 110| Gains : [$D.Base] PA & [$D.Base] Réputation }} I can't find how to setup a between value into scriptcards
1693040665

Edited 1693040996
Andrew R.
Pro
Sheet Author
!script {{ --#corners|10 --#format|skillatt --#title|Quête --=Roll|1D110 --=D|1D5 --+RollResult| : [$Roll.Base] --+DiceResult| : [$D.Base] --/|What do you want this to do?  --?[$Roll.Base] -ge 1 |CriticalHit --?[$Roll.Base] -ge 1 -and [$Roll.Base] -le 110|[   --+Quête| : Apporter [$D.Base] boissons de rang 1   --+Gains| : [$D.Base] PA & [$D.Base] Réputation --]| }}
1693041835

Edited 1693041855
Andrew R. said: !script {{ --#corners|10 --#format|skillatt --#title|Quête --=Roll|1D110 --=D|1D5 --+RollResult| : [$Roll.Base] --+DiceResult| : [$D.Base] --/|What do you want this to do?  --?[$Roll.Base] -ge 1 |CriticalHit --?[$Roll.Base] -ge 1 -and [$Roll.Base] -le 110|[   --+Quête| : Apporter [$D.Base] boissons de rang 1   --+Gains| : [$D.Base] PA & [$D.Base] Réputation --]| }} thank you it's solved
Is someone avaible to help me to fix the Scriptcards.js about the default aestetic of the card
I fixed most of points. Can't fixed : the title corner back ground color & the bottom corner
1693579205

Edited 1693593930
Someone able to help me with conditionnal ? they don't show when i use them : !script {{ --=D100|1D100 [D100] ?{script |Alchimiste, --#name|Alchimiste --#emotetext|**@{selected|NomPersonnage}** tente de concocter une potion sur @{target|character_name} --+Test de réussite| : [$D100] --?[$D100.Base] -ge 1|[Potions : [$D20] + [1] [Bonus] + [$Alchimiste] de [1t[Potions-R1-à-R10]] --?[$D100.Base] -ge 61 -and [$D100.Base] -le 80|Potions :  [$D20] + [1] [Bonus] + [$Alchimiste] de [1t[Potions-R1-à-R10]] --?[$D100.Base] -ge 41 -and [$D100.Base] -le 60|Potions :  [$D20] + [1] [Bonus] + [$Alchimiste] de [1t[Potions-R1-à-R10]] --?[$D100.Base] -ge 21 -and [$D100.Base] -le 40|Potions :  [$D20] + [1] [Bonus] + [$Alchimiste] de [1t[Potions-R1-à-R10]] --?[$D100.Base] -ge 1 -and [$D100.Base] -le 20|Potion raté : [0] |X, }}}
1693588022

Edited 1693588791
Andrew R.
Pro
Sheet Author
That looks weird to me. This line  --#name|Alchimiste makes me think you've used something unusual instead of the vertical bar "|" character. Is the Mods (API) console showing errors?  You use a Roll Variable D20 but you don't set it anywhere.  You may have mis-read the ScriptCard wiki on Conditionals. I think you want to display something when the conditional is true, but you aren't doing that. For example,  --?[$D100.Base] -ge 61 -and [$D100.Base] -le 80|Potions :  [$D20] + [1] [Bonus] + [$Alchimiste] de [1t[Potions-R1-à-R10]] should look like this: --?[$D100.Base] -ge 61 -and [$D100.Base] -le 80|+Potions; :  [$D20] + [1] [Bonus] + [$Alchimiste] de [1t[Potions-R1-à-R10]]
1693594424

Edited 1693594843
My code is more than 400 lines so i reduced it that why some things are missing, i added the D20 setup  | is equal to | inside a query. And i'm showing it, i guess you just don't know about query and how it impact the code of powercards & scriptcards. but we can reduce it without query, with less code and try it, it will still doesn't work : !script {{ --=D100|1D100 [D100] --=D20|1D20 [D20] --#name|Alchimiste --+Test de réussite|: [$D100] --?[$D100.Base] -ge 1  |  [Potions : [$D20] --?[$D100.Base] -ge 50-and [$D100.Base] -le 100  |  Potions :  [$D20] }}
1693626195
Andrew R.
Pro
Sheet Author
Does this do what you want? Note that I'm using Code Block after the Conditional to make it clear what I'm doing: --+ commands. Your code was trying to Branch to a Label called "Potions" which does not exist.  !script {{ --=D100|1D100 [D100] --=D20|1D20 [D20] --#name|Alchimiste --+Test de réussite|: [$D100] --?[$D100.Base] -ge 1 |[ --/| Always TRUE so a Conditional is unnecessary   --+Potions| : [$D20] --]| --?[$D100.Base] -ge 50 -and [$D100.Base] -le 100|[   --+Potions| :  [$D20] --]| }}
Thank you it work and y i know -ge 1 no need conditionnal, it was just for testing
1693639581

Edited 1693639739
Still not working in query now ^^' but i fixed it by changing | by  |
Can you help me to implement the same code in the : ?{script} It will become : !script {{ --=D100|1D100 [D100] --=D20|1D20 [D20] ?{script |Alchimiste|Bijoutier --:Alchimiste | --#name|Alchimiste --+Test de réussite|: [$D100] --?[$D100.Base] -ge 1|[   --+Potions| : [$D20] --]| --?[$D100.Base] -ge 50 -and [$D100.Base] -le 100|[   --+Potions| : [$D20] --]| --^Fin | --:Bijoutier | --#name|Bijoutier --+Test de réussite|: [$D100] --?[$D100.Base] -ge 1|[   --+Bijoux| : [$D20] --]| --?[$D100.Base] -ge 50 -and [$D100.Base] -le 100|[   --+Bijoux| : [$D20] --]| --^Fin | --:Fin | } }}
1693664856

Edited 1693664993
Andrew R.
Pro
Sheet Author
I’m going to refactor your code. I’ll post the new version once I’m done.  Code Refactoring
1694236134
Andrew R.
Pro
Sheet Author
Here is your refactored code. I've tested it and it works, though I have no idea what you want to do with it. Note that the ScriptCards code doesn't go inside the roll query at all, saving you all that special coding.  !script {{ --=D100|1D100 [D100] --=D20|1D20 [D20] -->Creator|?{script|Alchimiste|Bijoutier} --X|Exit  --:Creator| --/| [%1%] = Class --?[%1%] -eqi "Alchimiste"|[ --&Class|Alchimiste --&Creation|Potions --]| --?[%1%] -eqi "Bijoutier"|[ --&Class|Bijoutier --&Creation|Bijoux --]| --#title|[&Class] --+Test de réussite|: [$D100] --?[$D100.Base] -ge 1|[   --+[&Creation]| : [$D20] --]| --?[$D100.Base] -ge 50 -and [$D100.Base] -le 100|[ --+[&Creation]| : [$D20] --]| --<|End of Creator }}
thank you, it show me some other possibility than i have done
How to make a simple loop ? --=Loop | 1D6 - 1 Loop start from 0 to [$Loop.Total]     XX     XX     XX Loop end
1694270243
Andrew R.
Pro
Sheet Author
Royii said: How to make a simple loop ? Easy! I use this all the time for monsters that attack multiple times in 13th Age. The body of the loop is usually a subroutine call --> command.  --=Targets|1D6 -1 --%LoopCount|1;[$Targets];1 XXX XXX XXX --%|End of LoopCount
thank you
First of all, amazing API and community. I have a quick question - is there a way to specify table cell padding for the whole table (within the card), without specifying padding for every single <td> (which does work)? [td style="padding:5px"] This works but [/td] [td style="padding:5px"] it's a major pain to have to do it for all tds[/td]
Another question / problem. I'm trying to create scripts that do not require any token to be selected to run. Instead I want to just name a known character, for example Jim. Now I don't think you can do much with just the character name, so I know I need to get the character id for Jim. I know that in 'normal' macro I can use this: @{Jim|character_id} I want to generalise this so I only need to specify the character name, so I tried storing the character id like this: --&char_name|Jim --&char_id|@{ [&char_name] |character_id} This doesn't work - the chat comes back with this error No character was found for '[&char_name]' and if I output char_id it says Jim|character_id. I can't figure out why this doesn't work - best guess is that the string variable assignment doesn't resolve the @{ } the way I want it to. Also tried looking for alternative ways to get the same result - make the script work by only specifying character name instead of requiring a token to be selected.
Hi all, Thank you to Kurt Jaegers for your work on Scriptcards -&gt; Its the best! I learned some of the in's and out's of this API and wrote a ton of templates for various spells and attacks, which play fx, apply healing / damage etc, which I'll be using in my upcoming campaign. I thought it would be nice to share them here in case anyone else might find them useful. The scripts are not heavily commented, but the code is organized into function calls and subroutines with descriptive names, so I believe the code is highly readable and customizable. You can find all of these templates on my github:&nbsp; <a href="https://github.com/TaxableApples/Roll20-Scriptcards" rel="nofollow">https://github.com/TaxableApples/Roll20-Scriptcards</a> Requirements are: Scriptcards, TokenMod and Supernotes. Optional: Create two custom status markers in your campaign with the names 'Advantage' and 'Disadv' in order to allow the script to apply advantage and disadvantage on specific tokens/creatures. See the README.me for further details if you're interested in my long term goals with the project.
So Erudo, my understanding is that things get processed at different phases in Roll20 mods. I believe all the normal chat commands are processed before anything in a mod, so things like @{} and %{} and ?{} all process first which is why ScriptCards has other means to get input cause the ?{} won't be ScrptCards aware. You have different options depending upon your use case. There are meta scripts like SelectManager &nbsp;that you could use to select by name. If you have the ScriptCard on a character sheet for a particular character you can also do something like: --&amp;CharID|@{character_id} Perhaps if you went into more of what your script is trying to do and how and where you want to run it, I could give you a better and more specific example. Erudo said: Another question / problem. I'm trying to create scripts that do not require any token to be selected to run. Instead I want to just name a known character, for example Jim. Now I don't think you can do much with just the character name, so I know I need to get the character id for Jim. I know that in 'normal' macro I can use this: @{Jim|character_id} I want to generalise this so I only need to specify the character name, so I tried storing the character id like this: --&amp;char_name|Jim --&amp;char_id|@{ [&amp;char_name] |character_id} This doesn't work - the chat comes back with this error No character was found for '[&amp;char_name]' and if I output char_id it says Jim|character_id. I can't figure out why this doesn't work - best guess is that the string variable assignment doesn't resolve the @{ } the way I want it to. Also tried looking for alternative ways to get the same result - make the script work by only specifying character name instead of requiring a token to be selected.