Howdy, Stranger!

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

Supported by

How to change the stimuli list presented in a task depending on participant's response

Hello, everyone!

I am currently working on an experiment and it's the first time I use OpenSesame to program it. I intend to run this experiment online (so, I guess, I will also need to learn how OSWeb works, eventually). Right now, I am still in the programming phase and I would like to ask for your expertise.

The design of the experiment is the following: the participants will be asked to perform a 4-colour Stroop task but only after selecting on a slider the number of congruent trials (RED written in red) they want to perform in the upcoming block (e.g., none = 0, all = 24). I already have a stimuli list with 24 rows and 4 columns (colour, word, incongruency and correct response) with a counterbalanced number of congruent and incongruent trials (12 and 12), but I assume that in this case the stimuli list to be presented should be created on the go, since the participants' choice of congruent trials would be expressed through the said slider and it would vary in each block.

Right now, I have achieved creating and presenting onscreen the slider (I can attach the draft I've been working on as it may be helpful), but I am stuck with the create-a-new-stimuli-matrix-based-on-participants-choice phase.

Could someone help me?

Thanks so much in any case!


  • edited April 2023

    Hi Stone,

    when things seem very complicated to implement it is often a good indication that the approach is not ideal. In your specific case, you shouldn't try to dynamically generate a loop table (I don't even think this is possible). Instead you can use Python (inside inline_scripts) to generate lists of task parameters that more or less correspond to the columns in the loop table. For example, your participant chose 20 in the form. Then you can do in an inline_script (run phase) following that form:

    # assume var.n_congruent_trials exists and is set to 20
    # assume var.n_total_trials exists and is set to 24
    var.congruency = var.n_congruent_trials * ['congruent'] + var.n_total_trials * ['incongruent']

    That you can then also shuffle to make it random

    import random

    and finally match it with the other parameters

    avail_words = ['red', 'green', 'blue', 'black']
    avail_colors = ['red':'#00FFFF', 'green':'#FF00FF', 'blue':'#FFFF00', 'black':'#FFFFFF']
    cr_map = ['red':'r', 'green':'g', 'blue':'b', 'black':'f']
    var.words = 6 * avail_words
    var.colors = []
    var.correct_responses = []
    for trial_idx, word in enumerate(var.words):
        if var.congruency[trial_idx] == 'congruent':
              var.correct_responses = cr_map[word]
             temp_colors = avail_colors.remove(word)
             chosen_word = random.choice(temp_colors)
             var.correct_responses = cr_map[chosen_word]

    Now you have four lists that have 24 items. So you can put a loop/sequence after that inline_script, put another inline_script as first item in that sequence, and add there (in the prep phase):

    var.colour = var.colors.pop(0)
    var.word = var.words.pop(0)
    var.incongruency = var.congruency.pop(0)
    var.correct_response = var.correct_responses.pop(0)

    And now you're set.

    Does that make sense?


    ps. I have not tested the code, so there might be some errors. But I hope you get the general point.

    Buy Me A Coffee

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games