Quantcast
Channel: Help! with 2.0 - Twine Forum
Viewing all articles
Browse latest Browse all 1844

Sugarcube 2.7.0 If conditionals with two textboxes and multiple variables

$
0
0
Hello all,

I've got a couple of textboxes where users enter answers to questions.
31. Write the <b>first name</b> of one student who //passed// the session: 
<<textbox "$q41" "">>

32. Write the <b>first name</b> of one student who //failed// the session. 
<<textbox "$q42" "">><<button [[Submit|Partner Finalize FGR 3]]>><</button>>

The user has the answers, and can enter them in. There are several possible answers to each question, so I'm checking like this:
<<if $q41 eq "Shannon" or $q41 eq "Muriel" or $q41 eq "Marion" or "Debra" or $q41 eq "Ira" or $q41 eq "Wendell" or $q41 eq "Kelly" or $q41 eq "Peter" or $q41 eq "Aubrey" or $q41 eq "Perry" or $q41 eq "Troy">>
	<<if $q42 eq "Rosie" or $q42 eq "Allen" or $q42 eq "Marguerite">>
	<<set $player.experience to $player.experience + 5>>
<else>>Nope! <<back>><<audio "error" play>>        
<</if>>
<</if>>

I originally had it setup as one <<if>> conditional with "and" between $q41 and $q42, but that didn't work either. The problem is that if I enter any two names listed in either textbox, the result is accepted as correct and experience is gained by the player.

For example, if I enter Rosie in $q41 textbox and Allen in the $q42 textbox, (One value incorrect, one value correct) the answers are counted as correct and experience is awarded.

On the other hand, if I enter Rosie in $q41 and Shannon in $q42, (meaning both values are incorrect for the accepted answers), it returns a false value. Is there a way that I can more accurately assess the validity of both variables, instead of just one?

Thank you!

Viewing all articles
Browse latest Browse all 1844

Trending Articles