Howdy, Stranger!

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

Supported by

[Solved] Trial counter

edited October 2021 in OSWeb

Hi there,

I'm having a great time running my online experiments with OSWeb, thanks for the excellent work !

Just struggling with my trial counter. I'd like to have a text display at the end of each of my 40-trial test blocks, which says "You have [remaining] trials left", so 120 left, 80 left, etc. I define this variable as "vars.remaining = ..." in my java "inline_remaining" but upon execution it says that the variable is not present in the variable store. I only manage to get a correct display of the text when I define vars.remaining UPSTREAM of my test_loop, whereas I would need to define it within this loop so that it's correctly updated (see below my experiment's structure).

In general, I've noticed that my program sometimes craches when some custom variables are not defined at the same loop level. Looks like some variables are local for some loops, sthg like that.

Someone has an explanation? :-)

Cheers,


Comments

  • I think your problem is related to point 4 here: https://osdoc.cogsci.nl/3.3/manual/osweb/javascript/

    Is that possible? If not, could you share your experiment so that I could have a look?

    Alternatively, if your loop is not randomized, you could add the remaining trial counter to the loop table. That could simplify things.

    Eduard

    Buy Me A Coffee

  • Oh, my loop is randomized but that would have been a cool idea ;-)

    Yes it seems to have to do with non-persistent workspace.

    But if I simply define "vars.remaining = 200" in an inline_javascript and then put "You have [remaining] trials left" in a text display placed right after it, I still get the error message "remaining is not present in the variable store". Do you have an idea on how to proceed?

    Ideally I would like to use the "count_block_loop_test" variable to calculate the number of remaining trials, but not sure how to write the arithmetics. I got some messages with NaN instead of "remaining" value.

    I'm attaching my OS file. I shortened the experiment so that it's easier if you want to run it.


  • I still get the error message "remaining is not present in the variable store". Do you have an idea on how to proceed?

    This sounds like an prepare-run-strategy issue: https://osdoc.cogsci.nl/3.3/manual/prepare-run/

    Does the problem still occur if you use a feedback item instead of a sketchpad? Or if you put the code into the prepare phase?

    Buy Me A Coffee

  • I can't run your experiment in the browser for some reason, so unfortunately I can't test it. And it also very long to quickly test a simple thing.

    Buy Me A Coffee

  • Hi @ChartTom ,

    Your experiment is too long for me to look at, but if it helps, I think that the reason you get an error message saying that the variable "remaining" does not exist is because you define that variable during the task and call upon its content from a sketchpad within the sequence or loop where you define that variable. Sketchpad are drawn ahead of the sequence running, which means that even if your sketchpad is at the end of a sequence and after your inline object defining the variable, Open Sesame actually prepares the Sketchpad before running the sequence (even if it only shows it at the end). So, at that time, the variable "remaining" you refer to on your sketchpad does not exist yet... If you define "remaining" earlier in your program, you won't get that error message... but the counting will not be up to date for the reason I explain the next paragraph...

    The second thing to note is that whenever displaying information based on variables you calculate as the task runs, it is better to use a feedback object instead of a sketchpad, because only the feedback object is drawn in real time. So, if you keep incrementing a variable like a trial counter for example, and you then display it on a sketchpad, it will not show the current value of that counter but the value it had at the time the sketchpad was prepared (i.e., at the onset of the sequence being run). In contrast, in a feedback object, you'll see the current value displayed.

    I attach a very basic example where I count trials and trials remaining and display that information at the end of each of very short 4 blocks. I included both a feedback object and a sketchpad with the same text so that you can see that only the first displays the current values of these counters.

    Hopefully that will help you solve the issue in your own task.

    Good luck!

    Fabrice.

    ping @eduard

    Buy Me A Coffee

  • Dear Fabrice and Eduard,

    Thank you, now I got it! Your program example was very helpful Fabrice. In my case, defining the 'remaining' variable in the Prepare phase solves the problem. I have tested Sketchpad, Feedback and Text_display items. I observe that all three display the correct number if I define the variable in the Prepare phase, whereas only the Feedback item does if I define the variable in the Run phase.

    My apologies for not answering earlier, I was busy with other experiments.

    Cheers,

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