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

[Script] ScriptCards - Thread #2

Kurt, Thanks so much for coming back to me. I tried you're suggestion  which return this {selected|token_id|t-tooltip} into the chat. I've tried different bracket combinations but can't seem to crack this one Kurt J. said: FFR said: Hi, Hoping someone can help.  I'm trying to get a scriptcard output to display the tooltip text of a selected token. I have this entry in the scriptcard but it doesn't work    --+Conditions|@{selected|t-tooltip} Any ideas what I'm doing wrong ? Cheers This is a mix of roll20 referencing and scriptcards referencing. @selected|tooltip} will return the tooltip from Roll20 before the execution. Using [*@{selected|token_id}|t-tooltip} would be the ScriptCards notation.
1739729052

Edited 1739729069
Kurt J.
Pro
API Scripter
ScriptCards 2.7.35 has been Queued for OneClick The latest github version of ScriptCards has been queued for inclusion in the next OneClick push. Here are the changes since 2.7.31: New Functions:   hashtable;fromjson - Convert a JSON formatted string into a hashtable. Usage:  --~|hashtable;fromjson;hashtablename;JSONSTRING (all ";" will simply be concatenated into the JSONSTRING)   string;linefeedstobr - Converts \r, \n, and \r\n characters in a string to HTML BR tags (note an alias of striplinefeeds is also recognized)   string;brtolinefeeds - Converts HTML BR tag in a string to linefeeds (\n) Updates:   When using [&string(#,#)] to extract a substring, if the second number is negative, that many characters will be trimmed from the end of the string.
1739729762
Kurt J.
Pro
API Scripter
FFR said: Kurt, Thanks so much for coming back to me. I tried you're suggestion  which return this {selected|token_id|t-tooltip} into the chat. I've tried different bracket combinations but can't seem to crack this one Kurt J. said: FFR said: Hi, Hoping someone can help.  I'm trying to get a scriptcard output to display the tooltip text of a selected token. I have this entry in the scriptcard but it doesn't work    --+Conditions|@{selected|t-tooltip} Any ideas what I'm doing wrong ? Cheers This is a mix of roll20 referencing and scriptcards referencing. @selected|tooltip} will return the tooltip from Roll20 before the execution. Using [*@{selected|token_id}|t-tooltip} would be the ScriptCards notation. The call would look like this: --+Conditions|[*@{selected|token_id}:t-tooltip] Breaking this down, the CHAT server would fill in @{selected|token_id} with the ID of the token (lets say it is "-NylBsea26UZZ5O1kw6k" for example. What ScriptCards gets looks like: --+Conditions|[*-NylBsea26UZZ5O1kw6k:t-tooltip] Using [*...] referencing, the syntax is [*identifier:attribute]. In this case, we are looking for a token attribute, so it needs to be prefixed with "t-" so ScriptCards knows to look there instead of character-based attributes. This is necessary because there are some items with the same names (name, id, etc.) You will often see something like: --+Conditions|[*S:t-tooltip] which is just using one of two "shorthand" notations. It just means that somewhere earlier in the script there is a --#sourcetoken command to set the source token value: --#sourcetoken|@{selected|token_id} --+Conditions|[*S:t-tooltip] That way [*S:...] can be used instead of a longer construct.
Kurt, Works perfectly. Thanks so much for your help
1740043443

Edited 1740043707
Hello guys/gals i found this super awesome mod called scriptcards and im having this issue with the 5e action menu (yes we are using 5e sheets 2014 specifically) "Error updating/adding object Unexpected token u in JSON at position 0, thisTag: !t:-OJX6-oIt2P1e2oV9gUk, thisContent: bar1_value:0" "Error processing conditional blockDepth is not defined, thisTag: ?0 -eq 1 -and 1, thisContent: |[" "ScriptCards Error: Label _LibAMA_SpellFumbleOrCrit is not defined on line 785 (?\"_LibAMA_SpellFumbleOrCrit\" -ne \"\", &gt;_LibAMA_SpellFumbleOrCrit)" these issues appear when using spells and melee( melee works once token is placed but after one attack it breaks) against tokens(goblin and boss and bandit captain). ive spent some amount of time trying to find anything specific even with scriptinfo it seems token mod is having a small conflict but these errors persist with it disabled also this appears when AC value registers as 0 per api script (From API): Ranged Attack &nbsp;rolled&nbsp;<span class="userscript-userscript-showtip userscript-tipsy" title="Roll: 1d20 + 7 [Spell Atk Bonus] Result: (17) + 7 [Spell Atk Bonus] " style="color: rgb(0, 0, 0); background-color: rgb(255, 254, 162); min-width: 1.75em; font-family: undefined; 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-image: none !important;">24 &nbsp;vs AC&nbsp; 0 ps. any help would be appreciated, i know very little about coding&nbsp;
Guys, I need to convert some of my older powercard to scriptcard format. Unfortunatly, I have not a lot of time available lately. So, can i ask you a quick conversion of this one? I'm relatively new to Scriptcard. Thank you so much! The powercard was written as a command button in a Custom Sheet, so it does not need the @{selected|x} part. !power {{ --name| Flintlock Pistol --titlefont| arial --txcolor|white --bgcolor|purple --leftsub|@{Name} --rightsub| Ranged ~~~ --Tipo| M ~~~ -- Range| Short ~~~ --Attack| Normal 0 14 false false false IT X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Tabella normale"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:8.0pt; mso-para-margin-left:0cm; line-height:107%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri",sans-serif; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-font-kerning:1.0pt; mso-ligatures:standardcontextual; mso-fareast-language:EN-US;} [[ [$Atk] 1d20+{{@{Armidaguerra_Skill}+?{modif|0},0}&gt;21}*(@{Armidaguerra_Skill}+?{modif|0}-20) + 0]] &nbsp; v.s. **TRESHOLD** [[{@{Armidaguerra_Skill}+(?{modif|0}),20}kl1]] --?? $Atk.base == 1 ?? |[***FUMBLE!***](!&amp;#13;#fumblearma) ~~~ --Hit Location| [[ [$R] 1d10]] --?? $R == 10?? BODY PART| Gamba Destra @{target|Rleg_base} --?? $R == 9?? BODY PART| Gamba Destra @{target|Rleg_base} --?? $R == 8?? BODY PART| Gamba Sinistra @{target|Lleg_base} --?? $R == 7?? BODY PART| Gamba Sinistra @{target|Lleg_base} --?? $R == 6?? BODY PART| Braccio Sinistro @{target|Larm_base} --?? $R == 5?? BODY PART| Braccio Destro @{target|Rarm_base} --?? $R == 4?? BODY PART| Tronco @{target|Torso_base} --?? $R == 3?? BODY PART| Tronco @{target|Torso_base} --?? $R == 2?? BODY PART| Tronco @{target|Torso_base} --?? $R == 1?? BODY PART| Testa @{target|Head_base} -- Valori| *Cuoio* (6-10) ; *Metallo* (11-17) ~~~ --?? $R &gt; 1 ??Damage| [[@{damage}]] Is it a [Critical?](!#critical) ~~~ --?? $R == 1?? Damage| [[(@{damage})*@{fuocodannotesta}]] **Headshot!** Is it a [Critical?](!#critical) ~~~~ --Description| --**DANNI DA FUOCO**| (1/3 ARMOR CUOIO, 1/2 ARMOR METALLO) --api_ammo| @{character_id} focaia -1 pistola a pietra focaia carica --soundfx *1|_audio,play,nomenu|focaia --?? $Atk.base == 1 ?? soundfx*1|_audio,play,nomenu|cilecca --!showpic|[x](<a href="https://s3.amazonaws.com/files.d20.io/images/311089938/6k87wf1TIJT7Kuyr68hqaw/med.png?1666726935.png" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/311089938/6k87wf1TIJT7Kuyr68hqaw/med.png?1666726935.png</a>) }} !ammo @{character_id} pallottole -1 pallottole !ammo @{character_id} Polvere_da_Sparo -1 polvere da sparo
Can somebody help me, please?&nbsp;
1740293670

Edited 1740293921
Andrew R.
Pro
Sheet Author
Here's a first cut. I elided all the special effects, etc.,&nbsp; !script{{ --#title|Flintlock Pistol --#titleFontFace|Arial --#titleFontColor|white --#titleCardBackground|purple --#leftSub|@{Name} --#rightSub|Ranged --/| ~~~ --+|[hr] --+Tipo|M --+Range|Short --=Atk|1d20 + @{Armidaguerra_Skill} + … --=Treshold|@{Armidaguerra_Skill} + … --=HitLoc|1d10 --+Attack|[$Atk] v.s. [b]TRESHOLD[/b] [$Treshold] --?[$Atk.Base] -eq 1|[ --+FUMBLE!| --]| --+Hit Location|[$HitLoc] --C[$HitLoc.Total]|1:&gt;Testa;|2:&gt;Tronco;|3:&gt;Tronco;|4:&gt;Tronco;|5:&gt;BraccioDestro;|6:&gt;BraccioSinistro;|7:&gt;GambaSinistra;|8:&gt;GambaSinistra;|9:&gt;GambaDestra;|10:&gt;GambaDestra; --+Valori|[i]Cuoio[/i] (6-10) ; [i]Metallo[/i] (11-17) --?[$HitLoc.Base] -eq 1|[ --=Damage|@{damage} * @{fuocodannotesta} --]|[ --=Damage|@{damage} --]| --+Damage|[$Damage] --/| DESCRIPTION GOES HERE --@ammo|@{character_id} pallottole -1 pallottole --@ammo|@{character_id} Polvere_da_Sparo -1 polvere da sparo --X|Exit --:Testa --+BODY PART|Testa @{target|Head_base} --&lt;|End of Testa --:Tronco --+BODY PART|Tronco @{target|Torso_base} --&lt;|End of Tronco --:BraccioDestro --+BODY PART|Braccio Destro @{target|Rarm_base} --&lt;|End of BraccioDestro --:BraccioSinistro --+BODY PART|Braccio Sinistro @{target|Larm_base} --&lt;|End of BraccioSinistro --:GambaSinistra --+BODY PART|Gamba Sinistra @{target|Lleg_base} --&lt;|End of GambaSinistra --:GambaDestra --+BODY PART|Gamba Destra @{target|Rleg_base} --&lt;|End of GambaDestra }}
1740349241

Edited 1740349404
Andrew R. said: Here's a first cut. I elided all the special effects, etc., Thank you very much Andrew, it works well! Only problem is that the script don't shows the "body part" output section. Also,&nbsp;I know you avoided including the "special effects", but in the original version, I used a formula to make the powercard emit a different sound whenever the base attack roll is 1. I'm not able to produce the same output on my own with scriptcards... Can you show me how I do it? --soundfx *1|_audio,play,nomenu|focaia --?? $Atk.base == 1 ?? soundfx*1|_audio,play,nomenu|cilecca
1740370630

Edited 1740370922
Andrew R.
Pro
Sheet Author
According to the PowerCards wiki page, that's a call to the&nbsp; Mod&nbsp; Roll20 Audio Master &nbsp;which you must have installed. Try something like --@roll20AM|_audio,play,nomenu#focaia&nbsp; There's a Conditional in the script fragment you can copy. It starts --?[$Atk.Base] -eq 1|[
1740383082

Edited 1740403210
Ok thank you andrew! What about the body part section? Why is not showing?&nbsp; EDITED: I've solved it, thank you!
1741123668
Kurt J.
Pro
API Scripter
ScriptCards 3.0.00 EXPERIMENTAL on GitHub For those interested, I've pushed an experimental version of ScriptCards 3.0.00 to GitHub that allows accessing Beacon sheets using [*...] and --!t constructs. The code is experimental, as I had to change the entire script to run in async mode in order to include beacon support but if you need to use SC against 2024 characters it is the way to go at this point. Features will be expanded over the next couple of weeks to include more functionality.
1741486883

Edited 1741895693
Can ScriptCards change Player control of an NPC? Is it possible in ScriptCards to give a player control of an NPC character during a game? I'm still working on possession and trying a different approach. I also want to thank Kurt J. for HashTables. I'm now using HashTables for my characters'&nbsp; attributes and abilities and they are wonderful! I used to define attribute and abilities as a list under an ability called "Chart" on the NPC's character. But when I changed them I had to get out of the character before it actually changed the value. With HashTables when I change a value it immediately has the new value and if I need to change it again I can. So thank you for HashTables they make my game much better. Nevermind, I just reread TokenMod and it appears I can do it there.
1743274765

Edited 1743275082
Hello, I just found and have started trying out and experimenting with Scriptcards, still using the 2014 5e sheets. I'm running in a game where I have had a rule where you can stack Advantage/Disadvantage, so I'm trying to make a simple generic roller macro. I'm sure there's something super simple I'm missing, but can someone take a quick look at it? I've added line breaks for readability. When I've tried it it just displays the Title and the text (Highest of 4 for Advantage (3), for example), but doesn't display the result. !script{{ --#title|Roller --=lvlAdvantage|?{What Level of Advantage|-5|-4|-3|-2|-1|0|1|2|3|4|5} --=addmod|?{Modifier to add} --c[$lvlAdvantage]|-5:&amp;fintext;Lowest of 6|-4:&amp;fintext;Lowest of 5|-3:&amp;fintext;Lowest of 4|-2:&amp;fintext;Lowest of 3|-1:&amp;fintext;Lowest of 2|0:&amp;fintext;Normal|1:&amp;fintext;Highest of 2|2:&amp;fintext;Highest of 3|3:&amp;fintext;Highest of 4|4:&amp;fintext;Highest of 5|5:&amp;fintext;Highest of 6| --c[$lvlAdvantage]|-5:#result;6d20kl1 + [$addmod]|-4:#result;5d20kl1 + [$addmod]|-3:#result;4d20kl1 + [$addmod]|#result;3d20kl1 + [$addmod]|-1:#result;2d20kl1 + [$addmod]|0:#result;1d20 + [$addmod]|1:result;2d20kh1 + [$addmod]|2:result;3d20kh1 + [$addmod]|3:result;4d20kh1 + [$addmod]|4:result;5d20kh1 + [$addmod]|5:result;6d20kh1 + [$addmod]| --#rightsub|[&amp;fintext] --+You rolled a [$result]! --X| Thanks in advance!
1743338312

Edited 1743338395
Kurt J.
Pro
API Scripter
Brandon M. said: Hello, I just found and have started trying out and experimenting with Scriptcards, still using the 2014 5e sheets. I'm running in a game where I have had a rule where you can stack Advantage/Disadvantage, so I'm trying to make a simple generic roller macro. I'm sure there's something super simple I'm missing, but can someone take a quick look at it? I've added line breaks for readability. When I've tried it it just displays the Title and the text (Highest of 4 for Advantage (3), for example), but doesn't display the result. (snipped) Thanks in advance! Hello, Brandon. There are a couple of issues here, which I'll detail and then provide an alternative method of doing this. This line: --c[$lvlAdvantage]|-5:#result;6d20kl1 + [$addmod]|-4:#result;5d20kl1 + [$addmod]|-3:#result;4d20kl1 + [$addmod]|#result;3d20kl1 + [$addmod]|-1:#result;2d20kl1 + [$addmod]|0:#result;1d20 + [$addmod]|1:result;2d20kh1 + [$addmod]|2:result;3d20kh1 + [$addmod]|3:result;4d20kh1 + [$addmod]|4:result;5d20kh1 + [$addmod]|5:result;6d20kh1 + [$addmod]| Is using the # character instead of = to assign the result roll variable. This won't actually do anything since # is not valid in this context. --# sets card settings while --= creates roll variables. Similarly, in a --? or --c statement, the = char is used to set roll variables. The output line: --+You rolled a [$result]! Is missing a vertical bar. This should be showing up as an error in the API console. When using --+, the part before the | is bolded, the part after is normal. These are called the "tag" and "content" portions of any -- line. Adding a bar like this: --+|You rolled a [$result]! along with the change from # to = above (and adding a closing }} which I assume is just a copy/paste issue) will result in a working script. It is possible to simplify things a bit and avoid the --c lines completely by assigning string variables (--&amp;) to build up the roll expression based on the user's input. Here is an example with inline comments (--/): !script{{ --#title|Roller --/|Prompt for adv/dis and modifier to roll --=lvlAdvantage|?{What Level of Advantage|-5|-4|-3|-2|-1|0|1|2|3|4|5} --=addmod|?{Modifier to add} --/|Assume a standard roll (no adv/dis) --&amp;rollPart| --&amp;fintext|Standard Roll --/|Determine the number of D20s to roll by taking the absolute value of the adv/dis and adding 1 --=DiceCount|[$lvlAdvantage.Raw] {ABS} + 1 --/|Check the sign (positive/negative) of the adv/dis number to determine if we should keep lowest or highest --?"[$lvlAdvantage.Raw]" -lt 0|&amp;rollPart;kl1 --?"[$lvlAdvantage.Raw]" -gt 0|&amp;rollPart;kh1 --/|Create the explanatory text the same way --?"[$lvlAdvantage.Raw]" -lt 0|&amp;fintext;Lowest of [$DiceCount.Raw] --?"[$lvlAdvantage.Raw]" -gt 0|&amp;fintext;Highest of [$DiceCount.Raw] --/|Roll the dice using the count and the kh1/kl1 value (if it is set) along with the mod --=result|[$DiceCount.Raw]d20[&amp;rollPart] + [$addmod.Raw] --/|Display the results --#rightsub|[&amp;fintext] --+|You rolled a [$result]! --X| }} Thanks for checking out ScriptCards!
Thank you so much, that's a way better way to do it! There are some cool lessons in there for me to practice with as I try more things out. I love the comments, super helpful, you're a great teacher!
1744042908

Edited 1744049934
Anyone else seeing an issue where token numbers won't decrement under 1 using ScriptCards on Jumpgate? It appears to be just a visual bug (underneath the scenes the number seems to be removed). There does not seem to be a way to reset the marker (unless incrementing the count). I also tried using token-mod - in that case token-mod will decrement to "0" but did not appear to be able to remove the count/number. Worse, ScriptCards was then unable to remove the marker added by token-mod (and adding the same marker duplicated it underneath the scenes - as seen using t-statusmarkers). Not sure if it is related, but !aura now appears to have an issue adding the "dead" marker when a token's health goes negative (but this appears to be happening in legacy too). (Another Edit: The healthcolors issue appears to be another one of those "the token wont update until moved" sort of things which I absolutely hate.) Edit. It also appears changing a tint using SC on JG (to yellow: FFFF00) appears to come out as a black tint. (A final edit: The syntax for changing tint has changed between Jumpgate and Legacy? If I change&nbsp;--!graphic:[&amp;TT]|tint_color:FFFF00 to add a number sign in front of the color hex, Jumpgate gets the correct color; So FYI! -- final-final edit: Actually, I think the way the token interprets the set tint has changed - even tokens that changed long ago lost the color.) Thanks ~D
Hi again, hopefully quick question: I have a player who is playing a homebrew class called the Odic which casts 1st through 5th level spells by reducing their Max HP by an amount calculated based on their level and spell level. So I'm experimenting with making a scriptcard to help them with that: !script{{ --#title|Odic Magic --=spellLevel|?{Spell Level|1|2|3|4|5} --=Level|@{selected|level} --=hpcurrent|@{selected|hp} --#leftsub|You cast a Level [$spellLevel] Odic spell --/|Calculate Max HP decrease --c[$spellLevel]|1:=hpdec;[$Level]/4 {FLOOR} + 3|2:=hpdec;[$Level]/3 {FLOOR} + 6|3:=hpdec;[$Level]/3 {FLOOR} + 10|4:=hpdec;[$Level]/2 {FLOOR} + 11|5:=hpdec;8 + [$Level]| --/|Change Max HP --!a:@{selected|character_id}|hp^:-=[$hpdec] --=hpmax|@{selected|hp|max} --/|Lower current HP if necessary --?[$hpcurrent] -gt [$hpmax]|[ --!a:@{selected|character_id}|hp:[$hpmax] --+HP decreased to @{selected|hp} --]| --/|Output --+|Max HP decreased by [$hpdec] to [$hpmax] }} Unfortunately, what seems to be happening is that when I set the hpmax variable, it's pulling the old hp max instead of the new reduced one, despite the fact that variable definition is coming after I lower the max hp. So the card will successfully reduce the max hp but won't reduce the current hp, it doesn't ever go into the conditional branch. Is there an issue with using the @{selected|hp|max} for the variable?
1744341068
timmaugh
Pro
API Scripter
All Roll20 constructions are going to resolve before the message reaches scripts... so even though it comes later in your command line, it actually resolves before ScriptCards ever gets the message. If you look at your command line and replace all of the @{selected} formations with the value from the sheet... THAT is what ScriptCards sees when it gets the message. So if you need to refer to a value that has been altered by ScriptCards, you're going to need to use a ScriptCards reference to get it. BTW, you can watch the first ~15min of this video for a primer on the timing of different things resolving.
1744416191

Edited 1744423403
Hi all, I'm trying to get my token to display an aura. I'm using --&amp;tok|@{selected|token_id} --!t:[&amp;tok]|t-aura1_radius:30 But, it's not doing anything. I'm sure I'm missing something. EDIT: Thanks DaemonSlye for helping on discord. When editing token values you don't use the t-
1744715613

Edited 1744716349
Kurt J.
Pro
API Scripter
ScriptCards 3.0.0c is Queued for OneClick The latest version of ScriptCards is a pretty major update, and brings support for Beacon fields (which required converting the entire script to run asynchronously). After a few weeks of testing, I've queued this version for OneClick update. Changes since 2.7.35 include: Beacon Sheet Support Added : Beacon (D&amp;D 2024) fields can now be read and written via&nbsp; [*...] &nbsp;and&nbsp; --!c &nbsp;commands using&nbsp; b- &nbsp;or&nbsp; c- &nbsp;prefixes. Ex:&nbsp; [*S:c-hp] &nbsp;or&nbsp; --!c:[*S:id]|c-hp:10 Requires the&nbsp; Experimental sandbox &nbsp;to access Beacon fields. Some Beacon fields are read-only and will log a message if modified. Script Converted to Async : Enables compatibility with Beacon sheets and future async features. Notes, Bio, and GMNotes fields can now be read as a result of this change Table Roll Update : Table rolls (like&nbsp; [T#MyTable] ) now include the items&nbsp; .tableEntryWeight &nbsp;which gets filled with the weight value of the weight field in the table entry line. Token Property Improvements : --!t &nbsp;can now reference token properties with or without the&nbsp; t- &nbsp;prefix. Integrates with&nbsp; HealthColors &nbsp;(if installed) for automatic updates. Table Roll Enhancements : Table roll entries now include&nbsp; .tableEntryWeight &nbsp;values for custom weighting logic. Highlight Command Alias Added : setrollhighlight &nbsp;can now be used as an alias for&nbsp; sethighlight . Fixed Command Bugs : Resolved issues with broken&nbsp; --l &nbsp;(load) commands. Experimental - chat:message Triggers : Trigger scripts based on specific chat messages vioa&nbsp; chat:message &nbsp;triggers. Triggers must use ScriptCards and include a&nbsp; --/|TRIGGER_REPLACEMENTS &nbsp;section. Offers access to message metadata like sender name, type, and full content. Case-sensitive &nbsp;and&nbsp; requires sandbox restart &nbsp;after initial setup. API_Meta Script Line Adjustment : Updated to correct line offsets in sandbox error logs (thanks to Timmaugh). Bug Fixes : Fixed broken&nbsp; --l &nbsp;(load) lines
1744756358

Edited 1744756428
Exciting stuff, now if we can just map the beacon fields. I tried converting some of my scripts to the Beacon sheet but couldn't figure out what all the field equivalents were lol. Somewhat unrelated, is it possible to do an information request button in the card itself, like a reentrant button? I find that I have to create a reentrant button to then send it to an information request button and thought consolidating the two buttons into one would make things clearer for the script user. Thanks!
1744849431

Edited 1744849488
Kurt J.
Pro
API Scripter
NOTE : I mistakenly left a 0 out of the SC_VERSION_NUMERIC variable. If you are getting a message from the 5E Action Menu saying you need a more recent version of ScriptCards, I've update the Action Menu to suppress this error here:&nbsp; <a href="https://github.com/kjaegers/ScriptCards/blob/main/ScriptCards_Examples/dnd5e/5e_Character_Action_Menu.scard" rel="nofollow">https://github.com/kjaegers/ScriptCards/blob/main/ScriptCards_Examples/dnd5e/5e_Character_Action_Menu.scard</a> If you have customized the menu, this workaround can be implemented by going to the very end of the macro and changing: --?"[&amp;SC_VERSION_NUMERIC]" -eq "" -or "[&amp;SC_VERSION_NUMERIC]" -lt 207150|REPORT_BAD_SC_VERSION to --/?"[&amp;SC_VERSION_NUMERIC]" -eq "" -or "[&amp;SC_VERSION_NUMERIC]" -lt 207150|REPORT_BAD_SC_VERSION (adding a "/" before the "?" at the beginning of the line). I've queued an update (3.0.01) for OneClick that fixes this, but it will be next Tuesday/Wednesday before it is updated on Live.
1744992941

Edited 1745074286
Solved, I made a spelling error when requesting what type of save. Please ignore this question.&nbsp; Hello all, Wonder if you can help? I have a saving throw script card and the bonus for Con saving is not loading, If I hover over the value it reads false. The other saves work.&nbsp; !scriptcard {{ +++5E Tools+++ --#title|SavingThrows --#emoteText|@{selected|token_name} --#sourceToken|@{selected|token_id} --#leftsub|[*S:character_name] --#rightsub| --#titleFontColor|#FFFFFF --#titleCardBackground|#135A9C --#evenRowBackground|#B6AB91 --#evenRowFontColor|#000000 --#oddRowBackground|#CEC7B6 --#oddRowFontColor|#000000 --#emoteBackground|#FFFFFF --#tableBorderRadius|8px --:Initial variable population| --=strength_save_bonus|[*S:strength_save_bonus] --=dexterity_save_bonus|[*S:dexterity_save_bonus] --=constitution_save_bonus|[*S:constitution_save_bonus] --=intelligence_save_bonus|[*S:intelligence_save_bonus] --=wisdom_save_bonus|[*S:wisdom_save_bonus] --=charisma_save_bonus|[*S:charisma_save_bonus] --&gt;Lib5E_Active_Global_Save_Modifiers|@{selected|character_id};Bless --:Type| --&amp;Type|?{Saving Throw Type?|Strength,strength|Dexterity,dexterity|Constition,constition|Intelligence,intelligence|Wisdom,wisdom|Charisma,charisma} --+Type of Save : |[b][&amp;Type][/b] --:Bonus| --=BonusType|[$[&amp;Type]_save_bonus] --+Bonus| [$BonusType] --:Advantage, Disadvantage, Normal| --&amp;RollType|?{Advantage or Disadvantage?|Normal,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1} --:Roll| --=Save|[&amp;RollType] + [$BonusType][Bonus] [&amp;Bless] --+Saving Throw is|[$Save] }}
1744996517

Edited 1745193191
This script is not pulling bonuses for Initiative Can anyone help need this for my next game on Sat. !script {{ --/|Script Name : 5E Initiative Roller (Commented Version) --/|Version : 1.0 --/|Requires SC : 1.6.2+ (better with 1.6.4 or higher) --/|Author : Kurt Jaegers --/|Description : Handles rolling initiative for selected token(s). --/|Note: Functionally, this script is identical to the 5e_Initiative.roll20 file. This version of the file --/|has been updated to include extensive comments explaning how nearly every line of the script works and the --/|intention behind the code. In-game, I suggest using the non-commented version as it is much smaller than this version. --/|Style Notes: I begin all of my script with a comments header as displayed above, listing basic information about the --/|script and any requirements (like if it needs another API script to work, etc.) After that I have the description --/|section with any particular usage details, and then a customizable settings area. I try to use spelled-out names --/|for my customizable variables so it is easier to understand what they are suppose to do, and I comment the possible --/|values and the impacts that changing them will have on the script. At the end of the customization section I include --/|a highly visible separator. I alwyas put a blank space above a new comments section and the code that goes with that --/|comment immediately follows it without any blank lines to keep them grouped together. Finally, while it is possible --/|to simply string a single comment along for as many lines as you like (whitespace doesn't really matter until you --/|reach a new statement identifier (double-dash)), I generally keep my comment lines to around 120 characters in length --/|and start each new line with a comment statement identifier so it looks good/is readable in my editor (Visual Studio Code) --/|================ Customize the behavior of the script by setting these values ================ --/|If set to 1, the script will always ADD a token entry in the turn tracker instead of replacing the existing token --/|If left at the default (0) the token in the tracker will be replaced/updated if it already exists. --&amp;alwaysAddExtraToken|0 --/|If set to 1, the turn tracker won't be modified --&amp;dontUpdateTurnTracker|0 --/|The title for the Script Card that will be output to the chat window --#title|Initiative --/|===================== There are no customization options below this line ===================== --/|We need these substitution variable to get around the 5E sheet's weirdness about using dice rolls that look like attributes --&amp;obrac|{ --&amp;cbrac|} --&amp;at|@ --/|Create a list of all of the selected token ids (see the next couple of comments for additional information). In general, when --/|calling a function, the variable that will be returned is placed in the "Tag" portion of the call (in this case, selectedTokens) --/|and the content contains the name of the function, subfunction, and parameters. The "getselected" function has no subfunctions --/|and takes no parameters. --~selectedTokens|getselected --/|As a result of running getselected, the variable &amp;selectedTokensCount now contains the number of IDs that were selected. --/|We can use this count to set up a for...next loop to run through each of the tokens. --%loop|1;[&amp;selectedTokensCount] --/|The getselected function creates variables named selectedTokens1, selectedTokens2, etc. We can use nested variable --/|refrencing to use &amp;loop to build the name of the variable we are looking for on each loop iteration. This works because --/|the innermost variable reference ([&amp;loop]) will be evaluated first, and will be replaced with the value of &amp;loop, so the --/|outer reference becomes [&amp;selectedTokens1] for example, which is one of our varible names. We then store the --/|current token's ID in &amp;thisId for convenience so we don't have to write out the whole nested thing every time. --&amp;thisId|[&amp;selectedTokens[&amp;loop]] --/|Start by assuming we are just going to roll 1d20 for initiative. Note that this is creating a string variable (&amp; command) --/|and not actually rolling the dice. This is because we want to build a formula for a roll assignment (= command) to happen --/|later. The &amp;initDie string variable will literally contain the text "1d20" --&amp;initDie|1d20 --/|Now check the initiative_style entry for the character. It contains nested brackets and @ references, so we use oddrowbackground --/|&amp;at, &amp;obrac, and &amp;cbrac to avoid trouble trying to type those directly into the macro. If we find either of the two possible --/|values that indicate advantage or disadvantage, we set &amp;initDie to either 2d10kh1 (advantage) or 2d20kl1 (disadvantage). We use --/|the shorthand method of setting a string variable in a conditional here. --?"[*[&amp;thisId]:initiative_style]" -eq "[&amp;obrac][&amp;at][&amp;obrac]d20[&amp;cbrac],[&amp;at][&amp;obrac]d20[&amp;cbrac][&amp;cbrac]kh1"|&amp;initDie;2d20kh1 --?"[*[&amp;thisId]:initiative_style]" -eq "[&amp;obrac][&amp;at][&amp;obrac]d20[&amp;cbrac],[&amp;at][&amp;obrac]d20[&amp;cbrac][&amp;cbrac]kl1"|&amp;initDie;2d20kl1 --/|Assume there is no bonus to initiative. If we don't do this and try to use initiative_bonus directly, any character that --/|doesn't have an initiative bonus will end up with a roll that looks like "1d20 +" when you hover over it. It will subtitlefontcolor --/|work, but it doesn't look good, so by pre-setting the value to 0 we would end up with "1d20 + 0" --&amp;initBonus|0 --/|Check the initiative_bonus attribute for the character. We add an X here so that if the value is empty we get "X" back and it makes --/|for an easy comparison. (otherwise, we would end up with blanks that would confuse the conditional function). If we do find a value --/|for initiative_bonus, just update &amp;initBonus with that value. --?"X[*[&amp;thisID]:initiative_bonus]" -ne "X"|&amp;initBonus;[*[&amp;thisID]:initiative_bonus] --/|Using the &amp;initDie and &amp;initBonus we arranged above, roll the character's initiative. Both of these are string variables, so the --/|line below will end up looking something like "1d20 + 4" when processed, which will be where we actually roll the dice and assignment --/|the result to $initRoll --=initRoll|[&amp;initDie] + [&amp;initBonus] --/|Output the token's name and the initiative roll to the output card --+[*[&amp;thisId]:t-name]|[$initRoll] --/|OPTIMIZATION NOTE: Because the results of detemining the turn tracker methods to use are the same for every token processed, it would --/|likely be better to move this whole section to the part of the script before getting the selected tokens and only have it execute once. --/|But I didn't think of that until after I started writing the comments, so I left it here. It won't hurt anything, but the script would --/|run slightly faster if you had a lot of tokens selected if that change was made. The actual performance difference is likely unnoticable --/|though, and if a player is using the script to roll initiative for just their own token there is no practical difference between the --/|two approaches. --/|Time to update the turn tracker. We start by assuming the version number for ScriptCards is 1.6.4 or higher, which will allow us to --/|use "turnorder;replacetoken" as the function to update the tracker. Because of the change to the way the turn tracker works, and the --/|fact that the 1.6.2 update of ScriptCards only fixed the "turnorder;addtoken" function, we need to figure out what calls we will --/|use to update the tracker. If we have 1.6.4, we will just use replacetoken, setting method1 (the remove call) to dontremovetoken which --/|is not a valid turnorder function, so it will just be ignored by ScriptCards. --&amp;method1|dontremovetoken --&amp;method2|replacetoken --/|Check the &amp;ScriptCards_Version variable. If it is blank (same adding an X trick described above), we are using a version before 1.6.4, so --/|we need to remove the token from the tracker first and then re-add it, so we change method1 to removetoken and method2 to addtoken. --?"[&amp;ScriptCards_Version]X" -eq "X"|&amp;method1;removetoken --?"[&amp;ScriptCards_Version]X" -eq "X"|&amp;method2;addtoken --/|Check the &amp;alwaysAddExtraToken setting (top of the script). If it is 1, no matter what we came up with for version information, we just want --/|to add a turn for the token and not replace anything that might already exist, so set method1 and method2 appropriately. --?[&amp;alwaysAddExtraToken] -eq 1|&amp;method1;dontremovetoken --?[&amp;alwaysAddExtraToken] -eq 1|&amp;method2;addtoken --/|Next we need to check to see if &amp;dontUpdateTurnTracker is set to 1 (settings at top of script). If it is, we don't actually want to make --/|turn tracker changes, so set both method1 and method2 to invalid function names so they don't do anything. --?[&amp;dontUpdateTurnTracker] -eq 1|&amp;method1;dontremovetoken --?[&amp;dontUpdateTurnTracker] -eq 1|&amp;method2;dontaddtoken --/|Call the two functions we determined we would use. The first call (method1) *potentially* removes the existing token entry from the --/|turn tracker, while the second (method2) adds the token back into the tracker. --~|turnorder;[&amp;method1];[&amp;thisId] --~|turnorder;[&amp;method2];[&amp;thisId];[$initRoll.Raw] --/|We've don all the processing for this token, so mark the end of the loop and let the script process the next token. --%| }}