I’ve created an experiment that ‘nearly works’ in builder.
I just need some help with these lines of Python please. The ‘code’ below shows what I am trying to do, but obviously I have the language all wrong. I am planning to learn Python soon, but right now these lines are the only thing stopping the experiment from running for my 3 Honours students.
More detail about experiment.
Like the BART demo, I’m adjusting the presented image via arrow keys. Then you press ‘enter’ when subject thinks image ‘is right’. I am using this code on each frame to vary the value of ‘k’ depending on the arrow pressed. That k value is set as selected rows: $[k] in my trial properties. It references the excel conditions file to choose the image. The experiment works in that when I just put k=3 (for example) in ‘Each frame’ code, the experiment works. However I need to vary k.
I am a little concerned that this method might be a bit poor for timing, but it is not a major issue. Also the ‘ding sound’ is not essential, but would be nice.
k=3 #if k is within the range of row numbers in excel file. Shift pic as per keypress # if they want the image to go further away if UpDownResp.getKeys(['up']) and k>1: k=k-1 # if they want the image to come nearer if UpDownResp.getKeys(['down']) and k<6: k=k+1 else k= # make a ‘ding’ sound``` Many thanks for your help. I have spent a lot of time trying to make this work, and not gotten very far. Kirsten