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

1636356417

Edited 1636357543
Zach
Pro
Hello, absolutely love this script! I only have one thing stopping me from full utilization. My crew is playing Deadlands Classic and they use an exploding dice with aces and only keeping the highest. No combination of exploding (!) keeping highest (kh1} seems to result into what I need. Also, the dice can explode multiple times, every time they ace. Am I missing something or is this not possible in this system.  Example: 4d6 rolled. Rolls are [1,3,6,6], both the 6's explode into [6+2, 6+6} the second six then explodes again [6+6+3] meaning the roll totals 15. Also, the die size can change to any other die type and still follow the rules above. Thank you
1636377067
Kurt J.
Pro
API Scripter
Erik M. said: Just giving this a little bump. :) Erik M. said: A formatting question this time: The wiki says that the #buttonbackground to set color for the buttons is per-line, but I am getting global behavior for the last color set on my sheet buttons. I've also tried #buttonbackgroundcolor to no avail. Am I using these correctly? Erik, This gives me three different color buttons (red, green, and blue): !script {{ --#buttonbackground|#CC3333 --+|[button]Press me!::effect[/button] --#buttonbackground|#33CC33 --+|[button]Press me!::effect[/button] --#buttonbackground|#3333CC --+|[button]Press me!::effect[/button] }} I took a look at the current one-click version, and I think it should be using that behavior. Can you post your macro?
1636377975
Kurt J.
Pro
API Scripter
Zach said: Hello, absolutely love this script! I only have one thing stopping me from full utilization. My crew is playing Deadlands Classic and they use an exploding dice with aces and only keeping the highest. No combination of exploding (!) keeping highest (kh1} seems to result into what I need. Also, the dice can explode multiple times, every time they ace. Am I missing something or is this not possible in this system.  Example: 4d6 rolled. Rolls are [1,3,6,6], both the 6's explode into [6+2, 6+6} the second six then explodes again [6+6+3] meaning the roll totals 15. Also, the die size can change to any other die type and still follow the rules above. Thank you Zach,   I think I understand this, so let me ask to make sure. Even though the attribute is 4d6 (or whatever) that is just 4 chances to get a high number. My first though was that this could be done via a subroutine, but you wouldn't get the hover-over on the roll - just the highest number. For example, this will do the roll: !script {{   -->RollDeadlandsDice|4;6;result   --+Result|[$result]   --X|   --:RollDeadlandsDice|;count;sides;returnvariablename   --=_highest|-1   --%_rollLoop|1;[%1%]     --=_thisRoll|1d[%2%]!     --?[$_thisRoll.Total] -gt [$_highest.Total]|=_highest;[$_thisRoll.Total]   --%|   --=[%3%]|[$_highest.Total]   --<| }} but because of the way it works, there is no way to see the details of the dice. Give me a few hours and I'll see if I can include such a roll type into the code to make it work in a more satisfactory manner.
1636379703

