Howdy, Stranger!

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

Supported by

repeat_cycle does not repeat higher order loop

Dear team,

I have got a nested loop. Loop1 for levels (8 levels). Loop2 for trials.

I only want to continue from lvl1 to lvl2 if the trials were performed correct and fast.

If not, the participant will be asked whether to repeat the level or to quit (two buttons).

The quit does already work. Herefore, i used the break if option in the higher order loop.

The repetition however, does not work. I have tried to insert a repeat_cycle item after the response on the repetition. I checked the variable repeat_cycle which does indeed change to 1. But the loop continues with the next level, instead of repeating it. I believe that somehow the 'count_level' variable is not substracted with -1.

To explain myself in code language (maybe this helps to understand my question)

for i in (1:8):
	if var.x_resp=='j': #break if in loop
		break
	for j in (1:2):
		print i, j #do anything
	if var.x_resp=='f': #this should be the repeat_cycle
		i=i-1

Comments

  • Even if i set the repeat_cylce item to 'always' (in the sequence conditions as well as in the if condition of the item itself), it does not make the loop to cycle the same level again. Any ideas why?

  • Hi Stephen,

    To be honest, I don't know what the repeat cycle item is supposed to do and how it is doing it. So, my apologies for proposing a different solution.

    As far as I can see the outer loop is rather static, that is, there is not much change for the different levels (other than the variables in the loop table), right? If so, I would propose you remove the loop table and set the run if field of that outer loop to never. Instead, you can add an inline_script, after that loop that essentially replaces the loop (a bit like your for loop in your first post). Importantly, in that loop, you can then ask Openseame to run the outer loop with all its items, given the current settings (the variables in the original loop table). To be clear, the outer loop (Levels), can remain as it is, except taking out the variables in the loop table (that is only a single row and no variables), and its repeat value is set to never.


    Here some code, that could work :

    for rep in range(1,9):
         # these variables might be better put in a list and then accessed here iteratively
         var.letter = var.Level1
         var.instructions = dfjk.wav
         var.sound = var.sound1
         var.resp = var.resp1
         while True: 
             items.execute(u'Levels')
             if var.response != 'f':
                  break
    

    Does that make sense?

    Eduard

    Buy Me A Coffee

  • Hi Eduard,

    thanks for your answer!

    The repeat_cycle would have been such an easy and nice solution.

    This ist the description i found: This plug-in allows you to repeat cycles from a loop. Most commonly, this will be to repeat a trial when a participant made a mistake or was too slow. For example, to repeat all trials on which a response was slower than 3000 ms, you can add a repeat_cycle item after (typically) the keyboard_response and add the following repeat-if statement: [response_time] > 3000. You can also force a cycle to be repeated by setting the variable repeat_cycle to 1 in an inline_script, like so: var.repeat_cycle = 1.

    Anyway, i will try your suggestion. Is it possible to use the same text of the inline_script for the OSWeb inline_javascript?

    Stephan

  • Anyway, i will try your suggestion. Is it possible to use the same text of the inline_script for the OSWeb inline_javascript?

    Probably not without some minot adjustments. I don't know javascript, so I can't help you much here.

    The repeat_cycle would have been such an easy and nice solution.

    Yeah, given its description it seems to be exactly what you want. I don't see why it wouldn't work. Sorry.

    Eduard

    Buy Me A Coffee

  • Hi Eduard,

    i tried my best, but i did not manage do make it run. The problem lies in the nested lists which were previously two loop items. Now its a list and a loop item. How do i make them match?

    I even tried a workaround and double the variables (see loop and list in inline_script). However, i do not know how to draw from a nested list within the e.g. sound_item. Also it seems like the script within the loop does not run for whatever reason. Any ideas?

    Stephan

    PS: If not for OSWeb i would have scripted the whole thing from the beginning :)

  • Dear all,

    after all i created my own repeat_cycle with an inline_scipt.

    For anyone who needs the same:

    exp.items['Levelstart'].live_row = var.live_row_Levelstart-1
    #Levelstart is the name of my outer loop.
    #Just set the inlince script at the end of the sequence of the outer loop
    


  • Just to explain: It is not possible to change the variable this way:

    var.live_row_Levelstart= var.live_row_Levelstart-1 # will not work, do as above  ;)
    
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