Python to Java Question for Run-If Statement
in OSWeb
Hopefully this is a question that has a simple answer. I am by no means knowledgeable about programming, in any language, but I can usually make my way through if need be. I am currently using a short snippet of Python code for a run-if statement for a feedback display.
The code is as follows: =self.get('count_Trial_Sequence') % 40 == 20
I know that this isn't correct Java code, so it doesn't work when I try to run my experiment in OSWeb. Does anyone know what the proper way to say this is in Java to get it to work?
Comments
You probably mean JavaScript - not Java. They are different languages. And sorry, cant' help, I don't know Python (only Java and JavaScript).
@kri, yes you're right; JavaScript, not Java. If it helps, the above code asks OpenSesame to get the variable 'count_Trial_Sequence' (which is a variable OpenSesame already knows...I didn't code it), and asks the feedback to only be shown every 20 trials (done with modulo operator). If you know how to say something like that in JavaScript, that would be great!
Update for anyone who wants to know: I circumvented the problem by creating a variable in the Block_Loop called Trial_Number and used: [Trial_Number] % 20 == 1 instead. This works both on OpenSesame and OSWeb.
check this...JavaScript if statement
Hi @Eslifkin23,
It looks as if you're referring to code used in a "run if" parameter rather than within an actual inine_script object. In that context, the following should work: [count_Trial_Sequence]%20 == 20.
Fabrice.