Branching + creating proper blocks


Author
Message
liznik
liznik
Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)
Group: Forum Members
Posts: 7, Visits: 43
So the idea of the task is when someone chooses the risky selection, they go to the trial that contains an image that rewards them points. However, when I run the task, it doesn't send them there once they have selected the risky or safe option. Additionally, I know that the block needs to include ALL the trials, but rather then running the trials based on their branch conditions, it is just running them all separately.  
I removed the script that I had for the images, since it is done correctly and not an issue. 

****TRIALS******

<values>
/randomnum = "NA"
/cutoff1=10
/cutoff2=50
/cutoff3=90
/cutoff4=100
/score = 0
</values>
for risky choices this means theres a 10% chance of the worst outcome, 40% 2nd worse.... etc


<trial gain10object>
/ stimulusframes = [1=gain10object]
/ ontrialend = [
  values.score = values.score +=10]
/ timeout = 500
</trial>

<trial gain20house>
/ stimulusframes = [1=gain20house]
/ ontrialend = [
  values.score = values.score +=20]
/ timeout = 500
</trial>

<trial lose10animal>
/ stimulusframes = [1=lose10animal]
/ ontrialend = [
  values.score = values.score -=10]
/ timeout = 500
</trial>

<trial lose20place>
/ stimulusframes = [1=lose20place]
/ ontrialend = [
  values.score = values.score -=20]
/ timeout = 50
</trial>

<page pre>
^^TEXT
</page>

<page post>
^^TEXT
</page>

<block test>
/ preinstructions = (page.pre)
/postinstructions = (page.post)
/trials = [
1-10 = replace(choiceriskyleft, choiceriskyright, gain10object, gain20house, lose10animal, lose20place)
</block>



<trial choiceriskyleft>
/ontrialbegin = [values.randomnum = rand(1,100)]
/stimulusframes = [1 = yellowstarriskyleft, redblocksaferight]
/validresponse = ("f", "j")
/branch= [if (values.randomnum <=values.cutoff1 && response=="f") trial.gain10object]
/branch =[if (values.randomnum <=values.cutoff1 && response=="j") trial.gain20house]
/branch =[if (values.randomnum >values.cutoff1 && values.randomnum >=values.cutoff2 && response=="f") trial.gain20house]
/branch =[if (values.randomnum >values.cutoff1 && values.randomnum >=values.cutoff2 && response=="j") trial.gain10object]
/branch =[if (values.randomnum >values.cutoff2 && values.randomnum >=values.cutoff3 && response=="f") trial.lose10animal]
/branch =[if (values.randomnum >values.cutoff2 && values.randomnum >=values.cutoff3 && response=="j") trial.gain20house]
/branch =[if (values.randomnum >values.cutoff3 && values.randomnum >=values.cutoff4 && response=="f") trial.lose20place]
/branch =[if (values.randomnum >values.cutoff3 && values.randomnum >=values.cutoff4 && response=="j") trial.lose10animal]
</trial>


<trial choiceriskyright>
/ontrialbegin = [values.randomnum = rand(1,100)]
/stimulusframes = [1 = yellowstarriskyright, redblocksafeleft]
/validresponse = ("f", "j")
/branch= [if (values.randomnum <=values.cutoff1 && response=="j") trial.gain10object]
/branch =[if (values.randomnum <=values.cutoff1 && response=="f") trial.gain20house]
/branch =[if (values.randomnum >values.cutoff1 && values.randomnum >=values.cutoff2 && response=="j") trial.gain20house]
/branch =[if (values.randomnum >values.cutoff1 && values.randomnum >=values.cutoff2 && response=="f") trial.gain10object]
/branch =[if (values.randomnum >values.cutoff2 && values.randomnum >=values.cutoff3 && response=="j") trial.lose10animal]
/branch =[if (values.randomnum >values.cutoff2 && values.randomnum >=values.cutoff3 && response=="f") trial.gain20house]
/branch =[if (values.randomnum >values.cutoff3 && values.randomnum >=values.cutoff4 && response=="j") trial.lose20place]
/branch =[if (values.randomnum >values.cutoff3 && values.randomnum >=values.cutoff4 && response=="f") trial.lose10animal]
</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: 105K
#1: If you want to determine which gain or loss trial to run contingent on a subject's choice in the choice trials, it makes no sense to include gain and loss trials in the <block>'s /trials attribute. You cannot know that you want to run them. You will want to exclusively invoke them via /branch at the <trial>-level.

<block test>
/ preinstructions = (page.pre)
/postinstructions = (page.post)
/trials = [
1-10 = replace(choiceriskyleft, choiceriskyright, gain10object, gain20house, lose10animal, lose20place)
</block>

#2: This is invalid syntax on multiple grounds and hence cannot work.
<trial choiceriskyleft>
...
/branch= [if (values.randomnum <=values.cutoff1 && response=="f") trial.gain10object]
/branch =[if (values.randomnum <=values.cutoff1 && response=="j") trial.gain20house]
...
</trial>

(a) "response" has no meaning. You need to fully reference the respective <trial>'s response property:
(b) The response property does not return "f" or "j". It returns the respective key's numerical scan code. See the "Keyboard Scan Codes" topic in the documentation as well as Tools -> Keyboard Scancodes... for those values. The scancode for F is 33, the scancode for J is 36. In sum, the /branch logic needs to read

<trial choiceriskyleft>
...
/branch= [if (values.randomnum <=values.cutoff1 && trial.choiceriskyleft.response==33) trial.gain10object]
/branch =[if (values.randomnum <=values.cutoff1 && trial.choiceriskyleft.response==36) trial.gain20house]
...
</trial>

and so forth.

#3: Further,

<trial gain10object>
/ stimulusframes = [1=gain10object]
/ ontrialend = [
  values.score = values.score +=10]

/ timeout = 500
</trial>

is wrong. "+=" and "-=" are the increment and decrement operators, respectively. If you want to increment values.score by X, you simply state

<trial gain10object>
/ stimulusframes = [1=gain10object]
/ ontrialend = [ values.score +=10]
/ timeout = 500
</trial>

i.e., add 10 to values.score.

Similarly., to decrement values.score, state

<trial lose10animal>
/ stimulusframes = [1=lose10animal]
/ ontrialend = [values.score -=10]
/ timeout = 500
</trial>

i.e., subtract 10 from values.score.

Hope this helps.

Edited 9 Years Ago by Dave
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search