Show an image if a condition is satsfied


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: 12K, Visits: 101K
sbashyam - 7/25/2023
My apologies if I am being unclear, but this is my first time seeking help online on the forum so please bear with me. I meant to say that I want to ensure that the two boys that remain (after the white rectangle covers the third one), each have two circles of different colours (just as you mentioned, one green and one blue). I appreciate your help and prompt responses but I am also learning on how to use this software.

<trial test1_intro>
/ ontrialbegin = [
    trial.test1_intro.resetstimulusframes();
    picture.blue_circle_left.hposition = 25%;
    picture.green_blue_circle_right.hposition = 75%;
    if (picture.activity_group.currentitem == "cupcakes.png" || picture.activity_group.currentitem == "airplanes.png") {
        values.x = replace(25%, 75%);
        trial.test1_intro.insertstimulusframe(shape.whiterect, 1);
        if (values.x == 75%) {
            picture.blue_circle_left.hposition = 75%;
            picture.green_blue_circle_right.hposition = 25%;
        };
    };
]
/stimulusframes = [1=boy_d, boy_e, boy_f, blue_circle_left, green_blue_circle_middle, green_blue_circle_right, continue]
/ validresponse = (continue)
</trial>

Edited Last Year by Dave
sbashyam
sbashyam
Associate Member (281 reputation)Associate Member (281 reputation)Associate Member (281 reputation)Associate Member (281 reputation)Associate Member (281 reputation)Associate Member (281 reputation)Associate Member (281 reputation)Associate Member (281 reputation)Associate Member (281 reputation)
Group: Forum Members
Posts: 18, Visits: 27
Thank you, this is very helpful! Could you please explain what each line of code is doing, so that I can make changes to the other blocks in the experiment accordingly?
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: 101K
sbashyam - 7/25/2023
Thank you, this is very helpful! Could you please explain what each line of code is doing, so that I can make changes to the other blocks in the experiment accordingly?

<trial test1_intro>
/ ontrialbegin = [
  trial.test1_intro.resetstimulusframes(); // resets the trial's stimulus presentation sequence to its initial state
  picture.blue_circle_left.hposition = 25%; // sets circle of left boy to its normal position
  picture.green_blue_circle_right.hposition = 75%; // sets circle of right boy to its normal position
  if (picture.activity_group.currentitem == "cupcakes.png" || picture.activity_group.currentitem == "airplanes.png") { // if current activity is either cupcakes or airplanes
   values.x = replace(25%, 75%); // pick left or right boy position at random
   trial.test1_intro.insertstimulusframe(shape.whiterect, 1); // cover up the randomly picked boy with white rectangle
   if (values.x == 75%) { // if we have to cover up the right boy
    picture.blue_circle_left.hposition = 75%; // flip the left and right boys' circle positions
    picture.green_blue_circle_right.hposition = 25%;
   };
  };
]
/stimulusframes = [1=boy_d, boy_e, boy_f, blue_circle_left, green_blue_circle_middle, green_blue_circle_right, continue]
/ validresponse = (continue)
</trial>


All of these things are avaialbe for you to look up in the language reference: https://www.millisecond.com/support/docs/current/html/language/languagereference.htm

https://www.millisecond.com/support/docs/current/html/language/attributes/ontrialbegin.htm
https://www.millisecond.com/support/docs/current/html/language/express.htm
https://www.millisecond.com/support/docs/current/html/language/functions/resetstimulusframes.htm
https://www.millisecond.com/support/docs/current/html/language/attributes/hposition.htm
https://www.millisecond.com/support/docs/current/html/language/elements/values.htm
https://www.millisecond.com/support/docs/current/html/language/properties/currentitem.htm
https://www.millisecond.com/support/docs/current/html/language/expressions/functions.htm

Please study the programmer's manual: https://www.millisecond.com/support/Inquisit%20Programmer's%20Manual.pdf

sbashyam
sbashyam
Associate Member (281 reputation)Associate Member (281 reputation)Associate Member (281 reputation)Associate Member (281 reputation)Associate Member (281 reputation)Associate Member (281 reputation)Associate Member (281 reputation)Associate Member (281 reputation)Associate Member (281 reputation)
Group: Forum Members
Posts: 18, Visits: 27
<block test1_boys>
/trials = [1 = test1_intro; 2 = test1_speech; 3 = judgment]
/ bgstim = (
boy_d,
boy_e,
boy_f,
blue_circle_left,
green_blue_circle_middle,
green_blue_circle_right,
activity_group)
</block>

<shape whiterect>
/ shape = rectangle
/ color = white
/ size = (30%, 80%)
/ hposition = values.x
/ vposition = 50%
/ erase = false
</shape>

<trial test1_intro>
/ ontrialbegin = [
trial.test1_intro.resetstimulusframes();
picture.blue_circle_left.hposition = 25%;
picture.green_blue_circle_right.hposition = 75%;
if (picture.activity_group.currentitem == "cupcakes.png" || picture.activity_group.currentitem == "airplanes.png") {
  values.x = replace(25%);
  trial.test1_intro.insertstimulusframe(shape.whiterect, 1);
  };
]
/stimulusframes = [1=boy_d, boy_e, boy_f, blue_circle_left, green_blue_circle_middle, green_blue_circle_right, continue]
/ validresponse = (continue)
</trial>


