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

Scriptcards - using substring in condition

The following script rolls multiple tables and presents the values. The only part that isn't working is the Foci section. Any suggestions? !scriptcard {{   --#title|Quick Character Generator   --=Class|[T#QuickClass]   --+|[$Class.tableEntryText]   --=Background|[T#QuickBS]   --+|[$Background.tableEntryText]   --?|[$Class.tableEntryText] -inc "Smart"|[     --=Foci|[T#QuickFociESm] --]|       --?|[$Class.tableEntryText] -inc "Smooth"|[     --=Foci|[T#QuickFociESo]     --]|      --?|[$Class.tableEntryText] -inc "Nimble"|[     --=Foci|[T#QuickFociEN]     --]|     --?|[$Class.tableEntryText] -inc "Melee"|[     --=Foci|[T#QuickFociWM]     --]|    --?|[$Class.tableEntryText] -inc "Ranged"|[      --=Foci|[T#QuickFociWR]      --]|     --?|[$Class.tableEntryText] -inc "Leader"|[     --=Foci|[T#QuickFociWL]     --+|[$QuickFociWL.tableEntryText]     --]|     --?|[$Class.tableEntryText] -inc "Seer"|[     --=Foci|[T#QuickFociPS]     --]|      --?|[$Class.tableEntryText] -inc "Adept"|[     --=Foci|[T#QuickFociPA]     --]   --+Foci|[&Foci]   --=Bonus|[T#QuickBonus]   --+|[$Bonus.tableEntryText] }}
1646269139
David M.
Pro
API Scripter
You are assigning Foci as a roll variable, but are referencing it in your output statement as if it were a string variable (using [&...] syntax).
OK, I tweaked the script and it is working, almost.  If I put   --+Foci|[$Foci.tableEntryText] after each     --=Foci|[T#table] line, the output is the Foci values for each condition. Class  Expert (Nimble) Str 10 (+0) Dex 14 (+1) Con 12 (+0) Int 11 (+0) Wis 9 (+0) Cha 7 (-1) HP 1d6 Atk +0 Background  Criminal Connect-0, Sneak-0, Talk-0 Foci  Hacker Tinker Foci  Specialist/Notice Specialist/Talk Foci  Tinker Gunslinger Foci  Ironhide Die Hard Foci  Gunslinger Close Combatant Foci  Gunslinger Authority Foci  Hacker Foci  Die Hard Bonus  Heal: curing harm in mind and body If I leave that line at the end, as below, it appears to use a FOCI value at random, and displays only half of the entry !scriptcard {{   --#title|Quick Character Generator   --=Class|[T#QuickClass]   --+Class|[$Class.tableEntryText]   --=Background|[T#QuickBS]   --+Background|[$Background.tableEntryText]   --?[$Class.tableEntryText] -inc "Smart"|[     --=Foci|[T#QuickFociESm] --]|       --?|[$Class.tableEntryText] -inc "Smooth"|[     --=Foci|[T#QuickFociESo]     --]|      --?|[$Class.tableEntryText] -inc "Nimble"|[     --=Foci|[T#QuickFociEN]     --]|     --?|[$Class.tableEntryText] -inc "Melee"|[     --=Foci|[T#QuickFociWM]     --]|    --?|[$Class.tableEntryText] -inc "Ranged"|[      --=Foci|[T#QuickFociWR]     --]|     --?|[$Class.tableEntryText] -inc "Leader"|[     --=Foci|[T#QuickFociWL]     --]|     --?|[$Class.tableEntryText] -inc "Seer"|[      --=Foci|[T#QuickFociPS]    --]|      --?|[$Class.tableEntryText] -inc "Adept"|[     --=Foci|[T#QuickFociPA]     --]   --+Foci|[$Foci.tableEntryText]   --=Bonus|[T#QuickBonus]   --+Bonus|[$Bonus.tableEntryText] }} Class  Expert (Nimble) Str 10 (+0) Dex 14 (+1) Con 12 (+0) Int 11 (+0) Wis 9 (+0) Cha 7 (-1) HP 1d6 Atk +0 Background  Peasant Exert-0, Sneak-0, Survive-0 Foci  Die Hard Bonus  Notice: spot things and detect the unusual
1646303517

Edited 1646303719
Kurt J.
Pro
API Scripter
Joab said: OK, I tweaked the script and it is working, almost.  If I put   --+Foci|[$Foci.tableEntryText] after each     --=Foci|[T#table] line, the output is the Foci values for each condition. Class  Expert (Nimble) Str 10 (+0) Dex 14 (+1) Con 12 (+0) Int 11 (+0) Wis 9 (+0) Cha 7 (-1) HP 1d6 Atk +0 Background  Criminal Connect-0, Sneak-0, Talk-0 Foci  Hacker Tinker Foci  Specialist/Notice Specialist/Talk Foci  Tinker Gunslinger Foci  Ironhide Die Hard Foci  Gunslinger Close Combatant Foci  Gunslinger Authority Foci  Hacker Foci  Die Hard Bonus  Heal: curing harm in mind and body If I leave that line at the end, as below, it appears to use a FOCI value at random, and displays only half of the entry !scriptcard {{   --#title|Quick Character Generator   --=Class|[T#QuickClass]   --+Class|[$Class.tableEntryText]   --=Background|[T#QuickBS]   --+Background|[$Background.tableEntryText]   --?[$Class.tableEntryText] -inc "Smart"|[     --=Foci|[T#QuickFociESm] --]|       --?|[$Class.tableEntryText] -inc "Smooth"|[     --=Foci|[T#QuickFociESo]     --]|      --?|[$Class.tableEntryText] -inc "Nimble"|[     --=Foci|[T#QuickFociEN]     --]|     --?|[$Class.tableEntryText] -inc "Melee"|[     --=Foci|[T#QuickFociWM]     --]|    --?|[$Class.tableEntryText] -inc "Ranged"|[      --=Foci|[T#QuickFociWR]     --]|     --?|[$Class.tableEntryText] -inc "Leader"|[     --=Foci|[T#QuickFociWL]     --]|     --?|[$Class.tableEntryText] -inc "Seer"|[      --=Foci|[T#QuickFociPS]    --]|      --?|[$Class.tableEntryText] -inc "Adept"|[     --=Foci|[T#QuickFociPA]     --]   --+Foci|[$Foci.tableEntryText]   --=Bonus|[T#QuickBonus]   --+Bonus|[$Bonus.tableEntryText] }} Class  Expert (Nimble) Str 10 (+0) Dex 14 (+1) Con 12 (+0) Int 11 (+0) Wis 9 (+0) Cha 7 (-1) HP 1d6 Atk +0 Background  Peasant Exert-0, Sneak-0, Survive-0 Foci  Die Hard Bonus  Notice: spot things and detect the unusual Your conditional statements are not correctly formatted. The condition goes before the |, right after the ?. Also, any time it is possible that a value includes spaces, it is best to put quotes around it. This:   --?|[$Class.tableEntryText] -inc "Adept"|[     --=Foci|[T#QuickFociPA]     --] should be:   --?"[$Class.tableEntryText]" -inc "Adept"|[     --=Foci|[T#QuickFociPA]     --]