Calculating Correct responses in a single loop
Hi there,
i have created a nested loop.
In the outer loop sequence i have put the following:
vars.RT_Sum=0 vars.ERR_SUM=0 vars.COR_SUM=0
In the inner loop sequence i have put this:
vars.RT= vars.response_time_Resp
if (vars.correct_Resp== 1){
vars.COR=1
vars.COR_SUM = vars.COR_SUM + 1
}
else if (vars.correct_Resp== 0){
vars.COR=0
vars.ERR_SUM = vars.ERR_SUM + 1
}
vars.RT_Sum = vars.RT_Sum + vars.RT
The variable vars.EER_SUM is then used again in the outer loop in a feedback_item.
It works fine if i run it the normal way (single green play-button), but not if i run it in the browser. In the browser i always get the feedback that all respones were incorrect.
Any ideas what i am doing wrong here?
Stephan
Comments
Hi Stephan,
I would use the browser debugger for this. If you put a line with the statement
debuggerat the end of the script and then run the experiment while the browser console is active (Ctrl+Shift+Iin Chrome), the experiment will pause when it comes across thedebuggerstatement. That way you will be able to inspect the values of all relevant variables. (Simply typing them into the browser console, like so:vars.response.)Does that help?
-- Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
the problem is not as much that i do not see my variables, but that something that works in normal run, does not work in OSWeb.
It appears that I do not get into the if clause, but only into the else if. The only logical reason is that vars.correct_Resp is always 0, even if the response was correct.
I therefore played around a little with the correct_response input in the keyboard response item.
I have two variables that are defined in the loop. I have 4 allowed responses, each in upper and lower case. Two correct responses (one is upper case the other lower case) --> just in case participants use caps lock.
I tried [COR1];[COR2] and COR1;COR2 and vars.COR1;vars.COR2 and [COR1],[COR2]
--> only the first brings the correct number of errors in normal run, but not in OSWeb
--> the other options do not result in errors stopping the script, but do not count correct responses neither in normal run, nor in OSWeb.
I believe I am close, but what is the correct version to use in OSWeb?
Cheers, Stephan
Hi there,
i found a workaround. There seems a bug when using the correct_resp in OSWeb.
This worked for me. The console.log function may be added in the manual of common functions. It was very helpful ;)
console.log (vars.correct_Resp) vars.RT= vars.response_time_Resp if (vars.response_Resp== vars.COR1 | vars.response_Resp== vars.COR2){ vars.COR=1 vars.COR_SUM = vars.COR_SUM + 1 } else { vars.COR=0 vars.ERR_SUM = vars.ERR_SUM + 1 } console.log (vars.COR, vars.response, vars.COR1) vars.RT_Sum = vars.RT_Sum + vars.RTHi @DahmSF ,
Ok, I see what you mean now. OSWeb indeed doesn't recognize multiple correct responses, whereas OpenSesame on the desktop does. That's the issue, right? I filed an issue for it here.
— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!