I’m using a prompt to set a variable. The reader is choosing from about 10-12 options
(set: $followup to (prompt: “Enter your choice:”, “”))
(if: ($followup is 9)) [(set: $now to 1)]
(if: ($followup is 10)) [(set: $now to 1)]
and then $now reveals links in various passages that were not there before. That’s the idea.
(if: $now is 1)[Choice: [[Start the…]] ]
that didn’t work. I couldn’t even get $now to be assigned to 1.
I also tried (show:
(set: $followup to (prompt: “Enter your choice:”, “”))
(if: ($followup is 9) or ($followup is 10)) [(show:?now)]
then in various passages…
|now)[Choice: [[Start the…]] ]
Please use the Preformatted Text option when including code examples within a comment, doing so will stop the forum software converting valid standard single & double quotes into invalid Typographical (curly) single & double quotes. It also makes the code easier to read and to copy-n-paste into a test project for debugging.
If you look at the usage example of the (prompt:) macro you will see that the macro returns a String value. eg. the (prompt: String, String) → String line of the related documentation.
So if the end-user inputs a numerical value like 9 into the prompt field the String value returned by the macro will be "9", so you need to change the conditional expressions of your (if:) macros to test for String values. Also as each of your conditional expressions are mutually exclusive (eg. $followup can equal both 9 & 10) you should use an (else-if:) macro for the 2nd & last conditional expressions of that set.
(set: $followup to (prompt: "Enter your choice:", ""))
(if: $followup is "9")[(set: $now to 1)]
(else-if: $followup is "10")[(set: $now to 1)]
notes:
You don’t need the parenthesis you had around your condition expressions.
There should be no white space characters between a macro call and its associated hook.
If the $now variable represents a true/false or yes/no or on/off type of boolean state then you should make it a Boolean variable. eg. (set: $now to true) or (set: $now to false). If you do change the variable to a Boolean then you would use conditional expressions like the following to test its current state.
(if: $now)[The variable current equals true]
or
(if: not $now)[The variable current equals false]
The (show:) macro only reveals hidden hooks that are contain in the ‘current’ Passage, or Passages that are included into the ‘current’ Passage’s generated HTML contents.