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 - Nesting info request in branches, conditionals, and processes

Can you put requests inside the different code blocks and only have them happen if the conditions to get to that location happen.  cause from what i can tell, in my code when i put them in they are automatically called, no mater what. Additionally my code appears to not be able to do a conditional check on strings, when i break the entire things down into its base component im using for the checks it works, but when its fully built, it seems that NONE of the conditionals are working sorry for multiple questions in one post, ANY help would be appreciated. im just learning this api, and every time i think i have resolved it, it comes at me from a different direction, and sadly the documentation, is lacking in edge case examples this is my basic code for the conditionals !scriptcard {{ --#title|testing conditionals --&Proficient|?{Are you proficient in the Survival|Yes|No} --=modifier|0 --?[&Proficient] -eq Yes|[ --=modifier|+1 --]|[ --=modifier|+2 --]| --+Proficient| [&Proficient] [$modifier] --X| }} Here is the "Fully Built" code that is not working !scriptcard {{ --#title|Gathering Resources --#sourceToken|@{selected|token_id} --=GatheringAttempts|?{Gathering Attempts?} --=GatherMod|0 --=DisplayCount|1 --&ItemTypeRequest|?{What are you looking to do?|Search for Materials|Gather Reagents} --&ProficientSurvival|?{Are you proficient in the Survival|Yes|No} --&proficientHerbalism|?{Are you proficient in the Herbalism Kit|Yes|No} --+1| --?[&ItemTypeRequest] -inc "Search for Materials"|[ --+2| --&ItemType | Crafting -->proficientSurvival| --&Attribute|?{Which Attribute would you like to use|Strength|Dexterity|Wisdom} --?[$Attribute] -inc "Strength"|[ --=GatherMod| [$GatherMod] + @{selected|strength_mod} --]| --?[$Attribute] -inc "Dexterity"|[ --=GatherMod| [$GatherMod] + @{selected|dexterity_mod} --]| --?[$Attribute] -inc "Wisdom"|[ --=GatherMod| [$GatherMod] + @{selected|wisdom_mod} --]| --&Location|?{What Biome are you in?|Forest|Desert|Grasslands|Marsh|Mountains|Caves|Underdark|Graveyard|Shore|Tundra} --#emoteText|Attempts to gather [&ItemTypeRequest] [$GatheringAttempts] times, in the [&Location] --^GatherLoop| --X| --]| --?[&ItemTypeRequest] -inc ""Gather Reagents""|[ --&ItemType | Reagents -->proficientHerbalism| --=GatherMod| [$GatherMod] + @{selected|wisdom_mod} --&Location|?{What Biome are you in?|Forest|Desert|Grasslands|Marsh|Mountains|Caves|Underdark|Graveyard|Shore|Tundra} --#emoteText|Attempts to [&ItemTypeRequest] [$GatheringAttempts] times, in the [&Location] --^GatherLoop| --X| --]| --:GatherLoop| -->GatherProcess | [&Location] ; [&ItemType]; --=DisplayCount|[$DisplayCount] + 1 --?[$DisplayCount] -le [$GatheringAttempts]|GatherLoop --X| --:GatherProcess| --&SuccessType | Unknown --=ThisAttempt|[T#[%1%][%2%]] --=GatherRoll|1d20 + [$GatherMod] --?[$GatherRoll.Total] -lt 10|&SuccessType; Fails ; --?[$GatherRoll.Total] -ge 10|&SuccessType; Succeeds ; --?[$GatherRoll.Total] -eq 20|&SuccessType; is a Critical Success, Find Double ; --+Attempt [$DisplayCount.Total] | Finds [b][$ThisAttempt.tableEntryText][/b] and Rolls [$GatherRoll] which [b][&SuccessType][/b] --<| --:proficientSurvival| --+ps1| --?[&proficientSurvival] -eq Yes|[ --+ps2| --=GatherMod| [$GatherMod] + @{selected|pb} --]| --<| --:proficientHerbalism| --+ph1| --?[&proficientHerbalism] -eq Yes |[ --+ph2| --=GatherMod| [$GatherMod] + @{selected|pb} --]| --<| }}
1631791283
David M.
Pro
API Scripter
When you expect your strings may contain spaces, you need to wrap your string variable in quotes or else the conditional will only look at the first "word" in the string. For example, try updating these two lines as written. Note the quotes around the string variables at the start of the conditionals.  --?"[&ItemTypeRequest]" -inc "Search for Materials"|[ --?"[&ItemTypeRequest]" -inc ""Gather Reagents""|[
yea, i figured that out, after like 3 hours, of slamming my head agains the table, could not figure out why it was not working, then noticed i forgot to put those there.  Thanks for taking a look at it though, its been a while since i coded so still stretching parts of the brain i have not used in a while. i think i have this working, Here is my "final product" any thoughts from anyone are appreciated.  i have tried slamming it with alot of different inputs, to see how it goes !scriptcard {{ --#title|Finding Resources --#sourceToken|@{selected|token_id} --=GatheringAttempts|?{Gathering Attempts?} --=DisplayCount|1 --&Location|?{What Biome are you in?|Forest|Desert|Grasslands|Marsh|Mountains|Caves|Underdark|Graveyard|Shore|Tundra} --&ItemTypeRequest|?{What are you looking to do?|Search for Materials|Gather Reagents} --&Advantage|?{Do you have Normal/Advantage/Disadvantage on these rolls?|Normal|Advantage|Disadvantage} --#emoteText|@{selected|token_name} attempts to [&ItemTypeRequest] [$GatheringAttempts] times, in the [&Location] --?"[&ItemTypeRequest]" -inc "Search for Materials"|[ --&ItemType | Crafting -->Crafting| --^GatherLoop| --]| --?"[&ItemTypeRequest]" -inc "Gather Reagents"|[ --&ItemType | Gather -->Gather| --^GatherLoop| --] --:GatherLoop| -->GatherProcess | [&Location] ; [&ItemType]; --=DisplayCount|[$DisplayCount] + 1 --?[$DisplayCount] -le [$GatheringAttempts]|GatherLoop --X| --:GatherProcess| --&SuccessType | Unknown --=ThisAttempt|[T#[%1%][%2%]] --?"[&Advantage]" -inc "Normal"|[ --=GatherRoll|1d20 --&ADV| N --]| --?"[&Advantage]" -inc "Advantage"|[ --=GatherRoll|2d20kh1 --&ADV| A --]| --?"[&Advantage]" -inc "Disadvantage"|[ --=GatherRoll|2d20kl1 --&ADV| D --]| --?[$GatherRoll] -eq 20|&SuccessType; is a Critical Success, Find Double ; --=GatherTotal| [$GatherRoll] + [$GatherMod] --?[$GatherTotal.Total] -lt 10|&SuccessType; Fails ; --?[$GatherTotal.Total] -ge 10 -and [$GatherRoll] -ne 20|&SuccessType; Succeeds ; --+Attempt [$DisplayCount.Total] | Finds [b][$ThisAttempt.tableEntryText][/b] and Rolls [$GatherTotal] which [b][&SuccessType][/b] ADV=[&ADV] --&ADV| --<| --:Crafting| --iPlease Click the Button to proceed;Survival|q;ProficientSurv;Are you proficient in Survival?|Yes|No --=GatherMod|0 --?[&ProficientSurv] -eq Yes|[ --=GatherMod| [$GatherMod] + @{selected|pb} [PROF] --]| --iPlease Click the Button to proceed;Attribute|q;Attribute;Which Attribute would you like to use|Strength|Dexterity|Wisdom --=AttrApplied|0 --?"[&Attribute]" -inc "Strength"|[ --=GatherMod| [$GatherMod] + @{selected|strength_mod} [STR] --=AttrApplied| 1 + [$AttrApplied] --]| --?"[&Attribute]" -inc "Dexterity"|[ --=GatherMod| [$GatherMod] + @{selected|dexterity_mod} [DEX] --]| --?"[&Attribute]" -inc "Wisdom"|[ --=GatherMod| [$GatherMod] + @{selected|wisdom_mod} [WIS] --]| --?"[&AttrApplied]" -ne 1|[ --=ErrorInCode| --]| --<| --:Gather| --iPlease Click the Button to proceed;Herbalism|q;ProficientHerb;Are you proficient in Herbalism?|Yes|No --=GatherMod| 0 + @{selected|wisdom_mod} [WIS] --?[&ProficientHerb] -eq Yes|[ --=GatherMod| [$GatherMod] + @{selected|pb} [PROF] --]| --<| }}