compare variable loop with a key on the keyboard
I should compare a variable number stored in the loop with a number entered with the keyboard .
example : the loop variable at that time is 6 , 5 if I type on the keyboard the program performs a comparison between variable and input and gives me a true , if the numbers are equal , in another variable or I by a false .
how can I do?
Comments
Hi,
It may be best for you to look up some python instructions on the internet (google: "compare keyboard input to variable").
Python code is implemented through the inline_script item in OpenSesame. Here you can initiate the keyboard to collect a response (http://osdoc.cogsci.nl/python/keyboard/)
and create a variable. With "variable number stored in the loop" do you mean you're using OpenSesame's loop item with a variable that has some number in every condition, or do you mean you're using a for-loop that appends numbers to a list or something?
In any case, you can compare the keyboard input (if succesfully collected) to anything by doing something like this:
Cheers,
Josh