Howdy, Stranger!

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

Supported by

[solved] How to let the subject know how many more trials they have

edited June 2013 in OpenSesame

I'd like to be able to have my fixation screen have a line that says something like:
"This is trial [trial_number] of [total_number_of_trials]" or:
"There are [total_number_of_trials - trial_number] remaining"

But I'm not sure if there are already variables that I can use or if I have to create them (is count_trial_sequence what I should use?).

If I have to create them I may have to set them to a starting value and then increment them with some kind of loop statement such as "trial_number=trial_number + 1". I don't know how to do either of those things.

Also, what is the syntax for something like [total_number_of_trials - trial_number] ? When I was running a short experiment with 16 trials I tried to use "There are [16 - count_trial_sequence] trials remaining", but all I got was that statement literally on the screen.

Sorry for so many questions, but I don't quite have the hang of this yet. Thanks.

Comments

  • edited June 2013

    Hi Bob,

    Using the square-bracket in a feedback or sketchpad item (in your case the fixation screen) to inform the participant about how far in the experiment they are, is a very good idea.
    However, the square-bracket method can only use (e.g. display) the value of a previously defined variable, not change it. (That's why something like [16 - count_trial_sequence] will not work.)

    Thus, we'll first have to define the to-be-displayed variables. We'll use a little bit of Python inline scripting to do so.

    1.) Declare the total number of trials:
    The total number of trials is a constant variable. To set this variable, append an inline_script item to the beginning of your experiment, and place something like the following code in its Prepare-phase tab (see comments for more info):

    # Declare the total number of trials, which should correspond 
    # to the number of trials in the block loop 
    # (depending on 'cycles' and 'repeat').
    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)
    

    2.) Declare the trial count and the number of remaining trials:
    The values of those variables are not constant, and therefore have to be redefined at the beginning of every trial sequence. To do so, append an inline_script item to the beginning of your trial sequence, and add something like the following code to its Prepare-phase tab:

    # 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)
    

    3.) Use the square-bracket method in your sketchpad item:
    For example:
    This is trial [trial_count]/[total]
    You still have [trials_remaining] trials to go...

    After applying those suggestions, your overview area should look something like this:
    image

    A working example experiment can be downloaded here (simple download, change the extension from '.txt' into '.opensesame.tar.gz' and open as normally):

    Does this make sense?

    Best,

    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • edited 11:57PM

    I tried your instructions and they appeared to work as I needed. Thanks! It appears this issue is solved.

    I say they "appeared" to work as I had a little trouble seeing the screens with the trial number notices. They were supposed to remain until a key was pressed, but instead advanced quickly on their own. I'll start a new thread about that issue.

    --- Bob

  • edited June 2013

    Hi Bob,

    Glad to hear the trial info works!
    To keep the trial info displayed until a keypress, you can

    • set the duration of the sketchpad item (or feedback item) to 'keypress'
    • or set the duration of the sketchpad item to '0' and append a keyboard_response item immediately following. Since the keyboard_response waits for a response but doesn't change the screen, the trial info will remain visible until the participant presses a key.

    If the keypress is a variable of interest, the latter method should be used. If the keypress is not relevant and does not have to appear in the log file, you can use the former method as well.

    Best,

    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • edited 11:57PM

    Hi Lotje,

    It turns out that the instructions you provided to display the trial number work exactly as I need them to on most OS's. The problem with the screens not waiting for a keypress, however, seems to be unrelated to the trial number issue. And it's strange because it only happens on one OS, hardware combination. As I said above, I'll start a new thread on that one. Thanks.

    --- Bob

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