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

Colin C. said: Yours does not work because, when you have 3 parameters, Roll20 thinks the second parameter is the pseudonym of the the target. In your case, it thinks you're looking for a target, which you are calling "hp," and looking for an attribute named "max," which does not exist. Thanks for the explanation. Changing it to @{target|target|hp|max} did the trick.
I had a question about the following Magic Missile macro. It works extremely well, but when it applies damage to one token of a particular type it applies the damage to all of the tokens. For example, if I have 3 wolves on the table top, and I attack one, the damage will be applied to all of them. I checked the usual thing a person would check with this problem (checking to make sure the tokens aren't linked) and that's not the problem. I can apply damage to one token using any other method and it won't affect the rest of the tokens, so I'm thinking it's something with the alterbars sections in the macro. I just can't figure it out. Below is the macro I'm using. !scriptcard {{ --#title|Magic Missile --#sourceToken|@{selected|token_id} -->GetAndCheckSlotInformation| --=MissileCount|[$SlotLevel] + 2 -->BuildAndAskTargets|[$MissileCount.Total] --=DisplayCount|1 --=MissileDamage|0 --#leftsub|Slot level [$SlotLevel] --#rightsub|Ranged Attack --#emoteText|@{selected|character_name} uses a level [$SlotLevel.Total] spell slot to fire [$MissileCount.Total] missiles of magical force! --:MissileLoop| -->FireMissile|[$DisplayCount.Total] --=DisplayCount|[$DisplayCount] + 1 --?[$DisplayCount] -le [$MissileCount]|MissileLoop --+Total|Total damage is [$MissileDamage] -->DeductSpellSlot| --#rightsub|Level [$SlotLevel] Left: [$SlotsRemaining] --X| --:FireMissile| --&ThisTarget|[&target[%1%]] --=ThisMissile|1d4 + 1 --=MissileDamage|[$MissileDamage] + [$ThisMissile] --+Missile|[$DisplayCount.Total] Hits [*[&ThisTarget]:character_name] for [$ThisMissile] [b]force[/b] damage -->PlayEffects|@{selected|token_id};[&ThisTarget];none;burst-smoke;beam-magic;Magic Missiles -->ApplyDamageTokenmod|[*[&ThisTarget]:character_id];3;-[$ThisMissile.Total] --<| --:GetAndCheckSlotInformation| --=SlotLevel|?{Spell Slot Level?|1|2|3|4|5|6|7|8|9} --=SlotsTotal|[*S:lvl[$SlotLevel]_slots_total] --=SlotsExpended|[*S:lvl[$SlotLevel]_slots_expended] --?[$SlotsExpended.Total] -ge [$SlotsTotal.Total]|NoSlotsLeft --<| --:NoSlotsLeft| --+|[*S:character_name] has no level [$SlotLevel.Total] spell slots available. --X| --:DeductSpellSlot| --=SlotsExpended|[$SlotsExpended] + 1 --@setattr|_charid [*S:character_id] _lvl[$SlotLevel]_slots_expended|[$SlotsExpended] _silent --=SlotsRemaining|[$SlotsTotal] - [$SlotsExpended] --<| --:PlayEffects|Parameters are : sourcetoken; targettoken; source effect; target effect; line effect; sound effect --vtoken|[%1%] [%3%] --vtoken|[%2%] [%4%] --vbetweentokens|[%1%] [%2%] [%5%] --@roll20AM|_audio,play,nomenu|[%6%] --<| --:ApplyDamageTokenmod|Parameters are tokenid;bar#;amount --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%] --<| --:ApplyDamageAlterbars| --@alter|_target|[%1%] _bar|[%2%] _amount|[%3%] --<| --:BuildAndAskTargets| --&TargetString| --=targetCount|1 --:TargetLoop| --&TargetString|+t;target[$targetCount.Total];Missile [$targetCount.Total] Target --=targetCount|[$targetCount.Total] + 1 --?[$targetCount.Total] -le [%1%]|>AddSeparator --?[$targetCount.Total] -le [%1%]|TargetLoop --iPlease click the button below to select magic missile targets. The same target can be selected multiple times;Select [%1%] Targets|[&TargetString] --/| --<| --:AddSeparator| --&TargetString|+|| --<| }}
DM Goss said: -->ApplyDamageTokenmod| [*[&ThisTarget]:character_id] ;3;-[$ThisMissile.Total] --:ApplyDamageTokenmod|Parameters are tokenid ;bar#;amount --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%] --<| I believe that is your culprit. When you're calling Token-Mod, you're apply damage to the character, not the token, because the parameter you're passing is a character id. The sample script that Kurt wrote from the wiki has these lines: -->ApplyDamageTokenmod|@{target|token_id};3;-[$MissileDamage] --:ApplyDamageTokenmod|Parameters are tokenid;bar#;amount --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%] You will probably need to rework your script some, though, so that when you call targets, you also get the token_id so that you can pass that. Something like -->ApplyDamageTokenmod|@{target|[%1%]|token_id};3;-[$MissileDamage] I think that will work?
1614794191

Edited 1614795588
I'm trying to figure out what my options are for the [button]description:: action [/button].  Specifically, what kind of Actions can I perform and what syntax is it expecting?    For example: Run a Character Sheet macro (Display a trait like Rage or perform a Skill Check or Attack) Run a Campaign Macro (I think the syntax is:  !
#MyMacro.  So [button]MyMacro:: !&#13#MyMacro [/button] would run a macro named MyMacro. Open a website Run an API Script /w parameters Popup a message box Query for user response and assign the result to a variable Roll dice and assign the result to a variable Is there a reference somewhere that I've totally missed that lists the syntax for doing these in-line with scriptcard?  
Will M. said: I'm trying to figure out what my options are for the [button]description:: action [/button].  Specifically, what kind of Actions can I perform and what syntax is it expecting?    For example: Run a Character Sheet macro (Display a trait like Rage or perform a Skill Check or Attack) Run a Campaign Macro (I think the syntax is:  !
#MacroName.  So [button]Run Macro::! #MyMacro[/button]  would run a macro named MyMacro. Open a website Run an API Script /w parameters Popup a message box Query for user response and assign the result to a variable Roll dice and assign the result to a variable Is there a reference somewhere that I've totally missed that lists the syntax for doing these in-line with scriptcard?   I don't think you've missed anything. I too would appreciate more clarity on what we can do from within a button. So far I've restricted myself to calling macros from specific character sheets, like so: [button]Drink/Pour::~Healing Macros|PotionHealing[/button]
1614816059
Kurt J.
Pro
API Scripter
Because the button formatting text is just a wrapper around the normal Roll20 Chat Buttons, the follow the same rules as this page:  Chat Menus - Roll20 Wiki It *is* possible to build an entire ScriptCards script inside a string and put it into a button (that is what the "--i" command does, but that can get complex :)
1614817561

Edited 1614818172
Hey all, First of all I have a very geeky programmer who you have made very happy! I am looking for a bit of help on using custom FX So we have the below script for a goblin shooting a bow: !script  {{     +++5E Tools+++     --#title|Fire Shortbow     --#leftsub|Ranged Attack     --#rightsub|Range 80/360ft     --#sourceToken|@{selected|token_id}     --#targetToken|@{target|token_id}     --#emoteText|@{selected|token_name} attacks @{target|token_name}     --=TargetAC|@{target|npc_ac}     --?[$TargetAC.Total] -gt 0|DoneWithAC     --=TargetAC|@{target|ac}     --:DoneWithAC|     -->Lib5E_CheckDamageModifiers|ResistType;piercing     --=AttackRoll|?{Advantage|Normal,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1} + @{selected|dexterity_mod} [DEX] + @{selected|pb} [PROF]     --+Attack|@{selected|token_name} rolls [$AttackRoll].     --?[$AttackRoll.Base] -eq 20|Crit     --?[$AttackRoll.Base] -eq 1|Fumble     --?[$AttackRoll.Total] -ge [$TargetAC.Total]|Hit     --+Miss|The attack missed.     --^Final|     --:Fumble|     --+Fumble!|The attack went horribly wrong.     --^Final|     --:Hit|     --=Damage|1d6 + @{selected|dexterity_mod} [&ResistType]     --+Hit!|The attack hit @{target|token_name} for [$Damage] piercing damage.     --vbetweentokens|@{target|token_id} @{selected|token_id} Arrow      --@roll20AM|_audio,play,nomenu|Shortbow Arrow Hits Chainmail by Jean-Baptiste     --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage]     --^Final|     --:Crit|     --=Damage|2d6 + @{selected|dexterity_mod} [&ResistType]     --+Critical Hit!|The attack hit @{target|token_name} for [$Damage] slashing damage.     --vbetweentokens|@{target|token_id} @{selected|token_id}Arrow     --@roll20AM|_audio,play,nomenu|Shortsword Strikes Wood Shield by Stuart Duffield     --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage]     --:Final|     --X| }} The issue we are seeing is with the line in bold, its not calling my custom FX called arrow (we have a melee attack with a basic splatter-blood thats working as intended). e.g. we get the fire nova instead I am sure this is a simple syntax error, any help/guidance would be much appreciated! once again thank you for this incredible addon! (I am going to be running a game with 12 players so the more automation the better!)
1614818997
Kurt J.
Pro
API Scripter
callum g. said: Hey all, First of all I have a very geeky programmer who you have made very happy! I am looking for a bit of help on using custom FX So we have the below script for a goblin shooting a bow: !script  {{     +++5E Tools+++     --#title|Fire Shortbow     --#leftsub|Ranged Attack     --#rightsub|Range 80/360ft     --#sourceToken|@{selected|token_id}     --#targetToken|@{target|token_id}     --#emoteText|@{selected|token_name} attacks @{target|token_name}     --=TargetAC|@{target|npc_ac}     --?[$TargetAC.Total] -gt 0|DoneWithAC     --=TargetAC|@{target|ac}     --:DoneWithAC|     -->Lib5E_CheckDamageModifiers|ResistType;piercing     --=AttackRoll|?{Advantage|Normal,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1} + @{selected|dexterity_mod} [DEX] + @{selected|pb} [PROF]     --+Attack|@{selected|token_name} rolls [$AttackRoll].     --?[$AttackRoll.Base] -eq 20|Crit     --?[$AttackRoll.Base] -eq 1|Fumble     --?[$AttackRoll.Total] -ge [$TargetAC.Total]|Hit     --+Miss|The attack missed.     --^Final|     --:Fumble|     --+Fumble!|The attack went horribly wrong.     --^Final|     --:Hit|     --=Damage|1d6 + @{selected|dexterity_mod} [&ResistType]     --+Hit!|The attack hit @{target|token_name} for [$Damage] piercing damage.     --vbetweentokens|@{target|token_id} @{selected|token_id} Arrow      --@roll20AM|_audio,play,nomenu|Shortbow Arrow Hits Chainmail by Jean-Baptiste     --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage]     --^Final|     --:Crit|     --=Damage|2d6 + @{selected|dexterity_mod} [&ResistType]     --+Critical Hit!|The attack hit @{target|token_name} for [$Damage] slashing damage.     --vbetweentokens|@{target|token_id} @{selected|token_id}Arrow     --@roll20AM|_audio,play,nomenu|Shortsword Strikes Wood Shield by Stuart Duffield     --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage]     --:Final|     --X| }} The issue we are seeing is with the line in bold, its not calling my custom FX called arrow (we have a melee attack with a basic splatter-blood thats working as intended). e.g. we get the fire nova instead I am sure this is a simple syntax error, any help/guidance would be much appreciated! once again thank you for this incredible addon! (I am going to be running a game with 12 players so the more automation the better!) Currently, custom vfx aren't supported, but it is coming :) I had support for them in PowerCards so I just need to revisit that code and bring it forward.
Kurt J. said: callum g. said: Hey all, First of all I have a very geeky programmer who you have made very happy! I am looking for a bit of help on using custom FX So we have the below script for a goblin shooting a bow: !script  {{     +++5E Tools+++     --#title|Fire Shortbow     --#leftsub|Ranged Attack     --#rightsub|Range 80/360ft     --#sourceToken|@{selected|token_id}     --#targetToken|@{target|token_id}     --#emoteText|@{selected|token_name} attacks @{target|token_name}     --=TargetAC|@{target|npc_ac}     --?[$TargetAC.Total] -gt 0|DoneWithAC     --=TargetAC|@{target|ac}     --:DoneWithAC|     -->Lib5E_CheckDamageModifiers|ResistType;piercing     --=AttackRoll|?{Advantage|Normal,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1} + @{selected|dexterity_mod} [DEX] + @{selected|pb} [PROF]     --+Attack|@{selected|token_name} rolls [$AttackRoll].     --?[$AttackRoll.Base] -eq 20|Crit     --?[$AttackRoll.Base] -eq 1|Fumble     --?[$AttackRoll.Total] -ge [$TargetAC.Total]|Hit     --+Miss|The attack missed.     --^Final|     --:Fumble|     --+Fumble!|The attack went horribly wrong.     --^Final|     --:Hit|     --=Damage|1d6 + @{selected|dexterity_mod} [&ResistType]     --+Hit!|The attack hit @{target|token_name} for [$Damage] piercing damage.     --vbetweentokens|@{target|token_id} @{selected|token_id} Arrow      --@roll20AM|_audio,play,nomenu|Shortbow Arrow Hits Chainmail by Jean-Baptiste     --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage]     --^Final|     --:Crit|     --=Damage|2d6 + @{selected|dexterity_mod} [&ResistType]     --+Critical Hit!|The attack hit @{target|token_name} for [$Damage] slashing damage.     --vbetweentokens|@{target|token_id} @{selected|token_id}Arrow     --@roll20AM|_audio,play,nomenu|Shortsword Strikes Wood Shield by Stuart Duffield     --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage]     --:Final|     --X| }} The issue we are seeing is with the line in bold, its not calling my custom FX called arrow (we have a melee attack with a basic splatter-blood thats working as intended). e.g. we get the fire nova instead I am sure this is a simple syntax error, any help/guidance would be much appreciated! once again thank you for this incredible addon! (I am going to be running a game with 12 players so the more automation the better!) Currently, custom vfx aren't supported, but it is coming :) I had support for them in PowerCards so I just need to revisit that code and bring it forward. Much appreciated thank you!
1614901484
Andrew R.
Pro
Sheet Author
I’m now experimenting with ScriptCards for my 13th Age Glorantha monsters. Once I get the D20 automations to work I’ll look at customizing the colors etc., 
1615033419

Edited 1615147367
Kurt J.
Pro
API Scripter
ScriptCards version 1.0.8, 5E Tools Library version 0.0.6 Version 1.0.8 of ScriptCards is now up on the development GIST . I know this version is about a week later than I had hoped, but I ran into a problem with one of my updates that I had to back out because it was breaking existing scripts. Bug Fix : Tweaked the regex that is used to replace underscores in API lines (--@) with double-dashes. This should prevent the -_ sequence from being converted to ---. Additional Formatting Markup : You can now use [t], [/t], [tr], [/tr], [td], and [/td] to create tables inside a --+ direct output line. The [t], [tr], and [td] will use anything included with them as options on the table (so [t width=100%] would be converted to <table width=100%>, etc.) Tables should not span output lines, and keep in mind that formatting can get very weird if you don’t properly close table tags. Enhanced Behavior : Custom VFX are now supported. Custom VFX names are case sensitive , so if you just see a burst-fire effect when trying to use a custom effect, that is probably why. Behavior Change : Library text was being imported by jamming all of the lines together without spaces. This has been changed in the library import routine to space them out with at least a space. Should not impact existing scripts/libraries. Library Update : The “5E Tools” Library in the Wiki has been updated to version 0.0.6, which includes new options for displaying mini 5E character sheets. These can be called using a procedure branch statement: -->Lib5E_Character_Summary|@{selected|character_id} For example. The Lib5E_Character_Summary procedure works for both PCs and NPCs and will output available attacks/actions very similar to the way the various specialized tags in PowerCards work. This means that a script like this: !script {{    +++5E Tools+++     --#title|@{selected|token_name}    -->Lib5E_Character_Summary|@{selected|character_id} }} Will produce output like this:  or, for a PC  Similar treatments for spell lists will be up next for the 5E Tools library. Behavior Change : When using the [*S:], [*T:] and [*-id:] reference syntax, only character attributes were being checked. It is now possible to reference the following token attributes (note the T- prefix) t-name t-id t-statusmarkers t-bar1_value t-bar1_max t-bar2_value t-bar2_max t-bar3_value t-bar3_max t-top t-left t-width t-height t-rotation t-layer t-aura1_radius t-aura1_color t-aura2_radius t-aura2_color t-aura1_square t-aura2_square t-tint_color t-ligt_radius t-light_dimradius t-light_angle t-light_losangle t-light_multiplier t-light_otherplayers t-light_hassight t-flipv t-fliph t-controlledby t-_cardid t-_pageid t-imgsrc t-bar1_link t-bar2_link t-bar3_link t-represents t-layer t-isdrawing t-name t-gmnotes t-showname t-showplayers_name t-showplayers_bar1 t-showplayers_bar2 t-showplayers_bar3 t-showplayers_aura1 t-showplayers_aura2 t-playersedit_name t-playersedit_bar1 t-playersedit_bar2 t-playersedit_bar3 t-playersedit_aura1 t-playersedit_aura2 t-lastmove t-adv_fow_view_distance
Super-cool, Kurt! I'm looking forward to playing around with tables, in particular. 
Hi guys, I have an issue that shouldn't be difficult to debug for API gods like you ^^ I got insppired by the way you check slots in your magicmissile scriptcard to handle Ammo. My PC sheet has a repeating section called " Armement " (weaponry in french ^^) In this section weapon has a name ( aname ), bonus to hit ( abonus ), current Ammo ( acharg ) and max Ammo ( achargmax ). When a PC fires a gun, I ask for his RoF ( Cadence in french) : 1 bullet for single shot, 3 for short burst, Full to empty ammo. I can easily get the values from the repeating section to manipulate them but I must be doing something wrong when I try to update the values with the remaining. It proceeds ok in the scriptcard (it deducts the right amount of bullets) but it does not update the values themselves on the sheet ! You'll find below the subroutines that I use :     --:GetAndCheckMun|   --Rfind|@{selected|character_id};Pistolet-Mitrailleur1;repeating_armement;aname   --=ABonus|[*R:abonus]   --=Charg|[*R:achargmax]   --=Mun|[*R:acharg]   --=Cadence|?{Cadence de tir?|1, 1|Rafale courte, 3|Chargeur, [$Mun]}   --?[$Mun] -eq 0|NoMunLeft   --<|   --:NoMunLeft|   --+|[*S:character_name] n'a plus de munitions.   --X|   --:DeduireMun|   --Rfind|@{selected|character_id};Pistolet-Mitrailleur1;repeating_armement;aname   --=Mun|[*R:acharg] - [$Cadence]   --@setattr|_charid [*S:character_id] _[*R:acharg]|[$Mun] _silent   --<|    Thanks in advance for your help !
Having some trouble with --@token-mod. I can use !token-mod --set aura1_radius|20 successfuly, however in a !script, the following fails. --@token-mod|_ignore-selected _ids @{selected|token_id} _set aura1_radius|30 The syntax is taken directly from the magic missile script on the api page, hence the _ignore-selected. Any idea what could be causing this to not affect the aura radius?
1615059244
David M.
Pro
API Scripter
Jake, that code works for me. Are you getting an error message, or is it just not firing? I thought it might be just that "players can use --ids" was unchecked, but I toggled mine and it worked both ways. Also, this: !scriptcards {{    --@token-mod|_ignore-selected _ids @{selected|token_id} _set aura1_radius|30 }} is basically the same as this: !scriptcards {{    --@token-mod|_set aura1_radius|30 }} I'm assuming you were just trying to troubleshoot the syntax? It might help if you post your full scriptcard. Is it possible that the line with the token-mod call is never being reached due to branching or early termination?
1615059722

Edited 1615060462
David M. said: Jake, that code works for me. Are you getting an error message, or is it just not firing? I thought it might be just that "players can use --ids" was unchecked, but I toggled mine and it worked both ways. Also, this: !scriptcards {{    --@token-mod|_ignore-selected _ids @{selected|token_id} _set aura1_radius|30 }} is basically the same as this: !scriptcards {{    --@token-mod|_set aura1_radius|30 }} I'm assuming you were just trying to troubleshoot the syntax? It might help if you post your full scriptcard. Is it possible that the line with the token-mod call is never being reached due to branching or early termination? Doesn't seem to work for me, both ways, but given it works for you it's clear the syntax is fine and it's something else. The full code is: !script {{ +++5E Tools+++ --#title|Detect Magic --#leftsub|Range: 30ft --#rightsub|Duration: Concentration, up to 10 minutes --#sourceToken|@{selected|token_id} --#emoteText|@{selected|token_name} tunes in to nearby magic. --=SlotsTotal|[*S:lvl1_slots_total] --=SlotsExpended|[*S:lvl1_slots_expended] --?[$SlotsExpended] -ge [$SlotsTotal]|NoSlots --+|You sense the presence of magic in the range. --+|If magic is detected this way, you can use your action to see a faint aura around any visible creature or objectin the area that bears magic, and you learn the school of magic. --+|The spell can penetrate most barriers, but is blocked by 1 foot of stone, 1 inch of common metal, a thin sheet of lead, or 3 feet of wood or dirt. --@token-mod|_set aura1_radius|30 --=SlotsExpended|[$SlotsExpended] + 1 --@setattr|_charid [*S:character_id] _lvl1_slots_expended|[$SlotsExpended] _silent -->Final| --:NoSlots| --+|No level [&Level] slots left to cast this spell! -->Final| --:Final| --X| }} Everything else is outputted fine, no errors that I can see, the only thing not working is the --@token-mod line. Above has the line changed to the one you mentioned, but neither work. Output is shown below "Error: No attribute or sheet field found for character_id -MV2jxRq3-TT3CFhdP7s named token_id" Unclear, maybe I need to pass character_id instead of token_id?
1615059884

Edited 1615059911
David M.
Pro
API Scripter
Mangouste, I don't really have experience with repeating sections, but are you sure that your "DeduireMun" function is being called? Try either adding a debug output line like --+test| or maybe even outputting the text of your setattr call, like this:  --+setattr|_charid [*S:character_id] _[*R:acharg]|[$Mun] _silent ...then try to run setattr from chat or regular macro using the output text that scriptcards would be using. Finally, I don't think you need to use [$Mun.Total], but it might be worth trying that as well. 
I'm having trouble referencing the new token attributes--every one I have tested so far has come back as undefined. This happens when I try to store/retrieve &string variables as well. Any ideas why the below isn't working? !scriptcard {{ --#sourceToken|@{selected|token_id} --#targetToken|@{target|Evaluate|token_id} --=TokenValue|[*T:t-bar1_value] --+print|[$TokenValue] }}
1615068330
David M.
Pro
API Scripter
Glenn, I see the same thing. Looks like it works for the selected token but not Target? --=TokenValue|[*S:t-bar1_value]
Thanks @David M. I also got *S to work, so it looks the issue is *T specific. Also @Kurt there is a typo with "t-showpalyers_name" that I see at line 108 in the code, as well as in the announcement. Similarly, there is an extraneous "t-bar2_max" where the bar3_max should go.
Anyone have a good way to handle aoe spells like thunderwave? Want to roll the save and damage for each creature in the 15ft cube. Is it possible to select multiple targets?
1615071133
Kurt J.
Pro
API Scripter
Glenn said: Thanks @David M. I also got *S to work, so it looks the issue is *T specific. Also @Kurt there is a typo with "t-showpalyers_name" that I see at line 108 in the code, as well as in the announcement. Similarly, there is an extraneous "t-bar2_max" where the bar3_max should go. Sorry about that :) I just uploaded an update (1.0.9) that corrects both of these issues. I added the "t-" prefix late in the game and it looks like I didn't update the code for the T section. So: ScriptCards version 1.0.9 Bug Fix:  Referencing token values on the T token should now work properly. Bug Fix: Corrected "t-showpalyers_name' to "t-showplayers_name" and the duplicated "t-bar2_max" to "t-bar3_max". Thanks Glenn and David for finding these issues.
1615071394
Kurt J.
Pro
API Scripter
David M. said: Mangouste, I don't really have experience with repeating sections, but are you sure that your "DeduireMun" function is being called? Try either adding a debug output line like --+test| or maybe even outputting the text of your setattr call, like this:  --+setattr|_charid [*S:character_id] _[*R:acharg]|[$Mun] _silent ...then try to run setattr from chat or regular macro using the output text that scriptcards would be using. Finally, I don't think you need to use [$Mun.Total], but it might be worth trying that as well.  Mangouste - I believe David is correct here. The script never makes a call to the DeduireMun procedure - I believe the following changes should let your script function:   --:GetAndCheckMun|   --Rfind|@{selected|character_id};Pistolet-Mitrailleur1;repeating_armement;aname   --=ABonus|[*R:abonus]   --=Charg|[*R:achargmax]   --=Mun|[*R:acharg]   --=Cadence|?{Cadence de tir?|1, 1|Rafale courte, 3|Chargeur, [$Mun]}   --?[$Mun] -eq 0|NoMunLeft|DeduireMun   --X|   --:NoMunLeft|   --+|[*S:character_name] n'a plus de munitions.   --X|   --:DeduireMun|   --Rfind|@{selected|character_id};Pistolet-Mitrailleur1;repeating_armement;aname   --=Mun|[*R:acharg] - [$Cadence]   --@setattr|_charid [*S:character_id] _[*R:acharg]|[$Mun] _silent   --X| I marked the changed lines in bold. Essentially, the conditional tests $Mun equal to 0 and still goes to NoMunLeft if that is true, but now goes to DeduireMun if $mun is NOT 0. I replaced the returns (--<|) with exits (--X|) since the routines aren't being called as procedures..
1615071584
Kurt J.
Pro
API Scripter
Jake R said: Doesn't seem to work for me, both ways, but given it works for you it's clear the syntax is fine and it's something else. The full code is: !script {{ +++5E Tools+++ --#title|Detect Magic --#leftsub|Range: 30ft --#rightsub|Duration: Concentration, up to 10 minutes --#sourceToken|@{selected|token_id} --#emoteText|@{selected|token_name} tunes in to nearby magic. --=SlotsTotal|[*S:lvl1_slots_total] --=SlotsExpended|[*S:lvl1_slots_expended] --?[$SlotsExpended] -ge [$SlotsTotal]|NoSlots --+|You sense the presence of magic in the range. --+|If magic is detected this way, you can use your action to see a faint aura around any visible creature or objectin the area that bears magic, and you learn the school of magic. --+|The spell can penetrate most barriers, but is blocked by 1 foot of stone, 1 inch of common metal, a thin sheet of lead, or 3 feet of wood or dirt. --@token-mod|_set aura1_radius|30 --=SlotsExpended|[$SlotsExpended] + 1 --@setattr|_charid [*S:character_id] _lvl1_slots_expended|[$SlotsExpended] _silent -->Final| --:NoSlots| --+|No level [&Level] slots left to cast this spell! -->Final| --:Final| --X| }} Everything else is outputted fine, no errors that I can see, the only thing not working is the --@token-mod line. Above has the line changed to the one you mentioned, but neither work. Output is shown below "Error: No attribute or sheet field found for character_id -MV2jxRq3-TT3CFhdP7s named token_id" Unclear, maybe I need to pass character_id instead of token_id? Jake- Copying your script and pasting directly into my game works, with now console log output as indicated above. The aura gets set properly on the token I have selected when I run it.
Kurt J. said: Jake R said: Doesn't seem to work for me, both ways, but given it works for you it's clear the syntax is fine and it's something else. The full code is: !script {{ +++5E Tools+++ --#title|Detect Magic --#leftsub|Range: 30ft --#rightsub|Duration: Concentration, up to 10 minutes --#sourceToken|@{selected|token_id} --#emoteText|@{selected|token_name} tunes in to nearby magic. --=SlotsTotal|[*S:lvl1_slots_total] --=SlotsExpended|[*S:lvl1_slots_expended] --?[$SlotsExpended] -ge [$SlotsTotal]|NoSlots --+|You sense the presence of magic in the range. --+|If magic is detected this way, you can use your action to see a faint aura around any visible creature or objectin the area that bears magic, and you learn the school of magic. --+|The spell can penetrate most barriers, but is blocked by 1 foot of stone, 1 inch of common metal, a thin sheet of lead, or 3 feet of wood or dirt. --@token-mod|_set aura1_radius|30 --=SlotsExpended|[$SlotsExpended] + 1 --@setattr|_charid [*S:character_id] _lvl1_slots_expended|[$SlotsExpended] _silent -->Final| --:NoSlots| --+|No level [&Level] slots left to cast this spell! -->Final| --:Final| --X| }} Everything else is outputted fine, no errors that I can see, the only thing not working is the --@token-mod line. Above has the line changed to the one you mentioned, but neither work. Output is shown below "Error: No attribute or sheet field found for character_id -MV2jxRq3-TT3CFhdP7s named token_id" Unclear, maybe I need to pass character_id instead of token_id? Jake- Copying your script and pasting directly into my game works, with now console log output as indicated above. The aura gets set properly on the token I have selected when I run it. Clearly something on my end then, will investigate further, thank you for checking!
1615077627
David M.
Pro
API Scripter
Kurt J. said: I marked the changed lines in bold. Essentially, the conditional tests $Mun equal to 0 and still goes to NoMunLeft if that is true, but now goes to DeduireMun if $mun is NOT 0. I replaced the returns (--<|) with exits (--X|) since the routines aren't being called as procedures.. Since Mangouste only posted their subprocedures, the returns may still be appropriate in the context of the whole scriptcard, but I think your conditional should do the trick though, Kurt!
My Bad, I should have pasted the whole script ! @David, yes i am sure that the DeduireMun subroutine is being called because it displays the correct amout of bullets remaining ! @Kurt, I modified my script including your conditional but it essentially does the same that what i did (as I was running through DeduireMun anyway earlier -- I removed it now !) The issue seems to be with the setattr not being properly executed ! !scriptcard  {{   --#title|Pistolet-Mitrailleur1   --#leftsub|Armes humaines   --#sourceToken|@{selected|token_id}   --#targetToken|@{target|token_id}   -->GetAndCheckMun|   --Rfind|[*S:character_id];Pistolet-Mitrailleur1;repeating_armement;aname      --=Atk|?{Score|0} [SCORE] + [*S:ArmesHumainesPJ_Bonus] [SPE] + [$ABonus] [ACQUIS] + ?{Bonus-Malus|0} [BONUS]     --=Dbl|@{Target|DefCorpsTotalPJ}*2    --=Tpl|@{Target|DefCorpsTotalPJ}*3   --#emoteText|[*S:character_name] attaque [*T:character_name]   --Rfind|[*T:character_id];Bouclier;repeating_protection;ptype   --=Def|[*T:corps] [CORPS] + [*T:totaldef_corps] [DEFENSE]+ [*R:pcorps] [COUVERT]    --+Résultat|[Att] : [$Atk] vs [$Def] : [Def]   --#rightsub|munitions : [$Mun] / [$Charg]      --?[$Atk] -gt [$Tpl]|BM   --?[$Atk] -gt [$Dbl] -and [$Atk] -le [$Tpl.Total]|BG   --?[$Atk] -gt [$Def] -and [$Atk] -le [$Dbl]|BL   --?[$Atk] -ge 0 -and [$Atk] -le [$Def]|Echec   --?[$Atk] -lt 0|Fumble     --:BM|   -->PlayEffects|none;bubbling-blood;none;Flingue   -->ApplyDamageAlterbars|@{target|token_id};3;-6   --+Blessure|[*T:character_name] subit une Blessure mortelle    --^Final|      --:BG|   -->PlayEffects|none;bubbling-blood;none;Flingue   -->ApplyDamageAlterbars|@{target|token_id};3;-4   --+Blessure|[*T:character_name] subit une Blessure grave    --^Final|      --:BL|   -->PlayEffects|none;bubbling-blood;splatter-blood;Flingue   -->ApplyDamageAlterbars|@{target|token_id};3;-2   --+Blessure|[*T:character_name] subit une Blessure légère    --^Final|      --:Echec|    -->PlayEffects|none;none;none;Flingue   --+Echec|L'attaque échoue.   --^Final|   --:Fumble|   --+Fumble|L'arme s'enraye et ne peux plus être utilisée du combat!   --^Final|   --:PlayEffects|Parameters are : source effect; target effect; line effect; sound effect   --vtoken|@{selected|token_id} [%1%]   --vtoken|@{target|token_id} [%2%]   --vbetweentokens|@{selected|token_id} @{target|token_id} [%3%]   --@roll20AM|_audio,play,nomenu|[%4%]   --<|   --:ApplyDamageAlterbars|   --@alter|_target|[%1%] _bar|[%2%] _amount|[%3%]   --<|      --:GetAndCheckMun|   --Rfind|@{selected|character_id};Pistolet-Mitrailleur1;repeating_armement;aname   --=ABonus|[*R:abonus]   --=Charg|[*R:achargmax]   --=Mun|[*R:acharg]   --=Cadence|?{Cadence de tir?|1, 1|Rafale courte, 3|Chargeur, [$Mun]}   --?[$Mun] -eq 0|NoMunLeft|DeduireMun   --<|   --:NoMunLeft|   --+|[*S:character_name] n'a plus de munitions.   --X|   --:DeduireMun|   --Rfind|@{selected|character_id};Pistolet-Mitrailleur1;repeating_armement;aname   --=Mun|[*R:acharg] - [$Cadence]   --@setattr|_charid [*S:character_id] _[*R:acharg]|[$Mun] _silent   --<|      --:Final| }}    
1615115214
David M.
Pro
API Scripter
Ok, Mangouste, thx. For troubleshooting purposes, what do you get as output if you temporarily change the setattr call to this?    --+setattr|_charid [*S:character_id] _[*R:acharg]|[$Mun] _silent After running your card, if you copy that line's output into a simple macro (after replacing the underscores with "--" and adding a "!" in front), does the setattr command work?
David M. said: Ok, Mangouste, thx. For troubleshooting purposes, what do you get as output if you temporarily change the setattr call to this?    --+setattr|_charid [*S:character_id] _[*R:acharg]|[$Mun] _silent After running your card, if you copy that line's output into a simple macro (after replacing the underscores with "--" and adding a "!" in front), does the setattr command work? The output was : so I typed : !setattr --charid -ML7Aqesi55FusRR4FmX --18|17 --silent  and it didn't do anything ! But looking at it it's normal....That 18 should be the name of the attribute to set NOT its value !! Wot did I do wrong ?
Good morning, everyone. I'm attempting to set up a Saving Throw script card but I'm running into some specific issues. Hopefully someone who knows a lot more about this can help. Issue 1) I would like add the the Global Save Mod Name dynamically but can't figure out how to call it Issue 2) I can't seem to get the Global Save Mod to roll a value unless it is the second entry in the global save field (For example, if I add a 1d4 bless it won't roll the 1d4. However, if I add a blank entry with a value of zero and then add Bless [with the same value as I attempted in the first row] it works fine. Issue 3) If a character had multiple save modifiers how to call just specific ones? Example: a cloak of protection that is always on and a racial bonus to saving throws against magic? I'm assuming there is a way to call specific rows and names within the Global Save Mod field but I don't know how to locate the sheets section prefix. I've included a simple script that I've been using to test !scriptcard  {{ --#sourceToken|@{selected|token_id} --#emoteText|[*S:character_name] must save! --=GlobalSave|[*S:global_save_mod] --&SaveModName| HOW DO I CALL JUST THE NAME? --+Your Save Attempt:|Total = [$GlobalSave] [&SaveModName] }} Thanks in advance! Have a great day.
1615145632
David M.
Pro
API Scripter
Mangouste, can you just replace [*R:acharg] with the hardcoded name of the attribute, or does it need to be dynamic?
1615146067
Kurt J.
Pro
API Scripter
Mangouste said: David M. said: Ok, Mangouste, thx. For troubleshooting purposes, what do you get as output if you temporarily change the setattr call to this?    --+setattr|_charid [*S:character_id] _[*R:acharg]|[$Mun] _silent After running your card, if you copy that line's output into a simple macro (after replacing the underscores with "--" and adding a "!" in front), does the setattr command work? The output was : so I typed : !setattr --charid -ML7Aqesi55FusRR4FmX --18|17 --silent  and it didn't do anything ! But looking at it it's normal....That 18 should be the name of the attribute to set NOT its value !! Wot did I do wrong ? [*R:acharg] gives you the value of the attribute, while [*R>acgarg] gives you the name of the attribute. That might be what you are looking for.
1615146497
Kurt J.
Pro
API Scripter
Elegant Wookie said: Good morning, everyone. I'm attempting to set up a Saving Throw script card but I'm running into some specific issues. Hopefully someone who knows a lot more about this can help. Issue 1) I would like add the the Global Save Mod Name dynamically but can't figure out how to call it Issue 2) I can't seem to get the Global Save Mod to roll a value unless it is the second entry in the global save field (For example, if I add a 1d4 bless it won't roll the 1d4. However, if I add a blank entry with a value of zero and then add Bless [with the same value as I attempted in the first row] it works fine. Issue 3) If a character had multiple save modifiers how to call just specific ones? Example: a cloak of protection that is always on and a racial bonus to saving throws against magic? I'm assuming there is a way to call specific rows and names within the Global Save Mod field but I don't know how to locate the sheets section prefix. I've included a simple script that I've been using to test !scriptcard  {{ --#sourceToken|@{selected|token_id} --#emoteText|[*S:character_name] must save! --=GlobalSave|[*S:global_save_mod] --&SaveModName| HOW DO I CALL JUST THE NAME? --+Your Save Attempt:|Total = [$GlobalSave] [&SaveModName] }} Thanks in advance! Have a great day. Dealing with repeating sections is always challenging. If you use the 5E Tools library ( see the wiki ) there is a procedure you can call called "Lib5E_Active_Save_Modifiers" that will return a string that you can append to the saving throw with any global save modifiers that are active (checked) for the chartacter. You just need to pass it a character ID and a variable name that will be set to the result. -->Lib5E_Active_Save_Modifiers|@{selected|character_id};SaveModifiers You can then use this string in an assignment line: --=SaveRoll|1d20 [Base] + @{selected|constitution_mod} [CON] [&SaveModifiers] If there are no active save modifiers, the string will be empty and won't impact the roll. If there are active save modifiers, it will contain each one's roll with a description (for example, "+ 1d4 [Bless] + 2 [Cloak]"). If you don't want to use the library, you will need to do something similar to what it does, going through each of the repeating save modifier rows and filtering out inactive rows to create a final result.
1615147448
Kurt J.
Pro
API Scripter
I edited the list of token properties above. t-token_id should just be "t-id". Similarly, "t-tokenname" is just "t-name". These reflect the internal object properties associated with graphic objects in the API.
Thank you, Kurt. As always I appreciate the assistance. I'll dive into the code in a bit and hopefully figure it out. Have a good one. Kurt J. said: Elegant Wookie said: Good morning, everyone. I'm attempting to set up a Saving Throw script card but I'm running into some specific issues. Hopefully someone who knows a lot more about this can help. Issue 1) I would like add the the Global Save Mod Name dynamically but can't figure out how to call it Issue 2) I can't seem to get the Global Save Mod to roll a value unless it is the second entry in the global save field (For example, if I add a 1d4 bless it won't roll the 1d4. However, if I add a blank entry with a value of zero and then add Bless [with the same value as I attempted in the first row] it works fine. Issue 3) If a character had multiple save modifiers how to call just specific ones? Example: a cloak of protection that is always on and a racial bonus to saving throws against magic? I'm assuming there is a way to call specific rows and names within the Global Save Mod field but I don't know how to locate the sheets section prefix. I've included a simple script that I've been using to test !scriptcard  {{ --#sourceToken|@{selected|token_id} --#emoteText|[*S:character_name] must save! --=GlobalSave|[*S:global_save_mod] --&SaveModName| HOW DO I CALL JUST THE NAME? --+Your Save Attempt:|Total = [$GlobalSave] [&SaveModName] }} Thanks in advance! Have a great day. Dealing with repeating sections is always challenging. If you use the 5E Tools library ( see the wiki ) there is a procedure you can call called "Lib5E_Active_Save_Modifiers" that will return a string that you can append to the saving throw with any global save modifiers that are active (checked) for the chartacter. You just need to pass it a character ID and a variable name that will be set to the result. -->Lib5E_Active_Save_Modifiers|@{selected|character_id};SaveModifiers You can then use this string in an assignment line: --=SaveRoll|1d20 [Base] + @{selected|constitution_mod} [CON] [&SaveModifiers] If there are no active save modifiers, the string will be empty and won't impact the roll. If there are active save modifiers, it will contain each one's roll with a description (for example, "+ 1d4 [Bless] + 2 [Cloak]"). If you don't want to use the library, you will need to do something similar to what it does, going through each of the repeating save modifier rows and filtering out inactive rows to create a final result.
Made the change Kurt suggested ([*R>acharg] instead of [*R:acharg] ) and it didn't work ! Script works fine but attribute isn't chaged ! So I debugged (as suggeste by DAvid) and when I launched the !setattr in the chat it worked fine.... Any idea why it doesn't work from scriptcard ?
1615223215

Edited 1615223299
David M.
Pro
API Scripter
Mangouste, I wonder if it has something to do with any of the global configuration settings of ChatSetAttr?  Since the setattr call works from chat but not from the script, it may be a permissions problem. When you call it from chat, the command is sent by the GM. When called from scriptcards, it is sent by the api (which is not the GM). Maybe changing one of the permissions below might solve the problem? Global configuration (from ChatSetAttr documentation) There are three global configuration options,  playersCanModify ,  playersCanEvaluate , and  useWorkers , which can be toggled either on this page or by entering  !setattr-config  in chat. The former two will give players the possibility of modifying characters they don't control or using the  --evaluate  option. You should only activate either of these if you can trust your players not to vandalize your characters or your campaign. The last option will determine if the script triggers sheet workers on use, and should normally be toggled on.
David M. said: Mangouste, I wonder if it has something to do with any of the global configuration settings of ChatSetAttr?  Since the setattr call works from chat but not from the script, it may be a permissions problem. When you call it from chat, the command is sent by the GM. When called from scriptcards, it is sent by the api (which is not the GM). Maybe changing one of the permissions below might solve the problem? Global configuration (from ChatSetAttr documentation) There are three global configuration options,  playersCanModify ,  playersCanEvaluate , and  useWorkers , which can be toggled either on this page or by entering  !setattr-config  in chat. The former two will give players the possibility of modifying characters they don't control or using the  --evaluate  option. You should only activate either of these if you can trust your players not to vandalize your characters or your campaign. The last option will determine if the script triggers sheet workers on use, and should normally be toggled on. Initially only useWorkers was ON. I toggled The 3 options to ON but it doesn't change anything! Weird !
1615234363
David M.
Pro
API Scripter
Not sure what else to try, Mangouste. Someone with more familiarity using setattr with repeating attacks will have to chime in. I've never dealt with those before. Maybe if you posted your corrected --@setattr line and the output that your debug line ( --+setattr|... ) spits out, someone might see something that could be causing the problem? Or maybe creating another thread that has setattr in the title might attract some more people that might otherwise not be following this thread?
Hi it currently looks like it does not yet support directly exploding dice. ie  (Playing about to see if I can start expanding and replacing my scripts, but ERA system runs on Exploding 10s) !scriptcard  {{  --=Roll|10d10!>5 --+Dam|[$Roll] }} Is there a route around this? Possibly looping a reroll of 10s, then adding together the successes. If that is the only solution, OK - just means opposed and multi rolls just get a lot more complicated to script out.
I am liking the ScriptCards so far and trying to learn it. I am setting up a Potion Toxicity ScriptCard and it is working find but I have been trying to figure out how to have the script set the save DC to the Rarity of the potion that is picked instead of having all of the DC's in the Save DC section while still working with the Damage section of the script. This is what I have so far. !scriptcard {{ --#title|Potion Toxicity --=Rarity|?{Potion Rarity?|Common,0|Uncommon,1|Rare,2|Very Rare,3|Legendary,4} --=ToxicityRoll|1d10 --?[$ToxicityRoll] -eq 1|One --?[$ToxicityRoll] -eq 2|Two --?[$ToxicityRoll] -eq 3|Three --?[$ToxicityRoll] -eq 4|Four --?[$ToxicityRoll] -eq 5|Five --?[$ToxicityRoll] -eq 6|Six --?[$ToxicityRoll] -eq 7|Seven --?[$ToxicityRoll] -eq 8|Eight --?[$ToxicityRoll] -eq 9|Nine --?[$ToxicityRoll] -eq 10|Ten --:One| --=Damage|[$Rarity]d6 --+Save DC:| Con Save (Common) 9, (Uncommon) 11, (Rare) 13, (Very Rare) 15, (Legendary) 17 --+Effect:|Your stomach twists and turns, visibly wriggling inside you. --+Damage:|You become **poisoned**, and take [$Damage] acid damage at the end of every hour. --^Final| --:Two| --=Damage|1 + [$Rarity]d8 --+Save DC:| Con Save (Common) 9,(Uncommon) 11, (Rare) 13, (Very Rare) 15, (Legendary) 17 --+Effect:|Your veins begin to glow an unusual color, and your blood feels like it’s burning. --+Damage:|You take [$Damage] necrotic damage. You also take this damage whenever you’re Effect:ed by a spell that deals damage. --+Cure:| You can repeat the saving throw at the end of every day, ending the effect on yourself on a success. --^Final| --:Three| --+Save DC:| Con Save (Common) 9,(Uncommon) 11, (Rare) 13, (Very Rare) 15, (Legendary) 17 --+Effect:|Your eyes secrete a thick, cloudy fluid veined with neon color. --+Damage:|You become **blinded**. --+Cure:|You can repeat the saving throw at the end of every day, ending the effect on yourself on a success. --^Final| --:Four| --+Save DC:| Con Save (Common) 9,(Uncommon) 11, (Rare) 13, (Very Rare) 15, (Legendary) 17 --+Effect:|Your ears fill with a colorful, gummy substance. --+Damage:|You become **deafened**. You can repeat the saving throw at the end of every day, ending the Effect: on yourself on a success. --+Cure:|You can repeat the saving throw at the end of every day, ending the effect on yourself on a success. --^Final| --:Five| --+Save DC:| Con Save (Common) 9,(Uncommon) 11, (Rare) 13, (Very Rare) 15, (Legendary) 17 --+Effect:|Your saliva turns into a thick, glue-like ichor, sealing your mouth shut. --+Damage:|You can’t speak, and can’t cast spells that require verbal components. --+Cure:|You can repeat the saving throw at the end of every day, ending the effect on yourself on a success. **Lesser restoration** also ends this Effect:. --^Final| --:Six| --=Damage|1 + [$Rarity]d6 --+Save DC:| Con Save (Common) 9,(Uncommon) 11, (Rare) 13, (Very Rare) 15, (Legendary) 17 --+Effect:|Your legs lose all feeling, and solidify into a chalky, brittle substance. --+Damage:|At the end of every hour you travel at a normal or fast pace overland, or at the end of every turn in which you move 30 feet or more, you take [$Damage] necrotic damage. --+Cure:|You can repeat the saving throw at the end of every hour, ending the effect on yourself on a success. **Greater restoration** also ends this effect. --^Final| --:Seven| --=Damage|1 + [$Rarity]d8 --+Save DC:| Con Save (Common) 9,(Uncommon) 11, (Rare) 13, (Very Rare) 15, (Legendary) 17 --+Effect:|Your skin becomes translucent, and feels as thin as an insect’s wing. --+Damage:|You take [$Damage] necrotic damage. You also take this damage whenever you take damage from a weapon attack. --+Cure:|You can repeat the saving throw at the end of every day, ending the effect on yourself on a success. **Greater restoration** also ends this effect. --^Final| --:Eight| --=Damage|1 + [$Rarity]d8 --+Save DC:| Con Save (Common) 9,(Uncommon) 11, (Rare) 13, (Very Rare) 15, (Legendary) 17 --+Effect:|Your thinking slows, and you feel a strange liquid sloshing around within your skull. --+Damage:|You take [$Damage] psychic damage. You also have disadvantage on Wisdom, Intelligence, and Charisma saving throws. --+Cure:|You can repeat the saving throw at the end of every day, ending the effecte on yourself on a success. **Greater restoration** also ends this effect. --^Final| --:Nine| --=Damage|1 + [$Rarity]d8 --+Save DC:| Con Save (Common) 9,(Uncommon) 11, (Rare) 13, (Very Rare) 15, (Legendary) 17 --+Effect:|Your limbs feel like jelly, and your flesh becomes slick and wobbles when touched. --+Damage:|You take [$Damage] necrotic damage.You also have disadvantage on Strength, Dexterity, and Constitution saving throws. --+Cure:|You can repeat the saving throw at the end of every day, ending the effect on yourself on a success. **Greater restoration** also ends this effect. --^Final| --:Ten| --+Save DC:| Con Save (Common) 9,(Uncommon) 11, (Rare) 13, (Very Rare) 15, (Legendary) 17 --+Effect:|Your entire body convulses, and then locks up. --+Damage:|You become **paralyzed** until the start of your next turn. Then, you hiccough, and a tiny frog hops out of your throat. --:Final| }} 
1615291434
David M.
Pro
API Scripter
Snow, I'm away from my PC right now so air coding, but basically I would do this: create a baseDC variable, set to 9 after Rarity is selected, add a case statement, calling a procedure "setDC", and pass the amount to be added to the DC based on rarirty (so common, pass 0, uncommon, pass 2, etc.) Your setDC procedure would be something like: --:setDC|accepts mod as parameter   --=DC|[$baseDC]+[%1%] --<| Then, just reference [$DC] in your output
1615293859

Edited 1615397593
Mark C. said: Hi it currently looks like it does not yet support directly exploding dice. ie  (Playing about to see if I can start expanding and replacing my scripts, but ERA system runs on Exploding 10s) !scriptcard  {{  --=Roll|10d10!>5 --+Dam|[$Roll] }} Is there a route around this? Possibly looping a reroll of 10s, then adding together the successes. If that is the only solution, OK - just means opposed and multi rolls just get a lot more complicated to script out. I think I have the backbone of an Exploding dice !scriptcard  {{  --=SecondRoll|0 --=Aces|0 --=FirstRoll|10d10>7 --=Aces|[$FirstRoll.Aces] --=TotalTens|[$FirstRoll.Aces]+[$SecondRoll.Aces] --=TotalOnes|[$FirstRoll.Ones]+[$SecondRoll.Ones] --=TotalRoll|[$FirstRoll] --+Roll|[$FirstRoll] --+Ten|[$FirstRoll.Aces] --+One|[$FirstRoll.Ones] --?[$FirstRoll.Aces] -eq 0|Hit|Explode --:Explode| -->ExplodeLoop| --+Roll|[$SecondRoll] --+Ten|[$SecondRoll.Aces] --+One|[$SecondRoll.Ones] --+Total Roll|[$TotalRoll] --?[$SecondRoll.Aces] -eq 0|Hit|Explode   --<| --:ExplodeLoop| --=SecondRoll|[$Aces]d10>7 --=TotalRoll|[$TotalRoll] + [$SecondRoll] --=TotalTens|[$FirstRoll.Aces]+[$SecondRoll.Aces] --=TotalOnes|[$FirstRoll.Ones]+[$SecondRoll.Ones] --=Aces|[$SecondRoll.Aces]   --<| --:Hit| --+Total Tens Final|[$TotalTens] --+Total Ones Final|[$TotalOnes] --+Total Roll Final|[$TotalRoll]  --+hitRoll|[$TotalRoll] --?[$TotalOnes] -gt [$TotalRoll]|Fumble   --X|   --:Fumble|   --+Fumble|Things went horribly wrong.   --<| }} The script needs a major tidy up, but was done that way to show where things were going wrong/right Essentially !scriptcard  {{  --=SecondRoll|0  Needs to be declared and set to 0 near the start, else NaN if not used --=Aces|0  Needs to be declared and set to 0 near the start, else NaN if not used --=FirstRoll|10d10>7   this will get changed to {called in param}+ {called in param} d10> {called in param} type thing --=Aces|[$FirstRoll.Aces] --=TotalTens|[$FirstRoll.Aces]+[$SecondRoll.Aces] --=TotalOnes|[$FirstRoll.Ones]+[$SecondRoll.Ones] --=TotalRoll|[$FirstRoll]  Running total --+Roll|[$FirstRoll]   vis check only - can be stripped out --+Ten|[$FirstRoll.Aces]   vis check only - can be stripped out --+One|[$FirstRoll.Ones]   vis check only - can be stripped out --?[$FirstRoll.Aces] -eq 0|Hit|Explode  Explode loop trigger --:Explode| -->ExplodeLoop| --+Roll|[$SecondRoll]   vis check only - can be stripped out --+Ten|[$SecondRoll.Aces]   vis check only - can be stripped out --+One|[$SecondRoll.Ones]   vis check only - can be stripped out --+Total Roll|[$TotalRoll]   vis check only - can be stripped out    Running total --?[$SecondRoll.Aces] -eq 0|Hit|Explode  Explode loop trigger   --<| --:ExplodeLoop| --=SecondRoll|[$Aces]d10>7  Now just rerolling the 10s against the same threshold as above --=TotalRoll|[$TotalRoll] + [$SecondRoll]   Running total of successes --=TotalTens|[$FirstRoll.Aces]+[$SecondRoll.Aces]   Running total of tens, not needed, but used for vis check --=TotalOnes|[$FirstRoll.Ones]+[$SecondRoll.Ones]   Running total of failures (1s) --=Aces|[$SecondRoll.Aces]  Resetting the 10s coun   --<| --:Hit| --+Total Tens Final|[$TotalTens]  Final tally --+Total Ones Final|[$TotalOnes]  Final tally --+Total Roll Final|[$TotalRoll]  Final tally  --+hitRoll|[$TotalRoll]   vis check only - can be stripped out --?[$TotalOnes] -gt [$TotalRoll]|Fumble  Fumble check   --X|   --:Fumble|   --+Fumble|Things went horribly wrong.   --<| }}
1615295777
David M.
Pro
API Scripter
Snow, here's an updated version of your poison toxicity scriptcard. Note the setDC procedure is below the --X| line. I also changed your series of toxicity conditionals into another case statement to save on space, but it obviously works either way :) Changes in bold. !scriptcard {{ --#title|Potion Toxicity --=baseDC|9 --=Rarity|?{Potion Rarity?|Common,0|Uncommon,1|Rare,2|Very Rare,3|Legendary,4} --C[$Rarity.Total]|0:>setDC;0|1:>setDC;2|2:>setDC;4|3:>setDC;6|4:>setDC;8 --=ToxicityRoll|1d10 --C[$ToxicityRoll.Total]|1:One|2:Two|3:Three|4:Four|5:Five|6:Six|7:Seven|8:Eight|9:Nine|10:Ten --:One| --=Damage|[$Rarity]d6 --+Save DC:|[$DC] --+Effect:|Your stomach twists and turns, visibly wriggling inside you. --+Damage:|You become **poisoned**, and take [$Damage] acid damage at the end of every hour. --^Final| --:Two| --=Damage|1 + [$Rarity]d8 --+Save DC:|[$DC] --+Effect:|Your veins begin to glow an unusual color, and your blood feels like it’s burning. --+Damage:|You take [$Damage] necrotic damage. You also take this damage whenever you’re affected by a spell that deals damage. --+Cure:| You can repeat the saving throw at the end of every day, ending the effect on yourself on a success. --^Final| --:Three| --+Save DC:|[$DC] --+Effect:|Your eyes secrete a thick, cloudy fluid veined with neon color. --+Damage:|You become **blinded**. --+Cure:|You can repeat the saving throw at the end of every day, ending the effect on yourself on a success. --^Final| --:Four| --+Save DC:|[$DC] --+Effect:|Your ears fill with a colorful, gummy substance. --+Damage:|You become **deafened**. You can repeat the saving throw at the end of every day, ending the Effect: on yourself on a success. --+Cure:|You can repeat the saving throw at the end of every day, ending the effect on yourself on a success. --^Final| --:Five| --+Save DC:|[$DC] --+Effect:|Your saliva turns into a thick, glue-like ichor, sealing your mouth shut. --+Damage:|You can’t speak, and can’t cast spells that require verbal components. --+Cure:|You can repeat the saving throw at the end of every day, ending the effect on yourself on a success. **Lesser restoration** also ends this Effect:. --^Final| --:Six| --=Damage|1 + [$Rarity]d6 --+Save DC:|[$DC] --+Effect:|Your legs lose all feeling, and solidify into a chalky, brittle substance. --+Damage:|At the end of every hour you travel at a normal or fast pace overland, or at the end of every turn in which you move 30 feet or more, you take [$Damage] necrotic damage. --+Cure:|You can repeat the saving throw at the end of every hour, ending the effect on yourself on a success. **Greater restoration** also ends this effect. --^Final| --:Seven| --=Damage|1 + [$Rarity]d8 --+Save DC:|[$DC] --+Effect:|Your skin becomes translucent, and feels as thin as an insect’s wing. --+Damage:|You take [$Damage] necrotic damage. You also take this damage whenever you take damage from a weapon attack. --+Cure:|You can repeat the saving throw at the end of every day, ending the effect on yourself on a success. **Greater restoration** also ends this effect. --^Final| --:Eight| --=Damage|1 + [$Rarity]d8 --+Save DC:|[$DC] --+Effect:|Your thinking slows, and you feel a strange liquid sloshing around within your skull. --+Damage:|You take [$Damage] psychic damage. You also have disadvantage on Wisdom, Intelligence, and Charisma saving throws. --+Cure:|You can repeat the saving throw at the end of every day, ending the effect on yourself on a success. **Greater restoration** also ends this effect. --^Final| --:Nine| --=Damage|1 + [$Rarity]d8 --+Save DC:|[$DC] --+Effect:|Your limbs feel like jelly, and your flesh becomes slick and wobbles when touched. --+Damage:|You take [$Damage] necrotic damage. You also have disadvantage on Strength, Dexterity, and Constitution saving throws. --+Cure:|You can repeat the saving throw at the end of every day, ending the effect on yourself on a success. **Greater restoration** also ends this effect. --^Final| --:Ten| --+Save DC:|[$DC] --+Effect:|Your entire body convulses, and then locks up. --+Damage:|You become **paralyzed** until the start of your next turn. Then, you hiccough, and a tiny frog hops out of your throat. --:Final| --X|End Macro --:setDC|accepts DC modifier as parameter --=DC|[$baseDC]+[%1%] --<| }}
Keith, I LOVE this script parser! i know you have plans on the procedure libraries to take the place of PCM Helper, however i was wondering if you were going to make a similar helper script to build the libraries with the existing content, or help make something similar for those of us not so gifted at codifying what we want to see. I've gotten the idea of the procedures libraries down, however i feel it deserves its own video (like the magic missle deep dive) as it took me several hours of searching to figure out how to interpret the documentation to my understanding.  I've also adapted your magic missile card example for a 12-man stab session, which came in very handy during a session, saving me almost 5 minutes of clicking and adding. so THANKS for that!
1615301023

Edited 1615301563
David M.
Pro
API Scripter
Nice, Mark! As a fun brainteaser project, I took your base logic and added some condensed roll output in case you wanted to see all of the rolls in one line without mouseover. This outputs the base dice and exploded dice as separate line items. --EDIT: updated to start the rolls on the left for readability !scriptcard {{ --#title|Exploding Dice Example --:INITIALIZE VARIABLES| --=NumDice|?{Number of dice?|10} --=Target|?{Target Number?|7} --=Aces|0 --=Ones|0 --=Successes|0 --&BaseRolls| --&ExplodedRolls| --:MAIN ROLL LOOP| --=i|0 --:RollLoop| --=i|[$i]+1 -->MakeRoll|1 --?[$i] -lt [$NumDice]|RollLoop --:OUTPUT| --+Base dice:| --+|[&BaseRolls] --+Exploded Dice:| --+|[&ExplodedRolls] --+Target:|[$Target] --+[c]~~~~~~~RESULTS~~~~~~[/c]| --+[#990000]Num Ones[/#]|[$Ones] --+[#007700]Num Successes[/#]|[$Successes] --:CHECK FOR FUMBLE| --?[$Ones] -gt [$Successes]|>Fumble --X| End Macro --PROCEDURES| --:MakeRoll| accepts boolean as parameter to determine if base roll or exploded roll --=ThisRoll|1d10 --=Aces|[$Aces] + [$ThisRoll.Aces] --=Ones|[$Ones.Total] + [$ThisRoll.Ones] --?[%1%] -eq 1|>AddBaseRoll|>AddExplodedRoll --?[$ThisRoll] -ge [$Target]|>AddSuccess --?[$ThisRoll.Aces] -eq 1|>MakeRoll;0 --<| --:AddBaseRoll| --&BaseRolls|+[$ThisRoll] --<| --:AddExplodedRoll| --&ExplodedRolls|+[$ThisRoll] --<| --:AddSuccess| --=Successes|[$Successes] + 1 --<| --:Fumble| --+[#990000]Fumble! - [/#]|[#990000][b]Things went horribly wrong.[/b][/#] --<| }} Example output
David M. said: Not sure what else to try, Mangouste. Someone with more familiarity using setattr with repeating attacks will have to chime in. I've never dealt with those before. Maybe if you posted your corrected --@setattr line and the output that your debug line ( --+setattr|... ) spits out, someone might see something that could be causing the problem? Or maybe creating another thread that has setattr in the title might attract some more people that might otherwise not be following this thread? Done ! Thanks anyway ! Talking about brainteasers, here's one : In Shaan, our RPG, There are 4 major domains, each representing a facet of a PC & associated with a color: Esprit (Spirit) - Yellow / Ame (Soul) - Blue/ Corps (Body) - Red / Nécrose (Necrosis) - Black The first 3 are valued from 1 (worst) to 15 (greatest). Nécrose is particular because if you happen to reach >10 you become a NPC (undead) If we forget about necrose for time being the system is based on rolling 3 dices (1 yellow, 1 blue & 1 red). You need to roll less or equal to your level in the domain you're using in order to benefit from the basic value. You the add a Skill bonus and an object bonus. The fun part comes from the usage of the 2 other dices. Let's say you try to hit your opponent with your longsword . You have 7 in Corps (Body), 3 in Melee and 2 Longsword bonus. 1st case: Roll Success Red dice value  is 6 / Blue dice is 9 / Yellow dice is 4 Hit score would be 11 [ 6 for the red roll(<=7 [Body] - melee is relying on body) + 3+2] to be opposed to the target's protection to determine wound's level 2nd case: Roll failure - Substitution Red dice value  is 10 / Blue dice is 9 / Yellow dice is 4 Hit score would normaly be 5 [ 0 for the red roll(because 0 is always a fumble and is anyway >7 [Body] - melee is relying on body) + 3+2]  He can though switch its red dice value by the yellow one if he decreases the corresponding value (Esprit [esprit]) by one He would then have lost one point in that domain but it's hit would be 9 (4+3+2) instead of a fail ! 3nd case: Roll insufficient - completion Red dice value  is 1 / Blue dice is 4 / Yellow dice is 8 Hit score would normaly be 6 [ 1 for the red roll(1<7 [Body] - melee is relying on body) + 3+2]  He can though add its blue dice value (because the summ stays <7 [Body])  if he decreases the corresponding value (Ame [soul]) by one He would then have lost one point in that domain but it's hit would be 10 (1+4+3+2) instead of a potential fail ! Currently I am simulating the dice rolls results with dicefont ! I have my players to do their operations (completion or substitution with the corresponding decrease of domains -> risky in the short term) and I have them to input the final score in a user interaction ?{score|0} The ideal would be to be able to do everything in a row (playing with the dice and lauching the total to compare it with protection value of the target) but I cannot think of a way to do it ! If you have some ideas that would be great !
@Mangouste: First of all, that system sounds really interesting! Second, as for your problem: I think what you need is an --i line. I think something like this would be a good place to start: --?roll fail condition|>Roll Fail More lines or whatever --:Roll Fail --IYou rolled Red [$Red], Blue [$Blue], and Yellow [$Yellow];Click to decide whether to substitute or complete|q;Choice;What will you do?|Option 1|Option 2|Option 3 So, the player should only get prompted with the --i line if the roll failed. You can then give them a query to reinsert back into the script somewhere to affect the final outcome. You can then use something like ChatSetAttr to decrement the appropriate domain value.
No idea what the problem is but this crashes the API Kurt J. said: !script {{    +++5E Tools+++     --#title|@{selected|token_name}    -->Lib5E_Character_Summary|@{selected|character_id} }} I get this error: TypeError: Cannot read property '6' of undefined TypeError: Cannot read property '6' of undefined at apiscript.js:56575:70 at Array.forEach (<anonymous>) at replaceCharacterAttributes (apiscript.js:56568:13) at apiscript.js:55255:23 at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:154:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:154:1), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1663:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546)
1615311899

Edited 1615328929
EDIT: Apparently, the problem was the token? I just made a new token from the same character, which of course has a different id, and sure enough, it works fine: Maggus the Ancient's Combat Options 25 ft. 15/19hp (78%) Str  9(-1) Int  17(3) Dex  14(2) Wis  14(2) Con  13(1) Cha  8(-1) AC  15 Race  Gnome Background  Sage (Researcher) Level  3 Class  Wizard Subclass Wizard Level  1 Multiclass  Cleric Cleric Sub.  Knowledge Domain Cleric Level  2 Actions Channel Divinity: Turn Undead Description Channel Divinity: Knowledge of the Ages Description Bonus Actions You have no bonus actions from your abilities/spells. Reactions You have no reactions from your abilities/spells. Abilities Requiring No Action Arcane Recovery Description Speak with Small Beasts Description Channel Divinity Description I have strange problem that only results with one particular PC, that is a multiclass Wizard 1/Cleric 2. This is the output: ScriptCards undefined ft. undefined/undefinedhp (0%) Str  undefined(undefined) Int  undefined(undefined) Dex  undefined(undefined) Wis  undefined(undefined) Con  undefined(undefined) Cha  undefined(undefined) AC  undefined Race  undefined Subrace  undefined Background  undefined Level  undefined Class  undefined Subclass  undefined Actions You have no actions from your race or class. Bonus Actions You have no bonus actions from your abilities/spells. Reactions You have no reactions from your abilities/spells. Abilities Requiring No Action You have no special combat features from your race or class. For this script: !script {{ --#sourcetoken|@{selected|token_id} --#title|[*S:character_name]'s Combat Options -->SpeedFix|[*S:speed] --&CR| --&AC|[*S:ac] -->HP| --#whisper|gm --?[*S:npc] -eq 1|NPC --#leftsub|[&Speed] [&HP] --&Actions|You have no actions from your race or class. --&Bonus|You have no bonus actions from your abilities/spells. --&Reactions|You have no reactions from your abilities/spells. --&Special|You have no special combat features from your race or class. --&FullCast|no -->AttributeDisplay| --/|>Lib5E_RaceBackgroundClass| -->RCDisplayLoop|Race --?[*S:subrace]1 -ne 1|>RCDisplayLoop;Subrace --+Background|[*S:background] -->RCDisplayLoop|Level -->RCDisplayLoop|Class -->RCDisplayLoop|Subclass --?[*S:level] -eq [*S:base_level]|Features|>RCDisplayLoop;Base_level --?[*S:multiclass1_flag] -eq 1|>ClassFeatureLoop;multiclass1;multiclass1_lvl;multiclass1_subclass|>BeginFeatureDisplay -->RCDisplayLoop|Multiclass1 -->RCDisplayLoop|Multiclass1_subclass -->RCDisplayLoop|Multiclass1_lvl --?[*S:multiclass2_flag] -eq 1|>ClassFeatureLoop;multiclass2;multiclass2_lvl;multiclass2_subclass|>BeginFeatureDisplay -->RCDisplayLoop|Multiclass2 -->RCDisplayLoop|Multiclass2_subclass -->RCDisplayLoop|Multiclass2_lvl --?[*S:multiclass3_flag] -eq 1|>ClassFeatureLoop;multiclass3;multiclass3_lvl;multiclass3_subclass|>BeginFeatureDisplay -->RCDisplayLoop|Multiclass3 -->RCDisplayLoop|Multiclass3_subclass -->RCDisplayLoop|Multiclass3_lvl --:Features| -->RaceFeatureLoop|[*S:race];[*S:subrace];[*S:level] -->BackgroundFeatureLoop|[*S:background] -->ClassFeatureLoop|class;base_level;subclass --:BeginFeatureDisplay| -->PCTraits| --=Lvl|0 --/|>SpellChecking|[*S:character_id] -->FeatureDisplayLoop|Actions --:EndActionsDisplay| --?"[*S:retainers]" -ne undefined|>Retainers --X| --:RCDisplayLoop|R/C Attribute --~Name|string;split;_;[%1%] --?[&Name1] -inc Base|>BaseFix --?[&Name2] -inc l|>MultiFix;[&Name1]|>FixName;[%1%] --&Name|[&Name1] [&Name2] --~Name|string;replace;lvl;Level;[&Name] --~Name|string;replace;subclass;Sub.;[&Name] --?[&Name] -inc Multi|>MultiCut;[&Name] --+[&Name]|[*S:[%1%]] --<| --:MultiFix| --&Name1|[*S:[%1%]] --<| --:MultiCut| --~Name|string;left;10;[&Name] --<| --:BaseFix| --&Name1|[*S:class] Level --&Name2| --<| --:FeatureAddLoop|Which what action economy;feature to append --&[%1%]|+^^[%2%] --<| --:FeatureDisplayLoop|Which action economy --&ActionType|[%1%] --?[%1%] -eq Bonus|>FixActionName --?[%1%] -eq Special|>FixActionName --+[c][&ActionType][/c]| --=Num|2 --~[%1%]|string;split;^^;[&[%1%]] --?[$[%1%]Count] -eq 1|>NoExtras;[%1%] --:ActionsDisplayLoop| --?[$Num.Total] -gt [$[%1%]Count]|EndActionsLoop --~Display|string;split;!!;[&[%1%][$Num.Total]] --/|I haven't figured out a better way to do this yet --/|I can't use semicolons in the procedure call to FeatureAddLoop because semicolons are used as delimiters in the call syntax --/|I also can't just do a replacement function for the same reason --/|But there are always 11 parameters to the PC traits template, so I split the display string and then recombine with semicolons in between --/|I tried using a loop to auto-add them together by comparing &Semicolons# with $SemicolonsCount, but that wasn't working so I made this dumb solution --~Semicolons|string;split;^%^;[&Display2] --&Display2|[&Semicolons1];[&Semicolons2];[&Semicolons3];[&Semicolons4];[&Semicolons5];[&Semicolons6];[&Semicolons7];[&Semicolons8];[&Semicolons9];[&Semicolons10];[&Semicolons11] --/|~ButtonCheck|string;split;.;[&Display2] --/|?[$ButtonCheckCount] -ge 4|>Buttonize;[*S:character_id];[&Display1];[&Display2] --+|[l][&Display1][/l][&Display2] --=Num|[$Num] + 1 -->ActionsDisplayLoop|[%1%] --:EndActionsLoop| --C[%1%]|Actions:>FeatureDisplayLoop;Bonus|Bonus:>FeatureDisplayLoop;Reactions|Reactions:>FeatureDisplayLoop;Special|Special:EndActionsDisplay --:NoExtras| --+|[&[%1%]] --<| --:ReplaceSemicolons| --=Num|2 --&Display2|[&Semicolons1] --:ReplaceSemicolonsLoop| --=Num|[$Num] + 1 --?[$Num] -le [$SemicolonsCount]|ReplaceSemicolonsLoop --<| --:Buttonize|character id; name of trait; description --Rfind|[*S:charactrer_id];[%2%];repeating_traits;name --+|[*R:name] --&Display2|[r][button]Description::!
/w gm &{template:traits} [*S:charname_output] {{name=[*R:name]}} {{source=[*R:source]: [*R:source_type]}} {{description=[*R:description]&#!25;}[/button][/r] --<| --:FixActionName| --~ActionType|string;replace;Bonus;Bonus Actions;[&ActionType] --~ActionType|string;replace;Special;Abilities Requiring No Action;[&ActionType] --<| --:ClassFeatureLoop|base class v. multiclass; base level v. multiclass level; subclass --:ExtraAttackChecks|Sorting out fighter vs. other martial class extra attacks --?[*S:[%1%]] -eq Fighter -and [*S:[%2%]] -ge 5|>FighterEA;[*S:[%2%]] --?[$HasEAtt] -eq 1|AfterExtraAttack --?[*S:[%1%]] -eq Barbarian -or [*S:[%1%]] -eq Monk -or [*S:[%1%]] -eq Paladin -or [*S:[%1%]] -eq Ranger -and [*S:[%2%]] -ge 5|>HasEAtt --:AfterExtraAttack| --:CasterChecks|Sorting out where character has a lot of spells --?[&FullCast] -eq Yes|AfterFullCast --?[*S:[%1%]] -eq Bard -or [*S:[%1%]] -eq Cleric -or [*S:[%1%]] -eq Druid -or [*S:[%1%]] -eq Sorcerer -or [*S:[%1%]] -eq Wizard -and [*S:[%2%]] -ge 7|FullCaster --?[*S:[%1%]] -eq Paladin -or [*S:[%1%]] -eq Artificer -or [*S:[%1%]] -eq Ranger -or [*S:[%1%]] -eq Warlock -and [*S:[%2%]] -ge 11|FullCaster --:AfterFullCast| --<| --:PCTraits| --Rfirst|[*S:character_id];repeating_traits --:TraitLoop| --&Desc|!&#13^%^/w [*S:character_name] &amp^%^{template:traits} {{charname=[*S:character_name]&#125^%^&#125^%^ {{name=[*R:name]&#125^%^&#125^%^ {{source=[*R:source]: [*R:source_type]&#125^%^&#125^%^ {{description=[*R:description]&#125^%^&#125^%^ --~Desc|string;replace;|;&#124^%^ --/|Need to carve out Extra Attack for multiclass checks --?"[*R:description]" -inc "bonus action"|>FeatureAddLoop;Bonus;[*R:name]!![r][button]Description::[&Desc][/button][/r] --?"[*R:description]" -inc reaction -and "[*R:description]" -ninc "as an action"|>FeatureAddLoop;Reactions;[*R:name]!![r][button]Description::[&Desc][/button][/r] --?"[*R:description]" -inc "as an action" -or "[*R:description]" -inc " at will" -or "[*R:name]" -eq "Extra Attack" -or "[*R:description]" -inc "your action" -or "[*R:description]" -inc "Attack action"|>FeatureAddLoop;Actions;[*R:name]!![r][button]Description::[&Desc][/button][/r] --?"[*R:name]" -inc "Stronghold Actions" -or "[*R:description]" -inc "attack" -or "[*R:description]" -inc "rest" -and "[*R:description]" -ninc "bonus action" -and "[*R:description]" -ninc "reaction" -and "[*R:description]" -ninc "your action" -and "[*R:name]" -ne "Extra Attack" -and [*R:source] -ne Background -and "[&Actions]" -ninc "[*R:name]"|>FeatureAddLoop;Special;[*R:name]!![r][button]Description::[&Desc][/button][/r] --Rnext| --?"[*R:name]" -ne NoRepeatingAttributeLoaded|TraitLoop --<| --:HP| --=HPPerc|[*S:hp] / [*S:hp^] * 100 \ 1 --&HP|[*S:hp]/[*S:hp^]hp ([$HPPerc.Total]%) --<| --:SpeedFix|character speed and appends “ft.” if necessary --~Speed|string;replace; ft.;;[%1%] --&Speed|+ ft. --<|return to leftsub --:AttributeDisplay| --+|[b]Str[/b] [*S:strength]([*S:strength_mod])[r][b]Int[/b] [*S:intelligence]([*S:intelligence_mod])[/r] --+|[b]Dex[/b] [*S:dexterity]([*S:dexterity_mod]) [r][b]Wis[/b] [*S:wisdom]([*S:wisdom_mod])[/r] --+|[b]Con[/b] [*S:constitution]([*S:constitution_mod])[r][b]Cha[/b] [*S:charisma]([*S:charisma_mod])[/r] --+|[b]AC[/b] [&AC] [r][&CR][/r] --<| --:NPC| --&AC|[*S:npc_ac] --&CR|[b]Challenge Rating[/b] [*S:npc_challenge] --&HP| --#leftsub|[&Speed] [&HP] --#rightsub|[*S:npc_type] --#whisper|[*S:character_name] -->AttributeDisplay| --:NPCTraits| --Rfirst|[*S:character_id];repeating_npctrait --?"[*R:name]" -eq NoRepeatingAttributeLoaded|NPCActions --=Index|0 --+[c]Traits[/c]| --:NPCTraitsDisplayLoop| --?"[*R:name]" -eq NoRepeatingAttributeLoaded|NPCActions --+[*R:name]|[button]Details::!
/w [*S:character_name] %{[*S:character_id]|[*R:name]}[/button] --Rnext| --=Index|[$Index] + 1 -->NPCTraitsDisplayLoop| --:NPCActions| --+[c]Actions[/c]| --Rfirst|[*S:character_id];repeating_npcaction --=Index|0 --:NPCActionsDisplayLoop| --?"[*R:name]" -eq NoRepeatingAttributeLoaded|NPCReactions --+[*R:name]|[*R:description][*R:attack_damage] [*R:attack_damagetype] [r][button]Details::!
/w [*S:character_name] %{[*S:character_id]|repeating_npcaction_$[$Index.Total]_npc_action}[/button][/r] --?[*R:attack_damage2]1 -eq 1|NoSecondaryDamage --+ |[*R:attack_damage2] [*R:attack_damagetype2] --:NoSecondaryDamage| --Rnext| --=Index|[$Index] + 1 -->NPCActionsDisplayLoop| --:NPCReactions| --Rfirst|[*S:character_id];repeating_npcreaction --?"[*R:name]" -eq NoRepeatingAttributeLoaded|NPCLegendary --+[c]Reactions[/c]| --:NPCReactionsDisplayLoop| --?"[*R:name]" -eq NoRepeatingAttributeLoaded|NPCLegendary --+[*R:name]|[*R:description] --Rnext| -->NPCReactionsDisplayLoop| --:NPCLegendary| --Rfirst|[*S:character_id];repeating_npcaction-l --?"[*R:name]" -eq NoRepeatingAttributeLoaded|NPCSpells --+[c]Legendary Actions[/c]|[*S:npc_legendary_actions]/round --:NPCLegendaryDisplayLoop| --?"[*R:name]" -eq NoRepeatingAttributeLoaded|NPCSpells --+[*R:name]|[*R:description] --Rnext| -->NPCLegendaryDisplayLoop| --:NPCSpells| --?[*S:npcspellcastingflag] -ne 1|NPCDone -->Fullcaster| --X| --/|:Fullcaster| --&FullCast|Yes --<| --:NPCDone| --X| --/|:FixDesc| --~Button|string;split;|;[*R:description] --+|[&Button1] --+|[&Button2] --<| --:Retainers| --+[c]Retainers[/c]| --~Retainers|string;split;|;[*S:retainers] --=Num|1 --:RetainerDisplayLoop| --+[&Retainers[$Num.Total]]|[button]Show Card::!
%{[&Retainers[$Num.Total]]|Show-Card}[/button] --=Num|[$Num] + 1 --?[$Num.Total] -le [$RetainersCount]|RetainersDisplayLoop --<| }}