Hi everyone, I am new to twine and I am trying to set up and if/else scenario. I want the player to find a keycard, and then use the keycard to open a door. I have the <<set $numkeycard eq "true">> after the play picks up the card. But I am insure how to make the variable bring up a new passage depending on the value. Like I would like the if else statement to be able to send the player to my
Open the door passage if the variable equals "true" and send the player to
No keycard passage if the value equals "false". Is this possible in Twine or are variables strictly for displaying text when the variable restrictions are met. I' working in the Sugarcane format. Thank you!
Comments
You should be using the to keyword to do $variable assignments, the eq keyword is used for comparison. The boolean values true/false should not be wrapped in double quotes.
You have two basic choices for your problem,. there are a number of advanced options but I won't list them:
1. Conditionally show one of your two markup links based on the value of $numkeycard 2. Show the same markup link but change the target passage:
note: the above examples are assuming you are not using SugarCube, if you are then the <<endif>>'s would be replace by <</if>>s