Tick or text box in a trial


Author
Message
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: 13K, Visits: 104K
/ontrialend attributes are executed *after* correct response evaluation (via /iscorrectresponse or otherwise).

I.e.,

with

/ ontrialend = [ if(trial.getresponses2pengage.response == "LabelAa" && values.prob <= 33) {values.outcome=(53); values.spicked = 0; values.picked = 1; text.o1a.item.1 = "53 pts"; values.choicemade = 1;}]
/ ontrialend = [ if(trial.getresponses2pengage.response == "LabelAa" && values.prob > 33) {values.outcome=(27); values.spicked = 0; values.picked = 1; text.o1a.item.1 = "27 pts";values.choicemade = 1;}]

values.choicemade is *still zero* at the point

/ iscorrectresponse = [ values.choicemade ;]

is evaluated.

Hence the response counts as *not correct* and the /branch

/ branch = [if (!trial.getresponses2pengage.correct) trial.getresponses2pengage]

applies: another instance of trial.getresponses2pengage is called.

You should be able to simply change the /branch to

/ branch = [if (values.choicemade==0) trial.getresponses2pengage]

to avoid that. /branch attributes are executed *after* /ontrialend attributes.


nashby
nashby
Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)
Group: Forum Members
Posts: 78, Visits: 159
Hey Dave thanks for this. I have tried to get it to be more in line with what i need - the participants need to be able to decide to make the choice for real or not or simply let it carry over from their previous trial. I cant have a submit button, the trial must end when one of the buttons is clicked. So i built the following, which seems to work, but it leads to repeating trials for some reason (two choice 1s, two choice 2s, etc...)
 
(can post full experiment code if that would help let me know)

<trial setup2pengage>
/ ontrialbegin = [values.gamble = 1; values.condition = 0; values.prob = rand(1,100); values.choicemade = 0;]
/ trialduration = 0
/ branch = [trial.getresponses2pengage]
/ ontrialend = [values.choice += 1;]
/ recorddata = false
</trial>

<trial getresponses2pengage>


/ ontrialend = [ if(trial.getresponses2pengage.response == "LabelAa" && values.prob <= 33) {values.outcome=(53); values.spicked = 0; values.picked = 1; text.o1a.item.1 = "53 pts"; values.choicemade = 1;}]
/ ontrialend = [ if(trial.getresponses2pengage.response == "LabelAa" && values.prob > 33) {values.outcome=(27); values.spicked = 0; values.picked = 1; text.o1a.item.1 = "27 pts";values.choicemade = 1;}]

/ ontrialend = [if (trial.getresponses2pengage.response == "no") {text.yes.textbgcolor = grey; text.no.textbgcolor = yellow; values.real = 0; }; ]
/ ontrialend = [if (trial.getresponses2pengage.response == "yes") {text.yes.textbgcolor = yellow; text.no.textbgcolor = grey; values.real = 1; }; ]

/ ontrialend = [if(trial.getresponses2pengage.response == "quitwithoutpay") script.abort();]
/ ontrialend = [ if(values.real == 1) {values.tots += values.outcome}]

/ inputdevice = mouse
/ stimulusframes = [1= intaskengage, LabelAa,o1a , yes, no, quitwithoutpay]
/ validresponse = (Labelaa, yes, no, quitwithoutpay )
/ iscorrectresponse = [ values.choicemade ;]
/ branch = [if (!trial.getresponses2pengage.correct) trial.getresponses2pengage]

</trial>


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: 13K, Visits: 104K
You need

(1) A dummy-trial that sets up the round parameters so they remain unchanged for the entire round:
(2) A trial that you run repeatedly, which collects the required responses (the actual choice and (dis)confirmation), and allows subjects to "submit" their selections once they've locked it all in.

In a nutshell, you do something like this:

<values>
/ leftchoice = 0
/ rightchoice = 0
/ choicemade = 0
/ affirmationmade = 0
</values>

<block myblock>
/ trials = [1-4 = setup]
</block>

<trial setup>
/ ontrialbegin = [values.leftchoice = round(rand(5,100)); values.rightchoice = 3;
    values.affirmationmade = 0; values.choicemade = 0;
    text.left.textbgcolor = white; text.right.textbgcolor = white;
    text.yes.textbgcolor = white; text.no.textbgcolor = white; ]
/ trialduration = 0
/ branch = [trial.getresponses]
</trial>

<trial getresponses>
/ ontrialend = [if (trial.getresponses.response == "left") {text.left.textbgcolor = green;
    text.right.textbgcolor = white;
    values.choicemade = 1; }; ]
/ ontrialend = [if (trial.getresponses.response == "right") {text.left.textbgcolor = white;
    text.right.textbgcolor = green;
    values.choicemade = 1; }; ]
