Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

input then goto

please help a newbie to this Twine world
I want to have a correct input statement take me to a set passage.
like this
"input your code"
if code is "ABC" then go to page ABC.
if not "ABC" then "try again" loop back

can some one help PLEASE

Comments

  • You need to state which Story Format you are using when you ask a question, as answers can be different for each one.
  • any - sugercube
  • Try something like the following:
    <<set $code to "">>
    
    <<textbox "$code" $code autofocus>><span id="msg"></span>
    
    <<click "Submit Code">>
    	<<if $code.toLowerCase() is "abc">>
    		<<goto "ABC">>
    	<<else>>
    		<<replace "#msg">>Try Again<</replace>>
    	<</if>>
    <</click>>
    
    ... it use a <<textbox>> macro to obtain the code from the Reader, an <<if>> macro to check if the Reader entered the correct code, and a <<goto>> macro to send the Reader to the "ABC" passage.

    Because you don't know if the Reader will enter uppercase or lowercase letters the above uses Javascript's toLowerCase() method to force the entered code to be a single case so it is easier to check.
  • BIG THANKS pal spot on.now i can move forwa
Sign In or Register to comment.