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
Forum Champion
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. --%| }}
No one around anymore?&nbsp;
I have a question about the --@ command.&nbsp; Is there a reason why an API call wouldn't be made if this was used in a card? Does the mod have to be registered with ScriptCards? This command works as intended: !cp-action&nbsp; --src|Whispering Hammers --attr|items-other|other_item|Copper Bar --dst|Test Dummy but the line below in a ScriptCard does nothing: --@cp-action| _src|Whispering Hammers _attr|items-other|other_item|Copper Bar _dst|Test Dummy The Mod Console even shows that the call is being made, but nothing happens.&nbsp; "ScriptCards: Making API call - !cp-action&nbsp; --src|Whispering Hammers --attr|items-other|other_item|Copper Bar --dst|Test Dummy" Any ideas or thoughts?
1745959003
timmaugh
Forum Champion
API Scripter
When a script calls another script, certain things about the message are different than if a player calls a script. Specifically, three properties about the message object: selected =&gt; represents the tokens selected on the board for the issuer of the command; since the Script Moderator can't have any tokens selected, there is no selected property who =&gt; represents the "speaking" name of the issuer of the command; since the Script Moderator sent the message, this is 'api' playerid =&gt; stores the id of the player who issued the message; since the Script Moderator doesn't have an id, this is 'API' These properties are checked by scripts to make sure that the person who sent the message is authorized to take whatever action the command is asking the script to take (for instance, testing if you're a GM for certain tasks, etc.). For a long time, this limitation made it a pain to work with scripts like this (having ScriptCards issue a command to another script, like what you're trying to do). However, if you install the MetascriptToolbox, you'll get a script that quietly helps with this behind the scenes... restoring these properties before your destination script ("cp-action") sees the command... as long as your destination script is built to be a standard script (and, if it comes to that, it's an easy change if we have to make it). So, install the Toolbox, then run this command one time in your game: !smconfig +playerid +who Then try your ScriptCard again. It should start working.
Tim,&nbsp; You are a genius and shall have an elevated place in my shrine to Mod Authors.&nbsp; I will have to do this in all my games.
Hey all! I Imagine this is something that someone else has already dealt with. But I just realized that I'm having a bit of a problem. So, let's say I have a hash table that includes roll variables...something like this. --/|VAR_PROB Testing --h: VAR_PROB("1")| [=3d6] meters away. --h: VAR_PROB("2")| [[4d6]] meters away. --h: VAR_PROB("3")| [?[=1d2] -eq 1|No Encounter|Naval Patrol] --h: VAR_PROB("4")| [?[[1d2]] -eq 1|No Encounter|Marine Patrol] --s:|VAR_PROB And then I load up that table into the ScriptCards_Storage&nbsp; character. And then I have a macro, something like. --+|[:VAR_PROB("1")] --+|[:VAR_PROB("2")] --+|[:VAR_PROB("3")] --+|[:VAR_PROB("4")] And I got it all working...or so I thought. Until I realized that the same numbers come up each time I trigger the macro. Which...I'm guessing is because...maybe the numbers are generated when you load the hash table and then it stays at that number until you load the hash table again? Is that what is happening? Is there a way to make it so that the number is generated each time the I call the table?
TrooperSJP,&nbsp; Maybe try making variables to load into the hash table? --=Value1|3d6 --=Value2|4d6 --h: VAR_PROB("1")| [$Value1.Raw] meters away. --h: VAR_PROB("2")| [$Value2.Raw] meters away. That way they roll again when you use the macro?
And now it's time for 1 new macro, 2 new problems! (I mean, 2 for now.) I have a loop where the first iteration goes through perfectly and then any subsequent loops fail to load any attributes.&nbsp; &nbsp;&nbsp;&nbsp; --:ChooseShop| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --~|array;define;ShopID;-OOeMNvZK7n3tM3yj2jo;-OPQn4vBM67LXY84vQ1Q4;-OOebGL-vLjZPEpvBL-Y4 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --%ShopName|foreach;ShopID &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --+|Shop ID [&amp;ShopName] &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --+|[t][tr][td width=96px][F:Contrail One:16][i][c][*[&amp;ShopName]:character_name][/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle][*[&amp;ShopName]:image_url][/img]::ShopHere;[&amp;ShopName][/rbutton][/c][/td][td][f:12][c][br][*[&amp;ShopName]:store_desc][br][u][i]Current Approval Rating:[br][/u] Rank [*[&amp;ShopName]:approval] ([*[&amp;ShopName]:approval^]% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t] &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --%| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --X| The Shop IDs are being pulled from the array just fine for the debug lines, but none of the 2nd or 3rd [*[&amp;ShopName]:attribute] constructions are being applied.&nbsp; Also, why is the card border not around the entire card? Why is it stopping 2/3 of the way?
Erik M. said: TrooperSJP,&nbsp; Maybe try making variables to load into the hash table? --=Value1|3d6 --=Value2|4d6 --h: VAR_PROB("1")| [$Value1.Raw] meters away. --h: VAR_PROB("2")| [$Value2.Raw] meters away. That way they roll again when you use the macro? I tried that, it doesn't work. What I ended up doing it calling the macro with the hash table each time I call the triggering macro. I feel like it might not be efficient, but it works.
1747396278
Kurt J.
Pro
API Scripter
TrooperSJP said: Erik M. said: TrooperSJP,&nbsp; Maybe try making variables to load into the hash table? --=Value1|3d6 --=Value2|4d6 --h: VAR_PROB("1")| [$Value1.Raw] meters away. --h: VAR_PROB("2")| [$Value2.Raw] meters away. That way they roll again when you use the macro? I tried that, it doesn't work. What I ended up doing it calling the macro with the hash table each time I call the triggering macro. I feel like it might not be efficient, but it works. You could store the roll formula as a string in the hashtable (just 3d6 instead of [=3d6] and then, when you go to use it, enclose the value in [=...] ex: [= [:VAR_PROB("1")]]
1747410744
timmaugh
Forum Champion
API Scripter
Erik M. said: And now it's time for 1 new macro, 2 new problems! (I mean, 2 for now.) I have a loop where the first iteration goes through perfectly and then any subsequent loops fail to load any attributes.&nbsp; &nbsp;&nbsp;&nbsp; --:ChooseShop| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --~|array;define;ShopID;-OOeMNvZK7n3tM3yj2jo;-OPQn4vBM67LXY84vQ1Q4;-OOebGL-vLjZPEpvBL-Y4 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --%ShopName|foreach;ShopID &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --+|Shop ID [&amp;ShopName] &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --+|[t][tr][td width=96px][F:Contrail One:16][i][c][*[&amp;ShopName]:character_name][/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle][*[&amp;ShopName]:image_url][/img]::ShopHere;[&amp;ShopName][/rbutton][/c][/td][td][f:12][c][br][*[&amp;ShopName]:store_desc][br][u][i]Current Approval Rating:[br][/u] Rank [*[&amp;ShopName]:approval] ([*[&amp;ShopName]:approval^]% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t] &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --%| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --X| The Shop IDs are being pulled from the array just fine for the debug lines, but none of the 2nd or 3rd [*[&amp;ShopName]:attribute] constructions are being applied.&nbsp; Also, why is the card border not around the entire card? Why is it stopping 2/3 of the way? I'm not the best ScriptCards reference, but I can tell you things from experience with working with messages... your card is probably not enclosing the entire contents because there is an unescaped line break in your contents, somewhere, and/or that part of your code (that would have preserved the structure of the final card) got eaten or parsed because of unexpected content. Which is to say that it could very well be in either direction, either: you have contents in the 2nd (and possibly 3rd) entry that is breaking the structure of the card as it is being built, OR you are not pulling the info for the 2nd (and possibly 3rd) entry, and that is causing the parser to barf and consume characters that it shouldn't, which is leading to the broken card. I would suggest removing the 2nd and 3rd entries, and duplicating the 1st entry exactly for a couple of dummy entries. See if that fixes your problem. If it does fix the problem, it's likely that it's the contents of your entries that is causing the problem. If it does NOT fix the problem, then it is probably something in your ScriptCards syntax. But hopefully someone with more SC experience can jump in, too.
The card structure is fine I think. I don't see any unescaped line breaks or anything like that. So I still don't know what's going on with the border. !script {{ &nbsp;&nbsp;&nbsp; --#title|Testing Stuff &nbsp;&nbsp;&nbsp; --#whisper|self &nbsp;&nbsp;&nbsp; --#emoteState|Hidden --#debug|Yes &nbsp;&nbsp;&nbsp; --:ChooseShop| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --~|array;define;ShopID;-OOeMNvZK7n3tM3yj2jo;-OPQn4vBM67LXY84vQ1Q4;-OOebGL-vLjZPEpvBL-Y4 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --%ShopName|foreach;ShopID &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --+|Shop ID [&amp;ShopName] &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --+|[t][tr][td width=96px][F:Contrail One:16][i][c][*[&amp;ShopName]:character_name][/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle][*[&amp;ShopName]:image_url][/img]::ShopHere;[&amp;ShopName][/rbutton][/c][/td][td][f:12][c][br][*[&amp;ShopName]:store_desc][br][u][i]Current Approval Rating:[br][/u] Rank [*[&amp;ShopName]:approval] ([*[&amp;ShopName]:approval^]% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t] &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --%| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --X| }} I changed the 2nd and 3rd stores attributes to match the 1st store and it still has the same errors.&nbsp; I looked at the debug log and it is weird. The loop tag substitution works fine for the first iteration, but then doesn't do anything for the subsequent ones. It's like it doesn't even try to pull the attribute from the sheet or if it just didn't exist at all. I've deleted and recreated the attibutes with still no joy. "Line Counter: 5, Tag::ChooseShop, Content:" "Line Counter: 6, Tag:~, Content:array;define;ShopID;-OOeMNvZK7n3tM3yj2jo;-OPQn4vBM67LXY84vQ1Q4;-OOebGL-vLjZPEpvBL-Y4" "Line Counter: 7, Tag:%ShopName, Content:foreach;ShopID" "ScriptCards: Info - Beginning of loop ShopName" "ContentIn: Shop ID [&amp;ShopName] Match: [&amp;ShopName], vName: ShopName, replacement -OOeMNvZK7n3tM3yj2jo" "Line Counter: 8, Tag:+, Content:Shop ID -OOeMNvZK7n3tM3yj2jo" "ContentIn: [t][tr][td width=96px][F:Contrail One:16][i][c][*[&amp;ShopName]:character_name][/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle][*[&amp;ShopName]:image_url][/img]::ShopHere;[&amp;ShopName][/rbutton][/c][/td][td][f:12][c][br][*[&amp;ShopName]:store_desc][br][u][i]Current Approval Rating:[br][/u] Rank [*[&amp;ShopName]:approval] ([*[&amp;ShopName]:approval^]% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t] Match: [&amp;ShopName], vName: ShopName, replacement -OOeMNvZK7n3tM3yj2jo" "ContentIn: [t][tr][td width=96px][F:Contrail One:16][i][c]The Dragon's Roost[/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle][*[&amp;ShopName]:image_url][/img]::ShopHere;[&amp;ShopName][/rbutton][/c][/td][td][f:12][c][br][*[&amp;ShopName]:store_desc][br][u][i]Current Approval Rating:[br][/u] Rank [*[&amp;ShopName]:approval] ([*[&amp;ShopName]:approval^]% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t] Match: [&amp;ShopName], vName: ShopName, replacement -OOeMNvZK7n3tM3yj2jo" "ContentIn: [t][tr][td width=96px][F:Contrail One:16][i][c]The Dragon's Roost[/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle]<a href="https://files.d20.io/images/438319966/6TavkQ3ypccV8AZP56I4ew/original.png[/img]::ShopHere;[&amp;ShopName][/rbutton][/c][/td][td][f:12][c][br][*[&amp;ShopName]:store_desc][br][u][i]Current" rel="nofollow">https://files.d20.io/images/438319966/6TavkQ3ypccV8AZP56I4ew/original.png[/img]::ShopHere;[&amp;ShopName][/rbutton][/c][/td][td][f:12][c][br][*[&amp;ShopName]:store_desc][br][u][i]Current</a> Approval Rating:[br][/u] Rank [*[&amp;ShopName]:approval] ([*[&amp;ShopName]:approval^]% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t] Match: [&amp;ShopName], vName: ShopName, replacement -OOeMNvZK7n3tM3yj2jo" "ContentIn: [t][tr][td width=96px][F:Contrail One:16][i][c]The Dragon's Roost[/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle]<a href="https://files.d20.io/images/438319966/6TavkQ3ypccV8AZP56I4ew/original.png[/img]::ShopHere;-OOeMNvZK7n3tM3yj2jo[/rbutton][/c][/td][td][f:12][c][br][*[&amp;ShopName]:store_desc][br][u][i]Current" rel="nofollow">https://files.d20.io/images/438319966/6TavkQ3ypccV8AZP56I4ew/original.png[/img]::ShopHere;-OOeMNvZK7n3tM3yj2jo[/rbutton][/c][/td][td][f:12][c][br][*[&amp;ShopName]:store_desc][br][u][i]Current</a> Approval Rating:[br][/u] Rank [*[&amp;ShopName]:approval] ([*[&amp;ShopName]:approval^]% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t] Match: [&amp;ShopName], vName: ShopName, replacement -OOeMNvZK7n3tM3yj2jo" "ContentIn: [t][tr][td width=96px][F:Contrail One:16][i][c]The Dragon's Roost[/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle]<a href="https://files.d20.io/images/438319966/6TavkQ3ypccV8AZP56I4ew/original.png[/img]::ShopHere;-OOeMNvZK7n3tM3yj2jo[/rbutton][/c][/td][td][f:12][c][br]A" rel="nofollow">https://files.d20.io/images/438319966/6TavkQ3ypccV8AZP56I4ew/original.png[/img]::ShopHere;-OOeMNvZK7n3tM3yj2jo[/rbutton][/c][/td][td][f:12][c][br]A</a> tavern run by the red dragonborn Tyrath. General store items, some potions/elixirs.[br][u][i]Current Approval Rating:[br][/u] Rank [*[&amp;ShopName]:approval] ([*[&amp;ShopName]:approval^]% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t] Match: [&amp;ShopName], vName: ShopName, replacement -OOeMNvZK7n3tM3yj2jo" "ContentIn: [t][tr][td width=96px][F:Contrail One:16][i][c]The Dragon's Roost[/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle]<a href="https://files.d20.io/images/438319966/6TavkQ3ypccV8AZP56I4ew/original.png[/img]::ShopHere;-OOeMNvZK7n3tM3yj2jo[/rbutton][/c][/td][td][f:12][c][br]A" rel="nofollow">https://files.d20.io/images/438319966/6TavkQ3ypccV8AZP56I4ew/original.png[/img]::ShopHere;-OOeMNvZK7n3tM3yj2jo[/rbutton][/c][/td][td][f:12][c][br]A</a> tavern run by the red dragonborn Tyrath. General store items, some potions/elixirs.[br][u][i]Current Approval Rating:[br][/u] Rank 0 ([*[&amp;ShopName]:approval^]% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t] Match: [&amp;ShopName], vName: ShopName, replacement -OOeMNvZK7n3tM3yj2jo" "Line Counter: 9, Tag:+, Content:[t][tr][td width=96px][F:Contrail One:16][i][c]The Dragon's Roost[/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle]<a href="https://files.d20.io/images/438319966/6TavkQ3ypccV8AZP56I4ew/original.png[/img]::ShopHere;-OOeMNvZK7n3tM3yj2jo[/rbutton][/c][/td][td][f:12][c][br]A" rel="nofollow">https://files.d20.io/images/438319966/6TavkQ3ypccV8AZP56I4ew/original.png[/img]::ShopHere;-OOeMNvZK7n3tM3yj2jo[/rbutton][/c][/td][td][f:12][c][br]A</a> tavern run by the red dragonborn Tyrath. General store items, some potions/elixirs.[br][u][i]Current Approval Rating:[br][/u] Rank 0 (0% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t]" "Line Counter: 10, Tag:%, Content:" "ContentIn: Shop ID [&amp;ShopName] Match: [&amp;ShopName], vName: ShopName, replacement -OPQn4vBM67LXY84vQ1Q4" "Line Counter: 8, Tag:+, Content:Shop ID -OPQn4vBM67LXY84vQ1Q4" "ContentIn: [t][tr][td width=96px][F:Contrail One:16][i][c][*[&amp;ShopName]:character_name][/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle][*[&amp;ShopName]:image_url][/img]::ShopHere;[&amp;ShopName][/rbutton][/c][/td][td][f:12][c][br][*[&amp;ShopName]:store_desc][br][u][i]Current Approval Rating:[br][/u] Rank [*[&amp;ShopName]:approval] ([*[&amp;ShopName]:approval^]% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t] Match: [&amp;ShopName], vName: ShopName, replacement -OPQn4vBM67LXY84vQ1Q4" "ContentIn: [t][tr][td width=96px][F:Contrail One:16][i][c][/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle][*[&amp;ShopName]:image_url][/img]::ShopHere;[&amp;ShopName][/rbutton][/c][/td][td][f:12][c][br][*[&amp;ShopName]:store_desc][br][u][i]Current Approval Rating:[br][/u] Rank [*[&amp;ShopName]:approval] ([*[&amp;ShopName]:approval^]% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t] Match: [&amp;ShopName], vName: ShopName, replacement -OPQn4vBM67LXY84vQ1Q4" "ContentIn: [t][tr][td width=96px][F:Contrail One:16][i][c][/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle][/img]::ShopHere;[&amp;ShopName][/rbutton][/c][/td][td][f:12][c][br][*[&amp;ShopName]:store_desc][br][u][i]Current Approval Rating:[br][/u] Rank [*[&amp;ShopName]:approval] ([*[&amp;ShopName]:approval^]% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t] Match: [&amp;ShopName], vName: ShopName, replacement -OPQn4vBM67LXY84vQ1Q4" "ContentIn: [t][tr][td width=96px][F:Contrail One:16][i][c][/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle][/img]::ShopHere;-OPQn4vBM67LXY84vQ1Q4[/rbutton][/c][/td][td][f:12][c][br][*[&amp;ShopName]:store_desc][br][u][i]Current Approval Rating:[br][/u] Rank [*[&amp;ShopName]:approval] ([*[&amp;ShopName]:approval^]% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t] Match: [&amp;ShopName], vName: ShopName, replacement -OPQn4vBM67LXY84vQ1Q4" "ContentIn: [t][tr][td width=96px][F:Contrail One:16][i][c][/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle][/img]::ShopHere;-OPQn4vBM67LXY84vQ1Q4[/rbutton][/c][/td][td][f:12][c][br][br][u][i]Current Approval Rating:[br][/u] Rank [*[&amp;ShopName]:approval] ([*[&amp;ShopName]:approval^]% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t] Match: [&amp;ShopName], vName: ShopName, replacement -OPQn4vBM67LXY84vQ1Q4" "ContentIn: [t][tr][td width=96px][F:Contrail One:16][i][c][/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle][/img]::ShopHere;-OPQn4vBM67LXY84vQ1Q4[/rbutton][/c][/td][td][f:12][c][br][br][u][i]Current Approval Rating:[br][/u] Rank&nbsp; ([*[&amp;ShopName]:approval^]% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t] Match: [&amp;ShopName], vName: ShopName, replacement -OPQn4vBM67LXY84vQ1Q4" "Line Counter: 9, Tag:+, Content:[t][tr][td width=96px][F:Contrail One:16][i][c][/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle][/img]::ShopHere;-OPQn4vBM67LXY84vQ1Q4[/rbutton][/c][/td][td][f:12][c][br][br][u][i]Current Approval Rating:[br][/u] Rank&nbsp; (% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t]" "Line Counter: 10, Tag:%, Content:" "ContentIn: Shop ID [&amp;ShopName] Match: [&amp;ShopName], vName: ShopName, replacement -OOebGL-vLjZPEpvBL-Y4" "Line Counter: 8, Tag:+, Content:Shop ID -OOebGL-vLjZPEpvBL-Y4" "ContentIn: [t][tr][td width=96px][F:Contrail One:16][i][c][*[&amp;ShopName]:character_name][/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle][*[&amp;ShopName]:image_url][/img]::ShopHere;[&amp;ShopName][/rbutton][/c][/td][td][f:12][c][br][*[&amp;ShopName]:store_desc][br][u][i]Current Approval Rating:[br][/u] Rank [*[&amp;ShopName]:approval] ([*[&amp;ShopName]:approval^]% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t] Match: [&amp;ShopName], vName: ShopName, replacement -OOebGL-vLjZPEpvBL-Y4" "ContentIn: [t][tr][td width=96px][F:Contrail One:16][i][c][/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle][*[&amp;ShopName]:image_url][/img]::ShopHere;[&amp;ShopName][/rbutton][/c][/td][td][f:12][c][br][*[&amp;ShopName]:store_desc][br][u][i]Current Approval Rating:[br][/u] Rank [*[&amp;ShopName]:approval] ([*[&amp;ShopName]:approval^]% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t] Match: [&amp;ShopName], vName: ShopName, replacement -OOebGL-vLjZPEpvBL-Y4" "ContentIn: [t][tr][td width=96px][F:Contrail One:16][i][c][/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle][/img]::ShopHere;[&amp;ShopName][/rbutton][/c][/td][td][f:12][c][br][*[&amp;ShopName]:store_desc][br][u][i]Current Approval Rating:[br][/u] Rank [*[&amp;ShopName]:approval] ([*[&amp;ShopName]:approval^]% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t] Match: [&amp;ShopName], vName: ShopName, replacement -OOebGL-vLjZPEpvBL-Y4" "ContentIn: [t][tr][td width=96px][F:Contrail One:16][i][c][/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle][/img]::ShopHere;-OOebGL-vLjZPEpvBL-Y4[/rbutton][/c][/td][td][f:12][c][br][*[&amp;ShopName]:store_desc][br][u][i]Current Approval Rating:[br][/u] Rank [*[&amp;ShopName]:approval] ([*[&amp;ShopName]:approval^]% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t] Match: [&amp;ShopName], vName: ShopName, replacement -OOebGL-vLjZPEpvBL-Y4" "ContentIn: [t][tr][td width=96px][F:Contrail One:16][i][c][/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle][/img]::ShopHere;-OOebGL-vLjZPEpvBL-Y4[/rbutton][/c][/td][td][f:12][c][br][br][u][i]Current Approval Rating:[br][/u] Rank [*[&amp;ShopName]:approval] ([*[&amp;ShopName]:approval^]% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t] Match: [&amp;ShopName], vName: ShopName, replacement -OOebGL-vLjZPEpvBL-Y4" "ContentIn: [t][tr][td width=96px][F:Contrail One:16][i][c][/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle][/img]::ShopHere;-OOebGL-vLjZPEpvBL-Y4[/rbutton][/c][/td][td][f:12][c][br][br][u][i]Current Approval Rating:[br][/u] Rank&nbsp; ([*[&amp;ShopName]:approval^]% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t] Match: [&amp;ShopName], vName: ShopName, replacement -OOebGL-vLjZPEpvBL-Y4" "Line Counter: 9, Tag:+, Content:[t][tr][td width=96px][F:Contrail One:16][i][c][/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle][/img]::ShopHere;-OOebGL-vLjZPEpvBL-Y4[/rbutton][/c][/td][td][f:12][c][br][br][u][i]Current Approval Rating:[br][/u] Rank&nbsp; (% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t]" "Line Counter: 10, Tag:%, Content:" "ScriptCards: Info - End of loop ShopName" "Line Counter: 11, Tag:X, Content:"
I'm having an issue with getting the&nbsp; 5e_Character_Action_Menu.scard &nbsp;macro working... it's great! I can't seem to get healing to work right, though. It doesn't add the wisdom modifier in on my cleric. I'm (mostly) certain that the spell sheet is set up right. When i cast using the macro on the sheet it works fine. I'm using&nbsp; --&amp;damageApplyScript|scriptcards as my damage calculator. For some reason Token-Mod was treating me like a sibling.... "Why you hitting yourself? Why you hitting yourself?" I also get errors is the Mod Console, but I don't know how to interpret... "ScriptCards Triggers could not find character named \"ScriptCards_Triggers\"" Once at the start, then "ScriptCards Error: Label LibAMA_CHECK_FOR_LIBRARY is not defined on line 12 (&gt;LibAMA_CHECK_FOR_LIBRARY, UseAddons)" Repeatedly. Does anyone have clues, tips, suggestions, ridicule or good dad jokes for me? --Troy Ohh, and by the way.... in the Opportunity Attack placard, the bolded title has a typo... "Opporunity"
ENRDDnD,&nbsp; do you have a character named ScriptCards_Triggers in the Journal of your game?
I did not... was it supposed to be there when SC installed or is it supposed to be created by me? I kinda jumped in with both feet, not a lot other than some Youtube vids to get started. In any case, i have created one now, modeled on what you posted, and I think I'm launching clean now. "ScriptCards: 3 Templates loaded" "ScriptCards Triggers Active. Trigger Character ID is -OQkLAR2ee0oWIeYLaWs" "ScriptCards Message Triggers enabled? No" "-=&gt; ScriptCards - 3.0.01 by Kurt Jaegers Ready &lt;=- Meta Offset : 3429" So that's probably a good step, thanks! I am still having the no Spellcasting Mod issue though. I'd appreciate any further guidance. I'll also keep poking around.... hmmm, maybe roll up another cleric and see if it acts differently.
1747864598
Kurt J.
Pro
API Scripter
Erik M. said: And now it's time for 1 new macro, 2 new problems! (I mean, 2 for now.) I have a loop where the first iteration goes through perfectly and then any subsequent loops fail to load any attributes.&nbsp; &nbsp;&nbsp;&nbsp; --:ChooseShop| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --~|array;define;ShopID;-OOeMNvZK7n3tM3yj2jo;-OPQn4vBM67LXY84vQ1Q4;-OOebGL-vLjZPEpvBL-Y4 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --%ShopName|foreach;ShopID &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --+|Shop ID [&amp;ShopName] &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --+|[t][tr][td width=96px][F:Contrail One:16][i][c][*[&amp;ShopName]:character_name][/c][/i][/F][c][rbutton][img width=64 height=64 text-align=center vertical-align=middle][*[&amp;ShopName]:image_url][/img]::ShopHere;[&amp;ShopName][/rbutton][/c][/td][td][f:12][c][br][*[&amp;ShopName]:store_desc][br][u][i]Current Approval Rating:[br][/u] Rank [*[&amp;ShopName]:approval] ([*[&amp;ShopName]:approval^]% Discount)[/i][br][br][/f][/c][br][br][/td][/tr][/t] &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --%| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --X| The Shop IDs are being pulled from the array just fine for the debug lines, but none of the 2nd or 3rd [*[&amp;ShopName]:attribute] constructions are being applied.&nbsp; Also, why is the card border not around the entire card? Why is it stopping 2/3 of the way? The issue here is with the placement of the [F:12] specifier before the [c] specifier... The way formatting codes work is that the code looks for the&nbsp; start and end tag and then wraps the text inside with the HTML. When it sees [f:12][c]...[/f][/c] the stuff in the middle (including the [c] gets shifted and is now out of place f or the [/c]. Changing: [f:12][c] to&nbsp; [c][f:12] fixes the issue for me.
1747953240
Kurt J.
Pro
API Scripter
ENRDDnD said: I'm having an issue with getting the&nbsp; 5e_Character_Action_Menu.scard &nbsp;macro working... it's great! I can't seem to get healing to work right, though. It doesn't add the wisdom modifier in on my cleric. I'm (mostly) certain that the spell sheet is set up right. When i cast using the macro on the sheet it works fine. I'm using&nbsp; --&amp;damageApplyScript|scriptcards as my damage calculator. For some reason Token-Mod was treating me like a sibling.... "Why you hitting yourself? Why you hitting yourself?" I also get errors is the Mod Console, but I don't know how to interpret... "ScriptCards Triggers could not find character named \"ScriptCards_Triggers\"" Once at the start, then "ScriptCards Error: Label LibAMA_CHECK_FOR_LIBRARY is not defined on line 12 (&gt;LibAMA_CHECK_FOR_LIBRARY, UseAddons)" Repeatedly. Does anyone have clues, tips, suggestions, ridicule or good dad jokes for me? --Troy Ohh, and by the way.... in the Opportunity Attack placard, the bolded title has a typo... "Opporunity" If you aren't using ScriptCards Triggers or the Action Menu Addon Library (neither of which are needed for the Action Menu) those messages should be normal. I'll look into why it isn't adding the modifier.
Man, you folks must be getting tired of me.&nbsp; So I thought I know how to do this, but apparently I don't.&nbsp; I am trying to use Muler to retrieve a value from a table on a character called GenericMacro in an ability called miscMagicRoll which contains: 01-14=Misc1 15-28=Misc2 29-42=Misc3 43-56=Misc4 57-70=Misc5 71-85=Misc6 86-99=Misc7 00=Special The code is: !script {{ &nbsp;--=SecondaryRoll|1d100 --+|[$SecondaryRoll] --&amp;MagicTableName|get.GenericMacro.miscMagicRoll.[$SecondaryRoll.Raw].value/get --+|Table Name&nbsp; [&amp;MagicTableName] }} Please help me with my boggle. Thanks!
1748015579
timmaugh
Forum Champion
API Scripter
Erik M. said: I am trying to use Muler to retrieve a value from a table on a character called GenericMacro in an ability called miscMagicRoll which contains: 01-14=Misc1 15-28=Misc2 29-42=Misc3 43-56=Misc4 57-70=Misc5 71-85=Misc6 86-99=Misc7 00=Special The code is: !script {{ &nbsp;--=SecondaryRoll|1d100 --+|[$SecondaryRoll] --&amp;MagicTableName|get.GenericMacro.miscMagicRoll.[$SecondaryRoll.Raw].value/get --+|Table Name&nbsp; [&amp;MagicTableName] }} Please help me with my boggle. Thanks! You're dealing with the order in which things resolve. All of the metascripts will do what they do *before* ScriptCards gets the message, so by the time ScriptCards has a chance to fill the SecondaryRoll variable with the results of the roll, Muler has already lost it's opportunity to go get info from the table based on that result. What you can do to get around this is to just rely on Roll20 inline rolls and extract the value, yourself. Note that this will mean that the roll will no longer be a ScriptCards-generated roll, so you won't be able to do things like [$SecondaryRoll.Raw] with it, but there are ways to get at roll information contained in standard Roll20 rolls that can (possibly) bridge this gap -- if it even comes to that. Currently, you only need the value from the roll so that you can use it in the Muler construction. So, at its simplest, your code could be: !script {{ --&amp;MagicTableName|get.GenericMacro.miscMagicRoll.[[1d100]].value/get --+|Table Name&nbsp; [&amp;MagicTableName] }} If you needed to hang on to the result of that roll (maybe to display, elsewhere... which I think is what the --+ line does), you could do it like: !script {{ &nbsp;--=SecondaryRoll|[[1d100]].value --+|[$SecondaryRoll] --&amp;MagicTableName|get.GenericMacro.miscMagicRoll.$[[0]].value/get --+|Table Name&nbsp; [&amp;MagicTableName] }}
I have a set of working scripts to play hide &amp; seek using NPC’s stealth versus the players passive wisdom.&nbsp; These scripts also can function as a poor-man’s version of Encounter Helper, allowing the GM to give groups of NPC’s a group number, and then toggle the entire group between the gmlayer to object layer.&nbsp; The trick is to use the token’s aura1 color hexcode to carry the group number and the two-digit stealth roll result.&nbsp; Then on the player’s turn, &nbsp;run the script which pops the visible tokens onto the object layer.&nbsp; After the player’s turn, I run the group move to hide all the tokens and then repeat for the next player.&nbsp; I wanted to post them here because I think other GM’s could use them, and I’m interested in what other ideas there are to use the search &amp; query the token’s aura color hexcode. &nbsp; !script {{ +++5eLib;snlib;ActionMenuAddons;Lib5E+++ &nbsp; --/|Script Name : NPC-Stealth &nbsp; --/|Version&nbsp; &nbsp; &nbsp;: 1.1 &nbsp; --/|Date&nbsp; &nbsp; &nbsp; &nbsp; : 24 May 2025 &nbsp; --/|Requires SC :&nbsp; &nbsp; --/|Author&nbsp; &nbsp; &nbsp; : Aluminum_Ride &nbsp; --/|Description : Stealth for NPC sneaks &nbsp; --/| rolls a Stealth/Hide skill &amp; saves result in aura1 hexcode. [&amp;Hide] two-digit string variable which will inserted into the last two digits of hexcode. &nbsp; --/| adds a digit to aura1 hexcode to signify which NPC group token belongs to.&nbsp; [&amp;Group] single-digit string variable placed in the fourth digit of the hexcode.&nbsp; I use 1-9 in this script. &nbsp; --/| moves the token to GM layer&nbsp; &nbsp; --/| aura1 hexcode is #ff0[&amp;Group][&amp;Hide] &nbsp; --/|Card Format Stuff&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; --#bodyfontface|Helvetica &nbsp; &nbsp; &nbsp; --#oddrowfontcolor|#1B2631 &nbsp; &nbsp; &nbsp; --#evenrowfontcolor|#1B2631 &nbsp; &nbsp; &nbsp; --#bodyfontsize|[&amp;bodyFontSize]px &nbsp; &nbsp; &nbsp; --#titlecardbackgroundcolor|#2E4053 &nbsp; &nbsp; &nbsp; --#titlefontcolor|#EBEDEF &nbsp; &nbsp; &nbsp; --#titlefontsize|1.5em &nbsp; &nbsp; &nbsp; --#titlefontshadow|0 &nbsp; &nbsp; &nbsp; --#oddrowbackground|#AEB6BF &nbsp; &nbsp; &nbsp; --#evenrowbackground|#D6DBDF &nbsp; &nbsp; &nbsp; --#subtitlefontcolor|#fffebd &nbsp; &nbsp; &nbsp; --#tablebgcolor|#fffebd &nbsp; &nbsp; &nbsp; --#lineheight|10pt &nbsp; &nbsp; &nbsp; --#whisper|gm &nbsp; --/| &nbsp;&nbsp; &nbsp; --#title|NPC-Stealth &nbsp; --#emoteText|@{selected|token_name} &nbsp; --#sourceToken|@{selected|token_id} &nbsp; &nbsp; --&amp;STid|@{selected|token_id} &nbsp; --c?{roll type?|Normal|Advantage|Disadvantage}|Normal:&amp;RT;1d20|Advantage:&amp;RT;2d20kh1|Disadvantage:&amp;RT;2d20kl1 &nbsp; --=Roll|[&amp;RT] &nbsp; --+|roll type is [&amp;RT] and roll is [$Roll] &nbsp; --/| &nbsp; --/|NPCs pulled from Compendium have multiple attributes for stealth bonus on the Roll20 npc sheet. &nbsp; --/|This script will use the maximum value of the choices for the token's stealth roll. &nbsp; --=S1|[*S:npc_stealth] &nbsp; --=S2|[*S:npc_stealth_flag] &nbsp; --=S3|[*S:stealth_bonus] &nbsp; --=S4|[*S:npc_stealth_base] &nbsp; --+|[$S1] [$S2] [$S3] [$S4] &nbsp; --=MaxS|-6 &nbsp; --?[$MaxS] -lt [$S1]|[ --/|S1 is greater --=MaxS|[$S1] --]| &nbsp; &nbsp; --?[$MaxS] -lt [$S2]|[ --/|S2 is greater --=MaxS|[$S2] --]| &nbsp; --?[$MaxS] -lt [$S3]|[ --/|S3 is greater --=MaxS|[$S3] --]| &nbsp; &nbsp; --?[$MaxS] -lt [$S4]|[ --/|S4 is greater --=MaxS|[$S4] --]| &nbsp; --/|now [$MaxS] is storing the maximum of the four stealth bonus from npc's character attributes. &nbsp; --+|max stealth bonus is [$MaxS]&nbsp;&nbsp; &nbsp; --=Result|[$Roll]+[$MaxS] &nbsp; --+|@{selected|token_name} stealth roll is [$Result] &nbsp; --/|Select which npc group this token belongs to.&nbsp; I See You script only searches one group at a time.&nbsp;&nbsp; &nbsp; &nbsp;--=GR|?{npc group number is?|1|2|3|4|5|6|7|8|9} &nbsp; --&amp;Group|[$GR.raw] &nbsp; &nbsp; &nbsp; --+|Group number is [&amp;Group] &nbsp; --/|oldhide output is for checking purposes and could be streamlined out of script. &nbsp;&nbsp; &nbsp; --&amp;oldcolor|[*S:t-aura1_color] &nbsp; --&amp;oldhide|[&amp;oldcolor(5)] &nbsp; --+old hide was|[&amp;oldhide] &nbsp; --/|Making sure [&amp;Hide] is two-digits.&nbsp; Note I haven't done anything to prevent more than two. &nbsp;&nbsp; --?[$Result] -gt 9 |[ &nbsp; &nbsp;--&amp;Hide|[$Result.raw] --]|[ &nbsp; &nbsp;--&amp;Hide|0[$Result.raw]&nbsp; --]| --+Hide is |[&amp;Hide] --&amp;basecolor|#FF0 &nbsp; &nbsp; --&amp;NewColor|[&amp;basecolor][&amp;Group][&amp;Hide] &nbsp; &nbsp; --!t:[&amp;STid]|t-aura1_color:[&amp;NewColor] --&amp;checkcolor|[*S:t-aura1_color] --+checkcolor:|[*S:t-aura1_color] &nbsp; --/|Done with hexcode.&nbsp; Now moving token to gmlayer&nbsp;&nbsp; &nbsp; &nbsp;--!t:[&amp;STid]|t-layer:gmlayer &nbsp; &nbsp;--+|Now hiding on the GM layer. &nbsp; --X|End }}&nbsp;&nbsp; ============================================================ =========================================================== !script {{ +++5eLib;snlib;ActionMenuAddons;Lib5E+++ &nbsp; --/|Script Name : NPC-Stealth &nbsp; --/|Version&nbsp; &nbsp; &nbsp;: 1.0 &nbsp; --/|Date&nbsp; &nbsp; &nbsp; &nbsp; : 24 May 2025 &nbsp; --/|Requires SC :&nbsp; &nbsp; --/|Author&nbsp; &nbsp; &nbsp; : Aluminum_Ride &nbsp; --/|Description : NPC aura color scrubber &nbsp; --/| The purpose of this script is to scrub all the npc tokens on the map so no token has unintended value for [&amp;Group] or [&amp;Hide] &nbsp; --/|&nbsp; sets all aura1_color values to #ff0000, which can be changed in the line below if needed. &nbsp; --#title|NPC aura color scrubber &nbsp; &nbsp; --#whisper|gm &nbsp; --&amp;newhexcolor|#ff0000 &nbsp;&nbsp; &nbsp; --:(1) GET ALL TOKENS INTO THE "allTokens" ARRAY| will have blank 1st element to be removed later &nbsp; --~|array;pagetokens;allTokens;@{selected|token_id} &nbsp; --:(2) PREP ARRAY FOR LOOP| if no array elements then end macro &nbsp; --~tokenid|array;getfirst;allTokens &nbsp; --?[&amp;tokenid] -eq ArrayError|End &nbsp; --:(3) SCRUB AURA1 COLOR ON npc =1 TOKENS| &nbsp; --:EXPLoop| &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --:TOKEN MUST BE ON OBJECTS OR GMLAYER AND HAVE npc =1| &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --?[*[&amp;tokenid]:t-layer] -ne objects -and [*[&amp;tokenid]:t-layer] -ne gmlayer|NextToken &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --?[*[&amp;tokenid]:npc] -eqi "1"|&gt;AURASCRUB &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --:NextToken| &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --~tokenid|array;getnext;allTokens &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --?[&amp;tokenid] -ne ArrayError|EXPLoop &nbsp; --:End| &nbsp; --X| &nbsp; --:AURASCRUB| &nbsp; &nbsp; &nbsp; &nbsp;--&amp;oldcolor|[*[&amp;tokenid]:t-aura1_color]&nbsp; &nbsp; &nbsp; &nbsp; ​--+[*[&amp;tokenid]:character_name] old color|[&amp;oldcolor] &nbsp; --!t:[&amp;tokenid]|t-aura1_color:[&amp;newhexcolor] &nbsp; --&amp;newcolor|[*[&amp;tokenid]:t-aura1_color] ​&nbsp; &nbsp; &nbsp; --+[*[&amp;tokenid]:character_name] new color|[&amp;newcolor] &nbsp;&nbsp; &nbsp; --&lt;| }} ======================================= !script {{ +++5eLib;snlib;ActionMenuAddons;Lib5E+++ &nbsp; --/|Script Name : move NPC group &nbsp; --/|Version&nbsp; &nbsp; &nbsp;: 1.0 &nbsp; --/|Date&nbsp; &nbsp; &nbsp; &nbsp; : 24 May 2025 &nbsp; --/|Requires SC :&nbsp; &nbsp; --/|Author&nbsp; &nbsp; &nbsp; : Aluminum_Ride &nbsp; --/|Description : Moves a NPC group between object &amp; gmlayer &nbsp; --/| The purpose of this script is move a group of npc tokens from the gmlayer to the object layer or vice versa. &nbsp; --/|&nbsp; This script works after the npc's have been assigned a group [&amp;Group] and the value kept in digit four of aura1 hexcode. &nbsp; --/|&nbsp; See NPC-Stealth and NPC-Group. &nbsp; --#title|move group &nbsp; --#whisper|gm &nbsp; &nbsp; &nbsp;--=GR|?{npc group number is?|1|2|3|4|5|6|7|8|9} &nbsp; --&amp;Group|[$GR.raw] &nbsp; &nbsp; &nbsp; --+|Group number is [&amp;Group] &nbsp; --&amp;moveto|?{move to layer?|objects|gmlayer} &nbsp; --:(1) GET ALL TOKENS INTO THE "allTokens" ARRAY| will have blank 1st element to be removed later &nbsp; --~|array;pagetokens;allTokens;@{selected|token_id} &nbsp; --:(2) PREP ARRAY FOR LOOP| if no array elements then end macro &nbsp; --~tokenid|array;getfirst;allTokens &nbsp; --?[&amp;tokenid] -eq ArrayError|End &nbsp; --:(3) check token for object or gmlayer &amp; group# from aura1 color hexcode| &nbsp; --:EXPLoop| &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --:TOKEN MUST BE ON OBJECTS OR GMLAYER AND HAVE npc =1| &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --?[*[&amp;tokenid]:t-layer] -ne objects -and [*[&amp;tokenid]:t-layer] -ne gmlayer|NextToken &nbsp; &nbsp; --&amp;checkcolor|[*[&amp;tokenid]:t-aura1_color] --&amp;Gcheck|[&amp;checkcolor(4,1)] --?[&amp;Gcheck] -nei [&amp;Group]|NextToken &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --?[*[&amp;tokenid]:npc] -eqi "1"|&gt;TOKMOVE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --:NextToken| &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --~tokenid|array;getnext;allTokens &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --?[&amp;tokenid] -ne ArrayError|EXPLoop &nbsp; --:End| &nbsp; --X| &nbsp; --:TOKMOVE| &nbsp; &nbsp; &nbsp;--!t:[&amp;tokenid]|t-layer:[&amp;moveto] &nbsp; &nbsp; &nbsp;--+|[*[&amp;tokenid]:character_name] moves to [&amp;moveto] layer&nbsp;&nbsp; &nbsp; --&lt;| }} ================================================================= This script will move hidden tokens on the gmlayer to the objects layer conditions to move token from gmlayer to object layer: &nbsp; &nbsp; &nbsp; &nbsp;Group # (must be in same room etc.)= true &nbsp; &nbsp; &nbsp; &nbsp;Range (must be within vision range of PC. usually 60 feet) = true &nbsp; &nbsp; &nbsp; &nbsp;Stealth contest PC passive_wisdom greater or equal to Hide = true pc active search: PC Perception greater or equal to Hide = true !script {{ &nbsp; --/|Script Name : 🥷SeeYou &nbsp; --/|Version&nbsp; &nbsp; &nbsp;: 1.0 &nbsp; --/|Requires SC :&nbsp; &nbsp; --/|Author&nbsp; &nbsp; &nbsp; : Aluminum_Ride &nbsp; --/|Date&nbsp; &nbsp; &nbsp; &nbsp; : 23 May 2025 &nbsp; --/|Description : Moves npc tokens from the gmlayer to the object layer if certain conditions are met. &nbsp; --/|&nbsp; &nbsp;Must be in range of the PC's vision&nbsp; &nbsp; &nbsp; --/|&nbsp; &nbsp;npc hide value is less than equal to the PC's passive wisdom&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --/|&nbsp; &nbsp;npc must be in the group queried.&nbsp; Multiple groups will need to run this script once per group. &nbsp; --/|&nbsp; &nbsp; &nbsp; --/|&nbsp; &nbsp; &nbsp; --#bodyfontface|Helvetica &nbsp; --#oddrowfontcolor|#1B2631 &nbsp; --#evenrowfontcolor|#1B2631 &nbsp; --#bodyfontsize|[&amp;bodyFontSize]px &nbsp;&nbsp; &nbsp; --#titlecardbackgroundcolor|#2E4053 &nbsp; --#titlefontcolor|#EBEDEF &nbsp; --#titlefontsize|1.5em &nbsp; --#titlefontshadow|0 &nbsp; --#oddrowbackground|#AEB6BF &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; --#evenrowbackground|#D6DBDF &nbsp; --#subtitlefontcolor|#fffebd &nbsp; --#tablebgcolor|#fffebd &nbsp; --#lineheight|10pt &nbsp; --#title|I see you &nbsp; --#whisper|gm &nbsp; --/|PC is source token &nbsp; --#sourceToken|@{selected|token_id} &nbsp; --&amp;STid|@{selected|token_id} &nbsp; &nbsp; &nbsp;--=GR|?{npc group number is?|1|2|3|4|5|6|7|8|9} &nbsp; --&amp;Group|[$GR.raw] &nbsp; &nbsp; &nbsp; --+|Group number is [&amp;Group] &nbsp; --=vision|?{what is PC's vision distance (ft)?} --+|vision is [$vision] feet &nbsp; --=paswis|[*S:passive_wisdom]&nbsp; &nbsp; --&amp;paswis|[$paswis.raw] --+|passive wisdom is [&amp;paswis] &nbsp; --&amp;moveto|objects &nbsp; --:(1) GET ALL TOKENS INTO THE "allTokens" ARRAY| will have blank 1st element to be removed later &nbsp; --~|array;pagetokens;allTokens;@{selected|token_id} &nbsp; --:(2) PREP ARRAY FOR LOOP| if no array elements then end macro &nbsp; --~tokenid|array;getfirst;allTokens &nbsp; --?[&amp;tokenid] -eq ArrayError|End &nbsp; --:(3) check token for object or gmlayer &amp; group# from aura1 color hexcode| &nbsp; --:EXPLoop| &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --:TOKEN MUST BE ON GMLAYER AND HAVE npc =1| &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --?[*[&amp;tokenid]:t-layer] -nei gmlayer|NextToken &nbsp; &nbsp; --&amp;checkcolor|[*[&amp;tokenid]:t-aura1_color] --&amp;Gcheck|[&amp;checkcolor(4,1)] &nbsp; &nbsp; --&amp;S1|[&amp;checkcolor(5,1)] --&amp;S2|[&amp;checkcolor(6,1)] --&amp;hide|[&amp;S1][&amp;S2] --=hide|[&amp;hide] --+|hide = [$hide] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --?[$hide] -gt [$paswis]|NextToken --?[&amp;Gcheck] -nei [&amp;Group]|NextToken &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --?[*[&amp;tokenid]:npc] -nei "1"|NextToken &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --~HowFarAway|distance;[&amp;STid];[&amp;tokenid] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --=RANGE|[$HowFarAway] * 5 --+RANGE EQUALS|[$RANGE] feet. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --?[$RANGE] -le [$vision]|&gt;TOKMOVE &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --:NextToken| &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --~tokenid|array;getnext;allTokens &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --?[&amp;tokenid] -ne ArrayError|EXPLoop &nbsp; --:End| &nbsp; --X| &nbsp; --:TOKMOVE| &nbsp; &nbsp; &nbsp;--!t:[&amp;tokenid]|t-layer:[&amp;moveto] &nbsp; &nbsp; &nbsp;--+|[*[&amp;tokenid]:character_name] moves to [&amp;moveto] layer&nbsp;&nbsp; &nbsp; --&lt;| }} ====================================================================== ====================================================================== Group tokens !script {{ &nbsp; --#title|NPC aura color group &nbsp; --#emoteText|@{selected|token_name} &nbsp; --#whisper|gm &nbsp; --&amp;newhexcolor|#ff0000 &nbsp; --#sourceToken|@{selected|token_id} &nbsp; --&amp;STid|@{selected|token_id} &nbsp; &nbsp; &nbsp;--=GR|?{npc group number is?|1|2|3|4|5|6|7|8|9} &nbsp; --&amp;Group|[$GR.raw] --+|Group number is [&amp;Group]&nbsp; &nbsp; --&amp;newhexcolor|#ff0[&amp;Group]00 --+|newhexcolor is [&amp;newhexcolor] &nbsp;&nbsp; &nbsp; &nbsp; --!t:[&amp;STid]|t-aura1_color:[&amp;newhexcolor] &nbsp; --X| }}&nbsp;&nbsp; ========================================
Creating a Macro for the Cleric&nbsp;Twilight Sanctuary to roll and replace the value if higher then the current. Currently does a 1d6+7 Everything is working but I can't get setattr to use the $die variable in the card. If a number is use&nbsp;&nbsp; --@setattr| _sel _hp_temp| 5&nbsp; it then works but the [$die] value doesn't work. Or is there a better way to do this. Thanks in advance for any help.&nbsp; &nbsp;!scriptcard {{ --#Whisper|GM --#title|Temp Hit Points --#emoteText|@{selected|token_name} --#sourceToken|@{selected|token_id} --#leftsub|[*S:character_name] --#rightsub| --l#SkillTemp|allsettings --=CTHP|[*S:hp_temp] --+Current Temp HP:|[$CTHP] --:Roll| --&amp;Twilight|1d6 --=CL|7 --=Die|[&amp;Twilight] + [$CL] --?[$Die] -ge [$CTHP] | Replace --+No Change:|Current Temp HP is Greater Then Rolled --x| --:Replace| --@setattr| _sel _hp_temp| [$die] --x| }}
1748996117
Andrew R.
Pro
Sheet Author
Make sure you match the case of the variable. “$Die” is not “$die”. You’re using the latter but setting the former.&nbsp;