Last try:
#end routine
if key_resp_instr_end.keys == ['n']:
trials_3.finished = True
Last try:
#end routine
if key_resp_instr_end.keys == ['n']:
trials_3.finished = True
Okey UPDATE
Instruction works PERFECTLY now and repeat nicely
Beging Experiment: nReps = 1
End Routine: if key_resp_7.keys == [ānā]:
trials_3.finished = True
BUT for the repeating of practice
whenever I click yes or no, still repeat for both
Beging Experiment: nReps = 1
End Routine: if key_resp_7.keys == [ānā]:
trials_3.finished = True
You have to update your keyboard component and loop names accordingly - presumably key_resp_7 and trials_3 are only present in the instructions routine.
Best wishes,
Oli
I am sorry my mistake I copied them and did not change them -SILLY MEā¦
this is for instruction end routine
if key_resp_instr_end.keys == ['n']:
repeatinst.finished = True
and this is for practice end routine
if key_resp_7.keys == ['n']:
trials_3.finished = True
I am deeply sorry my dearest Oli
and yes the problem still the same for the practice repetition only
Hi Mada,
Thereās no reason it shouldnāt work - so it is probably a miss-named variable somewhere - perhaps you could upload your latest psyexp file so I can take a look?
BW
Oli
I have absolutely no idea why that is happening⦠I managed to get it to work by changing the practice code component entry to:
if key_resp_7.keys[0] == 'n':
trials_3.finished = True
But youāre right - both entries are identical and there is no reason why an if statement would return true in one case and not in an identical case.
If anyone else is reading this - see below some tests I ran on the code components in the above file - makes no sense to me at allā¦
#Instance 1
[In] print key_resp_instr_end.keys == ['n']
[out] True
#instance2
[In] print key_resp_prac_end.keys
[out] n
[In] print key_resp_prac_end.keys == ['n']
[out] False
[In] print key_resp_prac_end.keys[0] == 'n'
[out] True
For key_resp_instr_end
, you selected Store all keys
, which makes the result a list. For key_resp_7
(which is probably what you renamed to key_resp_prac_end
?), you selected Store last key
. In the latter case, no list, but a string is saved. This is an annoying inconsistency I personally consider a bug (but thereās arguments for and against this behavior). See why that matters:
In [3]: key = 'y'
In [4]: key == ['y']
Out[4]: False
In [5]: key[0] == 'y'
Out[5]: True
OMG OLI IT IS WORKING
THANK YOU SO MUCH
THANK YOU
THANK YOU