> I was going to attempt to write this next part but I think It might be unnecessary and should be feasible with whats available. The end goal is to have it so that a screen appears with a text list of pictures and audio(picture 1, picture 2, audio 1, audio 2- written). When the user presses 1,2,3 or any number that corresponds to either the picture or audio that corresponding file is shown.
You can't use conditions file loops for this. They determine the audio/picture depending on the current row in the condition file. You need it to be determined by a key press from the subject. See below for how to do this.
> The subject can then press any key to return to this original screen. Ideally if they had just pressed 1 for audio 1, that text box would be blurred or have some sort of indication that shows the subject that they have already selected that stimuli. This is to go on for a set duration of time.
To do this, you need to create a separate text component for each line: we can't currently change the attributes of text (e..g colour, font, etc) within a paragraph. You will need to split them up to alter each line as a whole as required.
> What I have so far: 3 routines- Stim selection, picture, audio. Stim selection has a text file that displays the list, a key response and a code component similar to the one used in the branching demo. next the picture routine has the image box and a text box, and the audio routine an audio box and key response.The picture routine is in a loop and the audio routine is in a loop and an outer loop encompass all 3 routines. -Ill attach the example below.
As mentioned, you can't use conditions files here. Just have each inner loop have an nReps specified as a variable.
> I figure I can use a code component similar to the branching demo and set it so that If subjects press numbers 1-5 it goes to the picture routine, if they press numbers 6-10 it goes to the audio. Would I be able to do if resp.keys=='1:5': to indicate that if either 1,2,3,4,or 5 is pressed, the picture routine comes up?
keyRange1 = [str(x) for x in range(1,6)]
keyRange2 = [str(x) for x in range(6,11)]
if resp.keys in keyRange1:
trials3.nReps = 1
trials4.nReps = 0
elif resp.keys in keyRange2:
trials3.nReps = 0
trials4.nReps = 1
else:
# can there be out of range responses?
> If it goes to the picture routine but I only want it to do one trial and then restart the loop, how can I use the nameofloop.finished==true to end that loop after one picture has been shown and return to stim selection, without going to the next routine?
Put a nested loop around the next routine with the number of reps specified by some variable. If you don't want that routine to be executed, set that variable to 0. Otherwise, set it to 1. As above. Don't use loop.finished = true.
> I also tried something along the lines of what was done earlier and created two trials, stim selection and stimuli- for stim selection I had the text box as well as a key responce box and stimuli I had a picture and audio component. I put all this together in one loop and attempted to make the excel file such so that if subjects press 1, the first routine ends and the corresponding image appears in the next routine. Obviously ran into several problems there but If there's a way to make it work, I think this way would be better. My excel file looked something like this:
> keyresp stimuli
> 1 V1.jpg
> 2 V2.jpg
> 3 A1.jpg
>
> The problem with this setup is that each keyresp is set to one trial ( even after I changed them to letters instead of numbers). Meaning if i press 3 during trial 1, it doesn't work.
Exactly. You are going to need to handle this yourself, as you aren't doing things the way Builder is designed to work. A way would be to construct two dictionaries like this, at the beginning of the experiment:
pictureFiles = {'1': 'v1.jpg',
'2': 'v2.jpg',
'3': 'v3.jpg'} # etc
audioFiles = {'6': 'A1.wav',
'7': 'A2.wav',
'8': 'A4.wav'} # etc...
They act as a look-up table, linking key presses to stimulus file names. So you can refer to them in the image or audio components like this:
$pictureFiles[resp.keys]
Mike