Getting user input from ask

Does the ask command not necessarily wait for user response before letting the surrounding code play out? Let's say I have a set of true/false questions that I want the user to go through in the order of their choosing. The user selects each question from an onscreen list (NOT an ask/menu!) and after each question has been selected and answerably correctly, I want to set a flag that will tell the code to remove the question from the available list.

I have each single question set up in an individual event handler (the player code tells the room code to run the specific question's event), with an ask with a true option and a false option. The idea being that after the user selects true or false from the ask, that flag variable of "seen and answered" comes back to the player code with a 1 (success from choosing a correct answer) or 0 (not a success.)

What happens instead is that the code defaults the flag variable to 0 before the user even finishes seeing the question. So any ripple effects from that variable are stuck building off of a 0 instead of what the user may have selected. Like, Log is showing me that the success variable is 0 as soon as the confirm button is pressed to start the event (to select a question from a list of six), and the ripple effect variables (where the code is supposed to figure out what question is next) all show up resolved in Log before the question finishes appearing on the user's screen. How do I make sure those calculations occur after the user selects from the ask option?

Once the user answers the question, the variable is adjusted, but by then all the under-the-hood stuff has already happened. When the question is selected a second time, then the "seen and asked" success variable is checked and the question is removed from the future list if a "success" is seen. Obviously the drag here is that the user can get a success the first time, but the question does not go away; it must be selected a second time and answered again.

I'm pretty sure it's related to the ask, because I tested some fake questions where the event handler literally just sets the success variable to 1, and those report back as successes and nicely remove themselves from the list.

Just wondering if that's normal behavior, or if there's some way to pause the near-instantaneous code processing while waiting for user input. I'm new at this, so I might have this all upside down.

1 Like

OK, I think I addressed the issue by shifting some code inside the ask options.

I guess my error is assuming that everything pauses while waiting for player input?