By sbashyam - 7/24/2023
Hi, I am in the process of creating a study on inquist, but need help with conditionally displaying an image. I want to code the study in such a way that if a certain picture is displayed (there are two out of eight such pictures that randomly display on two trials), then another picture also gets displayed along with it.
Thank you!
|
By Dave - 7/24/2023
+xHi, I am in the process of creating a study on inquist, but need help with conditionally displaying an image. I want to code the study in such a way that if a certain picture is displayed (there are two out of eight such pictures that randomly display on two trials), then another picture also gets displayed along with it. Thank you! What specifically do you need help with?
Also, your description is vague and you ought to provide more details and specifics. Finally, it sounds like you already have some code written, so you should provide that as well along with comments re. what the code is supposed to do.
|
By sbashyam - 7/24/2023
Thank you Dave for your response! I can add the code here below
<item stimuli> /1 = "lunch.png" /2 = "lemonades.png" /3 = "math_books.png" /4 = "oven.png" /5 = "coloring.png" /6 = "puzzle.png" /7 = "cupcakes.png" /8 = "airplanes.png" </item>
<picture activity_group> /items = stimuli / selectionrate = block /size = (35%, 35%) / hposition = 50% / vposition = 80% </picture>
What I need is - when the "cupckaes" or "airplane" stimuli is displayed, I want a white rectangle to be displayed on the screen along with them. I dont need this for any other stimuli. Is this possible?
|
By Dave - 7/24/2023
+xThank you Dave for your response! I can add the code here below <item stimuli> /1 = "lunch.png" /2 = "lemonades.png" /3 = "math_books.png" /4 = "oven.png" /5 = "coloring.png" /6 = "puzzle.png" /7 = "cupcakes.png" /8 = "airplanes.png" </item> <picture activity_group> /items = stimuli / selectionrate = block /size = (35%, 35%) / hposition = 50% / vposition = 80% </picture> What I need is - when the "cupckaes" or "airplane" stimuli is displayed, I want a white rectangle to be displayed on the screen along with them. I dont need this for any other stimuli. Is this possible? Anything's possible, but that code snippet isn't helpful. Where are the trials? What do they do? Why is the selectionrate set to block?
Again, please be precise and specific.
|
By sbashyam - 7/24/2023
This is the entire experiment set up.
[code removed by Administrator]
|
By sbashyam - 7/24/2023
In each trial, there are images of two boys displayed, along with one stimuli - "activity_group". What I need is, when "cupcakes" or "airplanes" are displayed, I also want a white rectangle to be displayed
|
By Dave - 7/24/2023
+x In each trial, there are images of two boys displayed, along with one stimuli - "activity_group". What I need is, when "cupcakes" or "airplanes" are displayed, I also want a white rectangle to be displayed
First, please don't paste entire scripts into a post's body. That's error-prone and generally difficult to work with. Further, if your code requires external files (images, etc.) to run, please always provide any and all files needed along with it.
Put everything in a ZIP file and attach it to a post by using +Insert -> Add File.
If the file is too big to attach here, make it available via Dropbox or any similar service (e.g. https://wetransfer.com/ ) and post the link. Thank you.
|
By sbashyam - 7/24/2023
+x+x In each trial, there are images of two boys displayed, along with one stimuli - "activity_group". What I need is, when "cupcakes" or "airplanes" are displayed, I also want a white rectangle to be displayed
First, please don't paste entire scripts into a post's body. That's error-prone and generally difficult to work with. Further, if your code requires external files (images, etc.) to run, please always provide any and all files needed along with it. Put everything in a ZIP file and attach it to a post by using +Insert -> Add File. If the file is too big to attach here, make it available via Dropbox or any similar service (e.g. https://wetransfer.com/ ) and post the link. Thank you. My apologies I have attached the file below
|
By sbashyam - 7/24/2023
+x+x+x In each trial, there are images of two boys displayed, along with one stimuli - "activity_group". What I need is, when "cupcakes" or "airplanes" are displayed, I also want a white rectangle to be displayed
First, please don't paste entire scripts into a post's body. That's error-prone and generally difficult to work with. Further, if your code requires external files (images, etc.) to run, please always provide any and all files needed along with it. Put everything in a ZIP file and attach it to a post by using +Insert -> Add File. If the file is too big to attach here, make it available via Dropbox or any similar service (e.g. https://wetransfer.com/ ) and post the link. Thank you. My apologies I have attached the file below+x+x In each trial, there are images of two boys displayed, along with one stimuli - "activity_group". What I need is, when "cupcakes" or "airplanes" are displayed, I also want a white rectangle to be displayed
First, please don't paste entire scripts into a post's body. That's error-prone and generally difficult to work with. Further, if your code requires external files (images, etc.) to run, please always provide any and all files needed along with it. Put everything in a ZIP file and attach it to a post by using +Insert -> Add File. If the file is too big to attach here, make it available via Dropbox or any similar service (e.g. https://wetransfer.com/ ) and post the link. Thank you.
|
By Dave - 7/24/2023
+x+x+x+x In each trial, there are images of two boys displayed, along with one stimuli - "activity_group". What I need is, when "cupcakes" or "airplanes" are displayed, I also want a white rectangle to be displayed
First, please don't paste entire scripts into a post's body. That's error-prone and generally difficult to work with. Further, if your code requires external files (images, etc.) to run, please always provide any and all files needed along with it. Put everything in a ZIP file and attach it to a post by using +Insert -> Add File. If the file is too big to attach here, make it available via Dropbox or any similar service (e.g. https://wetransfer.com/ ) and post the link. Thank you. My apologies I have attached the file below+x+x In each trial, there are images of two boys displayed, along with one stimuli - "activity_group". What I need is, when "cupcakes" or "airplanes" are displayed, I also want a white rectangle to be displayed
First, please don't paste entire scripts into a post's body. That's error-prone and generally difficult to work with. Further, if your code requires external files (images, etc.) to run, please always provide any and all files needed along with it. Put everything in a ZIP file and attach it to a post by using +Insert -> Add File. If the file is too big to attach here, make it available via Dropbox or any similar service (e.g. https://wetransfer.com/ ) and post the link. Thank you.
That ZIP shows up as empty for me.
|
By sbashyam - 7/24/2023
https://drive.google.com/drive/folders/15fCD0N9K7Wwm9FLY5IExBLd6jrJVMFy_?usp=sharing
This might help
|
By Dave - 7/24/2023
+x Thanks, I have the files now.
Help me understand:
- The "white rectangle" is supposed to be displayed when and where exactly? - The screen color throughout the task is white, so how is one supposed to notice the presence of the "white rectangle"? - You have files called rec1.png to rec8.png included in the folder you shared, but these aren't used anywhere in the script. What are they for? - What, if anything, are participants supposed to do with the "white rectangle"?
|
By Dave - 7/24/2023
+x+x Thanks, I have the files now. Help me understand: - The "white rectangle" is supposed to be displayed when and where exactly? - The screen color throughout the task is white, so how is one supposed to notice the presence of the "white rectangle"? - You have files called rec1.png to rec8.png included in the folder you shared, but these aren't used anywhere in the script. What are they for? - What, if anything, are participants supposed to do with the "white rectangle"? To add: What is the purpose of the "activity_alone" picture element, as opposed to the "activity_group" picture?
There are no comments at all throughout your code, nor are there instructions, so it's impossible to determine what it is intended to do.
|
By sbashyam - 7/24/2023
+x+x+x Thanks, I have the files now. Help me understand: - The "white rectangle" is supposed to be displayed when and where exactly? - The screen color throughout the task is white, so how is one supposed to notice the presence of the "white rectangle"? - You have files called rec1.png to rec8.png included in the folder you shared, but these aren't used anywhere in the script. What are they for? - What, if anything, are participants supposed to do with the "white rectangle"? To add: What is the purpose of the "activity_alone" picture element, as opposed to the "activity_group" picture? There are no comments at all throughout your code, nor are there instructions, so it's impossible to determine what it is intended to do. Whenever the cupckaes or airplane stimuli is displayed, I need the white rectangle to cover the boy on the right or the left. The purpose is to ensure that there are only two boys on the screen as opposed to white Those files were meant to be used in another version of the experiment, but we don't need them anymore Activity alone vs activity group is from a previous version of the experiment, not of use now.
I basically need to show just two boys for the stimuli "cupcakes" and "airplanes". I thought covering the third boy who shows up by default was the only way.
|
By Dave - 7/24/2023
+x+x+x+x Thanks, I have the files now. Help me understand: - The "white rectangle" is supposed to be displayed when and where exactly? - The screen color throughout the task is white, so how is one supposed to notice the presence of the "white rectangle"? - You have files called rec1.png to rec8.png included in the folder you shared, but these aren't used anywhere in the script. What are they for? - What, if anything, are participants supposed to do with the "white rectangle"? To add: What is the purpose of the "activity_alone" picture element, as opposed to the "activity_group" picture? There are no comments at all throughout your code, nor are there instructions, so it's impossible to determine what it is intended to do. Whenever the cupckaes or airplane stimuli is displayed, I need the white rectangle to cover the boy on the right or the left. The purpose is to ensure that there are only two boys on the screen as opposed to white Those files were meant to be used in another version of the experiment, but we don't need them anymore Activity alone vs activity group is from a previous version of the experiment, not of use now. I basically need to show just two boys for the stimuli "cupcakes" and "airplanes". I thought covering the third boy who shows up by default was the only way. > Whenever the cupckaes or airplane stimuli is displayed, I need the white rectangle to cover the boy on the right or the left.
Like what? Always the one on the left or always the one on the right or is this supposed to be randomly determined somehow?
|
By sbashyam - 7/24/2023
Randomly determined
|
By Dave - 7/24/2023
+x Attached a runnable example of how you need to set up the blocks, trials, and stimulus elements to make this work. This just runs the test1_boys block eight times, so you can see what happens when either cupcakes or airplanes are the selected activity. You'll have to change the other blocks etc. in the script accordingly.
|
By sbashyam - 7/24/2023
Thank you! Could you help me out by also making sure that when the cupcakes or airplane stimuli appear, both boys that are presented on the screen have two different colour over their head? Right now it shows one with one coloured circle and the other with two different coulour circles
|
By Dave - 7/24/2023
+xThank you! Could you help me out by also making sure that when the cupcakes or airplane stimuli appear, both boys that are presented on the screen have two different colour over their head? Right now it shows one with one coloured circle and the other with two different coulour circles What? I'm sorry, but you're not very clear regarding what you want. What is "[r]ight now it shows one with one coloured circle and the other with two different coulour circles" supposed to mean? That's not even correct; it depends on whether the left boy or the right boy is not shown. And what is "two different colour over their head" supposed to mean? In your script, as it exists, the colors aren't different. Left boy has a single blue circle, middle & right boy have a green & blue circle each.
|
By sbashyam - 7/24/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.
|
By Dave - 7/24/2023
+xMy 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>
|
By 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?
|
By Dave - 7/25/2023
+xThank 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
|
By 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
|
By Dave - 7/27/2023
+x<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.
|
By sbashyam - 8/6/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
|
By Dave - 8/7/2023
+xHi 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.
|
By Dave - 8/7/2023
+x+xHi 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>
|
|