Restrict allowed choices in touch response
Hi,
I'm trying to set up a Wisconsin Card Sorting Test for OSweb. However, I'm stuck trying to figure out a way to restrict the input of a touch response.
At the moment I have this inline JavaScript set to run:
allowedResponses = [1, 2, 3, 4];
while (!allowedResponses.includes(this.response)) {
this.exp.items.run("touch_response");
}
But it just loops to infinity after the first user input.
This is the task structure:
Has anyone got this to work?
Comments
Hi @SpacePenguins ,
A bit clunky, but you can place the
touch_responseinside aloop-sequencestructure, and then use arepeat_cycleitem to repeat thetouch_responseuntil a particular criterion is met. Like so:Hope this helps!
— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi @sebastiaan
Thanks for you solution!
'response not in [1,2,3,4]'
did not work, but I changed it to:
'response == 5 or response == 6 or response == 7 or response == 8'
Another way of doing this is to have a inline javascript instead of a repeat cycle block.
In the prepare part of the javascript you can define what squares are allowed or not allowed to be clicked.
And in the run part of the script:
if (buttonsGridPos.includes(response)) { repeat_cycle = 0 } else { repeat_cycle = 1 }