If/then with scan codes


Author
Message
troyh
troyh
Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)
Group: Forum Members
Posts: 38, Visits: 190
Perfect! Thanks, Dave! You're a lifesaver
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
troyh - 1/28/2021
I am terribly sorry--I could not even get the zip to upload but for some reason each stim uploaded fine on their own. I hope this is ok-- if not, I appreciate your help!

<item tocas>
/1 = "FinalVersionToca1_nomouth.jpg"



</item>
<item cakes1of3>
/1 = "Cake1.jpg"


</item>
<item cakes2of3>
/1 = "Cake31.jpg"



</item>
<item cakes3of3>
/1 = "Cake61.jpg"



</item>
<item outcomes>
/1 = "FinalVersionToca1_neutral.jpg"



</item>
<item anticipations>
/1 = "FinalVersionToca1_anticipation.jpg"



</item>

<text H>
/items = ("H")
/position = (25%, 85%)
/size = (20%,20%)
</text>
<text J>
/items = ("J")
/position = (50%,85%)
/size = (20%,20%)
</text>
<text K>
/items = ("K")
/position = (75%,85%)
/size = (20%,20%)
</text>

<picture tocas>
/items = item.tocas
/position = (50%,30%)
/size = (45%,45%)
/select = sequence
</picture>

<picture cake1>
/items = item.cakes1of3
/position = (25%,62%)
/size = (20%,20%)
/select = sequence
</picture>

<picture cake2>
/items = item.cakes2of3
/position = (50%,62%)
/size = (20%,20%)
/select = sequence
</picture>

<picture cake3>
/items = item.cakes3of3
/position = (75%,62%)
/size = (20%,20%)
/select = sequence
</picture>

<picture ants>
/items = item.anticipations
/position = (30%,50%)
/size = (45%,45%)
/select = sequence
</picture>

// cake1.jpg merely serves as placeholder item
// it will be replace with the image of the selected cake
// at runtime.
<picture cakepic>
/ items = ("cake1.jpg")
/position = (50%,62%)
/size = (20%,20%)
</picture>

<trial anticipation>
/stimulusframes = [
  1=ants, cakepic
]
/ trialduration = 2000
</trial>

<trial mytrial>
/stimulusframes = [
  1=tocas,cake1,cake2,cake3,H,J,K
]
/validresponse = (35, 36, 37)
/branch = [
  if(trial.mytrial.response == 35){
        picture.cakepic.setitem(picture.cake1.currentitem, 1);
   trial.anticipation;
  } else if (trial.mytrial.response == 36){
        picture.cakepic.setitem(picture.cake2.currentitem, 1);
   trial.anticipation;
  } else if (trial.mytrial.response == 37){
        picture.cakepic.setitem(picture.cake3.currentitem, 1);
   trial.anticipation;
  }
]
</trial>

<block cb1>
/trials = [
    1-3=mytrial
]
</block>


troyh
troyh
Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)
Group: Forum Members
Posts: 38, Visits: 190
I am terribly sorry--I could not even get the zip to upload but for some reason each stim uploaded fine on their own. I hope this is ok-- if not, I appreciate your help!

Attachments
pilotstudy.iqx (210 views, 1.00 KB)
Cake1.jpg (196 views, 1.00 MB)
Cake31.jpg (193 views, 336.00 KB)
Cake61.jpg (187 views, 130.00 KB)
FinalVersionToca1_anticipation.jpg (189 views, 3.00 MB)
FinalVersionToca1_nomouth.jpg (207 views, 111.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: 13K, Visits: 105K
troyh - 1/28/2021
sorry about that! 
It does not seem to be small enough to attach. There are many pictures

Then strip down the script to only use, idk, 20 items. I don't need the full script with hundreds of images, just something that (1) runs and (2) is a fair representation of the actual task.
troyh
troyh
Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)
Group: Forum Members
Posts: 38, Visits: 190
sorry about that! 
It does not seem to be small enough to attach. There are many pictures
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
troyh - 1/28/2021
If the trial branches, is it possible to keep on screen the selected picture, along with the new trial? I'm struggling with the use of scan codes for this. The bolded part in the attached script portion is what I am envisioning..

<picture tocas>
/items = item.tocas
/position = (50%,30%)
/size = (45%,45%)
/select = sequence
</picture>

<picture cake1>
/items = item.cakes1of3
/position = (25%,62%)
/size = (20%,20%)
/select = sequence
</picture>

<picture cake2>
/items = item.cakes2of3
/position = (50%,62%)
/size = (20%,20%)
/select = sequence
</picture>

<picture cake3>
/items = item.cakes3of3
/position = (75%,62%)
/size = (20%,20%)
/select = sequence
</picture>

<picture ants>
/items = item.anticipations
/position = (30%,50%)
/size = (45%,45%)
/select = sequence
</picture>

<trial anticipation>
/stimulusframes = [
    1=ants
]
/ trialduration = 2000
</trial>

