Howdy, Stranger!

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

Supported by

trial counter

Hi all,

I'm trying to add a basic trial counter to my experiment ("You are on trial X of Y"). I have read the following threads:

http://forum.cogsci.nl/index.php?p=/discussion/474/solved-how-to-let-the-subject-know-how-many-more-trials-they-have

http://forum.cogsci.nl/index.php?p=/discussion/480/solved-how-to-reset-the-trial-counter-after-the-practice-trials

I have specifically added Lotje's code from the first post to my experiment. Unfortunately, I get the following error when I try to run the experiment:

The variable 'count_trial_sequence' does not exist. Tip: Use the variable inspector (Ctrl+I) to see all variables.

item-stack: experiment[run].practice_loop[run].block_assignment[run].blocksequence[run].new_inline_script[run]
time: Mon Jul 16 11:57:07 2018

I've attached a picture of my experiment organization. The file itself is too large to attach, but please let me know if I can upload anything else to make it more clear.

Thanks for your help!

Comments

  • Hi,

    I'm not sure whether this will do the trick, but in the loop item, you can check the box skip on the first iteration or something like that. If this doesn't help, I would add an inline_script to the block_sequence (the first item or so) and add this line to its prepare phase: var.count_trial_sequence = 0

    Does that work?

    Eudard

    Buy Me A Coffee

  • Hi all,

    So I've come back to this project after several months. I have been able to implement a counter, and even a counter for my practice trials! Thank you to all for the help!

    Unfortunately, I can't seem to figure out how to get the counter to start at 1 rather than 0. I have based my code off of Lotje's code (linked above), but for whatever reason, the following code doesn't seem to do anything on the first iteration of the counter:

    trial_count = trial_count + 1

    I have the following inline script at the very beginning of my experiment (before the first loop):

    total = 96
    practice_total = 5
    
    # To make an in-an-inline_script-item-defined variable 
    # available in the GUI (e.g., in our case, a sketchpad item)
    # as well, we 'set' the variable by using the built-in 
    # experiment function exp.set(). 
    
    # This function takes two arguments: the name
    # of the variable and its value.
    # For more information, see:
    # http://osdoc.cogsci.nl/python-inline-code/experiment-functions/#experiment.set
    exp.set("total", total)
    exp.set("practice_total", practice_total)
    var.trial_count = 0
    var.trials_remaining = total
    var.practice_trials_remaining = practice_total
    

    And the following inline script in the trial sequence

    # Determine the trial count.
    # The built-in counter 'count_trial_sequence'
    # starts counting at zero (in line with the zero-based 
    # indexing generally used in Python). 
    
    # Therefore, we want to add '1' to the 
    # counter variable you want to show to
    # the participant.
    
    # Firstly, we 'get' the in-the-GUI-defined variable
    # 'count_trial_sequence' to use it in an inline_script.
    
    # To do so, we use the built-in experiment function 
    # self.get(). This function takes one argument, namely the 
    # name of the OpenSesame variable:
    # For more info, see:
    # http://osdoc.cogsci.nl/python-inline-code/experiment-functions/#experiment.get
    
    trial_count = self.get("count_trial_sequence")
    
    # Next, we add '1' to the trial_count:
    trial_count = trial_count + 1
    
    # To determine how many trials the participant still
    # has to do, we use the previously-defined
    # variable 'total', which we 'get' with self.get():
    trials_remaining = self.get("total") - trial_count
    
    # Finally, we have to 'set' the here-defined variables to 
    # make them available in the GUI:
    exp.set("trial_count", trial_count)
    exp.set("trials_remaining", trials_remaining)
    

    Thanks for any help you might be able to provide! I can attach my experiment structure, or any other files that might help answer this question if need be.

  • Hi,

    In the first part you set var.trial_count = 0. However, in the next script, you also have trial_count = self.get("count_trial_sequence"). So effectively, you are overwriting the trial count variable every single time with the count_trial_sequence variable. This variable is hardcoded in Opensesame and always starts at 0. I think if you replace trial_count = self.get("count_trial_sequence") with trial_count = self.get("trial_count"), or simply: trial_count = var.trial_count, you should be able to start at 1.

    Does that help?

    Eduard

    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 http://45.77.173.118/ 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