Hello, It is Me Again asking a stupid question.
>How do I add a Password System on Twine 1 with Sugarcube-2
My Old Code:
--
<<set $answer = prompt ("Please Input A Password To Continue.")>>
<<if ($answer is "butimletired")>>
Debug
<<else if ($answer is "0100000101110010011010010111001101100001")>><<
Secertroute >>
<<else if ($answer is "IHATETHISGAME")>><<
Commentary >>
<<else>>
Start <<endif>>
--
Worked Under Sugar Cane. I recently moved on to Sugarcube-2 and the now it leaves me with this error:
--
<<set>>
<<if>> ERROR: <<if>>: <<else>> must be a final clause.
--
I assumed it meant change <<endif>> to <</if>> but it still shows up.
......
This is might be tricky, but I want a variable that asks for your age. if your age is under 18 it will kick you back to
Start or even exit the game
Comments
You can use the <<textbox>> macro to ask the Reader to supply an answer, the <<button>> macro to know when to check their answer, and the Javascript <String>.trim() function and the <String>.toLowerCase() function to format the String value the Reader enter in a way it can be consistently checked against a set of expected responses.
If no answer was supplied you can use the UI.alert() function found in the UI API section to prompt the Reader for one, and once it has been determine that a correct answer has been supplied you can use the <<goto>> macro to send the Reader to the relevant next passage.
The combination of the above would look something like the following code: