Howdy, Stranger!

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

Radio Buttons AND if expression.

Good Night folks!

<<set $test>>
<<radio $test "Chocolate">>
<<radio $test "Apple">>
<<if $test is Chocolate>> <<set $test = "Chocolate">> <<endif>>
<<if $test is Apple>> <<set $test = "Apple">> <<endif>>

What 's wrong with this formula ? How do I assign values to my variable this way ?
In my print , the result is always 0.

Comments

  • You don't say which version of Twine or which Story Format your using so I am going to assume Twine 1 and Sugarcane.

    As the radio macro documentation states you have to have a button macro after your radio macros for the value to be stored.

    Try the following:
    (note: Using TWEE notation, the lines starting with double colons '::' represent a new passage's title.)

    :: StoryInit
    <<set $test to "">>


    :: Start
    Select one of the following and then click on the button:
    <<radio $test "Chocolate">>
    <<radio $test "Apple">>
    <<button [[Click me to see the result|Result]]>>


    :: Result
    Your choice was: <<print $test>>
    <<if $test is "Chocolate">>\
    And you love chocolate!
    <<else>>\
    Did you see a worm in that apple?
    <<endif>>
  • Thank you man! I'll test here . ( I am without the program )
Sign In or Register to comment.