Edited 1636379714
Kurt J.
Pro
API Scripter
ScriptCards version 1.4.7 Version 1.4.7 of the script is up on the  github  and introduces a new roll formula: XdY!h and/or XdY!l These formulas combine exploding dice with the ability to keep the highest roll. For example: !script {{   --=Roll|4d6!h   --+Roll|[$Roll] }} will roll 1d6 four times, with rolls of 6 exploding and adding back to the die roll. Each individual set of rolls is then compared to find the highest roll and that is the value returned for the total. For example:
Kurt J. said: Erik M. said: A formatting question this time: The wiki says that the #buttonbackground to set color for the buttons is per-line, but I am getting global behavior for the last color set on my sheet buttons. I've also tried #buttonbackgroundcolor to no avail. Am I using these correctly? Erik, This gives me three different color buttons (red, green, and blue): !script {{ --#buttonbackground|#CC3333 --+|[button]Press me!::effect[/button] --#buttonbackground|#33CC33 --+|[button]Press me!::effect[/button] --#buttonbackground|#3333CC --+|[button]Press me!::effect[/button] }} I took a look at the current one-click version, and I think it should be using that behavior. Can you post your macro? Sure, it is a bit long.&nbsp; !scriptcard {{&nbsp; +++M&amp;M3E+++ --#sourceToken|@{selected|token_id} --#emoteState|hidden &nbsp; --Lsettings|[*S:character_name] &nbsp; --?[*S:op_npc] -eq on|&gt;NPCSettings &nbsp; --#title|[*S:character_name] - Powers &nbsp; --#whisper|self &nbsp;&nbsp; &nbsp; --#buttonFontSize|small &nbsp; --#buttonbackgroundimage|url(<a href="https://s3.amazonaws.com/files.d20.io/images/251405432/dtTqq0QYaqRESSiIfHpECA/original.png?16347675395" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/251405432/dtTqq0QYaqRESSiIfHpECA/original.png?16347675395</a>); background-repeat: no-repeat; background-size:110px 56px; width:110px; height:48px; align:center;&nbsp; &nbsp; --#buttontextcolor|black &nbsp;&nbsp; &nbsp; --=i|1 &nbsp; --=j|1 &nbsp; --=k|0 &nbsp; --=m|1 &nbsp; --=PowerCount|0 &nbsp; --=ArrayCount|0 &nbsp; --&amp;IndentCell|[img width=36 height=48 ]<a href="https://s3.amazonaws.com/files.d20.io/images/189949695/nW5EdvKGlKOUHA-9gCuY6g/original.png?16097206605[/img]" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/189949695/nW5EdvKGlKOUHA-9gCuY6g/original.png?16097206605[/img]</a> &nbsp;&nbsp; &nbsp; --:FindAttacks| --Rfirst|[*S:character_id];repeating_powers --?"[*R:label]" -inc Loaded|PowerError --:Powers|Button color issues here --?"[*R:label]" -inc Loaded|PowersDone --?"[*R:description]" -inc Array|ArrayBuild --=Power[$i.Raw]AltCount|0 --?"[*R:element_type]" -eq "power"|[ --#buttonbackground|#F3FF9B --=PowerCount|[$PowerCount] + 1 --&amp;Power[$i.Raw]|[td style="width:100%;text-align:center;line-height:48px;font-weight: bold; padding: 5px"][sheetbutton][*R:label]::GenericMacro::NothingToSeeHere"class="showtip" title="[*R:description][/sheetbutton][/td] --^GoToNextPower| --]| --?"[*R:element_type]" -eq "attack_fx" -and "[*R:attack_type]" -ne "alternative"|[ --#buttonbackground|#F3FF9B --=PowerCount|[$PowerCount] + 1 --~MacroName|string;replaceall; ;;[*R:label] --&amp;Power[$i.Raw]|[td style="width:100%;text-align:center;line-height:48px;font-weight: bold; padding: 5px"][sheetbutton][*R:label]::[*S:character_name]::[&amp;MacroName]"class="showtip" title="[*R:description][/sheetbutton][/td] --^GoToNextPower| --]| --:AltPower| --?"[*R:element_type]" -eq "alt_power"|[ --#buttonbackground|#000000 --=Power[$i.Raw]AltCount|[$Power[$i.Raw]AltCount] + 1 --&amp;Power[$i.Raw]Alt[$j.Raw]|[td style="width:100%;text-align:center;line-height:48px;font-weight: bold; padding: 5px"][&amp;IndentCell][sheetbutton][*R:label]::GenericMacro::NothingToSeeHere"class="showtip" title="[*R:description][/sheetbutton][/td] --=j|[$j] + 1 --^GoToNextPower| --]| --?"[*R:element_type]" -eq "attack_fx" -and "[*R:attack_type]" -eq "alternative"|[ --#buttonbackground|#000000 --=Power[$i.Raw]AltCount|[$Power[$i.Raw]AltCount] + 1 --~MacroName|string;replaceall; ;;[*R:label] --&amp;Power[$i.Raw]Alt[$j.Raw]|[td style="width:100%;text-align:center;line-height:48px;font-weight: bold; padding: 5px"][&amp;IndentCell][sheetbutton][*R:label]::GenericMacro::[&amp;MacroName]"class="showtip" title="[*R:description][/sheetbutton][/td] --=j|[$j] + 1 --^GoToNextPower| --]| --:GoToNextPower| --Rnext| --?"[*R:element_type]" -eq "alt_power" -or "[*R:element_type]" -eq "alternative" -or "[*R:attack_type]" -eq "alternative"|AltPower --=i|[$i] + 1 --=j|1 --?"[*R:label]" -inc Loaded|PowersDone --^Powers|&nbsp; --:ArrayBuild| --?"X[*R:master_row]" -eq "X"|ArrayTitle --?[*R:master_row] -nei [&amp;ArrayID]|Powers --=Array[$k.Raw]PowerCount|[$Array[$k.Raw]PowerCount] + 1 --?"[*R:element_type]" -eq "alt_power" -and [*R:master_row] -eqi [&amp;ArrayID]|[ --&amp;Array[$k.Raw]Power[$m.Raw]|[td style="width:100%;text-align:center;line-height:48px;font-weight: bold; padding: 5px"][sheetbutton][*R:label]::GenericMacro::NothingToSeeHere"class="showtip" title="[*R:description][/sheetbutton][/td] --]| --?"[*R:element_type]" -eq "attack_fx" -and [*R:master_row] -eqi [&amp;ArrayID]|[ --~MacroName|string;replaceall; ;;[*R:label] --&amp;Array[$k.Raw]Power[$m.Raw]|[td style="width:100%;text-align:center;line-height:48px;font-weight: bold; padding: 5px"][sheetbutton][*R:label]::GenericMacro::[&amp;MacroName]"class="showtip" title="[*R:description][/sheetbutton][/td] --]| --Rnext| --?"X[*R:element_type]" -eq "X" -or [*R:element_type] -inc Loaded -or [*R:element_type] -eq power|Powers --=m|[$m] + 1 --^ArrayBuild| --:ArrayTitle| --=k|[$k] + 1 --=ArrayCount|[$ArrayCount] + 1 --=Array[$k.Raw]PowerCount|0 --&amp;Array[$k.Raw]Heading|[tr][td style="line-height:24px;font-size:18px; font-weight:bold;font-style: oblique; color: blue"][*R:label][/td][/tr] --~ArrayID|string;after;repeating_powers_;[*R&gt;label] --~ArrayID|string;before;_;[&amp;ArrayID] --Rnext| --^ArrayBuild| --:PowersDone| --=i|0 --=j|0 --=k|1 --=RowCount|0 --:CellOutput| --=i|[$i] + 1 --=j|[$j] + 1 --&amp;Row[$i.Raw]|[tr][&amp;Power[$j.Raw]][/tr] --=RowCount|[$RowCount] + 1 --?[$Power[$j.Raw]AltCount] -eq 0|NoAlternatePower --:CheckAlternatePowerEffect| --=i|[$i] + 1 --&amp;Row[$i.Raw]|[tr][&amp;Power[$j.Raw]Alt[$k.Raw]][/tr] --=RowCount|[$RowCount] + 1 --=k|[$k] + 1 --?[$k] -lt [$Power[$j.Raw]AltCount]|CheckAlternatePowerEffect --:NoAlternatePower| --=k|1 --?[$j] -lt [$PowerCount]|CellOutput|BeginArrayOutput --:BeginArrayOutput| --?[$ArrayCount] -eq 0|PrintPowers --=i|1 --=Array[$i.Raw]RowCount|0 --:ConstructArrayPowers| --=j|0 --:ArrayCellOutput| --=j|[$j] + 1 --=Array[$i.Raw]RowCount|[Array[$i.Raw]RowCount] + 1 --&amp;Array[$i.Raw]Row[$j.Raw]|[&amp;Array[$i.Raw]Power[$j.Raw]] --?[$j] -lt [$Array[$j.Raw]PowerCount]|ArrayCellOutput --?[$i] -eq [$ArrayCount]|PrintPowers --=i|[$i] + 1 --=Array[$i.Raw]RowCount|0 --^ConstructArrayPowers| --:PrintPowers| --=i|1 --&amp;TotalPowerOutput|[&amp;Row[$i.Raw]] --:AddRows| --=i|[$i] + 1 --?[$i] -gt [$RowCount]|PrintArrayPowers --&amp;TotalPowerOutput|[&amp;TotalPowerOutput][&amp;Row[$i.Raw]] --^AddRows| --:PrintArrayPowers| --?[$ArrayCount] -eq 0|GoToPrint --=i|1 --=j|0 --&amp;TotalArray[$i.Raw]Output|[&amp;Array[$i.Raw]Heading] --:AddArrayRows| --=j|[$j] + 1 --&amp;TotalArray[$i.Raw]Output|[&amp;TotalArray[$i.Raw]Output][&amp;Array[$i.Raw]Row[$j.Raw]] --?[$j] -eq [$Array[$i.Raw]RowCount]|CheckAdditionalArrays --^AddArrayRows| --:CheckAdditionalArrays| --?[$i] -eq [$ArrayCount]|GoToPrint --=i|[$i] + 1 --&amp;TotalArray[$i.Raw]Output|[&amp;Array[$i.Raw]Heading] --=j|0 --^AddArrayRows| --:GoToPrint| --=i|1 --+|[c][t style="width:100%; border-spacing: 1em .5em"][&amp;TotalPowerOutput][/t][/c] --?[$ArrayCount] -eq 0|Done --+|[c][t style="width:100%; border-spacing: 1em .5em"][&amp;TotalArray[$i.Raw]Output][/t][/c] --:ArrayOutputLoop| --=i|[$i] + 1 --?[$i] -gt [$ArrayCount]|Done --+|[c][t style="width:100%; border-spacing: 1em .5em"][&amp;TotalArray[$i.Raw]Output][/t][/c] --^ArrayOutputLoop| --:Done| --X| --:PowerError| --+Error|No Power Loaded. --X| }} I've bolded the section where the buttons are being constructed. Many thanks!
Kurt J. said: ScriptCards version 1.4.7 Version 1.4.7 of the script is up on the&nbsp; github &nbsp;and introduces a new roll formula: XdY!h and/or XdY!l These formulas combine exploding dice with the ability to keep the highest roll. For example: !script {{ &nbsp; --=Roll|4d6!h &nbsp; --+Roll|[$Roll] }} will roll 1d6 four times, with rolls of 6 exploding and adding back to the die roll. Each individual set of rolls is then compared to find the highest roll and that is the value returned for the total. For example: Kurt J. said: Zach said: Hello, absolutely love this script! I only have one thing stopping me from full utilization. My crew is playing Deadlands Classic and they use an exploding dice with aces and only keeping the highest. No combination of exploding (!) keeping highest (kh1} seems to result into what I need. Also, the dice can explode multiple times, every time they ace. Am I missing something or is this not possible in this system.&nbsp; Example: 4d6 rolled. Rolls are [1,3,6,6], both the 6's explode into [6+2, 6+6} the second six then explodes again [6+6+3] meaning the roll totals 15. Also, the die size can change to any other die type and still follow the rules above. Thank you Zach, &nbsp; I think I understand this, so let me ask to make sure. Even though the attribute is 4d6 (or whatever) that is just 4 chances to get a high number. My first though was that this could be done via a subroutine, but you wouldn't get the hover-over on the roll - just the highest number. For example, this will do the roll: !script {{ &nbsp; --&gt;RollDeadlandsDice|4;6;result &nbsp; --+Result|[$result] &nbsp; --X| &nbsp; --:RollDeadlandsDice|;count;sides;returnvariablename &nbsp; --=_highest|-1 &nbsp; --%_rollLoop|1;[%1%] &nbsp; &nbsp; --=_thisRoll|1d[%2%]! &nbsp; &nbsp; --?[$_thisRoll.Total] -gt [$_highest.Total]|=_highest;[$_thisRoll.Total] &nbsp; --%| &nbsp; --=[%3%]|[$_highest.Total] &nbsp; --&lt;| }} but because of the way it works, there is no way to see the details of the dice. Give me a few hours and I'll see if I can include such a roll type into the code to make it work in a more satisfactory manner. OMG you are the greatest!!! I was busy replying to your first post and then saw this one. That is perfect! Thank you so much :D
1636409823
Kurt J.
Pro
API Scripter
--?"[*R:element_type]" -eq "attack_fx" -and "[*R:attack_type]" -ne "alternative"|[ --#buttonbackground|#F3FF9B --=PowerCount|[$PowerCount] + 1 --~MacroName|string;replaceall; ;;[*R:label] --&amp;Power[$i.Raw]|[td style="width:100%;text-align:center;line-height:48px;font-weight: bold; padding: 5px"][sheetbutton][*R:label]::[*S:character_name]::[&amp;MacroName]"class="showtip" title="[*R:description][/sheetbutton][/td] --^GoToNextPower| --]| I snipped out all but one of the relevant sections. The reason you are seeing this behavior is that style replacement only happens on --+ lines, so when the --&amp;Power[$i.Raw] line executes, the [sheetbutton] text is actually included in the string variable. When the button finally gets output by including [&amp;PowerX] in a --# line, only the most recent button background color gets used. Let me ponder a bit and see if there is a workable solution I can come up with.
Ahhhh, that makes sense.&nbsp; Should I just shift the background color into the td cell? Would that work?
1636474912
Kurt J.
Pro
API Scripter
Erik M. said: Ahhhh, that makes sense.&nbsp; Should I just shift the background color into the td cell? Would that work? ScriptCards v 1.4.8&nbsp; I have update ScripCards to 1.4.8, now available on the&nbsp; github . This version adds support for setting the text and background color of buttons inline in the button's declaration, allowing multiple colors for buttons in a single line and allowing buttons stored in string variables to be colorized. When specifying a [button], [rbutton], or [sheetbutton], you can optionally include color specifiers by adding them inside the square brackets, separated by colons: [sheetbutton:#fbb640:#3333CC]Say Hello::@{selected|character_id}::Hello[/sheetbutton] The first color specifier is for the text color, and the second is for the background color. The following caveats apply: If you only include one specifier (i.e. [button:#fbb640]), the text&nbsp;color of the button will be set. If you include two specifiers, as above, the first specifier is for the text color and the second is for the background color. It is not currently possible to set the background color without also setting the text color. At this time, only hex color specifiers are supported (not color names). Hex specifiers can be either 3 digits or 6 digits (#ff0000 or #f00 for red, for example). If you have specified a buttonbackgroundimage, the colors set here will overlay the background image - not replace it. Here is a (slightly) larger example: !script {{ &nbsp; --+|[sheetbutton:#fbb640:#3333CC]Say Hello::@{selected|character_id}::Hello[/sheetbutton] &nbsp; &nbsp; &nbsp; [sheetbutton:#fff:#f00]Shout Hello::@{selected|character_id}::Hello[/sheetbutton] }} produces two buttons on the same output line with different colors:
Kurt,&nbsp; You are fantastic. This is more than I hoped for. Thanks so much!
1636499097

Edited 1636505649
Bill
Pro
Thunderwave script interacting with map tokens? I've been trying out the Thunderwave script ( link , using ScriptCards). It seems to run fine (great work!), except when the map layer includes (background) tokens (e.g. roads, trees) in the area of effect, at which point it (looks like it) tries to get the map tokens to save, and crashes the Sandbox. Thunderwave Save DC 13 ♦ Slot Level: 2 Level&nbsp; 2 &nbsp;Spell Slots Left:&nbsp; <span class="userscript-userscript-showtip userscript-tipsy" title="Roll: 1 - 1 Result: 1 - 1 " style="min-width: 1.75em ; font-family: &quot;undefined&quot; ; display: inline-block ; font-weight: bold ; height: 1em ; margin-top: -1px ; margin-bottom: 1px ; padding: 0px 2px ; border: 1px solid rgb( 135 , 133 , 10 ) ; border-radius: 3px ; background-color: rgb( 255 , 254 , 162 )">0 Damage Roll:&nbsp; <span class="userscript-userscript-showtip userscript-tipsy" title="Roll: 3d8 Result: 3d8 (3,7,2) " style="min-width: 1.75em ; font-family: &quot;undefined&quot; ; display: inline-block ; font-weight: bold ; height: 1em ; margin-top: -1px ; margin-bottom: 1px ; padding: 0px 2px ; border: 1px solid rgb( 135 , 133 , 10 ) ; border-radius: 3px ; background-color: rgb( 255 , 254 , 162 )">12 &nbsp; : &nbsp;Save&nbsp;<span class="userscript-userscript-showtip userscript-tipsy" title="Roll: 1d20 + Result: 1d20 (6) + " style="min-width: 1.75em ; font-family: &quot;undefined&quot; ; text-align: center ; display: inline-block ; font-weight: bold ; height: 1em ; margin-top: -1px ; margin-bottom: 1px ; padding: 0px 2px ; border: 1px solid rgb( 135 , 133 , 10 ) ; border-radius: 3px ; background-color: rgb( 255 , 254 , 162 )">6 <span class="userscript-userscript-showtip userscript-tipsy" title="Roll: 3d8 Result: 3d8 (3,7,2) " style="min-width: 1.75em ; font-family: &quot;undefined&quot; ; text-align: center ; display: inline-block ; font-weight: bold ; height: 1em ; margin-top: -1px ; margin-bottom: 1px ; padding: 0px 2px ; border: 1px solid rgb( 135 , 133 , 10 ) ; border-radius: 3px ; background-color: rgb( 255 , 254 , 162 )">12 &nbsp;thunder Goblin: &nbsp;Save&nbsp;<span class="userscript-userscript-showtip userscript-tipsy" title="Roll: 1d20 + 0 Result: 1d20 (7) + 0 " style="min-width: 1.75em ; font-family: &quot;undefined&quot; ; text-align: center ; display: inline-block ; font-weight: bold ; height: 1em ; margin-top: -1px ; margin-bottom: 1px ; padding: 0px 2px ; border: 1px solid rgb( 135 , 133 , 10 ) ; border-radius: 3px ; background-color: rgb( 255 , 254 , 162 )">7 12 &nbsp;thunder Goblin: &nbsp;Save&nbsp;<span class="userscript-userscript-showtip userscript-tipsy" title="Roll: 1d20 + 0 Result: 1d20 (16) + 0 " style="min-width: 1.75em ; font-family: &quot;undefined&quot; ; text-align: center ; display: inline-block ; font-weight: bold ; height: 1em ; margin-top: -1px ; margin-bottom: 1px ; padding: 0px 2px ; border: 1px solid rgb( 135 , 133 , 10 ) ; border-radius: 3px ; background-color: rgb( 255 , 254 , 162 )">16 <span class="userscript-userscript-showtip userscript-tipsy" title="Roll: 12 \ 2 Result: 12 \ 2 " style="min-width: 1.75em ; font-family: &quot;undefined&quot; ; text-align: center ; display: inline-block ; font-weight: bold ; height: 1em ; margin-top: -1px ; margin-bottom: 1px ; padding: 0px 2px ; border: 1px solid rgb( 135 , 133 , 10 ) ; border-radius: 3px ; background-color: rgb( 255 , 254 , 162 )">6 &nbsp;thunder Do I need to explicitly restrict the array to the token layer?&nbsp; --/|Get all of the tokens on the page so we can cache their positions --~|array;pagetokens;alltokens;@{selected|token_id} ... or should I be handling my map layer scenery differently? Any suggestions? Thanks, Bill
1636512549
David M.
Pro
API Scripter
Bill, you will need to check the layer property of each token. Something like: &nbsp; --~tokenid|array;getfirst;allTokens &nbsp; --?[&amp;tokenid] -eq ArrayError|End --:Loop| --?[*[&amp;tokenid]:t-layer] -ne objects|NextToken --/DO THE THINGS TO OBJECT LAYER TOKENS HERE --:NextToken| --~tokenid|array;getnext;allTokens --?[&amp;tokenid] -ne ArrayError|Loop --:End| --X|
1636542035

Edited 1636543753
Bill
Pro
David M. said: Bill, you will need to check the layer property of each token. Something like: &nbsp; --~tokenid|array;getfirst;allTokens &nbsp; --?[&amp;tokenid] -eq ArrayError|End --:Loop| --?[*[&amp;tokenid]:t-layer] -ne objects|NextToken --/DO THE THINGS TO OBJECT LAYER TOKENS HERE --:NextToken| --~tokenid|array;getnext;allTokens --?[&amp;tokenid] -ne ArrayError|Loop --:End| --X| David, Thanks for the advice and sample code! Everything works great now! Bill
Help, why am I not able to get the dice font to work?&nbsp; The die face always shows a 4.&nbsp; If I change the roll and and the dice font to a d8, it only shows J !scriptcard {{ &nbsp; --=Roll|1d6 &nbsp; --+|[d6]6[/d6] &nbsp; --+Roll|[$Roll.Total] &nbsp; --+Roll|[d6][$Roll.Total][/d6] }}
Steve,&nbsp; I think you want to use [$Roll.Raw] not [$Roll.Total] in your last line.&nbsp;
Erik, Is that a change I missed? I remember it being .Total many moons ago I even found the post where I first saw it. --:Lancer| &nbsp; &nbsp; &nbsp;--=De|1d6 &nbsp; &nbsp; &nbsp;--=Destotaux|[$Destotaux] + [$De] &nbsp; &nbsp; &nbsp;--&amp;MyText|+[d6][$De.Total][/d6] --&lt;|
1636762333
Kurt J.
Pro
API Scripter
Steve H. said: Erik, Is that a change I missed? I remember it being .Total many moons ago I even found the post where I first saw it. --:Lancer| &nbsp; &nbsp; &nbsp;--=De|1d6 &nbsp; &nbsp; &nbsp;--=Destotaux|[$Destotaux] + [$De] &nbsp; &nbsp; &nbsp;--&amp;MyText|+[d6][$De.Total][/d6] --&lt;| Yep. Version 1.3.1's referencing rewrite required a change that forced the use of ".Raw" suffix when you only want the total without all of the embedded HTML code for the crit/fumble/normal highlight. I try not to introduce breaking changes, but the advantages of the rewrite outweighed the downsides here, as it allows for nested variable name referencing which wasn't possible before the rewrite. Here are the notes from that update :&nbsp;<a href="https://app.roll20.net/forum/post/9752053/script-scriptcards-my-spiritual-successor-to-powercards/?pageforid=10137644#post-10137644" rel="nofollow">https://app.roll20.net/forum/post/9752053/script-scriptcards-my-spiritual-successor-to-powercards/?pageforid=10137644#post-10137644</a>
hi! i've been learning scriptacrd and loving it, but i can't seem to make spawn work, what am i missing? it keeps telling me that i need to select a token, but i have a selected token, there is some mistake that i don't see? thank you! !scriptcard {{ --#title|Coralli alle Caviglie --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --&gt;GetAndCheckAp| --=TotalDmg|0 --#leftsub|Immobilizza + Bleed --#rightsub| Ap Cost [$ApCost] --#emoteText|@{selected|character_name} usa [$ApCost.Total] AP per intrappolare il nemico! --:Skill| --@forselected|Spawn _name|Coralli _size|0.5 _offset|0,0.5 _targets|1 --&gt;CastSkill| --&gt;UsaAp| --&gt;PlayEffects|none;bomb-frost;none;none --&gt;ApplyDmg|@{target|token_id};1;-[$TotalDmg] --X| --:CastSkill| --=SkillAtk|( 1d6 + @{selected|totale_intelligenza} ) * 10&nbsp; --=EnemyDef|( 10 + { 0 , @{target|target|bar3|max} } kh1 ) --=SkillDmg|[$SkillAtk] / [$EnemyDef] {FLOOR} --=TotalDmg|[$TotalDamage] + [$SkillDmg] --+| Il Corallo ferisce il nemico per [$SkillDmg] danni. --&lt;| --:GetAndCheckAp| --=ApCost|60 --=ApDisp|[*S:Ap] --?[$ApCost.Total] -gt [$ApDisp.Total]|NoSlotsLeft --&lt;| --:UsaAp| --=ApDisp|[$ApDisp] - [$ApCost] --@modattr|_charid [*S:character_id] _Ap|-[$ApCost] --&lt;| --:ApplyDmg|Parametri sono: tokenid; bar#; ammontare --@token-mod|_ids [%1%] _set statusmarkers|bleed|burn bar[%2%]_value|[%3%] --&lt;| --:PlayEffects|parametri sono: Effetto dell’Origine; Effetto del Target; Effetto tra i due; Suono --vtoken|@{selected|token_id} [%1%] --vtoken|@{target|token_id} [%2%] --vbetweentokens|@{selected|token_id} @{target|token_id} [%3%] --@roll20AM|_audio,play,nomenu|[%4%] --&lt;| --:NoSlotsLeft| --+|[*S:character_name] has no Ap available. [$ApDisp.Total] Ap available. --X| }}
I want to start the Combat Master script from Scriptcards, but the sandbox crashes. I use: !script {{&nbsp; --@cmaster|_turn,start&nbsp; }} TypeError: Cannot read property 'get' of undefined at inputHandler (apiscript.js:42107:49) at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:65:16) at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:70:8) at /home/node/d20-api-server/api.js:1736: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) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:461
Hi, I used to use PowerCards a while back and I just started to look at this script for a current game of mine - I absolutely love it. I do have a request though - as you are using your own dice engine, would it be possible to include Fate/Fudge dice (4dF) as well? The Roll20 engine does them, and I would love to have them as dice images on the cards as well. For now, I can work around this (without images), as they can be emulated by d6 (actually 1d3-2), but that doesn't give me the cool looks of course, just the numbers. And of course, the tooltips of the dice rolls would also look nicer ;) (these dice are d6 with the following sides: -,-,0,0,+,+ values -1 / 0 / +1 respectively) My current workaround for 4dF is this: --=d1|1d3-2 --=d2|1d3-2 --=d3|1d3-2 --=d4|1d3-2 --=fatedice|[$d1] +[$d2] + [$d3] + [$d4] So that the players can see the roll details when hovering over the value. Dice graphics would of course give a lot more "feel" to the roll :) Regards Thomas
In Kurt's Action Menu&nbsp;script, how would I query advantage or disadvantage? I see you have it set to advantagetoggle for NPC &amp; PC..... I'm trying not to have to go back to the character sheet as much as possible.
@DM Scotty - I use a player inquiry in some of my macros if that is what you are looking for... &nbsp;&nbsp;&nbsp; &nbsp; --&amp;RollType|?{Advantage or Disadvantage?|Normal,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1}
I've tried that..... however in Kurt's script for the Character Action Menu it doesn't seem to call it each time or apply to the roll when you select an attack..
1637350023

