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

[Script] ScriptCards - My "Spiritual Successor" to PowerCards

1646963775

Edited 1646963909
Kurt J.
Pro
API Scripter
Arthur B. said: Michael C. said: @Arthur B. - strategically place the  --#whisper|self,gm command in the subroutine with the special damage.   @Andreas J. - Thanks! @Michael - I added the --#whisper|self,gm in the special damage code and it's putting the whole card in a whisper now, Any ideas? See modified code and result below. --:Poison| --#whisper|self,gm --=PoisonDmg|1d6 + 0 --+Poisoned|[*S:character_name] presses the button to release the poison into [*T:character_name]'s bloodstream. [*T:character_name] is paralyzed for 1 minute and takes [$PoisonDmg] Poison damage. The target may repeat the save at the end of each of its turns. --X| --:PoisonNeg| --#whisper|self,gm --=PoisonDmgNeg|1d6/ 2 --+Poisoned|[*S:character_name] presses the button to release the poison into [*T:character_name]'s bloodstream. [*T:character_name] is not paralyzed and takes [$PoisonDmg] Poison damage. --X| --:PoisonCrit| --#whisper|self,gm --=PoisonDmgCrit|1d6* 2 --+Poisoned|[*S:character_name] presses the button to release the poison into [*T:character_name]'s bloodstream. [*T:character_name] is paralyzed for 1 minute and takes [$PoisonDmg] Poison damage. The target may repeat the save at the end of each of its turns. --X| --:PoisonNegCrit| --#whisper|self,gm --=PoisonDmgCritNeg|(1d6* 2) / 2 --+Poisoned|[*S:character_name] presses the button to release the poison into [*T:character_name]'s bloodstream. [*T:character_name] is not paralyzed and takes [$PoisonDmg] Poison damage. --X| The whisper setting is indeed script-wide, but you can do what you are looking to do with the --e (echo) command. If you remove --#whisper|self,gm from the sections above and replace the --+ lines with something like this: --e[*S:character_name]|/w gm [*S:character_name] presses the button to release the poison into [*T:character_name]'s bloodstream. [*T:character_name] is paralyzed for 1 minute and takes [$PoisonDmg] Poison damage. The target may repeat the save at the end of each of its turns. --e[*S:character_name]|/w [& SendingPlayerName ] [*S:character_name] presses the button to release the poison into [*T:character_name]'s bloodstream. [*T:character_name] is paralyzed for 1 minute and takes [$PoisonDmg] Poison damage. The target may repeat the save at the end of each of its turns. That should do it. When using --e it will need to be done in two separate lines, since the whisper setting in ScriptCards sends multiple whispers when there is more than one target specified... it just does it behind the scenes. With this approach, the "table" will see the standard card while the individual player and the gm will be whispered the poison message. With the --e command, the tag portion (before the |) is who the text should look like it is coming from. Then it is just the same syntax for a standard whisper.
Kurt J. said: Ronnie McDurgen said: Might perhaps someone here be interested in creating a function that can read/write multiple variables to a token, not to a character? (I'm thinking that it might be possible to hack the token-tooltip to serve in this capacity.) . . . Here's an idea for how to create the function: use one symbol as a separator between variables, and then another symbol to separate between the variable's name and variable's value. Keep in mind that there might be much better solutions out there, I'm just a humble noob who's been brainstorming a little bit. This is a quick implementation. Seems to work, but of course there could be bugs :) Something like this will do that: !script {{   --/|Sample script to encode multiple string variables in a token tooltip.   --/|Use object modification to set the tooltip. Variables are in the format of   --/|Name=Value, with each pair separated by a $. Note is arbitraty. The split symbol   --/|could be changed, but :, ;, and | won't work   --!t:@{selected|token_id}|tooltip:Size=2$Zombie=True$Type=Undead$Alignment=Mean   --/|Retrieve the values stored in the tooltip   -->READ_TOKEN_TOOLTIP|@{selected|token_id}   --/|Print the values for Size, Zombie, Type, and Alignment   --+Size|[&Size]   --+Zombie|[&Zombie]   --+Type|[&Type]   --+Alignment|[&Alignment]   --X|   --:READ_TOKEN_TOOLTIP|TokenID --/|Get the tooltip from the token and use the split string function to break it into individual variables PARTSCount, PARTS1, PARTS2, etc.   --~PARTS|string;split;$;[*[%1%]:t-tooltip] --/|Make sure we have at least something in the PARTSCount   --?[$PARTSCount.Raw] -eq 0|SKIP_PARSE_TOOLTIP --/|Loop through the PARTS variables   --%ParseLoop|1;[$PARTSCount.Raw] --/|Find text before "=" and use it for the variable name     --~vname|string;before;=;[&PARTS[&ParseLoop]] --/|Find text after "=" and use it for the variable value     --~vvalue|string;after;=;[&PARTS[&ParseLoop]] --/|Set the variable to the value     --&[&vname]|[&vvalue]   --%|   --:SKIP_PARSE_TOOLTIP|   --<| }} The items in the --! command could be replaced with variables to save things between script runs or to provide to other scripts. That's brilliant, thank you so much! :-D I don't suppose that you would also be interested in writing a function that can write a new value for a given variable? (That is to say, a function that takes a name and a value as its input, and then searches through the tooltip for that name, and then, once the name has been found, it gives that variable a new value.)
1647019935

Edited 1647022129
@Arthur B. - EDIT: Place --#whisper| in the setup portion of your script and then c hange the command back to --#whisper| after the special damage.
Oddly, all of a sudden the     --&RollType|?{Advantage or Disadvantage?|Normal,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1} command is resulting in a weird readout on hovering over the die result. Instead of the usual double roll for advantage and disadvantage result of, for example, (Result: (4,9)) it reads... ((x4x),9) or (4,x9x) as the resulting roll. Was this intended?
Kurt, Is there a way to query to have a scriptcard to roll more than once to get multiple results... If so, how? !scriptcard {{   --#title|Treasure Hunter   --#titlecardbackground|#606c9b   --=R1|1d6   --=R2|1d6   --=R3|1d6   --=R4|1d12   --=R5|1d8   --=R6|1d6  --?[$R1] -eq 1|&A;A veteran dungeon delver  --?[$R1] -eq 2|&A;A desperate thief  --?[$R1] -eq 3|&A;A reckless fortune seeker  --?[$R1] -eq 4|&A;A well-known adventurer  --?[$R1] -eq 5|&A;A brash, young fool  --?[$R1] -eq 6|&A;A student of history  --?[$R2] -eq 1|&A2;a long, hooked nose  --?[$R2] -eq 2|&A2;a cute little button nose  --?[$R2] -eq 3|&A2;a scar below the left eye  --?[$R2] -eq 4|&A2;pockmarked cheeks  --?[$R2] -eq 5|&A2;high cheek bones  --?[$R2] -eq 6|&A2;a pointy chin  --?[$R3] -eq 1|&A3;hums or sings while walking  --?[$R3] -eq 2|&A3;constantly brushes the hair back from out of his or her face  --?[$R3] -eq 3|&A3;laughs maniacally at everything  --?[$R3] -eq 4|&A3;never smiles and never laughs  --?[$R3] -eq 5|&A3;scratches the elbow frequently  --?[$R3] -eq 6|&A3;picks at his or her teeth after meals  --?[$R4] -eq 1|&A4;a nose ring  --?[$R4] -eq 2|&A4;a dark red cape  --?[$R4] -eq 3|&A4;shiny leather boots  --?[$R4] -eq 4|&A4;boots with a hole in the left toe  --?[$R4] -eq 5|&A4;a heavy gold chain  --?[$R4] -eq 6|&A4;a wide-brimmed hat  --?[$R4] -eq 7|&A4;a tattoo on the forearm (d6): 1. dagger; 2. dragon; 3. nude figure; 4. skull; 5. snake; 6. thorns  --?[$R4] -eq 8|&A4;a long dark ponytail  --?[$R4] -eq 9|&A4;luscious golden curls  --?[$R4] -eq 10|&A4;a handkerchief in his breast pocket  --?[$R4] -eq 11|&A4;an open shirt and a very hairy chest  --?[$R4] -eq 12|&A4;extravagant mustache  --?[$R5] -eq 1|&A5;some hemp rope and a silk handkerchief  --?[$R5] -eq 2|&A5;several over-sized sacks  --?[$R5] -eq 3|&A5;several torches and a much-used knife  --?[$R5] -eq 4|&A5;a pocketbook of notes and maps  --?[$R5] -eq 5|&A5;a dagger in each boot  --?[$R5] -eq 6|&A5;a beautiful antique scabbard  --?[$R5] -eq 7|&A5;a well-worn lantern  --?[$R5] -eq 8|&A5;climbing gear—pitons, hammer, and rope  --?[$R6] -eq 1|&A6;rumors of treasure hoards  --?[$R6] -eq 2|&A6;the location of an ancient crypt or ruin  --?[$R6] -eq 3|&A6;a pair of strong arms to haul some gold  --?[$R6] -eq 4|&A6;proof of an ancient fable  --?[$R6] -eq 5|&A6;evidence to disprove a sacred text  --?[$R6] -eq 6|&A6;an ear to listen to some boasting  -->Result|   --:Result|  --+|[b]The treasure hunter is..[/b] [&A] that has [&A2] and [&A3], wears [&A4], that carries [&A5] looking for [&A6]. }}
@DM Scotty - I am not quite sure what you are looking for but if I am guessing correctly then I would use an array with a For/Next Loop with a floating variable.  Something like: !scriptcards {{ --:ArrayOfRandomNumbers|    --~|array;define;RandomTable;0;1d6;1d6;1d6;1d12;1d8;1d6;    --~|array;removeat;RandomTable;0    --~RNumber|array;getfirst;RandomTable    --?[&RNumber] -eq ArrayError|endOutput    --=Roll|[&RNumber]    --+Loop|Counter (1) is [&RNumber], roll was [$Roll] --:loopCheck|    --%LoopCounter|2;6;1       --~RNumber|array;getnext;RandomTable       --?[&RNumber] -eq ArrayError|endOutput       --=Roll|[&RNumber]       --+Loop|Counter ([&LoopCounter]) is [&RNumber], roll was [$Roll]    --%| --:EndOutput| }}
1647041010
Kurt J.
Pro
API Scripter
Michael C. said: Oddly, all of a sudden the     --&RollType|?{Advantage or Disadvantage?|Normal,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1} command is resulting in a weird readout on hovering over the die result. Instead of the usual double roll for advantage and disadvantage result of, for example, (Result: (4,9)) it reads... ((x4x),9) or (4,x9x) as the resulting roll. Was this intended? Yes, this was part of the Roll Parser rewrite. When dice are eliminated for some reason from the total, they are marked in the roll results with [x x] around the eliminated dice. Dice without that marker were counted in the total for the roll. It should looks like ([x4x],9) meaning the 4 was dropped and the 9 was kept because of the kh1.
@Mike, I am trying to query so that it will generate based on the number I enter in the query.... I have added your code but i'm just wanting to show the text output... If this was a treasure table, I want the option to change the amount of the number of times it rolls and shows the results.. Hopefully that helps with what i'm trying to do.. !scriptcard {{   --#title|Treasure Hunter   --#titlecardbackground|#606c9b   --?{Number of Dice|1}R1,R2,R3,R4,R5,R6   --=R1|1d6   --=R2|1d6   --=R3|1d6   --=R4|1d12   --=R5|1d8   --=R6|1d6 --:ArrayOfRandomNumbers|    --~|array;define;RandomTable;0;1d6;1d6;1d6;1d12;1d8;1d6;    --~|array;removeat;RandomTable;0    --~RNumber|array;getfirst;RandomTable    --?[&RNumber] -eq ArrayError|endOutput    --=Roll|[&RNumber]    --+Loop|Counter (1) is [&RNumber], roll was [$Roll] --:loopCheck|    --%LoopCounter|2;6;1       --~RNumber|array;getnext;RandomTable       --?[&RNumber] -eq ArrayError|endOutput       --=Roll|[&RNumber]       --+Loop|Counter ([&LoopCounter]) is [&RNumber], roll was [$Roll]    --%| --:EndOutput|  --?[$R1] -eq 1|&A;A veteran dungeon delver  --?[$R1] -eq 2|&A;A desperate thief  --?[$R1] -eq 3|&A;A reckless fortune seeker  --?[$R1] -eq 4|&A;A well-known adventurer  --?[$R1] -eq 5|&A;A brash, young fool  --?[$R1] -eq 6|&A;A student of history  --?[$R2] -eq 1|&A2;a long, hooked nose  --?[$R2] -eq 2|&A2;a cute little button nose  --?[$R2] -eq 3|&A2;a scar below the left eye  --?[$R2] -eq 4|&A2;pockmarked cheeks  --?[$R2] -eq 5|&A2;high cheek bones  --?[$R2] -eq 6|&A2;a pointy chin  --?[$R3] -eq 1|&A3;hums or sings while walking  --?[$R3] -eq 2|&A3;constantly brushes the hair back from out of his or her face  --?[$R3] -eq 3|&A3;laughs maniacally at everything  --?[$R3] -eq 4|&A3;never smiles and never laughs  --?[$R3] -eq 5|&A3;scratches the elbow frequently  --?[$R3] -eq 6|&A3;picks at his or her teeth after meals  --?[$R4] -eq 1|&A4;a nose ring  --?[$R4] -eq 2|&A4;a dark red cape  --?[$R4] -eq 3|&A4;shiny leather boots  --?[$R4] -eq 4|&A4;boots with a hole in the left toe  --?[$R4] -eq 5|&A4;a heavy gold chain  --?[$R4] -eq 6|&A4;a wide-brimmed hat  --?[$R4] -eq 7|&A4;a tattoo on the forearm (d6): 1. dagger; 2. dragon; 3. nude figure; 4. skull; 5. snake; 6. thorns  --?[$R4] -eq 8|&A4;a long dark ponytail  --?[$R4] -eq 9|&A4;luscious golden curls  --?[$R4] -eq 10|&A4;a handkerchief in his breast pocket  --?[$R4] -eq 11|&A4;an open shirt and a very hairy chest  --?[$R4] -eq 12|&A4;extravagant mustache  --?[$R5] -eq 1|&A5;some hemp rope and a silk handkerchief  --?[$R5] -eq 2|&A5;several over-sized sacks  --?[$R5] -eq 3|&A5;several torches and a much-used knife  --?[$R5] -eq 4|&A5;a pocketbook of notes and maps  --?[$R5] -eq 5|&A5;a dagger in each boot  --?[$R5] -eq 6|&A5;a beautiful antique scabbard  --?[$R5] -eq 7|&A5;a well-worn lantern  --?[$R5] -eq 8|&A5;climbing gear—pitons, hammer, and rope  --?[$R6] -eq 1|&A6;rumors of treasure hoards  --?[$R6] -eq 2|&A6;the location of an ancient crypt or ruin  --?[$R6] -eq 3|&A6;a pair of strong arms to haul some gold  --?[$R6] -eq 4|&A6;proof of an ancient fable  --?[$R6] -eq 5|&A6;evidence to disprove a sacred text  --?[$R6] -eq 6|&A6;an ear to listen to some boasting  -->Result|   --:Result|  --+|[b]The treasure hunter is..[/b] [&A] that has [&A2] and [&A3], wears [&A4], that carries [&A5] looking for [&A6]. }}
@Mike, I was able to get this to populate... However, when I change the number it still only rolls once....
1647049081

Edited 1647049192
Kurt J.
Pro
API Scripter
@DM Scotty. Not sure if I understood your intention, but this will roll and build a list of "the treasure hunter is..." entries the number of times you put in the roll query. It is essentially your same code, but simplified and with a few order changes. !scriptcard {{ --#title|Treasure Hunter --#titlecardbackground|#606c9b --%LoopCounter|1;?{Number of Dice|1} --=R1|1d6 --=R2|1d6 --=R3|1d6 --=R4|1d12 --=R5|1d8 --=R6|1d6 --?[$R1] -eq 1|&A;A veteran dungeon delver --?[$R1] -eq 2|&A;A desperate thief --?[$R1] -eq 3|&A;A reckless fortune seeker --?[$R1] -eq 4|&A;A well-known adventurer --?[$R1] -eq 5|&A;A brash, young fool --?[$R1] -eq 6|&A;A student of history --?[$R2] -eq 1|&A2;a long, hooked nose --?[$R2] -eq 2|&A2;a cute little button nose --?[$R2] -eq 3|&A2;a scar below the left eye --?[$R2] -eq 4|&A2;pockmarked cheeks --?[$R2] -eq 5|&A2;high cheek bones --?[$R2] -eq 6|&A2;a pointy chin --?[$R3] -eq 1|&A3;hums or sings while walking --?[$R3] -eq 2|&A3;constantly brushes the hair back from out of his or her face --?[$R3] -eq 3|&A3;laughs maniacally at everything --?[$R3] -eq 4|&A3;never smiles and never laughs --?[$R3] -eq 5|&A3;scratches the elbow frequently --?[$R3] -eq 6|&A3;picks at his or her teeth after meals --?[$R4] -eq 1|&A4;a nose ring --?[$R4] -eq 2|&A4;a dark red cape --?[$R4] -eq 3|&A4;shiny leather boots --?[$R4] -eq 4|&A4;boots with a hole in the left toe --?[$R4] -eq 5|&A4;a heavy gold chain --?[$R4] -eq 6|&A4;a wide-brimmed hat --?[$R4] -eq 7|&A4;a tattoo on the forearm (d6): 1. dagger; 2. dragon; 3. nude figure; 4. skull; 5. snake; 6. thorns --?[$R4] -eq 8|&A4;a long dark ponytail --?[$R4] -eq 9|&A4;luscious golden curls --?[$R4] -eq 10|&A4;a handkerchief in his breast pocket --?[$R4] -eq 11|&A4;an open shirt and a very hairy chest --?[$R4] -eq 12|&A4;extravagant mustache --?[$R5] -eq 1|&A5;some hemp rope and a silk handkerchief --?[$R5] -eq 2|&A5;several over-sized sacks --?[$R5] -eq 3|&A5;several torches and a much-used knife --?[$R5] -eq 4|&A5;a pocketbook of notes and maps --?[$R5] -eq 5|&A5;a dagger in each boot --?[$R5] -eq 6|&A5;a beautiful antique scabbard --?[$R5] -eq 7|&A5;a well-worn lantern --?[$R5] -eq 8|&A5;climbing gear—pitons, hammer, and rope --?[$R6] -eq 1|&A6;rumors of treasure hoards --?[$R6] -eq 2|&A6;the location of an ancient crypt or ruin --?[$R6] -eq 3|&A6;a pair of strong arms to haul some gold --?[$R6] -eq 4|&A6;proof of an ancient fable --?[$R6] -eq 5|&A6;evidence to disprove a sacred text --?[$R6] -eq 6|&A6;an ear to listen to some boasting -->Result| --+|[br] --%| --X| --:Result| --+|[b]The treasure hunter is..[/b] [&A] that has [&A2] and [&A3], wears [&A4], that carries [&A5] looking for [&A6]. --<| }}
Kurt, that is perfect!!! Thank you!!
Character action menu isn't working for some of my PCs.  Character action menu is giving me this error: TypeError: Cannot read property 'toString' of undefined TypeError: Cannot read property 'toString' of undefined at replaceVariableContent (apiscript.js:54039:52) at apiscript.js:51984:21 at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1737:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) Any idea what could be causing it?
1647083806
Kurt J.
Pro
API Scripter
Justin G. said: Character action menu isn't working for some of my PCs.  Character action menu is giving me this error: TypeError: Cannot read property 'toString' of undefined TypeError: Cannot read property 'toString' of undefined at replaceVariableContent (apiscript.js:54039:52) at apiscript.js:51984:21 at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1737:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) Any idea what could be causing it? What version of ScriptCards do you have installed? The most recent GitHub version (1.6.6) included a fix for this particular problem, but hasn't made its way to OneClick yet.
Kurt J. said: Justin G. said: Character action menu isn't working for some of my PCs.  Character action menu is giving me this error: TypeError: Cannot read property 'toString' of undefined TypeError: Cannot read property 'toString' of undefined at replaceVariableContent (apiscript.js:54039:52) at apiscript.js:51984:21 at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1737:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) Any idea what could be causing it? What version of ScriptCards do you have installed? The most recent GitHub version (1.6.6) included a fix for this particular problem, but hasn't made its way to OneClick yet. That was it, thanks for the quick response.
Looking for help with an idea for a scriptcard for doors.... Any assistance would greatly be appreciated. Pardon the mess in the code, trying to learn at the same time... !scriptcard {{   --#title|Doors   --#titlecardbackground|#606c9b   --#Door Size|?{What Size Door?|Small|Regular|Large|Huge/Giant}   --=BaseDoor|   --=Toughness|0   --=DC|0   --=Small|DS   --=Toughness|[Toughness.base]   --=SMDC|[DC.base]   --=Regular|DS     --=Toughness|[Toughness.base]     --=REGDC|[DC.base]   --=Large|DS   --=Toughness|[Toughness.base]+5   --=LGDC|[DC.base]+10   --=Huge/Giant|DS   --=Toughness|[Toughness.base]+10   --=HGDC|[DC.base]+15     --+Door Size| [&DS|     --+Door Type|   --+Toughness|[Toughness.Total]   --+DC|[DC.Total]STR check to open   --=Door Material|     --=R1|1d20     --?[$R1] -le 2|Bone/Ivory     --?[$R1] -ge 3|Wood     --?[$R1] -ge 12|Stone     --?[$R1] -ge 15|Iron     --?[$R1] -eq 19|Exotic     --?[$R1] -eq 20|Deadly   --:Exotic|     --=E|1d6     --?[$E] -eq 1|Gold     --?[$E] -eq 2|Silver     --?[$E] -eq 3|Platinum     --?[$E] -eq 4|Mithral     --?[$E] -eq 5|Adamantine     --?[$e] -eq 6|Crystal     --:Gold|     --=GT|5     --=GDC|10     --:Silver|     --=ST|5     --=SDC|10     --=Platinum|     --=PT|5     --=PDC|10     --:Mithral|     --=MT|7     --:Adamantine|     --=AT|10     --:Crystal|     --=Toughness|-5   --:Door Strength|     --=R2|1d20     --?[$R2] -le 3|Weak/Fragile     --?[$R2] -ge 4|Regular/Undamaged     --?[$R2] -ge 13|Strong/Robust     --?[$R2] -ge 17|Armoured/Toughened     --:Weak/Fragile|     --=Toughness|[Toughness] + 10     --:Regular/Undamaged|     --=Toughness|[Toughness] + 15     --:Strong/Robust|     --=Toughness|[Toughness] + 20     --:Armoured/Toughened|     --=Toughness|[Toughness] + 25     -->Result|     --+|[br]   --X|   --:Result| }}
Here is the most recent copy... Any guidance would greatly be appreciated.. !scriptcard {{   --#title|Doors   --#titlecardbackground|#606c9b   --#Door Size|?{What Size Door?|Small|Regular|Large|Huge/Giant}   --=BaseDoor|   --=Toughness|0   --=DC|0   --=Small|DS   --=Toughness|[Toughness.base]   --=SMDC|[DC.base]   --=Regular|DS     --=Toughness|[Toughness.base]     --=REGDC|[DC.base]   --=Large|DS   --=Toughness|[Toughness.base]+5   --=LGDC|[DC.base]+10   --=Huge/Giant|DS   --=Toughness|[Toughness.base]+10   --=HGDC|[DC.base]+15     --+Door Size| [&DS|     --+Door Type|   --+Toughness|[Toughness.Total]   --+DC|[DC.Total]STR check to open   --=Door Material|     --=R1|1d20     --?[$R1] -le 2|Bone/Ivory     --?[$R1] -ge 3|Wood     --?[$R1] -ge 12|Stone     --?[$R1] -ge 15|Iron     --?[$R1] -eq 19|Exotic     --?[$R1] -eq 20|Deadly   --:Bone/Ivory|     --=BI|1d20     --?[$BI] -le 2|Jammed Door (use Toughness for DC STR check to open)     --?[$BI] -ge 3|Regular Door     --?[$BI] -ge 12|Locked     --?[$BI] -ge 15|Trapped     --?[$BI] -eq 19|Trapped and Locked     --?[$BI] -eq 20|Special   --:Wood|     --=W|1d20     --?[$W] -le 2|Jammed Door (use Toughness for DC STR check to open)     --?[$W] -ge 3|Regular Door     --?[$W] -eq 14|Barred     --?[$W] -eq 15|Locked     --?[$W] -eq 16|Barred and Locked     --?[$W] -eq 17|Trapped     --?[$W] -eq 18|Barred and Trapped     --?[$W] -eq 19|Trapped and Locked     --?[$W] -eq 20|Special   --:Stone|     --=S|1d20     --?[$S] -le 2|Jammed Door (use Toughness for DC STR check to open)     --?[$S] -ge 3|Regular Door     --?[$S] -eq 14|Barred     --?[$S] -eq 15|Locked     --?[$S] -eq 16|Barred and Locked     --?[$S] -eq 17|Trapped     --?[$S] -eq 18|Barred and Trapped     --?[$S] -eq 19|Trapped and Locked     --?[$S] -eq 20|Special   --:Iron|     --=I|1d20     --?[$I] -le 2|Jammed Door (use Toughness for DC STR check to open)     --?[$I] -ge 3|Regular Door     --?[$I] -eq 14|Barred     --?[$I] -eq 15|Locked     --?[$I] -eq 16|Barred and Locked     --?[$I] -eq 17|Trapped     --?[$I] -eq 18|Barred and Trapped     --?[$I] -eq 19|Trapped and Locked     --?[$I] -eq 20|Special   --:Exotic|     --=E|1d6     --?[$E] -eq 1|Gold     --?[$E] -eq 2|Silver     --?[$E] -eq 3|Platinum     --?[$E] -eq 4|Mithral     --?[$E] -eq 5|Adamantine     --?[$e] -eq 6|Crystal   --:Gold|     --=G|1d20     --?[$G] -le 2|Jammed Door (use Toughness for DC STR check to open)     --?[$G] -ge 3|Regular Door     --?[$G] -eq 14|Barred     --?[$G] -eq 15|Locked     --?[$G] -eq 16|Barred and Locked     --?[$G] -eq 17|Trapped     --?[$G] -eq 18|Barred and Trapped     --?[$G] -eq 19|Trapped and Locked     --?[$G] -eq 20|Special     --=GT|5     --=GDC|10     --:Silver|     --=ST|5     --=SDC|10     --=Platinum|     --=PT|5     --=PDC|10     --:Mithral|     --=MT|7     --:Adamantine|     --=AT|10     --:Crystal|     --=Toughness|-5     --:Barred|     --=Toughness|+3 unless removed     --:Barred and Locked|     --=Toughness|+3 unless removed     --:Barred and Trapped|     --=Toughness|+3 unless removed   --:Door Strength|     --=R2|1d20     --?[$R2] -le 3|Weak/Fragile     --?[$R2] -ge 4|Regular/Undamaged     --?[$R2] -ge 13|Strong/Robust     --?[$R2] -ge 17|Armoured/Toughened     --:Weak/Fragile|     --=Toughness|[Toughness] + 10     --:Regular/Undamaged|     --=Toughness|[Toughness] + 15     --:Strong/Robust|     --=Toughness|[Toughness] + 20     --:Armoured/Toughened|     --=Toughness|[Toughness] + 25     -->Result|     --+|[br]   --X|   --:Result| }}
1647157947

Edited 1647158943
Appears you are trying to come up with a random door script.  I see a number of issues with the syntax.  Below is a snippet from the first half of your script.  I've edited it to do what I think you were going for.  I've not tested this code, but it should be closer to what you were going for.   --/| Based on User selected door size, determine DC and Toughness --&DoorSize|?{What Size Door?|Small|Regular|Large|Huge/Giant} --=BaseDoor| --=Toughness|0 --=DC|0 --C[&DoorSize]|Small:=Toughness;[$DC.Raw]|Regular:=Toughness;[$DC.Raw]|Large:=Toughness;[$DC.Raw]+5|Huge/Giant:=Toughness;[$DC.Raw]+10 --=SMDC|[$DC.Raw] --=REGDC|$DC.Raw] --=LGDC|[$DC.Raw]+10 --=HGDC|[$DC.Raw]+15 --/| Output data --+Door Size|[&DoorSize] --+Door Type| --+Toughness|[$Toughness.Total] --+DC|[$DC.Total]STR check to open The second half of your script where you are determining the material has additional issues, 1. Create a EndOfMaterials Branch Label (--:EndOfMaterials|) at the bottom of all your material selection logic and create a Branch To (--^EndOfMaterials|) line at the end of each of your materials settings. 2. Store the material into a variable on each of your conditionals 3. Material Type of "Deadly" but no logic tied to it. 4. Look at cleaning up and simplifying your use of variables.  Appears you've created more than you really need.  Might be good if you start with Item #5 (below) and work backwards back up through your code.  For example, I'd have created a simple &DoorState variable for (trapped, jammed, locked, ...) indicators, instead of one for each door material type.   5. Build out your results section.   DM Scotty said: Here is the most recent copy... Any guidance would greatly be appreciated..
Argh! I got stuck on the final stretch of hacking the token-tooltip to act as an array! I would be most grateful if someone could help, because I'm really close here! :-D I used this... abc,d,e,f,g ... as the contents of the token-tooltip when testing my code. The "," character acts as a delimiter to separate the array-elements from each other. Here is the code for reading from the "tooltip-array". I've tested it, and it works. !script {{ --/| Description: this code can be used to read from the token-tooltip-memory --#sourceToken|@{selected|token_id} --&StringFromTooltip|[*S:t-tooltip] --~NoVariableIsCreated|array;fromstring;MyArray;,;[&StringFromTooltip] --+TEST MESSAGE|The value of element 0 is [@MyArray(0)] --+TEST MESSAGE|The value of element 1 is [@MyArray(1)] --+TEST MESSAGE|The value of element 2 is [@MyArray(2)] --+TEST MESSAGE|The value of element 3 is [@MyArray(3)] --+TEST MESSAGE|The value of element 4 is [@MyArray(4)] }} This code, on the other hand, does not work. This is the code for writing to the "tooltip-array". The part of it that does not work is commented with "ERROR", and the comment directly below that explains exactly why the error is happening. !script {{ --/| Description: this code can be used to write to the token-tooltip-memory --#sourceToken|@{selected|token_id} --&StringFromTooltip|[*S:t-tooltip] --/| This converts the string from the tooltip into an array --~NoVariableIsCreated|array;fromstring;MyArray;,;[&StringFromTooltip] --/| This writes to array index 2 (it replaces the "e" with a "Z") --~NoVariableIsCreated|array;setatindex;MyArray;2;Z --/| This converts MyArray into the string that will later be written into the tooltip. --~TheStringForTheTooltip|array;stringify;MyArray --/| ERROR: --/| This tries (and fails) to change TheStringForTheTooltip, so that it uses "," as a --/| delimiter, instead of ";"... however, this fails, because there is (as far as I know) --/| no way to use a semicomma-character as the search value, without breaking the syntax. --~TheStringForTheTooltip|string;replaceall;[here-I-need-a-semicomma-character];,;[&TheStringForTheTooltip] --+TEST MESSAGE|The value of TheStringForTheTooltip is [&TheStringForTheTooltip] --@token-mod|_ignore-selected _ids @{selected|token_id} _set tooltip|[&TheStringForTheTooltip] }} Does anyone know of a way to fix that problem? :-(
@ Will.. Thank you for your assistance & patience as I am learning.... This looks great!! Now to figure out the rest.... based on your suggestions...
@Will.... It appears that I have created a loop that just keeps running... Not sure why... See my updated Code and chat result below.... Also, I have added the HP Condition which looks like its working so far.... !scriptcard {{   --#title|Doors   --#titlecardbackground|#606c9b   --/| Based on User selected door size, toughness, HP, and determine DC to open.   --&DoorSize|?{What Size Door?|Small|Regular|Large|Huge/Giant}   --=BaseDoor|   --=Toughness|0   --=HP|0   --=DC|0   --C[&DoorSize]|Small:=Toughness;[$DC.Raw]|Regular:=Toughness;[$DC.Raw]|Large:=Toughness;[$DC.Raw]+5|Huge/Giant:=Toughness;[$DC.Raw]+10   --C[&DoorSize]|Small:=HP;[$HP.Raw]+3|Regular:=HP;[$HP.Raw]+4|Large:=HP;[$HP.Raw]+5|Huge/Giant:=HP;[$HP.Raw]+6   --C[&DoorSize]|Small:=DC;[$DC.Raw]|Regular:=DC;[$DC.Raw]|Large:=DC;[$DC.Raw]+10|Huge/Giant:=DC;[$DC.Raw]+15   --/| Output data   --+DoorSize|[&DoorSize]   --+Toughness|[$Toughness.Total]   --+HP|[$HP.Total]   --+DC|[$DC.Total]STR check to open   --+Door State|[$DoorState]     --=DoorMaterial|     --=DM|1d20     --?[$DM] -le 2|Bone/Ivory     --?[$DM] -ge 3|Wood     --?[$DM] -ge 12|Stone     --?[$DM] -ge 15|Iron     --?[$DM] -eq 19|Exotic     --?[$DM] -eq 20|Deadly   --:EndOfMaterials|   --=&DoorType|[DoorMaterial.RollText]   --+DoorType|[&DoorType]   --^EndOfMaterials| }}
1647205041
David M.
Pro
API Scripter
You'll need some kind of conditional statement in your loop that will cause it to kick out of the loop when certain conditions are met. It could be a numDoors variable that you increment, for example, and if numDoors gets to some number you jump to a Done: location at the end of your macro. You also may consider setting this up as a for...next loop .
@DM Scotty - there are also 2 programmer tricks to check for errors and limit looping.  They are:   --#debug|1    which will show line-by-line what happened during the running of the script in the API Output Console. I enter this in every macro.   --#executionlimit|4000    which will stop at the 4000th (or whatever number you enter) iteration of the loop. I use this for macros with loops.
@David... super green here... and am trying to understand... Now, my code get's terminated with the same result... @Michael, where would I put the Debug|1 ? At the Top? !scriptcard {{   --#title|Doors   --#titlecardbackground|#606c9b   --/| Based on User selected door size, toughness, HP, and determine DC to open.   --&DoorSize|?{What Size Door?|Small|Regular|Large|Huge/Giant}   --=BaseDoor|   --=Toughness|0   --=HP|0   --=DC|0   --C[&DoorSize]|Small:=Toughness;[$DC.Raw]|Regular:=Toughness;[$DC.Raw]|Large:=Toughness;[$DC.Raw]+5|Huge/Giant:=Toughness;[$DC.Raw]+10   --C[&DoorSize]|Small:=HP;[$HP.Raw]+3|Regular:=HP;[$HP.Raw]+4|Large:=HP;[$HP.Raw]+5|Huge/Giant:=HP;[$HP.Raw]+6   --C[&DoorSize]|Small:=DC;[$DC.Raw]|Regular:=DC;[$DC.Raw]|Large:=DC;[$DC.Raw]+10|Huge/Giant:=DC;[$DC.Raw]+15   --/| Output data   --+DoorSize|[&DoorSize]   --+Toughness|[$Toughness.Total]   --+HP|[$HP.Total]   --+DC|[$DC.Total]STR check to open   --+Door State|[$DoorState]   --=DoorType|EndofMaterials   --=DoorMaterial|     --=DM|1d20     --?[$DM] -le 2|Bone/Ivory     --?[$DM] -ge 3|Wood     --?[$DM] -ge 12|Stone     --?[$DM] -ge 15|Iron     --?[$DM] -eq 19|Exotic     --?[$DM] -eq 20|Deadly   --:Exotic|     --=E|1d6     --?[$E] -eq 1|Gold     --?[$E] -eq 2|Silver     --?[$E] -eq 3|Platinum     --?[$E] -eq 4|Mithral     --?[$E] -eq 5|Adamantine     --?[$e] -eq 6|Crystal   --:Bone/Ivory|   --&DM|Bone/Ivory   --<|   --:Wood|   --&DM|Wood   --<|   --:Stone|   --&DM|Bone/Stone   --<|   --:Iron|   --&DM|Iron   --<|   --:Deadly|   --&DM|Bone/Deadly   --<|   --:Gold|   --&DM|Gold   --<|   --:Silver|   --&DM|Silver   --<|   --:Platinum|   --&DM|Platinum   --<|   --:Mithral|   --&DM|Mithral   --<|   --:Adamantine|   --&DM|Adamantine   --<|   --:Crystal|   --&DM|Crystal   --<|   --:EndOfMaterials|   --+DoorType|[&DM]   --^EndOfMaterials|   --^Final| --?"X[&RollInto]X" -eq "XX"|%   --^Final| }}
@Michael.... So the Debug shows this.... checking it now "ContentIn: [&DM] Match: [&DM], vName: DM, replacement Crystal" "Line Counter: 70, Tag:+DoorType, Content:Crystal" "Line Counter: 71, Tag:^EndOfMaterials, Content:" "ContentIn: [&DM] Match: [&DM], vName: DM, replacement Crystal" "Line Counter: 70, Tag:+DoorType, Content:Crystal" "Line Counter: 71, Tag:^EndOfMaterials, Content:" "ContentIn: [&DM] Match: [&DM], vName: DM, replacement Crystal" "Line Counter: 70, Tag:+DoorType, Content:Crystal" "Line Counter: 71, Tag:^EndOfMaterials, Content:" "ContentIn: [&DM] Match: [&DM], vName: DM, replacement Crystal" "Line Counter: 70, Tag:+DoorType, Content:Crystal" "Line Counter: 71, Tag:^EndOfMaterials, Content:" "ContentIn: [&DM] Match: [&DM], vName: DM, replacement Crystal"
@Michael & David.... So I got it to work without a loop... However, now it is only showing Crystal as the Door Type result.... no matter how many times I run the script card..
1647213460

Edited 1647213809
David M.
Pro
API Scripter
EDIT - we cross posted as I was typing this. Guess I'm not sure why you have a loop at all? Is the intended functionality to produce random door properties for a given single door of user-defined size? I see a few issues with what you've got so far. First off, I believe your intent here is have a DoorMaterial label, and then populate a string variable "DM" based on a roll. If so, then this: --=DoorMaterial| --=DM|1d20 --?[$DM] -le 2|Bone/Ivory --?[$DM] -ge 3|Wood --?[$DM] -ge 12|Stone --?[$DM] -ge 15|Iron --?[$DM] -eq 19|Exotic --?[$DM] -eq 20|Deadly Should be something like this: --:DoorMaterial| --=MatRoll|1d20 --?[$MatRoll] -le 2|&DM;Bone/Ivory --?[$MatRoll] -ge 3|&DM;Wood --?[$MatRoll] -ge 12|&DM;Bone/Stone --?[$MatRoll] -ge 15|&DM;Iron --?[$MatRoll] -eq 19|^Exotic --?[$MatRoll] -eq 20|&DM;Bone/Deadly --^EndOfMaterials| This will eliminate the need for all of your material subprocedures, allowing a direct assignment of the string variable based on the conditional. Since a roll of "Exotic" means you have to roll on a different "table", the above uses a gosub branch (^Exotic) to jump to your exotic code block, which would look like this:   --:Exotic| --=ExoticRoll|1d6 --?[$ExoticRoll] -eq 1|&DM;Gold --?[$ExoticRoll] -eq 2|&DM;Silver --?[$ExoticRoll] -eq 3|&DM;Platinum --?[$ExoticRoll] -eq 4|&DM;Mithral --?[$ExoticRoll] -eq 5|&DM;Adamantine --?[$ExoticRoll] -eq 6|&DM;Crystal The last part of your macro is a bit funky as well. This is what you have: --:EndOfMaterials| --+DoorType|[&DM] --^EndOfMaterials|                    //this line is causing your infinite loop/ It is telling the parser to jump up two lines to the EndOfMaterials label --^Final| --?"X[&RollInto]X" -eq "XX"|%            //I don't know what this is doing? RollInto doesn't appear anywhere else in your macro? --^Final|                             //this should be a label, not a gosub branch I'm guessing you want it to be this: --:EndOfMaterials| --+DoorType|[&DM] --^Final| --:Final|                //note these last two lines could even be deleted since you don't actually have any other code after your DoorType print statement, but I left it here in case you were going to add something
1647213623

Edited 1647213842
@DM Scotty - You are getting closer.  Try the following 1. Replace all instances of  " --<| " with " --^EndOfMaterials| " to jump down to the EndOfMaterials branch label once you've established your materials. 2. Add " --^EndOfMaterials| " before the " --:Bone/Ivory|"  line to prevent your exotic doors from bleeding into your Bone/Ivory logic.   3. Remove " --^EndOfMaterials| " found at the bottom, before the " --^Final| " to remove the infinite loop issue 4. Remove the two lines " --^Final| " as there is no Final branch label.   David M. - Saw you post about the same time as this post.  To me it looks like DM Scotty is learning both syntax of Scriptcards and programming (Loops, Conditionals, Statements, Variables, Branching, ...) at the same time.  Awesome he's jumping in to learn this, and nothing like having to work through the logic and syntax yourself to really pick it up.  
After checking the rolls, it is not matching the correct result... Any ideas why this would happen and how to fix?
Post your latest code in a Code block format (see the magic wand formatting dropdown in the text box toolbar) to make it more condensed and readable.  
@David & Will..... You guys rock!!!... coming along.... Working on cleaning up the Door State Section.. I'm thinking your suggestion of just having all the options for all the doors in this section instead of having it roll for each type of door..
So I've added the Door State section, however it is not showing up.... I wrote it as the others with the MatRoll... would that be causing a conflict for it not to show up? !scriptcard {{   --#title|Doors   --#titlecardbackground|#606c9b   --/| Based on User selected door size, toughness, HP, and determine DC to open.   --&DoorSize|?{What Size Door?|Small|Regular|Large|Huge/Giant}   --=BaseDoor|   --=Toughness|0   --=HP|0   --=DC|0   --C[&DoorSize]|Small:=Toughness;[$DC.Raw]|Regular:=Toughness;[$DC.Raw]|Large:=Toughness;[$DC.Raw]+5|Huge/Giant:=Toughness;[$DC.Raw]+10   --C[&DoorSize]|Small:=HP;[$HP.Raw]+3|Regular:=HP;[$HP.Raw]+4|Large:=HP;[$HP.Raw]+5|Huge/Giant:=HP;[$HP.Raw]+6   --C[&DoorSize]|Small:=DC;[$DC.Raw]|Regular:=DC;[$DC.Raw]|Large:=DC;[$DC.Raw]+10|Huge/Giant:=DC;[$DC.Raw]+15   --#debug|1   --/| Output data   --+DoorSize|[&DoorSize]   --+Toughness|[$Toughness.Total]   --+HP|[$HP.Total]   --+DC|[$DC.Total]STR check to open   --=DoorType|EndofMaterials   --=DoorState|EndofDoorState   --:DoorMaterial|     --=MatRoll|1d20     --?[$MatRoll] -le 2|&DM;Bone/Ivory     --?[$MatRoll] -ge 3|&DM;Wood     --?[$MatRoll] -ge 12|&DM;Bone/Stone     --?[$MatRoll] -ge 15|&DM;Iron     --?[$MatRoll] -eq 19|^Exotic     --?[$MatRoll] -eq 20|&DM;Bone/Deadly   --^EndOfMaterials|   --:Exotic|     --=ExoticRoll|1d6     --?[$ExoticRoll] -eq 1|&DM;Gold     --?[$ExoticRoll] -eq 2|&DM;Silver     --?[$ExoticRoll] -eq 3|&DM;Platinum     --?[$ExoticRoll] -eq 4|&DM;Mithral     --?[$ExoticRoll] -eq 5|&DM;Adamantine     --?[$ExoticRoll] -eq 6|&DM;Crystal   --:EndOfMaterials|   --+DoorType|[&DM]   --^Final|   --:DoorState|     --=MatRoll|1d20     --?[$MatRoll] -le 2|&DS;Jammed Door (use Toughness for DC STR check to open)     --?[$MatRoll] -ge 3|&DS;Regular Door     --?[$MatRoll] -eq 14|&DS;Barred     --?[$MatRoll] -eq 15|&DS;Locked     --?[$MatRoll] -eq 16|&DS;Barred and Locked     --?[$MatRoll] -eq 17|&DS;Trapped     --?[$MatRoll] -eq 18|&DS;Barred and Trapped     --?[$MatRoll] -eq 19|&DS;Trapped and Locked     --?[$MatRoll] -eq 20|&DS;Special   --^EndOfDoorState|   --:EndOfDoorState|   --+DoorState|[&DS]   --^Final|   --:Final| }}
@Will is the magic wand formatting dropdown in the text box toolbar located in the working & Sharing threads?
1647221905
Kurt J.
Pro
API Scripter
Ronnie McDurgen said: Argh! I got stuck on the final stretch of hacking the token-tooltip to act as an array! I would be most grateful if someone could help, because I'm really close here! :-D I used this... abc,d,e,f,g ... as the contents of the token-tooltip when testing my code. The "," character acts as a delimiter to separate the array-elements from each other. Here is the code for reading from the "tooltip-array". I've tested it, and it works. !script {{ --/| Description: this code can be used to read from the token-tooltip-memory --#sourceToken|@{selected|token_id} --&StringFromTooltip|[*S:t-tooltip] --~NoVariableIsCreated|array;fromstring;MyArray;,;[&StringFromTooltip] --+TEST MESSAGE|The value of element 0 is [@MyArray(0)] --+TEST MESSAGE|The value of element 1 is [@MyArray(1)] --+TEST MESSAGE|The value of element 2 is [@MyArray(2)] --+TEST MESSAGE|The value of element 3 is [@MyArray(3)] --+TEST MESSAGE|The value of element 4 is [@MyArray(4)] }} This code, on the other hand, does not work. This is the code for writing to the "tooltip-array". The part of it that does not work is commented with "ERROR", and the comment directly below that explains exactly why the error is happening. !script {{ --/| Description: this code can be used to write to the token-tooltip-memory --#sourceToken|@{selected|token_id} --&StringFromTooltip|[*S:t-tooltip] --/| This converts the string from the tooltip into an array --~NoVariableIsCreated|array;fromstring;MyArray;,;[&StringFromTooltip] --/| This writes to array index 2 (it replaces the "e" with a "Z") --~NoVariableIsCreated|array;setatindex;MyArray;2;Z --/| This converts MyArray into the string that will later be written into the tooltip. --~TheStringForTheTooltip|array;stringify;MyArray --/| ERROR: --/| This tries (and fails) to change TheStringForTheTooltip, so that it uses "," as a --/| delimiter, instead of ";"... however, this fails, because there is (as far as I know) --/| no way to use a semicomma-character as the search value, without breaking the syntax. --~TheStringForTheTooltip|string;replaceall;[here-I-need-a-semicomma-character];,;[&TheStringForTheTooltip] --+TEST MESSAGE|The value of TheStringForTheTooltip is [&TheStringForTheTooltip] --@token-mod|_ignore-selected _ids @{selected|token_id} _set tooltip|[&TheStringForTheTooltip] }} Does anyone know of a way to fix that problem? :-( @Ronnie - As it exists in ScriptCards 1.6.6, it isn't possible to do that. However, I've just uploaded 1.6.7 to the GitHub repo. This version should be considered "experimental", though it still works with my most complex macros so I don't see it breaking anything. In 1.6.7, there is a new parameter: #parameterdelimiter. This defaults to ; but it can be changed as desired. The new delimiter will impact every line that currently uses a ; as the delimiter, and will also be used as the character for joining with array stringify. Here is a quick sample of the parameter in use, including what you want to do above: !script {{ --~|array;define;mytest1;One;Two;Three --+mytest1|[@mytest1(0)], [@mytest1(1)], [@mytest1(2)] --#parameterdelimiter|\$\ --~|array\$\define\$\mytest2\$\A\$\B\$\C --+mytest2|[@mytest2(0)], [@mytest2(1)], [@mytest2(2)] --#parameterdelimiter|; --~TheStringForTheTooltip|array;stringify;mytest2 --#parameterdelimiter|^ --~TheStringForTheTooltip|string^replaceall^;^,^[&TheStringForTheTooltip] --#parameterdelimiter|; --+String|[&TheStringForTheTooltip] --+mytest2|[@mytest2(0)], [@mytest2(1)], [@mytest2(2)] --~|system;dumpvariables;array }} I HIGHLY suggest only changing the character for the line you need to use it on and then changing it back to a ; (as I do above). I've bolded the three lines you would need for your tooltip string replace in your code.
1647221997
Kurt J.
Pro
API Scripter
DM Scotty said: @Will is the magic wand formatting dropdown in the text box toolbar located in the working & Sharing threads? When you are posting a message in the forum, there is a tool bar above the text entry window. If you hilight what you want to format as code and click the magic wand (first button in the toolbar, next to the B  for bold) and select "code" from the list you will get: output formatted as code
!scriptcard {{ --#title|Doors --#titlecardbackground|#606c9b --/| Based on User selected door size, toughness, HP, and determine DC to open. --&DoorSize|?{What Size Door?|Small|Regular|Large|Huge/Giant} --=BaseDoor| --=Toughness|0 --=HP|0 --=DC|0 --C[&DoorSize]|Small:=Toughness;[$DC.Raw]|Regular:=Toughness;[$DC.Raw]|Large:=Toughness;[$DC.Raw]+5|Huge/Giant:=Toughness;[$DC.Raw]+10 --C[&DoorSize]|Small:=HP;[$HP.Raw]+3|Regular:=HP;[$HP.Raw]+4|Large:=HP;[$HP.Raw]+5|Huge/Giant:=HP;[$HP.Raw]+6 --C[&DoorSize]|Small:=DC;[$DC.Raw]|Regular:=DC;[$DC.Raw]|Large:=DC;[$DC.Raw]+10|Huge/Giant:=DC;[$DC.Raw]+15 --#debug|1 --/| Output data --+DoorSize|[&DoorSize] --+Toughness|[$Toughness.Total] --+HP|[$HP.Total] --+DC|[$DC.Total]STR check to open --=DoorType|EndofMaterials --=DoorState|EndofDoorState --:DoorMaterial| --=MatRoll|1d20 --?[$MatRoll] -le 2|&DM;Bone/Ivory --?[$MatRoll] -ge 3|&DM;Wood --?[$MatRoll] -ge 12|&DM;Stone --?[$MatRoll] -ge 15|&DM;Iron --?[$MatRoll] -eq 19|^Exotic --?[$MatRoll] -eq 20|&DM;Deadly --^EndOfMaterials| --:Exotic| --=ExoticRoll|1d6 --?[$ExoticRoll] -eq 1|&DM;Gold --?[$ExoticRoll] -eq 2|&DM;Silver --?[$ExoticRoll] -eq 3|&DM;Platinum --?[$ExoticRoll] -eq 4|&DM;Mithral --?[$ExoticRoll] -eq 5|&DM;Adamantine --?[$ExoticRoll] -eq 6|&DM;Crystal --:EndOfMaterials| --+DoorType|[&DM] --C[&DoorType]|Gold:=Toughness;[$DC.Raw]+5|Silver:=Toughness;[$DC.Raw]|Platinum:=Toughness;[$DC.Raw]+5|Mithral:=Toughness;[$DC.Raw]+7|Adamantine:=Toughness;[$DC.Raw]+10|Crystal:=Toughness;[$DC.Raw]-5 --C[&DoorType]|Small:=HP;[$HP.Raw]+3|Regular:=HP;[$HP.Raw]+4|Large:=HP;[$HP.Raw]+5|Huge/Giant:=HP;[$HP.Raw]+6 --C[&DoorType]|Gold:=DC;[$DC.Raw]+10|Silver:=DC;[$DC.Raw]+10|Platinum:=DC;[$DC.Raw]+10 --^Final| --:Final| }}
!scriptcard {{ --#title|Doors --#titlecardbackground|#606c9b --/| Based on User selected door size, toughness, HP, and determine DC to open. --&DoorSize|?{What Size Door?|Small|Regular|Large|Huge/Giant} --=BaseDoor| --=Toughness|0 --=HP|0 --=DC|0 --C[&DoorSize]|Small:=Toughness;[$DC.Raw]|Regular:=Toughness;[$DC.Raw]|Large:=Toughness;[$DC.Raw]+5|Huge/Giant:=Toughness;[$DC.Raw]+10 --C[&DoorSize]|Small:=HP;[$HP.Raw]+3|Regular:=HP;[$HP.Raw]+4|Large:=HP;[$HP.Raw]+5|Huge/Giant:=HP;[$HP.Raw]+6 --C[&DoorSize]|Small:=DC;[$DC.Raw]|Regular:=DC;[$DC.Raw]|Large:=DC;[$DC.Raw]+10|Huge/Giant:=DC;[$DC.Raw]+15 --#debug|1 --/| Output data --+DoorSize|[&DoorSize] --+Toughness|[$Toughness.Total] --+HP|[$HP.Total] --+DC|[$DC.Total]STR check to open --=DoorType|EndofMaterials --=DoorState|EndofDoorState --:DoorMaterial| --=MatRoll|1d20 --?[$MatRoll] -le 2|&DM;Bone/Ivory --?[$MatRoll] -ge 3|&DM;Wood --?[$MatRoll] -ge 12|&DM;Stone --?[$MatRoll] -ge 15|&DM;Iron --?[$MatRoll] -eq 19|^Exotic --?[$MatRoll] -eq 20|&DM;Deadly --^EndOfMaterials| --:Exotic| --=ExoticRoll|1d6 --?[$ExoticRoll] -eq 1|&DM;Gold --?[$ExoticRoll] -eq 2|&DM;Silver --?[$ExoticRoll] -eq 3|&DM;Platinum --?[$ExoticRoll] -eq 4|&DM;Mithral --?[$ExoticRoll] -eq 5|&DM;Adamantine --?[$ExoticRoll] -eq 6|&DM;Crystal --:EndOfMaterials| --+DoorType|[&DM] --C[&DoorType]|Gold:=Toughness;[$DC.Raw]+5|Silver:=Toughness;[$DC.Raw]|Platinum:=Toughness;[$DC.Raw]+5|Mithral:=Toughness;[$DC.Raw]+7|Adamantine:=Toughness;[$DC.Raw]+10|Crystal:=Toughness;[$DC.Raw]-5 --C[&DoorType]|Small:=HP;[$HP.Raw]+3|Regular:=HP;[$HP.Raw]+4|Large:=HP;[$HP.Raw]+5|Huge/Giant:=HP;[$HP.Raw]+6 --C[&DoorType]|Gold:=DC;[$DC.Raw]+10|Silver:=DC;[$DC.Raw]+10|Platinum:=DC;[$DC.Raw]+10 --:DoorState| --=MatRoll|1d20 --?[$MatRoll] -le 2|&DS;Jammed Door (use Toughness for DC STR check to open) --?[$MatRoll] -ge 3|&DS;Regular Door --?[$MatRoll] -eq 14|&DS;Barred --?[$MatRoll] -eq 15|&DS;Locked --?[$MatRoll] -eq 16|&DS;Barred and Locked --?[$MatRoll] -eq 17|&DS;Trapped --?[$MatRoll] -eq 18|&DS;Barred and Trapped --?[$MatRoll] -eq 19|&DS;Trapped and Locked --?[$MatRoll] -eq 20|&DS;Special --^EndOfDoorState| --:EndOfDoorState| --+DoorState|[&DS] --^Final| --:Final| }}
!scriptcard {{ --#title|Doors --#titlecardbackground|#606c9b --/| Based on User selected door size, toughness, HP, and determine DC to open. --&DoorSize|?{What Size Door?|Small|Regular|Large|Huge/Giant} --=BaseDoor| --=Toughness|0 --=HP|0 --=DC|0 --C[&DoorSize]|Small:=ToughnessMod;[$DC.Raw]|Regular:=ToughnessMod;[$DC.Raw]|Large:=ToughnessMod;[$DC.Raw]+5|Huge/Giant:=ToughnessMod;[$DC.Raw]+10 --C[&DoorSize]|Small:=HP;[$HP.Raw]+3|Regular:=HP;[$HP.Raw]+4|Large:=HP;[$HP.Raw]+5|Huge/Giant:=HP;[$HP.Raw]+6 --C[&DoorSize]|Small:=DC;[$DC.Raw]|Regular:=DC;[$DC.Raw]|Large:=DC;[$DC.Raw]+10|Huge/Giant:=DC;[$DC.Raw]+15 --#debug|1 --/| Output data --+DoorSize|[&DoorSize] --+DC|[$DC.Total]STR check to open --=DoorType|EndofMaterials --=DoorState|EndofDoorState --:DoorToughnessBase| --=MatRoll|1d20 --?[$MatRoll] -le 3|&DT;Weak/Fragile --?[$MatRoll] -ge 4|&DT;Regular/Undamaged --?[$MatRoll] -ge 13|&DT;Strong/Robust --?[$MatRoll] -ge 17|&DT;Armoured/Toughened --:EndOfDoorToughnessBase| --&DoorToughnessBase|[&DT] --C[&DoorToughnessBase]|Weak/Fragile:=ToughnessBase;[$DC.Raw]+10|Regular/Undamaged:=ToughnessBase;[$DC.Raw]+15|Strong/Robust:=ToughnessBase;[$DC.Raw]+20|Armoured/Toughened:=ToughnessBase;[$DC.Raw]+25 --+DoorCondition|[&DoorToughnessBase] --+ToughnessMod|[$ToughnessMod.Total] --+ToughnessBase|[$ToughnessBase.Total] --:DoorMaterial| --=MatRoll|1d20 --?[$MatRoll] -le 2|&DM;Bone/Ivory --?[$MatRoll] -ge 3|&DM;Wood --?[$MatRoll] -ge 12|&DM;Stone --?[$MatRoll] -ge 15|&DM;Iron --?[$MatRoll] -eq 19|^Exotic --?[$MatRoll] -eq 20|&DM;Deadly --^EndOfMaterials| --:Exotic| --=ExoticRoll|1d6 --?[$ExoticRoll] -eq 1|&DM;Gold --?[$ExoticRoll] -eq 2|&DM;Silver --?[$ExoticRoll] -eq 3|&DM;Platinum --?[$ExoticRoll] -eq 4|&DM;Mithral --?[$ExoticRoll] -eq 5|&DM;Adamantine --?[$ExoticRoll] -eq 6|&DM;Crystal --:EndOfMaterials| --+DoorType|[&DM] --C[&DM]|Gold:=Toughness;[$DC.Raw]+5|Silver:=Toughness;[$DC.Raw]|Platinum:=Toughness;[$DC.Raw]+5|Mithral:=Toughness;[$DC.Raw]+7|Adamantine:=Toughness;[$DC.Raw]+10|Crystal:=Toughness;[$DC.Raw]-5 --C[&DM]|Gold:=DC;[$DC.Raw]+10|Silver:=DC;[$DC.Raw]+10|Platinum:=DC;[$DC.Raw]+10 --:DoorState| --=MatRoll|1d20 --?[$MatRoll] -le 2|&DS;Jammed Door (use Toughness for DC STR check to open) --?[$MatRoll] -ge 3|&DS;Regular Door --?[$MatRoll] -eq 14|&DS;Barred --?[$MatRoll] -eq 15|&DS;Locked --?[$MatRoll] -eq 16|&DS;Barred and Locked --?[$MatRoll] -eq 17|&DS;Trapped --?[$MatRoll] -eq 18|&DS;Barred and Trapped --?[$MatRoll] -eq 19|&DS;Trapped and Locked --?[$MatRoll] -eq 20|&DS;Special --^EndOfDoorState| --:EndOfDoorState| --+DoorState|[&DS] --:HitPoints| --&DieType|[&DM] --C[&DieType]|Crystal:=DieType;[$DC.Raw]+4|Bone/Ivory:=DieType;[DC.Raw]+6|Wood:=DieType;[DC.Raw]+6|Stone:=DieType;[DC.Raw]+8|Gold:=DieType;[DC.Raw]+10|Silver:=DieType;[DC.Raw]+10|Platinum:=DieType;[DC.Raw]+10|Iron:=DieType;[DC.Raw]+12|Mithral:=DieType;[DC.Raw]+20|Adamantine:=DieType;[DC.Raw]+30 --C[&DoorSize]|Small:=DiceCount;[$DiceCount]+3|Regular:=DC;[$DiceCount]+4|Large:=DC;[$DiceCount]+5|Huge/Giant:=DC;[$DiceCount]+6 --C[&DoorToughnessBase]|Weak/Fragile:=StengthMod;[$DC.Raw]+.25|Regular/Undamaged:=StrengthMod;[$DC.Raw]+1|Strong/Robust:=StrengthMod;[$DC.Raw]+1.5|Armoured/Toughened:=StrengthMod;[$DC.Raw]+2 --DieType|[DieType.Total] --DiceCount|[DiceCount.Total] --StrengthMod|[StrengthMod.Total] --=HP|[$DiceCount.Total]d[$DieType]*[$StrengthMod.Total] --+HP|[$HP.Total] --^Final| --:Final| }}
Here is what I have so far and it's coming along.... However, I cannot get the HP to total up with the conditionals I have... Does anyone have any ideas?
1647240520

Edited 1647241040
Look at your last couple lines: --DieType|[DieType.Total] --DiceCount|[DiceCount.Total] --StrengthMod|[StrengthMod.Total] --=HP|[$DiceCount.Total]d[$DieType]*[$StrengthMod.Total] --+HP|[$HP.Total] You aren't putting a command character in front of DieType, DiceCount or StrengthMod.  Probably want to change to: --+DieType|[DieType.Total] --+DiceCount|[DiceCount.Total] --+StrengthMod|[StrengthMod.Total] --=HP|[$DiceCount.Total]d[$DieType]*[$StrengthMod.Total] --+HP|[$HP.Total] I also don't understand the what you are trying to do with " [$DiceCount.Total] d [$DieType]*[$StrengthMod.Total] ".  Why the small "d" It also looks like you have a standard variable [&DieType] and a roll variable [$DieType] defined.  I personally stay away from naming my roll and standard variables the same to avoid bugs.  Maybe keep [&DieType] to indicate material (Bone, crystal, ...) and use [$DoorDC] for holding the actual Door DC.   -Will
@Kurt Awesome! Thank you so much for putting that stuff into version 1.6.7! It's gonna be a huge help :-D
@DM Scotty - Technically, one can place a --#[Command]| instruction anywhere in the macro.  I put both of those instructions after the title and color blocks but before the body of my macro for readability and organization purposes. @Kurt - Hah!  I learn something new every day.  Did not know what the "code" magic wand was for.  Now I do!
@DM Scotty - there were several typing errors that seemed to be the problem.  Here is what I have so far...see if it fixes your issues... !scriptcard {{   --#title|Doors   --#titlecardbackground|#606c9b   --#debug|1   --/| Based on User selected door size, toughness, HP, and determine DC to open.   --/Determine Door Size & Initial Mods|     --&DoorSize|?{What Size Door?|Small|Regular|Large|Huge/Giant}     --C[&DoorSize]|Small:=ToughnessMod;[$DC.Raw]|Regular:=ToughnessMod;[$DC.Raw]|Large:=ToughnessMod;[$DC.Raw]+5|Huge/Giant:=ToughnessMod;[$DC.Raw]+10     --C[&DoorSize]|Small:=HP;[$HP.Raw]+3|Regular:=HP;[$HP.Raw]+4|Large:=HP;[$HP.Raw]+5|Huge/Giant:=HP;[$HP.Raw]+6     --C[&DoorSize]|Small:=DC;[$DC.Raw]|Regular:=DC;[$DC.Raw]|Large:=DC;[$DC.Raw]+10|Huge/Giant:=DC;[$DC.Raw]+15   --:DoorToughnessBase|     --=ToughRoll|1d20     --?[$ToughRoll] -le 3|&DoorToughnessBase;Weak/Fragile     --?[$ToughRoll] -ge 4|&DoorToughnessBase;Regular/Undamaged     --?[$ToughRoll] -ge 13|&DoorToughnessBase;Strong/Robust      --?[$ToughRoll] -ge 17|&DoorToughnessBase;Armoured/Toughened     --C[&DoorToughnessBase]|Weak/Fragile:=ToughnessBase;[$DC.Raw]+10|Regular/Undamaged:=ToughnessBase;[$DC.Raw]+15|Strong/Robust:=ToughnessBase;[$DC.Raw]+20|Armoured/Toughened:=ToughnessBase;[$DC.Raw]+25      --:DoorMaterial|     --=MatRoll|1d20     --?[$MatRoll] -le 2|&DM;Bone/Ivory     --?[$MatRoll] -ge 3|&DM;Wood     --?[$MatRoll] -ge 12|&DM;Stone     --?[$MatRoll] -ge 15|&DM;Iron     --?[$MatRoll] -eq 19|^Exotic     --?[$MatRoll] -eq 20|&DM;Deadly   --^EndOfMaterials|   --:Exotic|     --=ExoticRoll|1d6     --?[$ExoticRoll] -eq 1|&DM;Gold     --?[$ExoticRoll] -eq 2|&DM;Silver     --?[$ExoticRoll] -eq 3|&DM;Platinum     --?[$ExoticRoll] -eq 4|&DM;Mithral     --?[$ExoticRoll] -eq 5|&DM;Adamantine     --?[$ExoticRoll] -eq 6|&DM;Crystal     --C[&DM]|Gold:=Toughness;[$DC.Raw]+5|Silver:=Toughness;[$DC.Raw]|Platinum:=Toughness;[$DC.Raw]+5|Mithral:=Toughness;[$DC.Raw]+7|Adamantine:=Toughness;[$DC.Raw]+10|Crystal:=Toughness;[$DC.Raw]-5     --C[&DM]|Gold:=DC;[$DC.Raw]+10|Silver:=DC;[$DC.Raw]+10|Platinum:=DC;[$DC.Raw]+10   --:EndOfMaterials|   --:DoorState|     --=MatRoll|1d20     --?[$MatRoll] -le 2|&DS;Jammed Door (use Toughness for DC STR check to open)     --?[$MatRoll] -ge 3|&DS;Regular Door     --?[$MatRoll] -eq 14|&DS;Barred     --?[$MatRoll] -eq 15|&DS;Locked     --?[$MatRoll] -eq 16|&DS;Barred and Locked     --?[$MatRoll] -eq 17|&DS;Trapped     --?[$MatRoll] -eq 18|&DS;Barred and Trapped     --?[$MatRoll] -eq 19|&DS;Trapped and Locked     --?[$MatRoll] -eq 20|&DS;Special    --:HitPoints|   --&DieType|[&DM]   --C[&DieType]|Crystal:=DieType;[$DC.Raw]+4|Bone/Ivory:=DieType;[DC.Raw]+6|Wood:=DieType;[DC.Raw]+6|Stone:=DieType;[DC.Raw]+8|Gold:=DieType;[DC.Raw]+10|Silver:=DieType;[DC.Raw]+10|Platinum:=DieType;[DC.Raw]+10|Iron:=DieType;[DC.Raw]+12|Mithral:=DieType;[DC.Raw]+20|Adamantine:=DieType;[DC.Raw]+30   --C[&DoorSize]|Small:=DiceCount;[$DiceCount]+3|Regular:=DC;[$DiceCount]+4|Large:=DC;[$DiceCount]+5|Huge/Giant:=DC;[$DiceCount]+6   --C[&DoorToughnessBase]|Weak/Fragile:=StrengthMod;[$DC.Raw]+.25|Regular/Undamaged:=StrengthMod;[$DC.Raw]+1|Strong/Robust:=StrengthMod;[$DC.Raw]+1.5|Armoured/Toughened:=StrengthMod;[$DC.Raw]+2   --:DieType|[DieType.Total]   --$DiceCount|[DiceCount.Total]   --$StrengthMod|[StrengthMod.Total]   --=HP|[$DiceCount.Total]*[$DieType]*[$StrengthMod.Total]   --/| Output data   --+DoorSize|[&DoorSize]   --+DC|[$DC.Total] STR check to open   --+DoorCondition|[&DoorToughnessBase]   --+ToughnessMod|[$ToughnessMod.Total]   --+ToughnessBase|[$ToughnessBase.Total]   --+DoorMaterial|[&DM]   --+DoorState|[&DS]   --+HP|[$HP.Total]    --:EndMacro|  }}
@ Michael, Yes that is very helpful and works well..... However, they way that i'm trying to HP on they way I put in the conditional, is probably not the correct way to do it... See example below of what i'm trying to do