<trial mytrial>
/stimulusframes = [
    1=tocas,cake1,cake2,cake3,H,J,K
]
/validresponse = (35, 36, 37)
/branch = [
    if(trial.mytrial.response == 35){
        trial.anticipation + last selected stim from cake1;
    } else if (trial.mytrial.response == 36){
        trial.anticipation + last selected stim from cake2;
    } else if (trial.mytrial.response == 37){
        trial.anticipation +  last selected stim from cake3;
    }
]
</trial>


<block myblock>
/trials = [
    1-5=mytrial
]
</block>

When you need to provide code, please

(1) Provide code that is complete, i.e. that actually runs.
(2) Provide any external files the code requires to run.

Put it in a ZIP and attach it to your post via +Insert -> Add File.

Thank you!
troyh
troyh
Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)
Group: Forum Members
Posts: 38, Visits: 190
If the trial branches, is it possible to keep on screen the selected picture, along with the new trial? I'm struggling with the use of scan codes for this. The bolded part in the attached script portion is what I am envisioning..

<picture tocas>
/items = item.tocas
/position = (50%,30%)
/size = (45%,45%)
/select = sequence
</picture>

<picture cake1>
/items = item.cakes1of3
/position = (25%,62%)
/size = (20%,20%)
/select = sequence
</picture>

<picture cake2>
/items = item.cakes2of3
/position = (50%,62%)
/size = (20%,20%)
/select = sequence
</picture>

<picture cake3>
/items = item.cakes3of3
/position = (75%,62%)
/size = (20%,20%)
/select = sequence
</picture>

<picture ants>
/items = item.anticipations
/position = (30%,50%)
/size = (45%,45%)
/select = sequence
</picture>

<trial anticipation>
/stimulusframes = [
    1=ants
]
/ trialduration = 2000
</trial>

<trial mytrial>
/stimulusframes = [
    1=tocas,cake1,cake2,cake3,H,J,K
]
/validresponse = (35, 36, 37)
/branch = [
    if(trial.mytrial.response == 35){
        trial.anticipation + last selected stim from cake1;
    } else if (trial.mytrial.response == 36){
        trial.anticipation + last selected stim from cake2;
    } else if (trial.mytrial.response == 37){
        trial.anticipation +  last selected stim from cake3;
    }
]
</trial>


<block myblock>
/trials = [
    1-5=mytrial
]
</block>
troyh
troyh
Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)
Group: Forum Members
Posts: 38, Visits: 190
Ah! Thank you so much--I did not know about the overarching control structure. It works!
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
troyh - 1/27/2021
Hello,
I'm trying to set up a study, where there are 3 pictures on the screen at once and participants use key presses to select the pictures, e.g. H is Pic1, J is Pic2, and K is Pic3. The next trial depends on which picture they select, though I may be totally incompetent because I cannot seem to create a branch for scan codes, i.e. 
   [ if(trial.trial1.response == 35) trial.nexttrial] .
There is no error in my message list but Inquisit seems to just ignore it because the script ends without branching. Is there a way to create such a conditional with scan codes?

<block myblock>
/ trials = [1-6 = example]
</block>

<trial example>
/ stimulustimes = [1=instr]
/ validresponse = ("H", "J", "K")
/ branch = [
    if (trial.example.response == 35) {
        trial.h_trial;
    } else if (trial.example.response == 36) {
        trial.j_trial;
    } else if (trial.example.response == 37) {
        trial.k_trial;
    }
]
</trial>

<text instr>
/ items = ("Press H, J, or K.")
</text>

<trial h_trial>
/ stimulusframes = [1=h_text]
/ validresponse = (57)
</trial>

<trial j_trial>
/ stimulusframes = [1=j_text]
/ validresponse = (57)
</trial>

<trial k_trial>
/ stimulusframes = [1=k_text]
/ validresponse = (57)
</trial>

<text h_text>
/ items = ("You pressed H. Press SPACE.")
</text>

<text j_text>
/ items = ("You pressed J. Press SPACE.")
</text>

<text k_text>
/ items = ("You pressed K. Press SPACE.")
</text>


works perfectly fine for me? Note that for a branch to be executed the trial with the branch needs to be run by a block -- there has to be that overarching control structure.



troyh
troyh
Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)Partner Member (638 reputation)
Group: Forum Members
Posts: 38, Visits: 190
Hello,
I'm trying to set up a study, where there are 3 pictures on the screen at once and participants use key presses to select the pictures, e.g. H is Pic1, J is Pic2, and K is Pic3. The next trial depends on which picture they select, though I may be totally incompetent because I cannot seem to create a branch for scan codes, i.e. 
   [ if(trial.trial1.response == 35) trial.nexttrial] .
There is no error in my message list but Inquisit seems to just ignore it because the script ends without branching. Is there a way to create such a conditional with scan codes?
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search