Howdy, Stranger!

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

Supported by

Updating values within a sequence

edited March 2017 in OpenSesame

Hello!

I'm trying to present participants with a screen that updates according to their responses. Basically, they are to "negotiate" and I want to show them how much resources they have left on the top left part of the screen as they make an offer. I've managed to do most of that, but the values won't update within a sequence.

This is what I did:
1) There is a loop with value1, value2, value3 assigned. (let's say how much wood, plastic, and screws they have)
2) Then a sequence with a screen showing their current budget (how much wood, plastic, and screws they have) and asking how many of each they want to give and ask for in return and an "offer" button.

Script in a form base:

set timeout infinite
set spacing 10
set rows "1;1;1;1;1;1"
set only_render no
set margins "50;50;50;50"
set cols "1;1;1"
set _theme gray
widget 0 0 1 1 label text="[value1] Wood [value2] Plastic [value3] Screws"
widget 1 0 1 1 image path="Goal1.png"
widget 2 0 1 1 image path="Goal2.png"
widget 1 1 1 1 label text=Give
widget 2 1 1 1 label text=Get
widget 0 2 1 1 image path="wood.png"
widget 1 2 1 1 rating_scale nodes="0;1;2;3;4;5;6;7;8;9" var=question1
widget 0 3 1 1 image path="plastic.png"
widget 1 3 1 1 rating_scale nodes="0;1;2;3;4;5;6;7;8;9;10" var=question2
widget 0 4 1 1 image path="screws.png"
widget 1 4 1 1 rating_scale nodes="0;1;2;3;4;5;6;7;8;9;10" var=question3
widget 2 2 1 1 rating_scale nodes="0;1;2;3;4;5;6;7;8;9;10" var=question4
widget 2 3 1 1 rating_scale nodes="0;1;2;3;4;5;6;7;8;9;10" var=question5
widget 2 4 1 1 rating_scale nodes="0;1;2;3;4;5;6;7;8;9;10" var=question6
widget 0 5 3 1 button text=Offer

3) Logger
4) Inline script updating value1, value2, and value3.

Inline Script:
var.value1 = var.value1 + var.question4
var.value2 = var.value2 + var.question5
var.value3 = var.value3 + var.question6

5) Logger
6) Same script in form base as before, where value1, value2, and value3 should be updated.
7) Logger
...

The issue is that when the second form shows up (step 6) the values are still the original ones, i.e. they have not updated. I checked the variable inspector and it has the correct values. It just seems like the values for the form were obtained at the beginning of the sequence rather than immediately before the form. Is there any way to fix this?

thank you!!
Candice

PS: I'm using the legacy back-end. I don't know if that's relevant. It was the only one that ran the script without crashing.
PS2: I also tried to subtract the values from the "Give" column, but it won't let me use a minus sign, it just gives an error. Any ideas as to why?

Comments

  • edited March 2017

    Hi Candice,

    Did you place the code of your inline_script item in the Run phase tab?

    Cheers,

    Lotje

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

  • Have you already tried an independent form base at point 6) ?
    Maybe the image is prepared at the beginning (of the loop) and just used as it is later on. But what you want is that the image is set up again at point 6).

  • Lotje, Yes I did. :)

    DahmSF, I´m not sure I understand. They are separate base forms, unlinked.

    I ended up just writing the code in python and inserting it as an inline script, but I would still like to know if there is any way of fixing it within the base form.

    Thanks!

  • In this case, would you mind uploading your experiment? Then we'll probably find out what is going on faster.

    Eduard

    Buy Me A Coffee

  • Sorry, eduard, I missed your last message. What happens is that Opensesame seems to evaluate all variables in a sequence right when it starts running it, unless you use inline script. So, if you tell it n=5 in the beginning of the sequence, then change it to n=6, and at the end ask it to report n using a form base (or a sketchpad or basically any other way other than using feedback screen or inline script) , it will continue showing n=5, as it was in the beginning of the sequence. I simply fixed it by doing it all using inline script.

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