Code to Randomize Stimuli per Trial


Author
Message
Marusil2yada
Marusil2yada
Associate Member (60 reputation)Associate Member (60 reputation)Associate Member (60 reputation)Associate Member (60 reputation)Associate Member (60 reputation)Associate Member (60 reputation)Associate Member (60 reputation)Associate Member (60 reputation)Associate Member (60 reputation)
Group: Forum Members
Posts: 5, Visits: 7
Hi everyone,

I'm working on a project involving the Balloon Analogue Risk Task (BART), and I need some help with editing the code. The original task involves a red balloon that participants inflate to earn money, risking it popping. In my version, I want to introduce a twist: the balloon's color should change randomly at the start of each of the 30 trials.

I have six different balloon images and have figured out how to integrate them into the code. However, my current challenge is that the balloon's type changes with every press of the "pump up" button. I need the balloon's type (color) to remain constant throughout a single trial and only change when a new trial begins.

Could anyone guide me on how to modify the code to achieve this? I have attached the code file for reference.

Thank you in advance for your assistance!
Attachments
bart_exp.iqx (33 views, 33.00 KB)
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
Marusil2yada - 1/26/2024
Hi everyone,

I'm working on a project involving the Balloon Analogue Risk Task (BART), and I need some help with editing the code. The original task involves a red balloon that participants inflate to earn money, risking it popping. In my version, I want to introduce a twist: the balloon's color should change randomly at the start of each of the 30 trials.

I have six different balloon images and have figured out how to integrate them into the code. However, my current challenge is that the balloon's type changes with every press of the "pump up" button. I need the balloon's type (color) to remain constant throughout a single trial and only change when a new trial begins.

Could anyone guide me on how to modify the code to achieve this? I have attached the code file for reference.

Thank you in advance for your assistance!

You have six balloon items. You need a <list> with item numbers 1 to 6.

<list balloonitemnumbers>
/ items = (1,2,3,4,5,6)
/ selectionmode = random
/ poolsize = 30
</list>


You need to define a variable to store the balloon item number applicable to the given round

<values>
...
/ balloonitemnumber = 1
...
</values>


and you'll want the balloon picture element to select the item this variable will hold, i.e.

<picture balloon>
/ items = ("balloon_red.jpg", "balloon_blue.jpg", "balloon_yellow.jpg", "balloon_red_shiny.jpg", "balloon_blue_shiny.jpg", "balloon_yellow_shiny.jpg")
/ position = (33%, 83%)
/ select = values.balloonitemnumber // here
/ valign = bottom
/ erase = false
/ scale = values.scalingFactor
/ size = (expressions.balloonSize, expressions.balloonSize)
</picture>


Finally, at the start of each round, sample the item number to use in the ensuing round.

<trial init>
/ ontrialbegin = [
    values.pumpcount = 0;
    values.timebefore1stpump = 0;
    values.timebeforecollectwithoutpump = 0;
    values.timebtwlastpumpandcollect =0;
    values.timebtwpumps = 0;
    values.sum_timebtwpumps = 0;
    values.mean_timebtwpumps = 0;
    values.countchoice = 0;
    values.scalingFactor = 1;
    values.balloonitemnumber = list.balloonitemnumbers.nextvalue; // pick balloon item for this round
]
...
</trial>


Edited 4 Months Ago by Dave
Marusil2yada
Marusil2yada
Associate Member (60 reputation)Associate Member (60 reputation)Associate Member (60 reputation)Associate Member (60 reputation)Associate Member (60 reputation)Associate Member (60 reputation)Associate Member (60 reputation)Associate Member (60 reputation)Associate Member (60 reputation)
Group: Forum Members
Posts: 5, Visits: 7
Dear Dave,

Thank you so much. It works now!

Have a nice day!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search