Reply To: Create a continue button

PennController for IBEX Forums FAQ / Tips Create a continue button Reply To: Create a continue button

#4044
Jeremy
Keymaster

Hi Sahar,

Since commands are executed in order, inserting a .wait command at the end of the first block of commands will pause the execution of the script until your first button is clicked, and only after that will the commands coming next, relating to your second button, be executed, which is why the second button wouldn’t appear until you click the first one.

With the script you posted, however, you have a .wait command relating to the second button, so the execution of the script is paused until the second button is clicked.

What you want is tell the script to pause until one of the two buttons is clicked. Put otherwise, you want people to make a selection out of a group of two buttons. Whenever you want to do that, you should consider using a Selector which you can use to group elements together and wait for your participants to make a choice. So your script should look like this:

newText("question", "Is the above item a word?")
    .print()
,
newButton("Word", "

Word ✓

") .settings.color("green") .settings.size(150, 70) .print() , newButton("Not a Word", "

Not a Word x

") .settings.color("red") .settings.size(150, 70) .print() , newSelector("WordOrNotaWord") .settings.log() .settings.add( getButton("Word") , getButton("Not a Word") ) .wait()

I removed the commands .settings.log from the buttons themselves, and used it on the Selector element instead since you are interested in which one is selected.

Let me know if you have any questions

  • This reply was modified 4 years, 8 months ago by Jeremy.