Edited 1637350546
Zach
Pro
This has been the greatest script for me ever. I am getting its language down to par and have basically macro'd every possible thing Deadlands Classic can do to make the smoothest experience possible. I have been using a multiple button press for the initiative, which is a per round thing. One button press is the scrip DupTurn, a simple little snippet that allows the system to automatically duplicate turns and at it to the tracker. So far I am using script cards to set the token's Bar2 to how many Actions they get on the Tracker. If possible I would like to get this down to only two button presses, one to run the initiative check and duplicate the turns, and the other to deal the cards (I use DealInit) I have been using --@dup-turn|@selected|bar2} (and various other format attempts) but get the following error; So am I formatting this wrong? TypeError: Cannot read property 'forEach' of undefined TypeError: Cannot read property 'forEach' of undefined at apiscript.js:8693:26 at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:65:16) at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:70:8) at /home/node/d20-api-server/api.js:1736: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) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:461 Oh and side note, if I can get dup-turn to work, can it read script card's variables?
1637360021

Edited 1637360061
Kurt J.
Pro
API Scripter
Zach said: This has been the greatest script for me ever. I am getting its language down to par and have basically macro'd every possible thing Deadlands Classic can do to make the smoothest experience possible. I have been using a multiple button press for the initiative, which is a per round thing. One button press is the scrip DupTurn, a simple little snippet that allows the system to automatically duplicate turns and at it to the tracker. So far I am using script cards to set the token's Bar2 to how many Actions they get on the Tracker. If possible I would like to get this down to only two button presses, one to run the initiative check and duplicate the turns, and the other to deal the cards (I use DealInit) I have been using --@dup-turn|@selected|bar2} (and various other format attempts) but get the following error; So am I formatting this wrong? TypeError: Cannot read property 'forEach' of undefined TypeError: Cannot read property 'forEach' of undefined at apiscript.js:8693:26 at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:65:16) at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:70:8) at /home/node/d20-api-server/api.js:1736: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) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:461 Oh and side note, if I can get dup-turn to work, can it read script card's variables? If this is the actual line from the code :&nbsp; --@dup-turn|@selected|bar2} it is missing the { in the @{selected...} That said, I don't like leaving anything that can create a sandbox crash in the code, so I'll see if I can rectify that. Not familiar with dup-turn, but if it accepts parameters, it would be possible to pass scriptcards variables to it that way. The variables themselves would be out of scope for other APIs to access directly.
1637360208
Kurt J.
Pro
API Scripter
DM Scotty said: I've tried that..... however in Kurt's script for the Character Action Menu it doesn't seem to call it each time or apply to the roll when you select an attack.. Unfortunately, the Character Action Menu relies on advantage toggle, because it never knows (until it interprets the action) if there is a dice roll that advantage applies to included. At that point, it is too late to ask the user for input. The only alternative would be to ask the advantage question when the menu itself is displayed and save that information... but you would get that question for every use of the menu - even if you end up selecting an ability that doesn't include an attack roll.
1637360360
Kurt J.
Pro
API Scripter
tinythomas said: Hi, I used to use PowerCards a while back and I just started to look at this script for a current game of mine - I absolutely love it. I do have a request though - as you are using your own dice engine, would it be possible to include Fate/Fudge dice (4dF) as well? The Roll20 engine does them, and I would love to have them as dice images on the cards as well. For now, I can work around this (without images), as they can be emulated by d6 (actually 1d3-2), but that doesn't give me the cool looks of course, just the numbers. And of course, the tooltips of the dice rolls would also look nicer ;) (these dice are d6 with the following sides: -,-,0,0,+,+ values -1 / 0 / +1 respectively) My current workaround for 4dF is this: --=d1|1d3-2 --=d2|1d3-2 --=d3|1d3-2 --=d4|1d3-2 --=fatedice|[$d1] +[$d2] + [$d3] + [$d4] So that the players can see the roll details when hovering over the value. Dice graphics would of course give a lot more "feel" to the roll :) Regards Thomas Let me give this some thought and see how I can support it in the script. Doesn't sound difficult, but I'll need to do some reading on how fudge dice work.
1637361630
Kurt J.
Pro
API Scripter
Mads said: I want to start the Combat Master script from Scriptcards, but the sandbox crashes. I use: !script {{&nbsp; --@cmaster|_turn,start&nbsp; }} TypeError: Cannot read property 'get' of undefined at inputHandler (apiscript.js:42107:49) at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:65:16) at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:70:8) at /home/node/d20-api-server/api.js:1736: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) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:461 Scriptcards doesn't have an inputHandler function, so my guess would be that CombatMaster isn't seeing what it wants and is crashing there. I haven't used CombatMaster, but I'll try to poke around a bit. I'm assuming that "!cmaster --turn,start" works as expected?
Kurt J. said: Zach said: This has been the greatest script for me ever. I am getting its language down to par and have basically macro'd every possible thing Deadlands Classic can do to make the smoothest experience possible. I have been using a multiple button press for the initiative, which is a per round thing. One button press is the scrip DupTurn, a simple little snippet that allows the system to automatically duplicate turns and at it to the tracker. So far I am using script cards to set the token's Bar2 to how many Actions they get on the Tracker. If possible I would like to get this down to only two button presses, one to run the initiative check and duplicate the turns, and the other to deal the cards (I use DealInit) I have been using --@dup-turn|@selected|bar2} (and various other format attempts) but get the following error; So am I formatting this wrong? TypeError: Cannot read property 'forEach' of undefined TypeError: Cannot read property 'forEach' of undefined at apiscript.js:8693:26 at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:65:16) at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:70:8) at /home/node/d20-api-server/api.js:1736: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) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:461 Oh and side note, if I can get dup-turn to work, can it read script card's variables? If this is the actual line from the code :&nbsp; --@dup-turn|@selected|bar2} it is missing the { in the @{selected...} That said, I don't like leaving anything that can create a sandbox crash in the code, so I'll see if I can rectify that. Not familiar with dup-turn, but if it accepts parameters, it would be possible to pass scriptcards variables to it that way. The variables themselves would be out of scope for other APIs to access directly. No thats just a typo I constantly do 😅. It is correct in the script. Dup Turns is a small script written by the Aaron; <a href="https://app.roll20.net/forum/post/6817409/multiple-initiative-values-for-a-single-character/?pageforid=6817748" rel="nofollow">https://app.roll20.net/forum/post/6817409/multiple-initiative-values-for-a-single-character/?pageforid=6817748</a>
1637368189
Kurt J.
Pro
API Scripter
Zach said: Kurt J. said: Zach said: This has been the greatest script for me ever. I am getting its language down to par and have basically macro'd every possible thing Deadlands Classic can do to make the smoothest experience possible. I have been using a multiple button press for the initiative, which is a per round thing. One button press is the scrip DupTurn, a simple little snippet that allows the system to automatically duplicate turns and at it to the tracker. So far I am using script cards to set the token's Bar2 to how many Actions they get on the Tracker. If possible I would like to get this down to only two button presses, one to run the initiative check and duplicate the turns, and the other to deal the cards (I use DealInit) I have been using --@dup-turn|@selected|bar2} (and various other format attempts) but get the following error; So am I formatting this wrong? TypeError: Cannot read property 'forEach' of undefined TypeError: Cannot read property 'forEach' of undefined at apiscript.js:8693:26 at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:65:16) at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:70:8) at /home/node/d20-api-server/api.js:1736: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) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:461 Oh and side note, if I can get dup-turn to work, can it read script card's variables? If this is the actual line from the code :&nbsp; --@dup-turn|@selected|bar2} it is missing the { in the @{selected...} That said, I don't like leaving anything that can create a sandbox crash in the code, so I'll see if I can rectify that. Not familiar with dup-turn, but if it accepts parameters, it would be possible to pass scriptcards variables to it that way. The variables themselves would be out of scope for other APIs to access directly. No thats just a typo I constantly do . It is correct in the script. Dup Turns is a small script written by the Aaron; <a href="https://app.roll20.net/forum/post/6817409/multiple-initiative-values-for-a-single-character/?pageforid=6817748" rel="nofollow">https://app.roll20.net/forum/post/6817409/multiple-initiative-values-for-a-single-character/?pageforid=6817748</a> Looking at dup_turn, the parameter it is expecting is the number of times to duplicate the turns for the selected tokens. Because (by default) the API won't pass the selected tokens to further down API calls, it would be necessary to use a meta script like selectmanager to pass this information along to dup_turn. This line in dup_turn: msg.selected.forEach((m)=&gt;multiplyTurn(m._id,count)); is likely where the crash is happening, because without SelectManager, msg.selected will be undefined/empty, so forEach can't be called on it.
1637368428