/ ontrialend = [if (trial.getresponses.response == "yes") {text.yes.textbgcolor = green;
    text.no.textbgcolor = white;
    values.affirmationmade = 1; }; ]
/ ontrialend = [if (trial.getresponses.response == "no") {text.yes.textbgcolor = white;
    text.no.textbgcolor = green;
    values.affirmationmade = 1; }; ]
/ stimulusframes = [1=left, right, yes, no, submit]
/ inputdevice = mouse
/ validresponse = (left, right, yes, no, submit)
/ iscorrectresponse = [trial.getresponses.response == "submit" && values.choicemade && values.affirmationmade]
/ branch = [if (!trial.getresponses.correct) trial.getresponses]
</trial>

<text left>
/ items = ("Win <%values.leftchoice%>")
/ position = (40%, 50%)
/ size = (10%, 3%)
/ erase = false
</text>

<text right>
/ items = ("Win <%values.rightchoice%>")
/ position = (60%, 50%)
/ size = (10%, 3%)
/ erase = false
</text>

<text yes>
/ items = ("For real")
/ position = (40%, 70%)
/ size = (10%, 3%)
/ erase = false
</text>

<text no>
/ items = ("Not for real")
/ position = (60%, 70%)
/ size = (10%, 3%)
/ erase = false
</text>

<text submit>
/ items = ("SUBMIT")
/ position = (50%, 90%)
/ erase = false
</text>


nashby
nashby
Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)
Group: Forum Members
Posts: 78, Visits: 159
Thanks Dave. The problem is I have to have it all on one page. That is they can tick/untick the box  to make it consequential or not then make a choice all on the same screen. We are trying to replicate a previous study so we cannot deviate from the design unfortunately. Any ideas on how to build a tick like box in a trial?
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: 13K, Visits: 104K
<checkboxes> and the like (<dropdown>, etc.) can only be used with <surveypage>s. A <surveypage>, however, *is* a kind of <trial>. A <survey> element (which is a special kind of <block> is not necessary to use <surveypage>s. You can use and run <surveypage>s in regular <block>s along with regular <trial>s, i.e. you can run them via the <block>s /trials attribute, /branch to them from <trial> elements, etc.

You can also use a regular <trial> along with <text>, etc. elements to build something like a checkbox.

At any rate, you essentially want to collect two different responses and thus probably need two separate trial-type elements to implement this:

(A) The <trial> you already have can collect the initial response / choice. From there you'd /branch to
(B) Another <trial> (or <surveypage>) that collects the response indicating whether the response is to be considered for real or not.

(I'm not sure about the order; you might want to have people indicate (B) first; however, the same approach applies if the order is reversed.)

nashby
nashby
Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)
Group: Forum Members
Posts: 78, Visits: 159
I have a set of tasks where people need to choose between options, but on each trial they can tick a box to make the choice count for real or not. It looks like checkbox and dropdown can only be used in surveys not trials and I dont see how to make a trial like i need as a surveypage (see below, maybe its not possible). Any ideas on something I could use that would function like a tickbox within a trial?

<trial twopzero>
/ stimulusframes = [1= intaskzero, LabelAa, LabelBa, quitwithoutpay]
/ validresponse = (LabelAa, LabelBa, quitwithoutpay)
/ inputdevice = mouse
/ ontrialend = [values.choice += 1]
/ ontrialbegin = [values.gamble = 1; values.prob = rand(1,100);]
/ ontrialend = [if(trial.twopzero.response == "quitwithoutpay") script.abort();]

/ ontrialend = [ if (trial.twopzero.response == "LabelA" && values.side <= 50 && values.prob <= 33) {values.outcome=(53); values.spicked = 0; values.picked = 1; text.o1a.item.1 = "53 pts";}]
/ ontrialend = [ if (trial.twopzero.response == "LabelA" && values.side <= 50 && values.prob > 33) {values.outcome=(27); values.spicked = 0; values.picked = 1; text.o1a.item.1 = "27 pts";}]
/ ontrialend = [ if (trial.twopzero.response == "LabelB" && values.side > 50 && values.prob <= 33) {values.outcome=(53); values.spicked = 1; values.picked = 1; text.o2a.item.1 = "53 pts";}]
/ ontrialend = [ if (trial.twopzero.response == "LabelB" && values.side > 50 && values.prob > 33) {values.outcome=(27); values.spicked = 1; values.picked = 1; text.o2a.item.1 = "27 pts";}]

/ ontrialend = [ if (trial.twopzero.response == "LabelA" && values.side > 50) {values.outcome=(0); values.spicked = 0; values.picked = 0; text.o1a.item.1 = "0 pts";}]
/ ontrialend = [ if (trial.twopzero.response == "LabelB" && values.side <= 50) {values.outcome=(0); values.spicked = 1; values.picked = 0; text.o2a.item.1 = "0 pts";}]
/ ontrialend = [values.tots += values.outcome]
</trial>

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search