Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Calling index from list

Hi, I am fairly new to Opensesame, but I really like the interface and the flexibility it provides.

One question I have been struggling with. I cannot work out the syntax for calling a specific index from a list and using it directly to insert a picture.

Currently the respondents categorise pictures, and I have created a list of specific images for them to use later in the task. During the loop, each images gets added to a specific list according to a response:

var.female_attractive_list.append(str(var.sex)+str(var.number)+'.png')

I want to call that images by its index in the list later:

draw image center=1 file="[female_attractive_list[1]]" scale=1 show_if=always x=-96 y=-192 z_index=0

Obviously the above syntax is incorrect, but I cannot work out where to put the index to insert the contents of the list value. I have tried everything that I think would be reasonable in python.

If anyone could point out my glaringly obvious error, I would be extremely grateful

Comments

  • And in a related (or quite unrelated question). I want to use selections from earlier in the experiment to form part of a later phase of the experiment where timing is critical (I therefore want to use them as a Sketchpad item , rather than a feeback item). Is it possible to force the experiment into a second phase, where everything is re-initialised, prepared and preloaded using variables generated in the first phase, or does everything like this have to be known before the experiment begins?
    I hope this question makes sense, and I would appreciate any help

    Thanks

  • Hi,

    I cannot work out the syntax for calling a specific index from a list and using it directly to insert a picture.

    Try this syntax: "[=var.your_variable[the_index\]]"

    Is it possible to force the experiment into a second phase, where everything is re-initialised, prepared and preloaded using variables generated in the first phase

    This sounds like the perfect application for sequences: http://osdoc.cogsci.nl/3.1/manual/structure/sequence/

    In the first sequence, you define all the bits you need, in all later sequences you make use of those.

    DOes this make sense?

    Eduard

    Buy Me A Coffee

Sign In or Register to comment.