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

1634123417
David M.
Pro
API Scripter
Matt, does this work for you? You shouldn't need the AttackBase variable. I hardcoded the attack mods for demonstration purposes and added tooltip identifiers in the AttackRoll definition as well. --&AttackBonus|5 --&Prof|3 --=AttackRoll|2d20kh1[BASE] +[&AttackBonus][STR] + [&Prof][PROF] --+Attack Roll|[$AttackRoll] --?[$AttackRoll.Base] -eq 20|Crit --?[$AttackRoll.Base] -eq 1|Fumble --?[$AttackRoll.Total] -ge @{target|npc_AC}|>Hit|>Miss
Is there any way scriptcards can change the color code or page location of the Token Action bar?
1634156992

Edited 1634157023
Hi everyone,    Asking my question again from yesterday. Does anyone know how to make the attack prompt so it automatically does damage correctly to creatures that have vulnerabilities/resistances/immunities to  Bludgeoning, Piercing, and Slashing from Nonmagical Attacks that aren't Silvered?
From what I know, there is no way an API can change this. BUT... If you use Stylus, a web browser add on. You can make some changes to location and other things for esthetic purposes... Check out this forum...&nbsp; <a href="https://app.roll20.net/forum/post/7841113/show-off-your-style-2-the-stylening/?pagenum=1" rel="nofollow">https://app.roll20.net/forum/post/7841113/show-off-your-style-2-the-stylening/?pagenum=1</a> mine look something like this.
Yes!&nbsp; That works great.&nbsp; Exactly what I wanted.&nbsp; And simplified my steps a little too.&nbsp; Thanks David. David M. said: Matt, does this work for you? You shouldn't need the AttackBase variable. I hardcoded the attack mods for demonstration purposes and added tooltip identifiers in the AttackRoll definition as well. --&amp;AttackBonus|5 --&amp;Prof|3 --=AttackRoll|2d20kh1[BASE] +[&amp;AttackBonus][STR] + [&amp;Prof][PROF] --+Attack Roll|[$AttackRoll] --?[$AttackRoll.Base] -eq 20|Crit --?[$AttackRoll.Base] -eq 1|Fumble --?[$AttackRoll.Total] -ge @{target|npc_AC}|&gt;Hit|&gt;Miss
1634163416
Kurt J.
Pro
API Scripter
Asmodeus said: Hi everyone, &nbsp; &nbsp;Asking my question again from yesterday. Does anyone know how to make the attack prompt so it automatically does damage correctly to creatures that have vulnerabilities/resistances/immunities to&nbsp; Bludgeoning, Piercing, and Slashing from Nonmagical Attacks that aren't Silvered? There is code in the sample spell scripts at&nbsp; the GitHub repo &nbsp;that handles this. Any of the scripts would work as a starting point, and all include a configurable setting for how to apply the damage (token-mod, alterbar or don't apply damage). It handles the damage modification cases as well.
1634163494
Kurt J.
Pro
API Scripter
BilBo 2 said: From what I know, there is no way an API can change this. BUT... If you use Stylus, a web browser add on. You can make some changes to location and other things for esthetic purposes... Check out this forum...&nbsp; <a href="https://app.roll20.net/forum/post/7841113/show-off-your-style-2-the-stylening/?pagenum=1" rel="nofollow">https://app.roll20.net/forum/post/7841113/show-off-your-style-2-the-stylening/?pagenum=1</a> mine look something like this. Yep, unfortunately none of this is exposed to the API. The stylus stuff is great, though. So much so that until BilBo 2 posted I kinda forgot that wasn't the default for Roll20 :)
@Kurt - thanks! That was just what the doctor ordered!
1634165778
Kurt J.
Pro
API Scripter
Michael C. said: @Kurt - thanks! That was just what the doctor ordered! One important note is that unless your players &nbsp;install it with the same configuration, they won't see the changes... They will continue to see the old styles. There are some other cool styles in that thread (like styling the handouts after the D&amp;D 5E look) but since each user has to set them up, I never went with anything except making the game look better for me.
Formatting question when using rbutton Is there a way to set the formatting so that when using rbutton the rows are contiguous without the break?&nbsp; I do have this in the reentrant subroutine, which prevents the duplicate emote and title card. &nbsp; &nbsp; --#HideTitleCard|yes &nbsp; &nbsp; --#emoteState|hidden But I'm hoping there is a way to make this look like all one block.
Asmodeus said: Hi everyone, &nbsp; &nbsp;Asking my question again from yesterday. Does anyone know how to make the attack prompt so it automatically does damage correctly to creatures that have vulnerabilities/resistances/immunities to&nbsp; Bludgeoning, Piercing, and Slashing from Nonmagical Attacks that aren't Silvered? Here is what I use in my Weapon Attacks to check for that. &nbsp; &nbsp; --?"[*@{target|token_id}:npc_immunities]" -inc "[&amp;damageType]" -and [&amp;Magical] -eq "no"|&gt;Immune &nbsp; &nbsp; --?"[*@{target|token_id}:npc_resistances]" -inc "[&amp;damageType]" -and [&amp;Magical] -eq "no"|&gt;Resistant Earlier in the scriptcard, I have a section to define the base damage type of the weapons and whether the weapon is magical. --&amp;damagename|Weapon --=DamageDice|1 --&amp;DamageDieType|10 --&amp;damageType|slashing&nbsp; --&amp;Magical|yes &nbsp; --=MagicLvl|0
The issue is that, because the script ends before the rbuttons are used, that's the end of it. Anyone and everyone can run additional content through the chat box that could get shoved in between where the first block ends and where the second block begins. Matt M. said: Formatting question when using rbutton Is there a way to set the formatting so that when using rbutton the rows are contiguous without the break?&nbsp; I do have this in the reentrant subroutine, which prevents the duplicate emote and title card. &nbsp; &nbsp; --#HideTitleCard|yes &nbsp; &nbsp; --#emoteState|hidden But I'm hoping there is a way to make this look like all one block.
Hey all,&nbsp; I'm having some trouble wrapping my head around button formatting.&nbsp; In my Mutants &amp; Masterminds game, I want action buttons to have a cool little comic-booky explosion text box around the button text, but the CSS either isn't working like I thought I knew or (more likely) my basic CSS knowledge is super wrong.&nbsp; This is my formatting and a button.&nbsp; &nbsp; --#buttonFontSize|large &nbsp; --#buttonbackgroundimage|url(<a href="https://s3.amazonaws.com/files.d20.io/images/251120382/5mwaTtf_7BKL9X57MZql3w/original.png?16345951375);background-size" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/251120382/5mwaTtf_7BKL9X57MZql3w/original.png?16345951375);background-size</a>: 100%; width:96px; height: 64px; object-fit: contain &nbsp; --#buttontextcolor|black &nbsp; --#buttonbackground|#FFFFFF --+| [sheetbutton]Power Name::GenericMacro::NothingToSeeHere"class="showtip" title="Some Tooltip About the Power[/sheetbutton]&nbsp; What I am trying to do is re-size the button and then have the text within the button centered or moved around so it is in the white space of the "explosion" Here is what it looks like now. Any help would be most appreciated. Thanks!
1634602828
Kurt J.
Pro
API Scripter
Erik M. said: Hey all,&nbsp; I'm having some trouble wrapping my head around button formatting.&nbsp; In my Mutants &amp; Masterminds game, I want action buttons to have a cool little comic-booky explosion text box around the button text, but the CSS either isn't working like I thought I knew or (more likely) my basic CSS knowledge is super wrong.&nbsp; This is my formatting and a button.&nbsp; &nbsp; --#buttonFontSize|large &nbsp; --#buttonbackgroundimage|url(<a href="https://s3.amazonaws.com/files.d20.io/images/251120382/5mwaTtf_7BKL9X57MZql3w/original.png?16345951375);background-size" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/251120382/5mwaTtf_7BKL9X57MZql3w/original.png?16345951375);background-size</a>: 100%; width:96px; height: 64px; object-fit: contain &nbsp; --#buttontextcolor|black &nbsp; --#buttonbackground|#FFFFFF --+| [sheetbutton]Power Name::GenericMacro::NothingToSeeHere"class="showtip" title="Some Tooltip About the Power[/sheetbutton]&nbsp; What I am trying to do is re-size the button and then have the text within the button centered or moved around so it is in the white space of the "explosion" Here is what it looks like now. Any help would be most appreciated. Thanks! Since the button is actually an HTML A (link) element, you'll need to use a Display tag to center the text. Here is one I have that looks to be working for me: !script {{ --#buttonFontSize|0.8em --#buttonbackgroundimage|url(<a href="https://s3.amazonaws.com/files.d20.io/images/251120382/5mwaTtf_7BKL9X57MZql3w/original.png?16345951375" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/251120382/5mwaTtf_7BKL9X57MZql3w/original.png?16345951375</a>); background-size:96px 64px; display: table-cell; width:96px; height:64px; --#buttontextcolor|black --#buttonbackground|#FFFFFF --+|[button]Slam::GenericMacro[/button] }} I lowered the font size so it fits inside the button. Besides setting display to table-cell, I changed the background-size to match the desired size (which should also match width and height). I'm just using a regular button here because I didn't have a sheet set up to test macros with, but the same thing should apply for sheetbuttons.
I think I found a bug in the procedure named "Lib5E_FindResource" (which is part of the library named "dnd5elib"). Can anyone confirm that this is an actual bug, and not just me doing something wrong? How to reproduce the bug: 1) Install the dnd5elib library (see the instructions in the ScriptCards wiki). 2) Use this code. !scriptcard{{ &nbsp; +++dnd5elib+++ &nbsp; --#sourceToken|@{selected|token_id} &nbsp; --&amp;ResName|bbb &nbsp; --&gt;Lib5E_FindResource|[*S:character_id];[&amp;ResName];ResNameAddress;ResValueAddress &nbsp;&nbsp; &nbsp; --+The name of the found resource is |[*S:[&amp;ResNameAddress]] &nbsp; --+The value of the found resource is |[*S:[&amp;ResValueAddress]] }} 3) Use that code with a test-character that has the following resources (they're on the right side of the character sheet, directly under where it says "flaws"). . . . . . And then, you should see on the output card that the resource named "aaa" is found by the code, rather than the resource named "bbb" (which is what the code should have been finding). By the way, this resource-slot is the only resource-slot that this bug occurs with. Or, in other words, this bug only happens when I search for a resource that is stored within the slot named "other_resource".
Kurt J. said: Since the button is actually an HTML A (link) element, you'll need to use a Display tag to center the text. Here is one I have that looks to be working for me: !script {{ --#buttonFontSize|0.8em --#buttonbackgroundimage|url(<a href="https://s3.amazonaws.com/files.d20.io/images/251120382/5mwaTtf_7BKL9X57MZql3w/original.png?16345951375" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/251120382/5mwaTtf_7BKL9X57MZql3w/original.png?16345951375</a>); background-size:96px 64px; display: table-cell; width:96px; height:64px; --#buttontextcolor|black --#buttonbackground|#FFFFFF --+|[button]Slam::GenericMacro[/button] }} I lowered the font size so it fits inside the button. Besides setting display to table-cell, I changed the background-size to match the desired size (which should also match width and height). I'm just using a regular button here because I didn't have a sheet set up to test macros with, but the same thing should apply for sheetbuttons. You are awesome. Back to my CSS tutorial!
1634763494

Edited 1634763676
Turnorder Usage: I am trying to use the turnorder function to add a turn for a token however I can seem to get it to work! Is a variable for return required? I tried both ways with no joy either way.Debug doesn't show any errors. thanks much --~somevariable | turnorder ; @{selected|token_id} ; [$value] i see the doc says not return variable required! Do i have to delimit it somehow? thx
1634767315

Edited 1634767711
Andrew R.
Pro
Sheet Author
I think you’re missing an “ addtoken” sub function.&nbsp; --~somevariable|turnorder; addtoken ;@{selected|token_id};[$value]
1634770672

Edited 1634770733
Andrew, Thx but I just mistyped it. I had the addtoken subfunction....still doesn't work. just doing a simple Initiative script but no luck. I tried the --@ for the tracker but I cannot get to take the value. Thx much &nbsp;--/~ somevariable| turnorder ; addtoken ;&nbsp; @{selected|token_id} ; [$MyInit]
1634771469

Edited 1634772135
Kurt J.
Pro
API Scripter
Ronnie McDurgen said: I think I found a bug in the procedure named "Lib5E_FindResource" (which is part of the library named "dnd5elib"). Can anyone confirm that this is an actual bug, and not just me doing something wrong? How to reproduce the bug: 1) Install the dnd5elib library (see the instructions in the ScriptCards wiki). 2) Use this code. !scriptcard{{ &nbsp; +++dnd5elib+++ &nbsp; --#sourceToken|@{selected|token_id} &nbsp; --&amp;ResName|bbb &nbsp; --&gt;Lib5E_FindResource|[*S:character_id];[&amp;ResName];ResNameAddress;ResValueAddress &nbsp;&nbsp; &nbsp; --+The name of the found resource is |[*S:[&amp;ResNameAddress]] &nbsp; --+The value of the found resource is |[*S:[&amp;ResValueAddress]] }} 3) Use that code with a test-character that has the following resources (they're on the right side of the character sheet, directly under where it says "flaws"). . . . . . And then, you should see on the output card that the resource named "aaa" is found by the code, rather than the resource named "bbb" (which is what the code should have been finding). By the way, this resource-slot is the only resource-slot that this bug occurs with. Or, in other words, this bug only happens when I search for a resource that is stored within the slot named "other_resource". I just updated the library on the GitHub with a fix for this.
1634771683
Kurt J.
Pro
API Scripter
joeuser said: Andrew, Thx but I just mistyped it. I had the addtoken subfunction....still doesn't work. just doing a simple Initiative script but no luck. I tried the --@ for the tracker but I cannot get to take the value. Thx much &nbsp;--/~ somevariable| turnorder ; addtoken ;&nbsp; @{selected|token_id} ; [$MyInit] All of the extra spaces are causing the issue. Spaces aren't trimmed out of parameters because, depending on what you are trying to do, they could be significant. This should work: &nbsp; --~somevariable|turnorder;addtoken;@{selected|token_id};[$MyInit] &nbsp;The "somevariable" is optional and won't be used by the command.
Kurt, Thx much for the response. That fixed it.
Kurt J. said: Ronnie McDurgen said: I think I found a bug in the procedure named "Lib5E_FindResource" (which is part of the library named "dnd5elib"). Can anyone confirm that this is an actual bug, and not just me doing something wrong? How to reproduce the bug: 1) Install the dnd5elib library (see the instructions in the ScriptCards wiki). 2) Use this code. !scriptcard{{ &nbsp; +++dnd5elib+++ &nbsp; --#sourceToken|@{selected|token_id} &nbsp; --&amp;ResName|bbb &nbsp; --&gt;Lib5E_FindResource|[*S:character_id];[&amp;ResName];ResNameAddress;ResValueAddress &nbsp;&nbsp; &nbsp; --+The name of the found resource is |[*S:[&amp;ResNameAddress]] &nbsp; --+The value of the found resource is |[*S:[&amp;ResValueAddress]] }} 3) Use that code with a test-character that has the following resources (they're on the right side of the character sheet, directly under where it says "flaws"). . . . . . And then, you should see on the output card that the resource named "aaa" is found by the code, rather than the resource named "bbb" (which is what the code should have been finding). By the way, this resource-slot is the only resource-slot that this bug occurs with. Or, in other words, this bug only happens when I search for a resource that is stored within the slot named "other_resource". I just updated the library on the GitHub with a fix for this. Hmm... maybe I'm doing something wrong, but after installing the latest version (0.0.6a) of the library, there seem to be more bugs now than in the old version...&nbsp; i.e. now my test-program can only find the resource named "aaa", and nothing else.
Erik M. said: Kurt J. said: Since the button is actually an HTML A (link) element, you'll need to use a Display tag to center the text. Here is one I have that looks to be working for me: !script {{ --#buttonFontSize|0.8em --#buttonbackgroundimage|url(<a href="https://s3.amazonaws.com/files.d20.io/images/251120382/5mwaTtf_7BKL9X57MZql3w/original.png?16345951375" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/251120382/5mwaTtf_7BKL9X57MZql3w/original.png?16345951375</a>); background-size:96px 64px; display: table-cell; width:96px; height:64px; --#buttontextcolor|black --#buttonbackground|#FFFFFF --+|[button]Slam::GenericMacro[/button] }} I lowered the font size so it fits inside the button. Besides setting display to table-cell, I changed the background-size to match the desired size (which should also match width and height). I'm just using a regular button here because I didn't have a sheet set up to test macros with, but the same thing should apply for sheetbuttons. You are awesome. Back to my CSS tutorial! Ok, one more stupid CSS question: How do I center the button on the output on the card? I tried text-align:center &nbsp;after putting it into a table, but that didn't seem to work.&nbsp;
1634904630
Kurt J.
Pro
API Scripter
Erik M. said: Erik M. said: Kurt J. said: Since the button is actually an HTML A (link) element, you'll need to use a Display tag to center the text. Here is one I have that looks to be working for me: !script {{ --#buttonFontSize|0.8em --#buttonbackgroundimage|url(<a href="https://s3.amazonaws.com/files.d20.io/images/251120382/5mwaTtf_7BKL9X57MZql3w/original.png?16345951375" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/251120382/5mwaTtf_7BKL9X57MZql3w/original.png?16345951375</a>); background-size:96px 64px; display: table-cell; width:96px; height:64px; --#buttontextcolor|black --#buttonbackground|#FFFFFF --+|[button]Slam::GenericMacro[/button] }} I lowered the font size so it fits inside the button. Besides setting display to table-cell, I changed the background-size to match the desired size (which should also match width and height). I'm just using a regular button here because I didn't have a sheet set up to test macros with, but the same thing should apply for sheetbuttons. You are awesome. Back to my CSS tutorial! Ok, one more stupid CSS question: How do I center the button on the output on the card? I tried text-align:center &nbsp;after putting it into a table, but that didn't seem to work.&nbsp; You should be able to use the built-in formatting to do this: --+|[c][button]Slam::GenericMacro[/button][/c] Any CSS you add to the button settings will only apply to the button itself, and positioning of the button is a level higher in the layout.
Kurt J. said: You should be able to use the built-in formatting to do this: --+|[c][button]Slam::GenericMacro[/button][/c] Any CSS you add to the button settings will only apply to the button itself, and positioning of the button is a level higher in the layout. Hmm, that doesn't seem to be working for me. I think I have the formatting correct if you wouldn't mind taking a quick look? This is what comes up now:&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:90px 48px; display: table-cell; width:90px; height:48px; align:center;&nbsp; &nbsp; --#buttontextcolor|black &nbsp; --#buttonbackground|#F3FF9B &nbsp;&nbsp; &nbsp; --=i|0 &nbsp; --=k|1 &nbsp;&nbsp; --:FindAttacks| --Rfirst|[*S:character_id];repeating_powers --:Powers| --?"[*R:label]" -inc Loaded|PowersDone --?"[*R:description]" -inc Array|ArrayBuild --&amp;Output|+ [sheetbutton][*R:label]::GenericMacro::NothingToSeeHere"class="showtip" title="[*R:description][/sheetbutton] --Rnext| --?"[*R:label]" -inc Loaded|PowersDone --^Powers| --:ArrayBuild| --?"X[*R:master_row]" -eq "X"|ArrayTitle --&amp;ArrayOutput[$i.Raw]|+ [sheetbutton][*R:label]::GenericMacro::NothingToSeeHere"class="showtip" title="[*R:description][/sheetbutton] --Rnext| --?"X[*R:element_type]" -eq "X" -or [*R:element_type] -inc Loaded|Powers --^ArrayBuild| --:ArrayTitle| --=i|[$i] + 1 --&amp;ArrayHeading[$i.Raw]|Array: [*R:label] --Rnext| --^ArrayBuild| --:PowersDone| --+|[c][&amp;Output][/c] --:ArrayToChat| --?[$i] -ne 0|[ --+|[c][b][&amp;ArrayHeading[$k.Raw]][/b][/c] --+|[c][&amp;ArrayOutput[$k.Raw]][/c] --=k|[$k] + 1 --]| --?[$k] -ge [$i]|Done|ArrayToChat --:Done| }} Thanks much!
I was trying to play around with exploding dice for a D6 game I am putting together but I am completely out of practice with scriptcards.&nbsp; How would I have a single wild die that explodes on a 6, adding more each roll of a 6, and takes away the highest roll when it rolls a 1.
1634995147

Edited 1634995175
David M.
Pro
API Scripter
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] }}
This gets me closer.&nbsp; I will try to modify this so it is only one die wild in a group and a one on the wild die only subtracts the highest other die on the initial roll rather than on any exploded rolls. 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] }}
1635092077
David M.
Pro
API Scripter
Ah, I see - I didn't get how you were intending to use this from your original description. Cool, post back if you run into issues!
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?
1635707599