Edited 1637394048
Zach
Pro
Makes sense. I will check out SelectManager. Thank you again.&nbsp; Edit: Just so happens scriptcards can handles duplicating turns without replacing the tokens automatically and I just missed it....whoops. So I just created a series of script blocks that utilize the turnorder;addtoken function.
Kurt J. said: Mads said: I want to start the Combat Master script from Scriptcards, but the sandbox crashes. I use: !script {{&nbsp; --@cmaster|_turn,start&nbsp; }} TypeError: Cannot read property 'get' of undefined at inputHandler (apiscript.js:42107:49) at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:65:16) at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:70:8) at /home/node/d20-api-server/api.js:1736: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) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:461 Scriptcards doesn't have an inputHandler function, so my guess would be that CombatMaster isn't seeing what it wants and is crashing there. I haven't used CombatMaster, but I'll try to poke around a bit. I'm assuming that "!cmaster --turn,start" works as expected? Yes,&nbsp; "!cmaster --turn,start" works as normal, it launches combat by rolling initiative for all selected pc and npc tokens and sorts the combat tracker. Thanks Kurt, for Scriptcards and your help.
Hello I am trying to apply the Magic Missile script for ADD2. The script works well, except for taking into account the damage of several missiles on a target. Only the damage of the last projectile received is deducted from the token's life bar. &nbsp; Can you help me please ? !script {{ &nbsp; --/|Script Name : 5E Magic Missile &nbsp; --/|Version&nbsp; &nbsp; &nbsp;: 2.0 &nbsp; --/|Requires SC : 1.4.0+, alterbars or token-mod to apply damage (Optional) &nbsp; --/|Author&nbsp; &nbsp; &nbsp; : Kurt Jaegers &nbsp; --/|Description : Handles the D&amp;D 5E spell Magic Missile, with the ability to select a dynamic &nbsp; --/|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; number of targets.&nbsp; &nbsp; --/| &nbsp; --/|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; You can optionally have damage applied to impacted tokens. The script defaults to using &nbsp; --/|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TokenMod to update Bar 3. These can be changed by altering the settings below. &nbsp; --/|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If you use one die roll for Magic Missile, update the damageMode variable below. &nbsp; --/|Set this to either "token-mod", "alterbars", or anything else to not apply damage &nbsp; --&amp;damageApplyScript|alterbars &nbsp; --/|Set this to the bar number you use to track hit points &nbsp; --&amp;hitPointsBar|1 &nbsp; --/|If damageMode is 1, a separate die will be rolled for each missile. Set this variable to 0 to,&nbsp; &nbsp; --/|only have a single damage die roll applied to each missile. &nbsp; --&amp;damageMode|1 &nbsp; --/|Magic Missile by the book does Force damage. &nbsp; --&amp;damageType|force &nbsp; --/|===================== There are no customization options below this line ===================== --#title|Projectile Magique --#sourceToken|@{selected|token_id} &nbsp; &nbsp; --=MissileCount|1 -?@{selected|level-class1} -le 2 |&gt;MissileCount1 --?@{selected|level-class1} -ge 3 -and @{selected|level-class1} -lt 5 |&gt;MissileCount2 --?@{selected|level-class1} -ge 5 -and @{selected|level-class1} -lt 7 |&gt;MissileCount3 --?@{selected|level-class1} -ge 7 -and @{selected|level-class1} -lt 9 |&gt;MissileCount4 --?@{selected|level-class1} -ge 9 |&gt;MissileCount5 &nbsp; --=OneMissileDamage|1d4+1 &nbsp; --&gt;BuildAndAskTargets|[$MissileCount.Total] &nbsp; --=DisplayCount|1 &nbsp; --=MissileDamage|0 &nbsp; --#leftsub|@{selected|class1} Niveau @{selected|level-class1} --#rightsub|Attaque à distance (max @{selected|repeating_spells-wiz1_$12_spell-range}) &nbsp; --#emoteText|@{selected|character_name} uses a level [$SlotLevel.Total] spell slot to fire [$MissileCount.Total] missiles of magical force! &nbsp; --/|Determine damage subroutine. Start by assuming we aren't going to apply damage &nbsp; --&amp;damageRoutine|DontApplyDamage &nbsp; --?[&amp;damageApplyScript] -eq "token-mod"|&amp;damageRoutine;ApplyDamageTokenmod &nbsp; --?[&amp;damageApplyScript] -eq "alterbars"|&amp;damageRoutine;ApplyDamageAlterbars &nbsp; --:MissileLoop| &nbsp; --&gt;FireMissile|[$DisplayCount.Total] &nbsp; --=DisplayCount|[$DisplayCount] + 1 &nbsp; --?[$DisplayCount] -le [$MissileCount]|MissileLoop &nbsp; --+Total|Total damage is [$MissileDamage] &nbsp; --&gt;DeductSpellSlot| &nbsp; &nbsp;--X| &nbsp; --:FireMissile| &nbsp; --&amp;ThisTarget|[&amp;target[%1%]] &nbsp; --?[&amp;damageMode] -eq 1|=ThisMissile;1d4+1|=ThisMissile;[$OneMissileDamage] &nbsp; --=MissileDamage|[$MissileDamage] + [$ThisMissile] &nbsp; --+Missile|[$DisplayCount.Total] Hits [*[&amp;ThisTarget]:character_name] for [$ThisMissile] [b]force[/b] damage &nbsp; --&gt;PlayEffects|@{selected|token_id};[&amp;ThisTarget];none;burst-smoke;beam-magic;Projectile_Magique &nbsp; --=ResultantDamage|[$ThisMissile.Raw] &nbsp; --?"[*[&amp;tokenid]:npc_immunities]" -inc "[&amp;damageType]"|Immune &nbsp; --?"[*[&amp;tokenid]:npc_resistances]" -inc "[&amp;damageType]"|Resistant &nbsp; --?"[*[&amp;tokenid]:npc_vulnerabilities]" -inc "[&amp;damageType]"|Vulnerable &nbsp; --^DoneResist| &nbsp; --:Immune| &nbsp; --=ResultantDamage|0 &nbsp; --^DoneResist| &nbsp; --:Resistant| &nbsp; --=ResultantDamage|[$ThisMissile] \ 2 &nbsp; --^DoneResist| &nbsp; --:Vulnerable| &nbsp; --=ResultantDamage|[$ThisMissile] * 2 &nbsp; --^DoneResist| &nbsp; --:DoneResist| &nbsp; --&gt;[&amp;damageRoutine]|[&amp;ThisTarget];[&amp;hitPointsBar];[$ResultantDamage.Raw] &nbsp; --&lt;| &nbsp; --:BuildAndAskTargets| &nbsp; --&amp;TargetString| &nbsp;--=targetCount|1 &nbsp; --:TargetLoop| &nbsp; --&amp;TargetString|+t;target[$targetCount.Raw];Missile [$targetCount.Raw] Target &nbsp; --=targetCount|[$targetCount.Raw] + 1 &nbsp; --?[$targetCount] -le [%1%]|&gt;AddSeparator &nbsp; --?[$targetCount] -le [%1%]|TargetLoop &nbsp; --iPlease click the button below to select magic missile targets. The same target can be selected multiple times ;Select [%1%] Targets|[&amp;TargetString] &nbsp; --/| &nbsp; --&lt;| --:MissileCount1| --=MissileCount|1 --&lt;| --:MissileCount2| --=MissileCount|2 --&lt;| --:MissileCount3| --=MissileCount|3 --&lt;| --:MissileCount4| --=MissileCount|4 --&lt;| --:MissileCount5| --=MissileCount|5 --&lt;| &nbsp; --:AddSeparator| &nbsp; --&amp;TargetString|+|| &nbsp; --&lt;| &nbsp; --/|===================== Subroutines ===================== &nbsp; --/|There are three "ApplyDamage" subroutines - one for alterbars, one for token-mod, and one to not apply damage &nbsp; --/|Token-Mod doesn't have a "set to a relative number", so we get the current bar value, subtract thedamage amount &nbsp; --/|make sure it doesn't fall below 0, and set the amount back into the bar. &nbsp; --:ApplyDamageTokenmod|Parameters are tokenid;bar#;amount &nbsp; --=newValue|[*[%1%]:t-bar[%2%]_value] - [%3%] &nbsp; --?[$newValue] -lt 0|=newValue;0 &nbsp; --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[$newValue.Raw] &nbsp; --&lt;|&nbsp; &nbsp; --/|AlterBars supports relative values for the amount parameter, so we just pass it the value with a "-" in front of it. &nbsp; --:ApplyDamageAlterbars|Parameters are tokenid;bar#;amount &nbsp; --@alter|_target|[%1%] _bar|[%2%] _amount|-[%3%] _show|none &nbsp; --&lt;| &nbsp; --/|Just a dummy routine that doesn't do anything, but it is easier to do it this way than adding logic to see if we are &nbsp; --/|skipping applying damage in the main routine. &nbsp; --:DontApplyDamage| &nbsp; --&lt;| &nbsp; --:PlayEffects|Parameters are : sourcetoken; targettoken; source effect; target effect; line effect; sound effect &nbsp; --vtoken|[%1%] [%3%] &nbsp; --vtoken|[%2%] [%4%] &nbsp; --vbetweentokens|[%1%] [%2%] [%5%] &nbsp; --@roll20AM|_audio,play,nomenu|[%6%] &nbsp; --&lt;| --:CheckSlotInformation| --=SlotsSortsTotal|[@{selected|spell-level1-total}] --=SlotsSortsRestant|[@{selected|spell-level1-remaining}] --=NbreSortPMJette|[@{selected|repeating_spells-wiz1_$12_spell-cast-value}] --?@{selected|spell-level1-remaining} -le 0 |PasDeSort --&lt;| --:PasDeSort| --#emoteText|@{selected|character_name} ne peut jeter son sort ! --X| --:DeductSpellSlot| --=NbreSortPMJette|[$NbreSortPMJette] + 1 --@setattr| _charid @{selected|character_id} _mod _repeating_spells-wiz1_$12_spell-cast-value|[$NbreSortPMJette] _silent --&lt;| }}
David M. said: Brien, I think this does what you are asking. Don't believe we can use the standard exploding dice syntax here, as you need to access the individual rolls. The following assumes that when you roll a one (and only a one), it doesn't remove itself. Sixes are re-rolled (exploding), and if a one is rolled at any later time, the highest roll (which will always be 6) is removed from the total and the user is alerted. !script {{ --&amp;rollStr| --=rollTotal|0 --=rolledOne|0 --=numRolls|0 --:Loop| --=numRolls|[$numRolls] + 1 --=thisRoll|1d6 --=rollTotal|[$rollTotal] + [$thisRoll] --&amp;rollStr|+[$thisRoll] --?[$thisRoll] -eq 1|=rolledOne;1 --?[$thisRoll] -eq 6|Loop --+Roll(s)|[&amp;rollStr] --?[$rolledOne] -eq 1 -and [$numRolls] -gt 1|[ --=droppedRoll|6 --+Dropped Roll|[$droppedRoll] --=rollTotal|[$rollTotal] - 6 --]| ​--+Total Roll|[$rollTotal] }} I've tried to get this closer to what I want, with no success.&nbsp; I'm trying to create a D6 roller that can make one D6 a wild die that explodes on a 6 (adding the total to the other dice) or drops and takes the highest roll on the other dice on a 1.&nbsp;&nbsp;
1637427144

