Howdy, Stranger!

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

Supported by

[solved] OSWeb break if loop

edited December 2020 in OSWeb

I'm trying to code an experiment for OSWeb where a 50-interation loop is broken if the participant presses the 'space' key.

I have used inline java script to create a breaking_variable that is true if 'space' is pressed. I have set the 'break if' function to [breaking_variable]=yes. On my desktop - this works perfectly and the loop is broken if the space key is pressed.

But, when I test the experiment online through OSWeb this does not work and I cannot find a way to break the loop. I've tried many different methods and it appears that conditionals don't seem to work on OSWeb with my code.

Is there a way I can break the loop using inline java script or without using a conditional?

Many thanks for your help,

Alex

Comments

  • Hi @agmitchell ,


    Break-if statements should work in (the latest versions of) OSWeb. Is it possible to share your experiment here, by pressing the paperclip icon, so that we can have a closer look?


    Cheers,


    Lotje

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

  • Hi again,


    What if you type "space" instead of "SPACE"? Does that solve it?


    Cheers,


    Lotje

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

  • Thanks for getting back to me. I've tried capitalizing the key presses but that doesn't work. I've also tried changing the key that's pressed, using a mouse click instead, setting the loop to repeat if keypress != space. It appears to me that it's the conditional that doesn't work - as I've double checked and the keypress is registered correctly.

    I've attached my experiment. It's the first 'screen' loop I'm having trouble with.

    Thanks


  • edited December 2020

    Hi @agmitchell ,


    It seems easier to evaluate the value of the built-in variable "response" in the break-if statement:


    • Add one line to your inline_javascript item to give the variable "response" a starting value:
    vars.response = "None"
    


    • Use the following formulation in the break-if box (no quotation marks around the word space):
    [response] = space
    


    I attached the updated experiment.


    Hope this helps!


    Cheers,


    Lotje


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

  • This worked perfectly, thank you!

  • Ahh, great to hear @agmitchell !

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

  • Hi @lvanderlinden I'm afraid I'm having this problem again. I downloaded your version of the code and everything was working perfectly. I piloted the experiment and realised I needed to change something. Changed it in OS, updated the experiment and now I'm having the same problem with the space key for the screen size form. Instead of moving on, it just 'scrolls' down the page instead.


    I've attached the experiment and was wondering if you could help me figure it out again.


  • Just FYI I solved this problem by getting participants to move on by pressing 'y' and not 'space'

  • Hi @agmitchell ,


    Ahh, great! I think an alternative would have been to use your own code again, where you were checking for both "space" and "SPACE". (Perhaps it had something to do with the capitalization...)


    Cheers,


    Lotje

    Did you like my answer? Feel free to 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