How to do expectant answers

So I want to do a thing where only certain answers are supposed to be answered so sorta like:

So whats the (insert random stuff)

*input_text answer

expected answer (insert random stuff)

so does anyone know how to do this?

Hmm. The first thing I’ve got in mind is to have two variables; a pair of [question] and [answer]. Put a dice roll to randomize the chosen pair, and you’ll get your random question thing (if random is your goal).

Something like this

*rand dieroll 0 999   <<or as many as you like>>

*if dieroll = 1
   *set question "the color of grass?"
   *set answer "GREEN"
*elseif dieroll = 2
   *set question "the color of cloud?
   *set question "WHITE"
*elseif dieroll = 3
   *set question "cows drink..."
   *set answer "WATER"
Etc.

Keep in mind I use ALL CAP letters for answers so if the player mess up the capitalization, they still get it right if the word is correct.
Using
*if player_answer = "$!!{answer}"

but like what if you dont want it random just 1 question

edit: and *goto is still the same right no extra indents or anything

So you want to ask a question, then have the player put in an answer, then see if the player got the right answer?

basically

Then you just need to compare the player’s guess (or answer, or whatever you name it) to whatever it’s supposed to be.

*input_text guess

*if guess = answer
 text here

Thats… confusing

so how would you set the answer

For code that will work:

*if (guess = "$!!{answer}")
  You got it right!
  *goto fame_and_fortune
*else
  You're stupid and nobody will ever love you.
  *goto eat_dog_shit

how would you set the answer

*set answer "BLUE"
...
*input_text player_answer
...
*set guess "$!!{player_answer}"
1 Like

You would have to create variables beforehand.
Example:

*temp guess ""
*temp answer "what"

When the player makes their guess, the command *input_text guess will save whatever they typed in to the variable called guess. So let’s pretend the player typed in the word what.

*if guess = answer

This is another way of saying… is “what” equal to “what”

@will

Lol, savage.

So like …

*temp guess ""
*temp answer "Random"

Random question

*Input_text guess

*if guess = Random
      Random words
 *else
       More random words
*temp guess ""
*temp answer "Random"

Random question

*Input_text guess

*if guess = answer
 Random words
*else
 More random words

You can also do it a slightly different way.
If you know what the answer is supposed to be, you can do something like…

*temp guess ""

Random question

*Input_text guess

*if guess = "helloworld"
 Random words
*else
 More random words

In the above example, the player would have needed to type in helloworld exactly. If you have it in quotes like that, it looks at it as a piece of text. But if you don’t have it in quotes, it considers it a variable, and tries to find a variable with that name.

So, if you had *if guess = helloworld instead of *if guess = “helloworld” it would try to find a variable named helloworld.

1 Like

hold on let me try it…

It worked

2 Likes