Edited 1635707718
Hello, I have been using ScriptCards for less than a week. In order to get used to this new script, I will take the examples from the Wiki. I took the magic missile script again, and tweaked it slightly. My current problem is to do a separate localization for each shot. Can you help me please ? !scriptcard&nbsp; {{&nbsp; --#title|Lance d'Odin --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --=NbreLance|1 --?@{selected|level-class1} -le 5 |&gt;NbreLance1 --?@{selected|level-class1} -ge 6 -and @{selected|level-class1} -lt 11 |&gt;NbreLance3 --?@{selected|level-class1} -ge 11 |&gt;NbreLance5 --=NbreAffichageLO|1 --=DegatsLance|0 --=Localisation|[T#Localisation-humanoïdes-distance] --#leftsub|@{selected|class1} Niveau @{selected|level-class1} --#rightsub|Attaque à distance (max 45m) --#emoteText|@{selected|character_name} jette [$NbreLance] lance(s) magique(s) ! --:LanceBoucle| --&gt;LanceTirée| --=NbreAffichageLO|[$NbreAffichageLO] + 1 --?[$NbreAffichageLO] -le [$NbreLance]|LanceBoucle --+Le Total des dégâts|est de [$DegatsLance] --X| --:LanceTirée| --=Lance|1d6 + 1 --=DegatsLance|[$DegatsLance] + [$Lance] --+Lance|[$NbreAffichageLO.Total] touche [b] [$Localisation.tableEntryText] [/b] et occasionne [$Lance] points de dommage --&lt;| --:NbreLance1| --=NbreLance|1 --&lt;| --:NbreLance3| --=NbreLance|3 --&lt;| --:NbreLance5| --=NbreLance|5 --&lt;| }}
1635713839
David M.
Pro
API Scripter
Trendor, this is untested, but I think you just need to move your table roll to your&nbsp; LanceTirée function so it rolls for each missile, like this: !scriptcard {{ --#title|Lance d'Odin --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --=NbreLance|1 --?@{selected|level-class1} -le 5 |&gt;NbreLance1 --?@{selected|level-class1} -ge 6 -and @{selected|level-class1} -lt 11 |&gt;NbreLance3 --?@{selected|level-class1} -ge 11 |&gt;NbreLance5 --=NbreAffichageLO|1 --=DegatsLance|0 --#leftsub|@{selected|class1} Niveau @{selected|level-class1} --#rightsub|Attaque à distance (max 45m) --#emoteText|@{selected|character_name} jette [$NbreLance] lance(s) magique(s) ! --:LanceBoucle| --&gt;LanceTirée| --=NbreAffichageLO|[$NbreAffichageLO] + 1 --?[$NbreAffichageLO] -le [$NbreLance]|LanceBoucle --+Le Total des dégâts|est de [$DegatsLance] --X| --:LanceTirée| --=Lance|1d6 + 1 --=DegatsLance|[$DegatsLance] + [$Lance] --=Localisation|[T#Localisation-humanoïdes-distance] --+Lance|[$NbreAffichageLO.Total] touche [b] [$Localisation.tableEntryText] [/b] et occasionne [$Lance] points de dommage --&lt;| --:NbreLance1| --=NbreLance|1 --&lt;| --:NbreLance3| --=NbreLance|3 --&lt;| --:NbreLance5| --=NbreLance|5 --&lt;| }}
it works. thank you so much
I have been working in on scriptcards for the newish Mutants and Masterminds 3E character sheet.&nbsp; I have been using the code below to pull up the repeating attacks and it's clearly seeing the right section because it creates the correct number of buttons.&nbsp; The problem is it shows "False" in the button and sets the attribute to empty.&nbsp; I have tried various attributes in the repeating attack section just to see if something will display but I keep getting empty. Thoughts? !scriptcard {{ --#title|@{selected|token_name}, Choose your weapon, then attack!!! &nbsp; --#whisper|self &nbsp; --#subtitleFontSize|1.0em &nbsp; --#titleFontFace|Tahoma &nbsp; --#bodyFontFace|Tahoma &nbsp; --#tableBorderRadius|3px &nbsp; --#buttonfontsize|medium --Rfirst|@{selected|character_id};repeating_attacks --:ButtonDisplayLoop| --+[button][*R:name]::!&amp;#13;!setattr &amp;#45;&amp;#45;sel &amp;#45;&amp;#45;attack_name&amp;#124;[*R:name][/button]| --Rnext| --? "[*R:name]" -ne NoRepeatingAttributeLoaded|ButtonDisplayLoop &nbsp; --#buttonbackground|#993333 --+|[c][button][b][i]Attack!::!&amp;#13;#AttackSC[/i][/b][/button][/c] }}
Is the attribute named correctly in [*R:name]? Meaning, my best guess is that "repeating_attacks_$X_name" (where X is the index value of the row) does not refer to anything.&nbsp;
1635792998
Kurt J.
Pro
API Scripter
Brien V. said: I have been working in on scriptcards for the newish Mutants and Masterminds 3E character sheet.&nbsp; I have been using the code below to pull up the repeating attacks and it's clearly seeing the right section because it creates the correct number of buttons.&nbsp; The problem is it shows "False" in the button and sets the attribute to empty.&nbsp; I have tried various attributes in the repeating attack section just to see if something will display but I keep getting empty. Thoughts? !scriptcard {{ --#title|@{selected|token_name}, Choose your weapon, then attack!!! &nbsp; --#whisper|self &nbsp; --#subtitleFontSize|1.0em &nbsp; --#titleFontFace|Tahoma &nbsp; --#bodyFontFace|Tahoma &nbsp; --#tableBorderRadius|3px &nbsp; --#buttonfontsize|medium --Rfirst|@{selected|character_id};repeating_attacks --:ButtonDisplayLoop| --+[button][*R:name]::!&amp;#13;!setattr &amp;#45;&amp;#45;sel &amp;#45;&amp;#45;attack_name&amp;#124;[*R:name][/button]| --Rnext| --? "[*R:name]" -ne NoRepeatingAttributeLoaded|ButtonDisplayLoop &nbsp; --#buttonbackground|#993333 --+|[c][button][b][i]Attack!::!&amp;#13;#AttackSC[/i][/b][/button][/c] }} Whenever I'm dealing with an unknown sheet and looking for attributes, I run something like this: !script {{ &nbsp; --Rfirst|@{selected|character_id};repeating_attacks &nbsp; --rdump| }} Which dumps all of the properties of the repeating object to the API console log. For the M&amp;M3 sheet, I created a dummy character with a dummy attack and I get: "attack_name|Pow!" "attack_name_max|" "attack_combat|Toughness" "attack_combat_max|" "attack|1" "attack_max|" "attack_mod|1" "attack_mod_max|" "rank_total|2" "rank_total_max|" "attack_damage_type|Bludgeoning" "attack_damage_type_max|" so R:name &nbsp;should be R:attack_name, &nbsp;based on how the repeating section entries are named.
This is why I come here.&nbsp; Smarter people than me giving useful answers,&nbsp; Thank you, Kurt.
Good afternoon, everyone. I'm working on a Scriptcard for Saving throws but I would like to add conditional bonuses to certain ones. Each skill will have a SkillMod variable set to 0 unless there is a specific bonus it needs to apply. I have attached my current build. This character gets a +2 bonus to Survival when the check would benefit from scent. So, as long as you select Survival the question "Does this check benefit from scent" comes up and sets a new variable based upon your answer.&nbsp; The issue I'm having is that the query comes up no matter what skill you select. The survival skill is the only one with the code that sends it to the subroutine, --:SurvivalSkillMod|, so I'm at a loss as to why, no matter what I do, the query appears every time. Any help would be greatly appreciated. Thanks in advance. Have a good one. !scriptcard &nbsp; {{ --#sourceToken|@{selected|token_id} --&gt;CheckType| --#emoteText|[*S:character_name] is making a [&amp;SkillName] skill check. &nbsp; --#title|[*S:character_name]’s [&amp;SkillName] Skill Check --#titleFontSize|1.4em --#titlecardbackground|#783f04 --:ActualRoll| --=SkillRoll|?{Skill|Standard,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1} + [$Bonus] [ATTR + PRO] + [$SkillMod] [SKILL MOD] &nbsp; --+[&amp;SkillName] Roll:| [$SkillRoll] --?[$SkillRoll] -le 12|Crap --?[$SkillRoll] -gt 20|Awesome --:OK|Roll was Meh --+It's Just OK| This roll is just mediocre. --X| --:Crap|Roll was crap --+Terrible| This rolled was horrible! --X| --:Awesome|Roll was best --+[*S:character_name] is a GOD!| Everyone should PRAY to roll this well --X| --:CheckType| --=SkillType|Skill ?{Choose|Acrobatics,0|Animal Handling,1|Arcana,2|Athletics,3|Deception,4|History,5|Insight,6|Intimidate,7|Investigation,8|Medicine,9|Nature,10|Perception,11|Performance,12|Persuasion,13|Religion,14|Sleight of Hand,15|Stealth,16|Survival,17} --?[$SkillType] -eq 0|Acro --?[$SkillType] -eq 1|AnHa --?[$SkillType] -eq 2|Arca --?[$SkillType] -eq 3|Athl --?[$SkillType] -eq 4|Dece --?[$SkillType] -eq 5|Hist --?[$SkillType] -eq 6|Insi --?[$SkillType] -eq 7|Inti --?[$SkillType] -eq 8|Inve --?[$SkillType] -eq 9|Medi --?[$SkillType] -eq 10|Natu --?[$SkillType] -eq 11|Perc --?[$SkillType] -eq 12|Perf --?[$SkillType] -eq 13|Pers --?[$SkillType] -eq 14|Reli --?[$SkillType] -eq 15|Slio --?[$SkillType] -eq 16|Stea --?[$SkillType] -eq 17|Surv --:Acro| --=Bonus|[*S:acrobatics_bonus] --&amp;SkillName|Acrobatics --=SkillMod|0 --&lt;| --:AnHa| --=Bonus|[*S:animal_handling_bonus] --&amp;SkillName|Animal Handling --=SkillMod|0 --&lt;| --:Arca| --=Bonus|[*S:arcana_bonus] --&amp;SkillName|Arcana --=SkillMod|0 --&lt;| --:Athl| --=Bonus|[*S:Athletics_bonus] --&amp;SkillName|Athletics --=SkillMod|0 --&lt;| --:Dece| --=Bonus|[*S:Deception_bonus] --&amp;SkillName|Deception --=SkillMod|0 --&lt;| --:Hist| --=Bonus|[*S:history_bonus] --&amp;SkillName|History --=SkillMod|0 --&lt;| --:Insi| --=Bonus|[*S:insight_bonus] --&amp;SkillName|Insight --=SkillMod|0 --&lt;| --:Inti| --=Bonus|[*S:intimidation_bonus] --&amp;SkillName|Intimidation --=SkillMod|0 --&lt;| --:Inve| --=Bonus|[*S:investigation_bonus] --&amp;SkillName|Investigation --=SkillMod|0 --&lt;| --:Medi| --=Bonus|[*S:Medicine_bonus] --&amp;SkillName|Medicine --=SkillMod|0 --&lt;| --:Natu| --=Bonus|[*S:nature_bonus] --&amp;SkillName|Nature --=SkillMod|0 --&lt;| --:Perc| --=Bonus|[*S:perception_bonus] --&amp;SkillName|Perception --=SkillMod|0 --&lt;| --:Pers| --=Bonus|[*S:persuasion_bonus] --&amp;SkillName|Persuasion --=SkillMod|0 --&lt;| --:Perf| --=Bonus|[*S:performance_bonus] --&amp;SkillName|Performance --=SkillMod|0 --&lt;| --:Reli| --=Bonus|[*S:religion_bonus] --&amp;SkillName|Religion --=SkillMod|0 --&lt;| --:Slio| --=Bonus|[*S:sleight_of_hand_bonus] --&amp;SkillName|Sleight of Hand --=SkillMod|0 --&lt;| --:Stea| --=Bonus|[*S:stealth_bonus] --&amp;SkillName|Stealth --=SkillMod|0 --&lt;| --:Surv| --=Bonus|[*S:survival_bonus] --&amp;SkillName|Survival --&gt;SurvivalSkillMod| --&lt;| --:SurvivalSkillMod| --=ScentCheck| ?{Does this check benefit from scent?|Yes,1|No,0} --?[$ScentCheck] -eq 0|NoScent --=SkillMod|2 --&lt;| --:NoScent| --=SkillMod|0 --&lt;| &nbsp; }}
@Elegant Wookie - unfortunately, a hard rule we all learn is that macros do not follow the logic rules of programming.&nbsp; One of the frustrating issues is that all roll variable assignments that require user input will queue the user regardless of its location in the macro or whether it even would be called in the logic of the macro. There are several workarounds (using buttons, etc.) but your&nbsp; --=ScentCheck| ?{Does this check benefit from scent?|Yes,1|No,0}&nbsp; will always appear regardless of the skill selected.
1636066709
David M.
Pro
API Scripter
To piggyback on what Michael said, here is the order of operations followed by dice rolls and macros. Roll queries happen at step 5, and the last thing to happen (step 11) is the msg being sent to chat and api scripts (like scriptcards). So, even though Kurt has developed an impressive parser and procedural language, the damage has been done by the time scriptcards even starts.&nbsp; &nbsp;
1636067147
Andrew R.
Pro
Sheet Author
I avoid Roll Queries in my ScriptCard macros, using only the Information Request (--i) statement type. So far this has worked every time.&nbsp;
Andrew R. said: I avoid Roll Queries in my ScriptCard macros, using only the Information Request (--i) statement type. So far this has worked every time.&nbsp; Could we see how you use the Information Request?
Michael C. said: @Elegant Wookie - unfortunately, a hard rule we all learn is that macros do not follow the logic rules of programming.&nbsp; One of the frustrating issues is that all roll variable assignments that require user input will queue the user regardless of its location in the macro or whether it even would be called in the logic of the macro. There are several workarounds (using buttons, etc.) but your&nbsp; --=ScentCheck| ?{Does this check benefit from scent?|Yes,1|No,0}&nbsp; will always appear regardless of the skill selected. Thanks so much for the feedback. I was wondering if it was going to be something like that and at least now I know and won't spend any more time slamming my head against this issue. Much appreciated.
Brien V. said: Andrew R. said: I avoid Roll Queries in my ScriptCard macros, using only the Information Request (--i) statement type. So far this has worked every time.&nbsp; Could we see how you use the Information Request? I'd also really like to see how to use information request.
Hi I'm struggling big time, I'm trying to write scriptcards for savage worlds (deadlands). As anyone familiar with savage worlds knows most rolls are made against a target number of 4 and then the damage rolls are made against either the targets toughness or parry. I can manage to write simple scriptcards (see Below) that show both the trait dice and wild dice, however I cant seem to get them to roll against a target number of 4 and then to add a modifiers drop down vs the highest dice from either the trait or wild die. Then if there rolling an attack roll and the beat the target number by 4 or more they can add a d6! to there damage dice. I also don't seem to be able to get the damage dice to work. Skill Rolls !scriptcard {{ &nbsp;--#title|Skill Roll &nbsp;--#sourcToken|@{selected|token_id} &nbsp;--#emoteText|@{selected|token_name} &nbsp;--=Roll1|1d8!&nbsp; &nbsp;--=Roll2|1d6! &nbsp;--+|Trait Dice [$Roll1] Wild Dice [$Roll2] Attack Rolls !scriptcard {{ &nbsp;--#title|Pistol &nbsp;--#leftsub|Ranged Weapon &nbsp;--#rightsub|12/24/48 &nbsp;--#sourceToken|@{selected|token_id} &nbsp;--#targetToken|@{target|token_id} &nbsp;--#emoteText|@{selected|token_name} Firer's @{target|token_name} &nbsp;--=AttackRoll1|1d8!&nbsp; &nbsp;--=AttackRoll2|1d6! &nbsp;--+Attack|Trait Dice [$AttackRoll1] Wild Dice [$AttackRoll2] &nbsp;--=DamageRoll|2d6! Spell Attack !scriptcard {{ &nbsp;--#title|Ice Bolt &nbsp;--#leftsub|Ranged Spell &nbsp;--#rightsub|12/24/48 &nbsp;--#sourceToken|@{selected|token_id} &nbsp;--#targetToken|@{target|token_id} &nbsp;--#emoteText|@{selected|token_name} Cast's a Spell At @{target|token_name} &nbsp; --=AttackRoll1|1d8!&nbsp; &nbsp;--=AttackRoll2|1d6! &nbsp;--+Attack|Trait Dice [$AttackRoll1] Wild Dice [$AttackRoll2] &nbsp;--vbetweentokens|@{selected|token_id} @{target|token_id} Burst-Frost my problem is I can't rap my head around writing macros my brain is just not wired that way. I all I need is 2 scrips for the skill rolls with a drop down asking for dice type and a drop down for modifiers, 1 of which takes in to account the d6 wild die and 1 which doesn't. 2 script for attack and damage with a drop down for modifiers only, again 1 with wild dice one without but to include sfx and 2 for spell cast with the same premise as above but including sfx and vfx. I realise this is an awful lot to ask and your quite within your right to tell me "no can do" but short of finding someone in the real world so to speak, to write them for me I don't no who to turn to except here. I would be willing to compensate someone for there time and effort. So if anyone can help me I would be extremely grateful.&nbsp; &nbsp;
Hello, everyone. Could someone please show me an example of how to implement a Information Request statement. I'm not having any luck making one work. I want to avoid using variables with user input and Roll Queries and switch to Information Requests. How can I switch the example below to an Information Request?&nbsp; !scriptcard {{ --=ScentCheck| ?{Does this check benefit from scent?|Yes,1|No,0} --?[ScentCheck] -eq 0|NoScent --=SkillMod|2 --&lt;| }}
1636145951

Edited 1636146031
@Elegant Wookie/Brian - Andrew is talking about one of the work-arounds.&nbsp; Built into several of Kurt's AoE spells is a marvelous subroutine, that I use often, that illustrates the use of the --i command. &nbsp; --:BuildAndAskTargets| &nbsp; &nbsp; &nbsp;--&amp;TargetString| &nbsp; &nbsp; &nbsp;--=targetCount|1 &nbsp; --:TargetLoop| &nbsp; &nbsp; &nbsp;--&amp;TargetString|+t;target[$targetCount.Raw];Missile [$targetCount.Raw] Target &nbsp; &nbsp; &nbsp;--=targetCount|[$targetCount.Raw] + 1 &nbsp; &nbsp; &nbsp;--?[$targetCount.Total] -le [%1%]|&gt;AddSeparator &nbsp; &nbsp; &nbsp;--?[$targetCount.Total] -le [%1%]|TargetLoop &nbsp; &nbsp; &nbsp;--iPlease click the button below to select targets to bless.;Select [%1%] Targets|[&amp;TargetString] &nbsp; --&lt;|
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?
1636335725

Edited 1636336280
Andrew R.
Pro
Sheet Author
Here's how I use the Information Request (--i) statement type in my 13th Age Glorantha monsters Abilities macros. For example, a 12th level Walktapus. C: Poison Gas Spray +19 vs Special (each enemy engaged with the walktapus), and +15 vs Special (each nearby non-Chaotic creature) — The effect and the defense the attack targets is determined by the Chaos poison &nbsp; it can use that battle Limited Use: &nbsp; 1/battle &nbsp; This is coded in ScriptCards as !scriptcard&nbsp; {{ --Lsettings|RuneChaos --#leftsub|@{selected|token_name} --#rightsub|Close-Quarters --#title|Poison Gas Spray --IScriptCards needs additional information to continue;Click to provide information|q;Engaged;How Many Engaged? --IScriptCards needs additional information to continue;Click to provide information|q;Nearby;How Many Nearby? --+Targets|Each enemy engaged with the walktapus --%LoopCount|1;[&amp;Engaged];1 &nbsp; --&gt;Engaged| --%|LoopCount --+Targets|Each nearby non-Chaotic creature --%LoopCount|1;[&amp;Nearby];1 &nbsp; --&gt;Nearby| --%|LoopCount --+|The effect and the defense the attack targets is determined by the [i]Chaos poison[/i] it can use that battle --+Limited Use|1/battle --X|Exit --:Engaged| --=Attack|1d20 +19 +@{tracker|Chaos Die}[Chaos] --+Attack|[$Attack] vs Special&nbsp; --&lt;|End of Engaged --:Nearby| --=Attack|1d20 +15 +@{tracker|Chaos Die}[Chaos] --+Attack|[$Attack] vs Special&nbsp; --&lt;|End of Nearby }}