Group: Forum Members
Posts: 3,
Visits: 39
|
Hi,
This is probably a stupid question, but I'm completely new to coding and cannot seem to figure it out.
I'm trying to get the correct response to be dependent on the location of a probe, which randomly appears on the left (25% hposition) or the right (75% hposition). If the probe appears on the left, I want "N" to be the correct response; and if the probe appears on the right, the "M" key.
I'm using the following code to randomize the probe location:
<list practiceproberandomizer> / items = (25%, 75%) / selectionrate = always </list>
And my latest attempt for the correct response, which I've adjusted from a different script:
/ iscorrectresponse = [ return ((list.practiceproberandomizer.nextvalue == 25% && parameters.responsekey_left) || (list.practiceproberandomizer.nextvalue == 75% && parameters.responsekey_right)); ]
The script runs, but the feedback appears to be random so this isn't working. Most of my other attempts have resulted in the script not running and an error saying Missing '[', for instance with these attempts:
/ iscorrectresponse = (parameters.responsekey_left if list.practiceproberandomizer.nextvalue == 25% else parameters.responsekey_right) / iscorrectresponse = (parameters.responsekey_left if [list.practiceproberandomizer.nextvalue == 25%] else parameters.responsekey_right) / iscorrectresponse = if (list.practiceproberandomizer.nextvalue == 25%; parameters.responsekey_left) else if (list.practiceproberandomizer.nextvalue == 75%; parameters.responsekey_right) I hope someone can help me with this, thanks in advance!!
Best, Eva
|