Edited 1637427280
David M.
Pro
API Scripter
Ok I get the first part, but the rolling one part needs some clarification Examples: (1) 3d6 + 1d6(wild) 2,4,6 + 6(explodes and rolls 3) = 12+9 = 21 (2) 3d6 + 1d6(wild) 2,4,6 + 1 =&gt; drop the six = 2+4 = 6 ? (or do you still add the wild 1 to get 7?) (3) 3d6 + 1d6 (wild) 1,5,5 + 6(explodes to another 6, explodes again to a 1) = ??? (do you drop the 5 from the first three dice and add 13 to get 19?) (4) 1d6 + 1d6 (wild) 4 + 6(explodes to a 1) = ??? (5) 1d6 + 1d6 (wild) 4 + 1 = 0? or 1?
Hi, i've been using scriptcard with this code and it works great: ! script {{ --/| Script Name : 5 E Magic Missile --/| Version : 2.0 --/| Requires SC : 1.4 . 0 +, alterbars or token - mod to apply damage ( Optional ) --/| Author : Kurt Jaegers --/| Description : Handles the D &amp; D 5 E spell Magic Missile , with the ability to select a dynamic --/| number of targets . --/| --/| You can optionally have damage applied to impacted tokens . The script defaults to using --/| TokenMod to update Bar 3. These can be changed by altering the settings below . --/| If you use one die roll for Magic Missile , update the damageMode variable below . --/| Set this to either "token-mod" , "alterbars" , or anything else to not apply damage --&amp; damageApplyScript | token - mod --/| Set this to the bar number you use to track hit points --&amp; hitPointsBar | 1 --/| If damageMode is 1 , a separate die will be rolled for each missile . Set this variable to 0 to , --/| only have a single damage die roll applied to each missile . --&amp; damageMode | 1 --/| Magic Missile by the book does Force damage . --&amp; damageType | elettrico --/|===================== There are no customization options below this line ===================== --# title | Meduse --# sourceToken |@{ selected | token_id } --&gt; GetAndCheckAp --= SlotLevel | 40 --= SkillLevel |[* S : ms_4_lv ] --= MissileCount |[ $SkillLevel ] + 1 --= OneMissileDamage |[ $SkillDmg ] --&gt; BuildAndAskTargets |[ $MissileCount . Total ] --= DisplayCount | 1 --= MissileDamage | 0 --# leftsub | Ap [ $SlotLevel ] --# rightsub | Ranged Attack --# emoteText |@{ selected | character_name } usa [ $SlotLevel . Total ] AP per lanciare [ $MissileCount . Total ] meduse elettrificate ! --: GetAndCheckAp | --= ApCost | 30 --= ApDisp |[* S : Ap ] --?[ $ApCost . Total ] - gt [ $ApDisp . Total ]| NoSlotsLeft --&lt;| --/| Determine damage subroutine . Start by assuming we aren 't going to apply damag e --&amp; damageRoutine | DontApplyDamage --?[&amp; damageApplyScript ] - eq "token-mod" |&amp; damageRoutine ; ApplyDamageTokenmod --?[&amp; damageApplyScript ] - eq "alterbars" |&amp; damageRoutine ; ApplyDamageAlterbars --: MissileLoop | --&gt; FireMissile |[ $DisplayCount . Total ] --= DisplayCount |[ $DisplayCount ] + 1 --?[ $DisplayCount ] - le [ $MissileCount ]| MissileLoop --&gt; UsaAp | --# rightsub | Paralizza + Veleno -- X | --: FireMissile | --&amp; ThisTarget |[&amp; target [% 1 %]] --= SkillAtk |( 1 d4 + 1 + [* S : totale_intelligenza ] ) * 10 --= EnemyDef |( 10 + { 0 , [ * [ &amp; ThisTarget]:t - bar3_max] } kh1) --=SkillDmg|( [$SkillAtk] / [$EnemyDef] ) {FLOOR} --?[ &amp; damageMode] -eq 1|=ThisMissile;[$SkillDmg]|=ThisMissile;[$OneMissileDamage] --=MissileDamage|[$MissileDamage] + [$ThisMissile] --+Medusa|[$DisplayCount.Total]: [ $ThisMissile ] danni base . --&gt; PlayEffects |@{ selected | token_id };[&amp; ThisTarget ]; none ; bomb - holy ; none ; none --= ResultantDamage |[ $ThisMissile . Raw ] --? "[*[&amp;ThisTarget]:npc_immunities]" - inc "[&amp;damageType]" | Immune --? "[*[&amp;ThisTarget]:npc_resistances]" - inc "[&amp;damageType]" | Resistant --? "[*[&amp;ThisTarget]:npc_vulnerabilities]" - inc "[&amp;damageType]" | Vulnerable --^ DoneResist | --: Immune | --= ResultantDamage | 0 --+ La Medusa |[ $DisplayCount . Total ] colpisce con i suoi tentacoli [*[&amp; ThisTarget ]: t - name ], ma questo sembra ignorarla ! --^ DoneResist | --: Resistant | --= ResultantDamage |[ $ThisMissile ] \ 2 --+ Medusa |[ $DisplayCount . Total ] colpisce [*[&amp; ThisTarget ]: t - name ] per [ $ResultantDamage ] danni [ b ] elettrici [/ b ] --^ DoneResist | --: Vulnerable | --= ResultantDamage |[ $ThisMissile ] * 2 --+ Medusa |[ $DisplayCount . Total ] colpisce [*[&amp; ThisTarget ]: t - name ] per [ $ResultantDamage ] danni [ b ] elettrici [/ b ] --^ DoneResist | --: DoneResist | --&gt;[&amp; damageRoutine ]|[&amp; ThisTarget ];[&amp; hitPointsBar ];[ $ResultantDamage . Raw ] --&lt;| --: BuildAndAskTargets | --&amp; TargetString | --= targetCount | 1 --: TargetLoop | --&amp; TargetString |+ t ; target [ $targetCount . Raw ]; Missile [ $targetCount . Raw ] Target --= targetCount |[ $targetCount . Raw ] + 1 --?[ $targetCount ] - le [% 1 %]|&gt; AddSeparator --?[ $targetCount ] - le [% 1 %]| TargetLoop -- iPlease click the button below to select magic missile targets . The same target can be selected multiple times ; Select [% 1 %] Targets |[&amp; TargetString ] --/| --&lt;| --: AddSeparator | --&amp; TargetString |+|| --&lt;| --: NoSlotsLeft | --+|[* S : character_name ] non ha abbastanza AP . [ $ApDisp . Total ] AP disponibili . -- X | --/|===================== Subroutines ===================== --: ApplyDamageTokenmod | Parameters are tokenid ; bar #; amount --@ token - mod | _ignore - selected _ids [% 1 %] _set statusmarkers | Paralizzato | Poisoned bar [% 2 %] _value |-[% 3 %] --&lt;| --/| Just a dummy routine that doesn 't do anything, but it is easier to do it this way than adding logic to see if we ar e --/| skipping applying damage in the main routine . --: DontApplyDamage | --&lt;| --: UsaAp | --= ApDisp |[ $ApDisp ] - [ $ApCost ] --@ modattr | _charid [* S : character_id ] _Ap |-[ $ApCost ] --&lt;| --: 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 % ] --&lt;| }} but i have one problem, if i select the same target for both attacks, the target receives Twice the markers, as shown in the picture, any idea how to make a workaround to this?
@ Trendor - this is a common problem, apparently the chat cannot handle rapid calculations when selecting the same target more than once and will only apply damage on the last roll.&nbsp; Kurt solved this by having the accumulated damage of the missiles calculated first before applying the damage to the token.&nbsp;Try: !script {{&nbsp; &nbsp; --#title|Magic Missile &nbsp; --#sourceToken|@{selected|token_id} &nbsp; --#titleFontColor|#ffffff &nbsp; --#titleCardBackground|#000000 &nbsp; --#evenRowBackground|#ff0000 &nbsp; --#evenRowFontColor|#ffffff &nbsp; --#oddRowBackground|#F1C40F &nbsp; --#oddRowFontColor|#000000 &nbsp; --#debug|1 &nbsp; --~|array;define;targetarray; &nbsp; --=uniquetargetcount|0 &nbsp; --&gt;GetAndCheckSlotInformation| &nbsp; --=MissileCount|[$SlotLevel] + 2 &nbsp; --&gt;BuildAndAskTargets|[$MissileCount.Total] &nbsp; --=DisplayCount|1 &nbsp; --=MissileDamage|0 &nbsp; --#leftsub|Slot level [$SlotLevel] &nbsp; --#rightsub|Ranged Attack &nbsp; --#emoteText|@{selected|character_name} uses a level [$SlotLevel.Total] spell slot to fire [$MissileCount.Total] missiles of magical force! &nbsp; --:MissileLoop| &nbsp; --&gt;FireMissile|[$DisplayCount.Total] &nbsp; --=DisplayCount|[$DisplayCount] + 1 &nbsp; --?[$DisplayCount] -le [$MissileCount]|MissileLoop &nbsp; --+Total|Total damage is [$MissileDamage] &nbsp; --&gt;DeductSpellSlot| &nbsp; --#rightsub|Level [$SlotLevel] Left: [$SlotsRemaining]&nbsp; &nbsp; --&gt;ApplyCumulativeDamage|3 &nbsp; --X| &nbsp; --:FireMissile| &nbsp; --&amp;ThisTarget|[&amp;target[%1%]] &nbsp; --=ThisMissile|1d4 + 1 &nbsp; --=MissileDamage|[$MissileDamage] + [$ThisMissile] &nbsp; --+Missile|[$DisplayCount.Raw] Hits [*[&amp;ThisTarget]:character_name] for [$ThisMissile] [b]force[/b] damage &nbsp; --&gt;PlayEffects|@{selected|token_id};[&amp;ThisTarget];none;burst-smoke;beam-magic;spell_01 &nbsp; --&gt;AccumulateDamage|[&amp;ThisTarget];[$ThisMissile] &nbsp; --&lt;| &nbsp; --:GetAndCheckSlotInformation| &nbsp; --=SlotLevel|?{Spell Slot Level?|1|2|3|4|5|6|7|8|9} &nbsp; --=SlotsTotal|[*S:lvl[$SlotLevel]_slots_total] &nbsp; --=SlotsExpended|[*S:lvl[$SlotLevel]_slots_expended] &nbsp; --?[$SlotsExpended.Total] -ge [$SlotsTotal.Total]|NoSlotsLeft &nbsp; --&lt;| &nbsp; --:NoSlotsLeft| &nbsp; --+|[*S:character_name] has no level [$SlotLevel.Total] spell slots available. &nbsp; --X| &nbsp; --:DeductSpellSlot| &nbsp; --=SlotsExpended|[$SlotsExpended] + 1 &nbsp; --@setattr|_charid [*S:character_id] _lvl[$SlotLevel]_slots_expended|[$SlotsExpended] _silent &nbsp; --=SlotsRemaining|[$SlotsTotal] - [$SlotsExpended] &nbsp; --&lt;| &nbsp; --:PlayEffects|Parameters are : sourcetoken; targettoken; source effect; target effect; line effect; sound effect &nbsp; --vtoken|[%1%] [%3%] &nbsp; --vtoken|[%2%] [%4%] &nbsp; --vbetweentokens|[%1%] [%2%] [%5%] &nbsp; --@roll20AM|_audio,play,nomenu|[%6%] &nbsp; --&lt;| &nbsp; --:AccumulateDamage|tokenid;amount &nbsp; --=damage[%1%]|[$damage[%1%]] + [%2%] &nbsp; --~index|array;indexof;targetarray;[%1%] &nbsp; --?[&amp;index] -eq "ArrayError"|[ &nbsp; --~|array;add;targetarray;[%1%] &nbsp; --=uniquetargetcount|[$uniquetargetcount] + 1 &nbsp; &nbsp; --&lt;| &nbsp; --:ApplyCumulativeDamage|bar &nbsp; --%loop|1;[$uniquetargetcount] &nbsp; &nbsp; --&amp;thisTarget|[@targetarray([&amp;loop])] &nbsp; &nbsp; --=thisDamage|[$damage[&amp;thisTarget]] &nbsp; &nbsp; --&gt;ApplyDamageAlterbars|[&amp;thisTarget];1;-[$thisDamage] &nbsp; --%| &nbsp; --&lt;| &nbsp;&nbsp; &nbsp; --/ApplyDamageTokenmod|Parameters are tokenid;bar#;amount &nbsp; --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%] &nbsp; --&lt;| &nbsp; --:ApplyDamageAlterbars| &nbsp; --@alter|_target|[%1%] _bar|[%2%] _amount|[%3%] &nbsp; --&lt;| &nbsp; --:BuildAndAskTargets| &nbsp; --&amp;TargetString| &nbsp; --=targetCount|1 &nbsp; --:TargetLoop| &nbsp; --&amp;TargetString|+t;target[$targetCount.Raw];Missile [$targetCount.Raw] Target &nbsp; --=targetCount|[$targetCount.Total] + 1 &nbsp; --?[$targetCount.Total] -le [%1%]|&gt;AddSeparator &nbsp; --?[$targetCount.Total] -le [%1%]|TargetLoop &nbsp; --iPlease click the button below to select magic missile targets. The same target can be selected multiple times;Select [%1%] Targets|[&amp;TargetString] &nbsp; --&lt;| &nbsp; --:AddSeparator| &nbsp; --&amp;TargetString|+|| &nbsp; --&lt;| }}&nbsp;
How and where would I add in to your 5E Character Action Menu the script to check and see if the target is immune, resistant, or vulnerable and change the damage before the output?&nbsp; Also I have a crit/fumble chart that I would like to add somehow directly or have a button to roll whichever is easier.... Is that possible with they way the script is written?
Thank you Michael&nbsp;C.
1637499009

Edited 1637499050
@DM Scotty - possible suggestions for melee/range attacks: Immunities: Just after the call to --:EXEC_PC_ATTACK| display the immune condition then direct to ATTACK_DONE. Resistances: I would suggest two points, one for ease of programming the other for better display.&nbsp; The first would be to use the ATTACK_DONE sublabel as a subroutine that modifies the output of the attacks after the fact, the other a call to a subroutine you make just prior to ATTACK_ONE_DAMAGE and ATTACK_TWO_DAMAGE.&nbsp; ===================================== Fumble:&nbsp; I would change --?[$attackRoll.Base] -eq 1|ATTACK_MISS to&nbsp;&nbsp; --?[$attackRoll.Base] -eq 1|ATTACK_FUMBLE and apply your change to the new subroutine you create.&nbsp; Personally, I use a button to call the fumble routine macro but that may be the lazy way out. ===================================== I use a very simple Fumble macro:&nbsp; !roll20AM --audio,play,nomenu|( NAME OF AUDIO FILE HERE) !scriptcards {{ &nbsp; --#sourceToken|@{selected|token_id} &nbsp; --#targetToken|@{target|token_id} &nbsp; --#title|[*S:character_name] &nbsp; --#emoteText|[*S:character_name] Blows It! &nbsp; --&amp;FColor1|#F56FAD &nbsp; --&amp;FColor2|#F7DC6F &nbsp; --&amp;FColor3|#3F0713 &nbsp; --&amp;BColor1|#ff0000 &nbsp; --&amp;BColor2|#ffff00 &nbsp; --&amp;BColor3|#9D84B7 &nbsp; --#emoteBackground|[&amp;BColor3] &nbsp; --#emoteFontColor|#&amp;FColor3] &nbsp; --#titlecardbackground|[&amp;BColor1] &nbsp; --#titlecardbackgroundimage|linear-gradient(to bottom, [&amp;BColor1], [&amp;BColor2]) &nbsp; --#titleFontColor|#F7DC6F &nbsp; --#titlefontsize|2.0em &nbsp; --#titlefontlineheight|1.2em &nbsp; --#titlefontface|Times &nbsp; --#subtitleFontColor|#000000 &nbsp; --#norollhighlight|0 &nbsp; --#hideTitleCard|0 &nbsp; --#bodyfontsize|15px &nbsp; --#bodyfontface|Times &nbsp; --#oddrowbackground|#F78812 &nbsp; --#oddrowfontcolor|#ffffff &nbsp; --#evenrowbackground|#ffff00 &nbsp; --#evenrowfontcolor|#000000 &nbsp; --#buttonbackground|[&amp;BColor3] &nbsp; --#buttontextcolor|[&amp;FColor3] &nbsp; --#buttonbordercolor|[&amp;BColor2] &nbsp; --#buttonfontsize|small &nbsp; --#buttonfontface|Times &nbsp; --#debug|1 --&gt;SECTION_HEADER|FUMBLE! &nbsp; --+|[img] <a href="https://media.giphy.com/media/ylyUQmwDTvJ8rEaZrO/giphy.gif[/img]" rel="nofollow">https://media.giphy.com/media/ylyUQmwDTvJ8rEaZrO/giphy.gif[/img]</a> &nbsp; --=FumbleType|?"Weapon, Saving Throw, Skill Check? |Attack,1|Save,2|Check,3} &nbsp; --c[$FumbleType]|1:Weapon &nbsp; --=Random|1d20 &nbsp; --?[$Random] -le 2|Weapon Break &nbsp; --?[$Random] -le 4|Goodbye Fair Blade &nbsp; --?[$Random] -le 6|Wild Swing &nbsp; --?[$Random] -le 8|Stuck Weapon &nbsp; --?[$Random] -le 10|Ooops! &nbsp; --?[$Random] -le 12|Self Inflicted Wound &nbsp; --?[$Random] -le 14|Slip Up &nbsp; --?[$Random] -eq 15|Pulled Leg Muscle &nbsp; --?[$Random] -eq 16|Pulled Arm Muscle &nbsp; --?[$Random] -eq 17|Loss of Nerve &nbsp; --?[$Random] -eq 18|Broken Item &nbsp; --?[$Random] -le 20|A Little Accident &nbsp; --:Weapon Break| &nbsp; &nbsp; &nbsp;--+|The force of your blow, or parrying that of your opponent’s, causes your weapon to snap in two.&nbsp; &nbsp; &nbsp; &nbsp;--+|[#006400](For magical weapons roll an additional d10, on a 1 they break).[/#] &nbsp; --^EndMacro| &nbsp; --:Goodbye Fair Blade| &nbsp; &nbsp; &nbsp;--=SaveRoll|1d20 [BASE] + [*S:athletics_bonus] [SKILLMOD]&nbsp; &nbsp; &nbsp; &nbsp;--?[$SaveRoll] -lt 15|Fail &nbsp; &nbsp; &nbsp;--+|[#006400]Wow!&nbsp; [*S:character_name] got lucky and barely missed tossing the weapon away![/#] &nbsp; --^EndMacro| &nbsp; &nbsp; &nbsp;--:Fail| &nbsp; &nbsp; &nbsp; &nbsp; --=Direction|1d8 &nbsp; &nbsp; &nbsp; &nbsp; --c[$Direction]|1:&amp;North;Northern|2:&amp;North;NorthEastern|3:&amp;North;Eastern|4:&amp;North;Southeastern|5:&amp;North;Southern|6:&amp;North;Southwestern|7:&amp;North;Western|8:&amp;North;Northwestern &nbsp; &nbsp; &nbsp; &nbsp; --+|[#0000FF]Ow! The weapon flies [[1d12]] feet out of [*S:character_name]'s hand in a [&amp;North] direction.[/#]&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --+|[#006400]If [*S:character_name] has any movement and a bonus action left they can go and pick it up. (Does not avoid opportunity attacks from anyone in the area.) If available, they can use a bonus action to draw a second weapon.[/#] &nbsp; --^EndMacro| &nbsp; --:Wild Swing| &nbsp; &nbsp; &nbsp;--+|You overextend yourself going for the kill. Your opponent gains advantage on their next attack roll.&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;--@token-mod| _ignore|selected _ids @{target|token_id} _set statusmarkers|Advantage &nbsp; --^EndMacro| &nbsp; --:Stuck Weapon| &nbsp; &nbsp; &nbsp;--=SaveRoll|1d20 [BASE] + [*S:strength_bonus] [SKILLMOD]&nbsp; &nbsp; &nbsp; &nbsp;--=DC|[*S:strength_mod] + 8 &nbsp; &nbsp; &nbsp;--+|[*S:character_name]'s weapon gets stuck in [*T:character_name]’s shield, armour, hide, or else in a tree or wall, or the ground.&nbsp; &nbsp; &nbsp; &nbsp;--+|[#006400]Strength Check! Roll a Strength check to see if [*S:character_name] can free it using a bonus action. The DC is [$DC].[/#] &nbsp; --^EndMacro| &nbsp; --:Ooops!| &nbsp; &nbsp; &nbsp;--+|[c][b][*S:character_name] Hit an Unintended Foe in Combat! [/c][/b] &nbsp; &nbsp; &nbsp;--+|[*S:character_name] may choose any combatant in range &amp; roll a second attack roll (at disadvantage) as if they were the intended target. (Sneak attack does not apply for Rogues).&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;--+|If no other combatant within range, nothing further happens. &nbsp; --^EndMacro| &nbsp; --:Self Inflicted Wound| &nbsp; &nbsp; &nbsp;--+|[*S:character_name] misses and manages to slice/bang/clip/bark/bite him or herself with their own weapon.&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;--+|Roll Normal Damage and take Half. (Sneak attack does not apply for Rogues). &nbsp; --^EndMacro| &nbsp; --:Slip Up| &nbsp; &nbsp; &nbsp;--=SaveRoll|1d20 [BASE] + [*S:athletics_bonus] [SKILLMOD]&nbsp; &nbsp; &nbsp; &nbsp;--?[$SaveRoll] - ge 15|SlipSave &nbsp; &nbsp; &nbsp;--+|[*S:character_name] lost their footing and fell prone. The turn has ended and melee attacks have advantage against [*S:character_name]. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --@token-mod| _ids [*S:t_id] _set statusmarkers|Prone|red &nbsp; --&lt;| &nbsp; &nbsp; &nbsp;--:SlipSave| &nbsp; &nbsp; &nbsp; &nbsp; --|Whew! [*S:character_name] almost lost their footing! &nbsp; --^EndMacro| &nbsp; --:Pulled Arm Muscle| &nbsp; &nbsp; &nbsp;--=SaveRoll|1d20 [BASE] + [*S:constitution_bonus] [SKILLMOD]&nbsp; &nbsp; &nbsp; &nbsp;--?[$SaveRoll] - ge 15|PullSave &nbsp; &nbsp; &nbsp;--+|The strain of [*S:character_name]'s attack causes them to pull a muscle in their upper body.&nbsp; &nbsp; &nbsp; &nbsp;--+|[*S:character_name] has disadvantage in attack rolls and ability checks until completing three long rests or receiving magical healing. &nbsp; &nbsp; &nbsp;--@token-mod| _ids [*S:t_id] _set statusmarkers|Disadvantage &nbsp; --&lt;| &nbsp; &nbsp; &nbsp;--:PullSave| &nbsp; &nbsp; &nbsp; &nbsp; --|Whew! [*S:character_name] almost pulled a muscle! &nbsp; --^EndMacro| &nbsp; --:Pulled Leg Muscle|&nbsp; &nbsp; &nbsp; &nbsp;--=SaveRoll|1d20 [BASE] + [*S:consitution_bonus] [SKILLMOD]&nbsp; &nbsp; &nbsp; &nbsp;--?[$SaveRoll] - ge 15|PullSave &nbsp; &nbsp; &nbsp;--+|The Strain of Combat Causes [*S:character_name] to Pull a Leg Muscle!&nbsp; &nbsp; &nbsp; &nbsp;--+|[*S:character_name]'s movement is halved, loses their dex modifier to AC and initiative and has disadvantage on any ability checks that require lower body strength. &nbsp; &nbsp; &nbsp;--+|[*S:character_name] requires 3 completed long rests or receive magical healing to return to normal functioning. &nbsp; &nbsp; &nbsp;--=Speed|[*S:speed] \ 2 &nbsp; &nbsp; &nbsp;--@setattr| _charid @{selected|character_id} _speed|[$Speed] _silent &nbsp; --^EndMacro| &nbsp; --:Loss of Nerve| &nbsp; &nbsp; &nbsp;--=SaveRoll|1d20 [BASE] + [*S:wisdom_bonus] [SKILLMOD]&nbsp; &nbsp; &nbsp; &nbsp;--=DC|@{target|hp} \ @{selected|hp} * 4 &nbsp; &nbsp; &nbsp;--?[$SaveRoll] - ge [$DC]|NerveSave &nbsp; &nbsp; &nbsp;--+|Man your opponent looks tough. Unless immune to fear, [*S:character_name] is frightened.&nbsp; &nbsp; &nbsp; &nbsp;--+|After one turn [*S:character_name] can attempt a WIS saving throw vs. DC [$DC]. &nbsp; &nbsp; &nbsp;--@token-mod| _ids [*S:t_id] _set statusmarkers|Frightened|red &nbsp; --&lt;| &nbsp; &nbsp; &nbsp;--:NerveSave| &nbsp; --^EndMacro| &nbsp; --:Broken Item| &nbsp; &nbsp; &nbsp;--+|In the hurly burly of combat, something fragile – like a magic potion – [*S:character_name] is carrying breaks (DM's choice.).&nbsp; &nbsp; --^EndMacro| &nbsp; --:A Little Accident| &nbsp; &nbsp; &nbsp;--+|[#006400]Either through fear, excitement or simply needing to go:[/#] &nbsp; &nbsp; &nbsp;--+|[c][b][*S:character_name] soils him or herself![/b][/c] &nbsp; --:EndMacro| &nbsp; --X| &nbsp; --:PROCEDURES| &nbsp; &nbsp; --:SECTION_HEADER|Title &nbsp; --&amp;hdrstyle_T|style="width:100%;padding:1px;border-spacing:0px;border-collapse:collapse;text-shadow: 0px 0px 0px [&amp;BColor1];border:1px solid [&amp;FColor2];" &nbsp; --&amp;hdrstyle_TR|style="border:0px solid [&amp;FColor2];" &nbsp; --&amp;hdrstyle_TD|style="width:100%;background-color:[&amp;BColor3]; color:[&amp;FColor3]; font-size:110%;font-weight:bold;text-align:center" &nbsp; --+|[t [&amp;hdrstyle_T]][tr [&amp;hdrstyle_TR]][td [&amp;hdrstyle_TD]][c][%1%][/c][/td][/tr][/t] &nbsp; --&lt;| }}
1637499263
Kurt J.
Pro
API Scripter
Mads said: Kurt J. said: Mads said: I want to start the Combat Master script from Scriptcards, but the sandbox crashes. I use: !script {{&nbsp; --@cmaster|_turn,start&nbsp; }} TypeError: Cannot read property 'get' of undefined at inputHandler (apiscript.js:42107:49) at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:65:16) at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:70:8) at /home/node/d20-api-server/api.js:1736: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) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:461 Scriptcards doesn't have an inputHandler function, so my guess would be that CombatMaster isn't seeing what it wants and is crashing there. I haven't used CombatMaster, but I'll try to poke around a bit. I'm assuming that "!cmaster --turn,start" works as expected? Yes,&nbsp; "!cmaster --turn,start" works as normal, it launches combat by rolling initiative for all selected pc and npc tokens and sorts the combat tracker. Thanks Kurt, for Scriptcards and your help. It sounds like this is the same issue that Zach is hitting with dup_turn. It looks like tha combat master command relies on selected tokens, so it will be necessary to use something like SelectManager to get the selected tokens to pass from ScriptCards to Combat Master.
1637499735

Edited 1637499778
Kurt J.
Pro
API Scripter
ScriptCards v 1.4.9 - The Fudge Dice Update Version 1.4.9 of ScriptCards is now available on the&nbsp; github . This version includes: Support for Fudge dice rolling. These dice have "+", "-", or blank sides. The rolling format is "XdF" (for example, 4dF). The numeric final result of the roll is determined by treating blanks as 0, "-" as -1, and "+" as +1. The .Text property of the roll (and the hover-over text) will include "[ ]", "[-]" and "[+]" representations for each die. Quick example: !script {{&nbsp; &nbsp; --=Roll|4dF &nbsp; --+Roll|[$Roll] [$Roll.Text] }} gives results like this: Edit : if no issues are uncovered, I'll likely prompt 1.4.9 to OneClick in the near future. tinythomas said: Hi, I used to use PowerCards a while back and I just started to look at this script for a current game of mine - I absolutely love it. I do have a request though - as you are using your own dice engine, would it be possible to include Fate/Fudge dice (4dF) as well? The Roll20 engine does them, and I would love to have them as dice images on the cards as well. For now, I can work around this (without images), as they can be emulated by d6 (actually 1d3-2), but that doesn't give me the cool looks of course, just the numbers. And of course, the tooltips of the dice rolls would also look nicer ;) (these dice are d6 with the following sides: -,-,0,0,+,+ values -1 / 0 / +1 respectively) My current workaround for 4dF is this: --=d1|1d3-2 --=d2|1d3-2 --=d3|1d3-2 --=d4|1d3-2 --=fatedice|[$d1] +[$d2] + [$d3] + [$d4] So that the players can see the roll details when hovering over the value. Dice graphics would of course give a lot more "feel" to the roll :) Regards Thomas
@Michael C, I really appreciate the guidance and assistance!!!
1637960910