<trial test1_speech>
/ stimulusframes = [1=continue, green_speech_right]
/ validresponse = (continue)
</trial>

Hi Dave, thank you for all your help previously. I was trying to remove the randomization and run this code to only cover the left side. But when I run this and click on continue, all the screen goes blank and i can only see the speech bubble. Previously I was seeing the boys and the speech bubble. Could you please correct me with where I might be going wrong

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: 101K
sbashyam - 7/27/2023
<block test1_boys>
/trials = [1 = test1_intro; 2 = test1_speech; 3 = judgment]
/ bgstim = (
boy_d,
boy_e,
boy_f,
blue_circle_left,
green_blue_circle_middle,
green_blue_circle_right,
activity_group)
</block>

<shape whiterect>
/ shape = rectangle
/ color = white
/ size = (30%, 80%)
/ hposition = values.x
/ vposition = 50%
/ erase = false
</shape>

<trial test1_intro>
/ ontrialbegin = [
trial.test1_intro.resetstimulusframes();
picture.blue_circle_left.hposition = 25%;
picture.green_blue_circle_right.hposition = 75%;
if (picture.activity_group.currentitem == "cupcakes.png" || picture.activity_group.currentitem == "airplanes.png") {
  values.x = replace(25%);
  trial.test1_intro.insertstimulusframe(shape.whiterect, 1);
  };
]
/stimulusframes = [1=boy_d, boy_e, boy_f, blue_circle_left, green_blue_circle_middle, green_blue_circle_right, continue]
/ validresponse = (continue)
</trial>


<trial test1_speech>
/ stimulusframes = [1=continue, green_speech_right]
/ validresponse = (continue)
</trial>

Hi Dave, thank you for all your help previously. I was trying to remove the randomization and run this code to only cover the left side. But when I run this and click on continue, all the screen goes blank and i can only see the speech bubble. Previously I was seeing the boys and the speech bubble. Could you please correct me with where I might be going wrong

Please take another close look at the code I gave you. Everything in there is important, including the /erase = false settings for the various stimuli.
sbashyam
sbashyam
Associate Member (281 reputation)Associate Member (281 reputation)Associate Member (281 reputation)Associate Member (281 reputation)Associate Member (281 reputation)Associate Member (281 reputation)Associate Member (281 reputation)Associate Member (281 reputation)Associate Member (281 reputation)
Group: Forum Members
Posts: 18, Visits: 27
Hi Dave, 

Thank you for all your help previously! The code works, but in some cases (see screenshot below) for the cupcake stimuli, we have three boys appearing on screen. However, this error is not consistent - it turns up randomly. When I test run the code, it goes okay but when we try it on a participant, sometimes it fails to cover the third boy/girl. 
We find this error in both cpc_boys.iqx file and cpc_girls.iqx file. 
 
The link -https://drive.google.com/drive/folders/15fCD0N9K7Wwm9FLY5IExBLd6jrJVMFy_?usp=share_link
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: 101K
sbashyam - 8/7/2023
Hi Dave, 

Thank you for all your help previously! The code works, but in some cases (see screenshot below) for the cupcake stimuli, we have three boys appearing on screen. However, this error is not consistent - it turns up randomly. When I test run the code, it goes okay but when we try it on a participant, sometimes it fails to cover the third boy/girl. 
We find this error in both cpc_boys.iqx file and cpc_girls.iqx file. 
 
The link -https://drive.google.com/drive/folders/15fCD0N9K7Wwm9FLY5IExBLd6jrJVMFy_?usp=share_link

Figure out in which blocks this happens by looking at the data, then work backwards from there to locate the mistakes in your scripts.
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: 101K
Dave - 8/7/2023
sbashyam - 8/7/2023
Hi Dave, 

Thank you for all your help previously! The code works, but in some cases (see screenshot below) for the cupcake stimuli, we have three boys appearing on screen. However, this error is not consistent - it turns up randomly. When I test run the code, it goes okay but when we try it on a participant, sometimes it fails to cover the third boy/girl. 
We find this error in both cpc_boys.iqx file and cpc_girls.iqx file. 
 
The link -https://drive.google.com/drive/folders/15fCD0N9K7Wwm9FLY5IExBLd6jrJVMFy_?usp=share_link

Figure out in which blocks this happens by looking at the data, then work backwards from there to locate the mistakes in your scripts.

The type of mistakes to look out for: For example, in test5a_intro, you're not actually inserting the white rectangle into the test5a_intro trial's stimulus presentation sequence.

You're inserting it into an entirely different, irrelevant trial's stimulus presentation sequence, test5_intro. So, nothing will be covered up in test5a_intro.

<trial test5a_intro>
/ ontrialbegin = [
trial.test5a_intro.resetstimulusframes(); // resets the trial's stimulus presentation sequence to its initial state
picture.lightblue_circle_right.hposition = 75%; // sets circle of left boy to its normal position
picture.lightblue_black_circle_left.hposition = 25%; // sets circle of right boy to its normal position
if (picture.activity_group.currentitem == "cupcakes.png" || picture.activity_group.currentitem == "airplanes.png") { // if current activity is either cupcakes or airplanes
  values.x = replace(75%);
  trial.test5_intro.insertstimulusframe(shape.whiterect, 1); // cover up the randomly picked boy with white rectangle
  };
]
/stimulusframes = [1=continue]
/ validresponse = (continue)
</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