Howdy, Stranger!

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

Supported by

[solved] breaking out of loop after 1 stimulus

edited April 2014 in OpenSesame

have tried a few things. tried using the Count variable and then used Break if = count_seq >1 in the loop object. I thought this would work.. Must i make a new variable in an inline script which matches the count variable? and then use this in my Break If line instead of directly calling the count variable? i.e.

Count1 = self.experiment.get('count_Cue_seq')

then in Break if = Count1>1

:( struggling here

Comments

  • edited April 2014

    Referring to variables is done using square brackets, like so for you break if statement:

    [count_seq] > 0
    

    EDIT: count needs to exceed 0, as Python starts counting at zero (thus the first trial is numbered trial 0).

    Also, you might need to add an inline script to the very start of your experiment, and place this in the Prepare phase:

    exp.set("count_seq", 0)
    

    This will make sure that the variable that you use in your loop (i.e. count_seq already exists when the loop is being prepared. Otherwise the variable will be defined only upon running the sequence, which happens after preparation of the loop. Therefore, the variable you reference in your break if statement will not exists yet, and that would result in an error.

  • edited 3:49AM

    Thanks for this. This is working.. however it shows 2 stimuli and then breaks, not just 1.

  • edited 3:49AM

    ok i did it as break if [count_seq] >0

    for the first time around, it displays 2 stimuli then breaks but then on the second time round and for all times after, it works as it should and just displays 1. weird

  • edited 3:49AM

    Python (and thus OpenSesame) starts counting at zero, so your first stimulus will be counted as presentation 0 rather than 1. Glad that it's solved! :)

  • edited 3:49AM

    Its not completely solved as it is still displaying 2 stimuli in the first loop. Then acts as expected after this by only showing 1. I cant understand how this can be? all counts start at 0 and Break if >0. No idea why it does this. would this be a bug?

    Many thanks

  • edited April 2014

    The behaviour kind of depends on what variable you are using as a counter, and how this variable is influenced by the stimuli in your loop. Could you perhaps post an overview and/or a script of the experiment?

  • edited 3:49AM

    the experiment basically presents a cue (a lowercase letter), then an empty 3x3 grid, then a 3x3 grid with an X marked in one of the cells. The task is to imagine the uppercase version of the cue and to mentally project this onto the empty grid. When the marked grid appears, you respond as to whether the mark would fall on top of your imagined letter (with a keypress of X for yes or N for no).

  • edited 3:49AM

    I tried to post the code into here but did not post. Please see dropbox link below

    https://www.dropbox.com/s/pfj7shgyxthm09i/Imagine_example.opensesame.tar.gz

  • edited 3:49AM

    Have you uploaded the correct version? There are no Break if statements in the loops of the version that you have uploaded.

  • edited 3:49AM

    I can see that, not sure why it has removed from that field, it is still there though, in the main script of the experiment. ive re-inserted the code in the field just to make sure and it still behaves the same

  • edited 3:49AM

    any thoughts guys?

  • edited 3:49AM

    So the counting does not quite happen as I thought it would. Easy solution is to introduce our own counter using three inline_script items.

    Place this into the inline_script you currently have at the start of your experiment ("set_count"):

    exp.set("counter", 0)
    

    Place the following within the Cue_seq sequence:

    exp.set("counter", exp.get("counter")+1)
    

    Finally, place this at the end of the MasterSeq sequence (in the inline_script called "resetting"):

    exp.set("counter", 0)
    

    Now, your CueLoop's Break if statement should be counter > 0

  • edited 3:49AM

    thanks so much, Edwin.

  • edited April 2016

    Hi guys,

    I try to break out of the practice loop after 2 trials.
    I added the inline script at the start of the experiment, in the prepare phase, and entered the break-if statement in my practice loop juste like you did.
    But it still doesn't work, and the practice block keeps running.

    I tried with only [count_trial_sequence] > 2 , then "2" , then followed by "and [practice] = yes" , "yes"...
    When i add [practice] = yes in the break if statement in the practice loop, i also add exp.set("practice", yes) in the inline script.
    Nothing works.
    It keeps running.
    Please help...

    Many thanks

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