Edited 1637961147
Kurt J. said: ScriptCards v 1.4.9 - The Fudge Dice Update Version 1.4.9 of ScriptCards is now available on the&nbsp; github . This version includes: Support for Fudge dice rolling. These dice have "+", "-", or blank sides. The rolling format is "XdF" (for example, 4dF). The numeric final result of the roll is determined by treating blanks as 0, "-" as -1, and "+" as +1. The .Text property of the roll (and the hover-over text) will include "[ ]", "[-]" and "[+]" representations for each die. Thanks a lot for implementing this, it makes my scripts a lot more readable and simpler... If I could suggest one more (tiny) thing: the usual representation (as roll20 does in its roller) of a 4dF result would be "0","-" and "+", so the tooltip over [[4dF]] would be something like (00+-) or (0-++) - it doesn't really make a big difference and it works either way, but to my eye this is a bit easier to read. Screenshot example from the roll20 internal dice roller: Kind regards Thomas
1637970302

Edited 1637970329
Kurt J.
Pro
API Scripter
tinythomas said: Kurt J. said: ScriptCards v 1.4.9 - The Fudge Dice Update Version 1.4.9 of ScriptCards is now available on the&nbsp; github . This version includes: Support for Fudge dice rolling. These dice have "+", "-", or blank sides. The rolling format is "XdF" (for example, 4dF). The numeric final result of the roll is determined by treating blanks as 0, "-" as -1, and "+" as +1. The .Text property of the roll (and the hover-over text) will include "[ ]", "[-]" and "[+]" representations for each die. Thanks a lot for implementing this, it makes my scripts a lot more readable and simpler... If I could suggest one more (tiny) thing: the usual representation (as roll20 does in its roller) of a 4dF result would be "0","-" and "+", so the tooltip over [[4dF]] would be something like (00+-) or (0-++) - it doesn't really make a big difference and it works either way, but to my eye this is a bit easier to read. Screenshot example from the roll20 internal dice roller: Kind regards Thomas I updated the background text for the dice as you suggested (0,-,+). It is on the github as 1.4.9a and will likely go to OneClick next week.
1637976488
timmaugh
Pro
API Scripter
Not sure if it will matter in this usage, but I found a problem with exploding-penetrating fate dice when I was coding up the libInline library. Basically, a -2 is possible in that case, but that isn't reportable with only - (-1), 0 (0), and + (+1). I solved it by adding another character, =, to represent -2.
I am getting a strange failure and I am sure I am missing something foolish but I have been staring at it too long.&nbsp; When I access the following code block --&gt;Library_CheckEdge|4 --:Library_CheckEdge|Cost &nbsp; &nbsp;--=EdgeUsing|[%1%] &nbsp; &nbsp; --=current|[*S:currEdge] &nbsp; &nbsp; --?[$EdgeUsing] -gt [$current]|NotEnoughEdge &nbsp; &nbsp; --=currEdge|[$current] - [$EdgeUsing] &nbsp; &nbsp; --@setattr|_silent _charid [*S:character_id] _currEdge|[$currEdge] --&lt;| &nbsp; &nbsp; --:NotEnoughEdge| --+[*S:personal-alias]| doesn't have that much Edge --X| I get the following failure and it will not branch to NotEnoughEdge "ScriptCards Error: Label NotEnoughEdge&nbsp; &lt;span style=\"white-space: pre\"&gt;\t&lt;/span&gt; is not defined on line 13" If I have the exact same code block but I add it to the end of my card, it works perfectly. To make it even more confusing, other subroutines in the same Library access NotEnoughEdge just fine, with no problems.&nbsp; Only this block fails. An example of a code block that works: &nbsp;--:Library_PlusOne| &nbsp; &nbsp; --#title|Add One to a Die &nbsp; &nbsp; --#whisper| &nbsp; &nbsp; --IFurther Info ;Enter|q;RerollDice;How many pluses are you adding?||q;BuyHits;How many successes does this add? &nbsp; &nbsp; --=RerollDieCount|[&amp;RerollDice] &nbsp; &nbsp; --=EdgeUsing|[$RerollDieCount] * 2 &nbsp; &nbsp; --=current|[*S:currEdge] &nbsp; &nbsp; --?[$EdgeUsing] -gt [$current]|NotEnoughEdge
1638059111
Kurt J.
Pro
API Scripter
Steve H. said: I am getting a strange failure and I am sure I am missing something foolish but I have been staring at it too long.&nbsp; When I access the following code block --&gt;Library_CheckEdge|4 --:Library_CheckEdge|Cost &nbsp; &nbsp;--=EdgeUsing|[%1%] &nbsp; &nbsp; --=current|[*S:currEdge] &nbsp; &nbsp; --?[$EdgeUsing] -gt [$current]|NotEnoughEdge &nbsp; &nbsp; --=currEdge|[$current] - [$EdgeUsing] &nbsp; &nbsp; --@setattr|_silent _charid [*S:character_id] _currEdge|[$currEdge] --&lt;| &nbsp; &nbsp; --:NotEnoughEdge| --+[*S:personal-alias]| doesn't have that much Edge --X| I get the following failure and it will not branch to NotEnoughEdge "ScriptCards Error: Label NotEnoughEdge&nbsp; &lt;span style=\"white-space: pre\"&gt;\t&lt;/span&gt; is not defined on line 13" If I have the exact same code block but I add it to the end of my card, it works perfectly. To make it even more confusing, other subroutines in the same Library access NotEnoughEdge just fine, with no problems.&nbsp; Only this block fails. An example of a code block that works: &nbsp;--:Library_PlusOne| &nbsp; &nbsp; --#title|Add One to a Die &nbsp; &nbsp; --#whisper| &nbsp; &nbsp; --IFurther Info ;Enter|q;RerollDice;How many pluses are you adding?||q;BuyHits;How many successes does this add? &nbsp; &nbsp; --=RerollDieCount|[&amp;RerollDice] &nbsp; &nbsp; --=EdgeUsing|[$RerollDieCount] * 2 &nbsp; &nbsp; --=current|[*S:currEdge] &nbsp; &nbsp; --?[$EdgeUsing] -gt [$current]|NotEnoughEdge I would suggest copy/pasting the text of your macro to Notepad and then back into Roll20. That looks like the Roll20 editor adding extraneous HTML to the text.
Kurt J. said: Steve H. said: I am getting a strange failure and I am sure I am missing something foolish &nbsp; I would suggest copy/pasting the text of your macro to Notepad and then back into Roll20. That looks like the Roll20 editor adding extraneous HTML to the text. No luck. &nbsp;I always do all my writing in notepad and then copy it. &nbsp;I rewrote in then copied it back in again and no luck. &nbsp;It’s a minor problem that I can work around but I do hate things I can’t figure out.&nbsp;
@Steve H. I know it's simplistic but if Kurt's fix did not work I would next suspect that a non-alphanumeric symbol was the problem.&nbsp; I can't tell from your post but it seems like you may have swapped a (for example) "/" for a "|" or a "/" is replaced by a "\" or some such.&nbsp; Sometimes also, a shift-character appears the same on the screen as a character but is not recognized as such in ASCII.&nbsp; These are just "old school" resolutions that may not be the issue but sometimes we still encounter them.&nbsp;&nbsp;