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

ScriptCard call rollable table

I am really digging ScriptCards, makes more sense to me then PowerCards. But having an issue wrapping my brain around how to handle rollable tables it seems.  I have a simple example that I cannot get to behave, running ScriptCards 15a,  I have a simple table, named "EncounterTable" with two items "Encounter" and  "NoEncounter", but cannot get the table to "roll" or at least echo its result. my simple scriptcard, any example to echo the results of a table should suffice for me though.. !scriptcard  {{   --#title|Encounter --&Terrain|?{Type?|Land|Air|Water|Fire}   --=ERoll| 1d2 --?  [$ERoll]  -eq 1|>AnEncounter --?  [$ERoll]  -eq 2|>ZeroEncounter --:AnEncounter| --+monster |is found on [&Terrain] [$ERoll] --+|You all Die due to   --=ThisRoll|[T# EncounterTable ]      --+[$ThisRoll.tableEntry] --X| --<| --:ZeroEncounter| --+|No one Dies --+No | [&Terrain] Encounter [$ERoll] --X| --<| }} thanks for any assistance.
1613360398

Edited 1613360705
David M.
Pro
API Scripter
Totally agree with you on Scriptcards. Much easier for me to grasp than Powercards, and more powerful in many ways. Try this for your "AnEncounter" function. The roll parameter is tableEntry Text , not tableEntry. --:AnEncounter| --+monster|is found on [&Terrain] [$ERoll] --=ThisRoll|[T#EncounterTable] --+|You all Die due to [$ThisRoll.tableEntryText] --<| BTW, you only need one --X| line at the end of your basic card block. The individual functions don't need them, as they return back to the main block (at the next line after they were called) after executing. Here is your card with that convention. I added some comment lines (no output) for clarity. EDIT - and moved the table roll up into the variable assignment section. Not important, just for clarity. Technically having it in the AnEncounter function could save on processing time if there was no encounter, but the effect won't be noticeable. !scriptcard {{ --#title|Encounter --:USER INPUT AND VARIABLE ASSIGNMENT| --&Terrain|?{Type?|Land|Air|Water|Fire} --=ERoll| 1d2 --=ThisRoll|[T#EncounterTable] --:CHECK ROLLS| --?[$ERoll] -eq 1|>AnEncounter --?[$ERoll] -eq 2|>ZeroEncounter --X| End Macro --:FUNCTIONS| --:AnEncounter| --+monster|is found on [&Terrain] [$ERoll] --+|You all Die due to [$ThisRoll.tableEntryText] --<| --:ZeroEncounter| --+|No one Dies --+No|[&Terrain] Encounter [$ERoll] --<| }} Another option to save another line is to use an if/then/else conditional if there are only two possibilities for ERoll. The following executes the AnEncounter function on a roll of 1, otherwise it executes ZeroEncounter. If ERoll had more possibilities, then checking them explicitly like you originally wrote would be more appropriate. --?[$ERoll] -eq 1|>AnEncounter|>ZeroEncounter
Thanks for the suggestions, your full script does  work as expected, but mine still does not, with the correction of tableEntryText. might be some odd white space or character substitution in the cut and paste, will have to dissect it more this weekend, thanks again for the assistance.
1613396040
David M.
Pro
API Scripter
oh yeah, I forgot to mention that the line where you referenced the tableEntryText was missing a vertical bar  --=ThisRoll|[T#EncounterTable]      --+[$ThisRoll.tableEntry] Needs to be  --+[$ThisRoll.tableEntryText]| or --+|[$ThisRoll.tableEntryText]