Elo
|
|
Group: Forum Members
Posts: 5,
Visits: 31
|
Hi, I would like to replace part of the code (the part that makes the iimage increasing in size) with an array of images (I want to have several images where, for example, in the first image the balloon is small, in the second it is a little bigger etc. to have 128 images). I will create this images myself, I just need a way to navigate through them.
This is my first attempt, which doesn't work but will probably give you a better idea of what I'm trying to accomplish:
<picture image_name_1> / items = ("body_1.jpg) ... </picture>
<picture image_name_2> / items = ("body_2.jpg) ... </picture>
...
<picture image_name_128> / items = ("body_128.jpg) ... </picture> ... <trial init> ... if (trial.choice.response == "pumpbutton") { picture.current = picture["image_name_"+values.totalpumpcount] ... </trial>
Perhaps there is a better way of doing this without needing to make 128 picture elements, but adding more elements in the items array?
Thank you very much for your help,
Eleonora
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 105K
|
+xHi, I would like to replace part of the code (the part that makes the iimage increasing in size) with an array of images (I want to have several images where, for example, in the first image the balloon is small, in the second it is a little bigger etc. to have 128 images). I will create this images myself, I just need a way to navigate through them. This is my first attempt, which doesn't work but will probably give you a better idea of what I'm trying to accomplish: <picture image_name_1> / items = ("body_1.jpg) ... </picture> <picture image_name_2>/ items = ("body_2.jpg)...</picture>... <picture image_name_128>/ items = ("body_128.jpg)...</picture>
... <trial init> ... if (trial.choice.response == "pumpbutton") { picture.current = picture["image_name_"+values.totalpumpcount] ... </trial> Perhaps there is a better way of doing this without needing to make 128 picture elements, but adding more elements in the items array? Thank you very much for your help, Eleonora You don't need 128 <picture> elements. You need a single <picture> element with 128 items and then you can "navigate" through them by increasing a global variable (a <values> entry) by one on a trial by trial basis. <picture image_name> / items = image_name_items / select = values.image_name_item ... </picture> <item image_name_items> / 1 = "body_1.jpg" ... / 128 = "body_128.jpg" </item> if (trial.choice.response == "pumpbutton") { values.image_name_item +=1}]
|
|
|
Elo
|
|
Group: Forum Members
Posts: 5,
Visits: 31
|
+x+xHi, I would like to replace part of the code (the part that makes the iimage increasing in size) with an array of images (I want to have several images where, for example, in the first image the balloon is small, in the second it is a little bigger etc. to have 128 images). I will create this images myself, I just need a way to navigate through them. This is my first attempt, which doesn't work but will probably give you a better idea of what I'm trying to accomplish: <picture image_name_1> / items = ("body_1.jpg) ... </picture> <picture image_name_2>/ items = ("body_2.jpg)...</picture>... <picture image_name_128>/ items = ("body_128.jpg)...</picture>
... <trial init> ... if (trial.choice.response == "pumpbutton") { picture.current = picture["image_name_"+values.totalpumpcount] ... </trial> Perhaps there is a better way of doing this without needing to make 128 picture elements, but adding more elements in the items array? Thank you very much for your help, Eleonora You don't need 128 <picture> elements. You need a single <picture> element with 128 items and then you can "navigate" through them by increasing a global variable (a <values> entry) by one on a trial by trial basis. <picture image_name> / items = image_name_items / select = values.image_name_item ... </picture> <item image_name_items> / 1 = "body_1.jpg" ... / 128 = "body_128.jpg" </item> if (trial.choice.response == "pumpbutton") { values.image_name_item +=1}] Hi Dave, thank you very much for your help. I have now modified the script and put below the instructions: <item instructions> ... <instructions> <item body_items> / 1 = "body_1.jpg" / 2 = "body_2.jpg" / 3 = "body_3.jpg" / 4 = "body_4.jpg" </item> then instead of the <picture balloon> / items = ("balloon.jpg") / position = (33%, 83%) / valign = bottom / size = (100%, 100%) / erase = false </picture> I have put <picture body> / items = body_items / select = values.body_item / position = (33%, 83%) / valign = bottom / size = (100%, 100%) / erase = false </picture> Then after if (trial.choice.response == "pumpbutton") { I put
values.image_name_item +=1}]
but without closing the square bracket and I have deleted picture.balloon.width += parameters.balloonsizeincrement; picture.balloon.height += parameters.balloonsizeincrement; shape.blank.width = picture.balloon.width; shape.blank.height = picture.balloon.height; When I try to run the script I receive an error message in Element: trial.choice and the messages says: expression 'values.body_item' is invalid. Expression contains an unknown element or property name. I cannot understand what I should do...
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 105K
|
+x+x+xHi, I would like to replace part of the code (the part that makes the iimage increasing in size) with an array of images (I want to have several images where, for example, in the first image the balloon is small, in the second it is a little bigger etc. to have 128 images). I will create this images myself, I just need a way to navigate through them. This is my first attempt, which doesn't work but will probably give you a better idea of what I'm trying to accomplish: <picture image_name_1> / items = ("body_1.jpg) ... </picture> <picture image_name_2>/ items = ("body_2.jpg)...</picture>... <picture image_name_128>/ items = ("body_128.jpg)...</picture>
... <trial init> ... if (trial.choice.response == "pumpbutton") { picture.current = picture["image_name_"+values.totalpumpcount] ... </trial> Perhaps there is a better way of doing this without needing to make 128 picture elements, but adding more elements in the items array? Thank you very much for your help, Eleonora You don't need 128 <picture> elements. You need a single <picture> element with 128 items and then you can "navigate" through them by increasing a global variable (a <values> entry) by one on a trial by trial basis. <picture image_name> / items = image_name_items / select = values.image_name_item ... </picture> <item image_name_items> / 1 = "body_1.jpg" ... / 128 = "body_128.jpg" </item> if (trial.choice.response == "pumpbutton") { values.image_name_item +=1}] Hi Dave, thank you very much for your help. I have now modified the script and put below the instructions: <item instructions> ... <instructions> <item body_items> / 1 = "body_1.jpg" / 2 = "body_2.jpg" / 3 = "body_3.jpg" / 4 = "body_4.jpg" </item> then instead of the <picture balloon> / items = ("balloon.jpg") / position = (33%, 83%) / valign = bottom / size = (100%, 100%) / erase = false </picture> I have put <picture body> / items = body_items / select = values.body_item / position = (33%, 83%) / valign = bottom / size = (100%, 100%) / erase = false </picture> Then after if (trial.choice.response == "pumpbutton") { I put
values.image_name_item +=1}]
but without closing the square bracket and I have deleted picture.balloon.width += parameters.balloonsizeincrement; picture.balloon.height += parameters.balloonsizeincrement; shape.blank.width = picture.balloon.width; shape.blank.height = picture.balloon.height; When I try to run the script I receive an error message in Element: trial.choice and the messages says: expression 'values.body_item' is invalid. Expression contains an unknown element or property name. I cannot understand what I should do... The error message means the script cannot find a <value> called "body_item" defined anywhere in the script, which you reference here: <picture body> / items = body_items / select = values.body_item/ position = (33%, 83%) / valign = bottom / size = (100%, 100%) / erase = false </picture> You need to define that global variable in the <values> element and update it accordingly in your <trial>s or elsewhere throughout the script.
|
|
|
Elo
|
|
Group: Forum Members
Posts: 5,
Visits: 31
|
+x+x+x+xHi, I would like to replace part of the code (the part that makes the iimage increasing in size) with an array of images (I want to have several images where, for example, in the first image the balloon is small, in the second it is a little bigger etc. to have 128 images). I will create this images myself, I just need a way to navigate through them. This is my first attempt, which doesn't work but will probably give you a better idea of what I'm trying to accomplish: <picture image_name_1> / items = ("body_1.jpg) ... </picture> <picture image_name_2>/ items = ("body_2.jpg)...</picture>... <picture image_name_128>/ items = ("body_128.jpg)...</picture>
... <trial init> ... if (trial.choice.response == "pumpbutton") { picture.current = picture["image_name_"+values.totalpumpcount] ... </trial> Perhaps there is a better way of doing this without needing to make 128 picture elements, but adding more elements in the items array? Thank you very much for your help, Eleonora You don't need 128 <picture> elements. You need a single <picture> element with 128 items and then you can "navigate" through them by increasing a global variable (a <values> entry) by one on a trial by trial basis. <picture image_name> / items = image_name_items / select = values.image_name_item ... </picture> <item image_name_items> / 1 = "body_1.jpg" ... / 128 = "body_128.jpg" </item> if (trial.choice.response == "pumpbutton") { values.image_name_item +=1}] Hi Dave, thank you very much for your help. I have now modified the script and put below the instructions: <item instructions> ... <instructions> <item body_items> / 1 = "body_1.jpg" / 2 = "body_2.jpg" / 3 = "body_3.jpg" / 4 = "body_4.jpg" </item> then instead of the <picture balloon> / items = ("balloon.jpg") / position = (33%, 83%) / valign = bottom / size = (100%, 100%) / erase = false </picture> I have put <picture body> / items = body_items / select = values.body_item / position = (33%, 83%) / valign = bottom / size = (100%, 100%) / erase = false </picture> Then after if (trial.choice.response == "pumpbutton") { I put
values.image_name_item +=1}]
but without closing the square bracket and I have deleted picture.balloon.width += parameters.balloonsizeincrement; picture.balloon.height += parameters.balloonsizeincrement; shape.blank.width = picture.balloon.width; shape.blank.height = picture.balloon.height; When I try to run the script I receive an error message in Element: trial.choice and the messages says: expression 'values.body_item' is invalid. Expression contains an unknown element or property name. I cannot understand what I should do... The error message means the script cannot find a <value> called "body_item" defined anywhere in the script, which you reference here: <picture body> / items = body_items / select = values.body_item/ position = (33%, 83%) / valign = bottom / size = (100%, 100%) / erase = false </picture> You need to define that global variable in the <values> element and update it accordingly in your <trial>s or elsewhere throughout the script.
|
|
|
Elo
|
|
Group: Forum Members
Posts: 5,
Visits: 31
|
+x+x+x+xHi, I would like to replace part of the code (the part that makes the iimage increasing in size) with an array of images (I want to have several images where, for example, in the first image the balloon is small, in the second it is a little bigger etc. to have 128 images). I will create this images myself, I just need a way to navigate through them. This is my first attempt, which doesn't work but will probably give you a better idea of what I'm trying to accomplish: <picture image_name_1> / items = ("body_1.jpg) ... </picture> <picture image_name_2>/ items = ("body_2.jpg)...</picture>... <picture image_name_128>/ items = ("body_128.jpg)...</picture>
... <trial init> ... if (trial.choice.response == "pumpbutton") { picture.current = picture["image_name_"+values.totalpumpcount] ... </trial> Perhaps there is a better way of doing this without needing to make 128 picture elements, but adding more elements in the items array? Thank you very much for your help, Eleonora You don't need 128 <picture> elements. You need a single <picture> element with 128 items and then you can "navigate" through them by increasing a global variable (a <values> entry) by one on a trial by trial basis. <picture image_name> / items = image_name_items / select = values.image_name_item ... </picture> <item image_name_items> / 1 = "body_1.jpg" ... / 128 = "body_128.jpg" </item> if (trial.choice.response == "pumpbutton") { values.image_name_item +=1}] Hi Dave, thank you very much for your help. I have now modified the script and put below the instructions: <item instructions> ... <instructions> <item body_items> / 1 = "body_1.jpg" / 2 = "body_2.jpg" / 3 = "body_3.jpg" / 4 = "body_4.jpg" </item> then instead of the <picture balloon> / items = ("balloon.jpg") / position = (33%, 83%) / valign = bottom / size = (100%, 100%) / erase = false </picture> I have put <picture body> / items = body_items / select = values.body_item / position = (33%, 83%) / valign = bottom / size = (100%, 100%) / erase = false </picture> Then after if (trial.choice.response == "pumpbutton") { I put
values.image_name_item +=1}]
but without closing the square bracket and I have deleted picture.balloon.width += parameters.balloonsizeincrement; picture.balloon.height += parameters.balloonsizeincrement; shape.blank.width = picture.balloon.width; shape.blank.height = picture.balloon.height; When I try to run the script I receive an error message in Element: trial.choice and the messages says: expression 'values.body_item' is invalid. Expression contains an unknown element or property name. I cannot understand what I should do... The error message means the script cannot find a <value> called "body_item" defined anywhere in the script, which you reference here: <picture body> / items = body_items / select = values.body_item/ position = (33%, 83%) / valign = bottom / size = (100%, 100%) / erase = false </picture> You need to define that global variable in the <values> element and update it accordingly in your <trial>s or elsewhere throughout the script. Hi Dave, thank you very much for your help. in the script there is a part where the <values> are specified: <values> / completed = 0 / totalearnings = 0.0 now I have added / imagenumber = 0the script runs but it get stucked when it tries to find image number 129. I am not sure where in the script I sould specify that the images number are from 1:129. if (trial.choice.response == "pumpbutton") { values.imagenumber +=1; here i should put until 128?shape.blank.width = shape.blank.width; shape.blank.height = shape.blank.height ; values.pumpcount += 1; if (values.pumpcount > 1) { values.mean_timebtwpumps = values.sum_timebtwpumps / (values.pumpcount-1); How do I know which image is selected on the first trial thoughout the script? (I mean where I have to look in the script to eventually modify it). Thanks again, I really appreciate your help. Eleonora
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 105K
|
+x+x+x+x+xHi, I would like to replace part of the code (the part that makes the iimage increasing in size) with an array of images (I want to have several images where, for example, in the first image the balloon is small, in the second it is a little bigger etc. to have 128 images). I will create this images myself, I just need a way to navigate through them. This is my first attempt, which doesn't work but will probably give you a better idea of what I'm trying to accomplish: <picture image_name_1> / items = ("body_1.jpg) ... </picture> <picture image_name_2>/ items = ("body_2.jpg)...</picture>... <picture image_name_128>/ items = ("body_128.jpg)...</picture>
... <trial init> ... if (trial.choice.response == "pumpbutton") { picture.current = picture["image_name_"+values.totalpumpcount] ... </trial> Perhaps there is a better way of doing this without needing to make 128 picture elements, but adding more elements in the items array? Thank you very much for your help, Eleonora You don't need 128 <picture> elements. You need a single <picture> element with 128 items and then you can "navigate" through them by increasing a global variable (a <values> entry) by one on a trial by trial basis. <picture image_name> / items = image_name_items / select = values.image_name_item ... </picture> <item image_name_items> / 1 = "body_1.jpg" ... / 128 = "body_128.jpg" </item> if (trial.choice.response == "pumpbutton") { values.image_name_item +=1}] Hi Dave, thank you very much for your help. I have now modified the script and put below the instructions: <item instructions> ... <instructions> <item body_items> / 1 = "body_1.jpg" / 2 = "body_2.jpg" / 3 = "body_3.jpg" / 4 = "body_4.jpg" </item> then instead of the <picture balloon> / items = ("balloon.jpg") / position = (33%, 83%) / valign = bottom / size = (100%, 100%) / erase = false </picture> I have put <picture body> / items = body_items / select = values.body_item / position = (33%, 83%) / valign = bottom / size = (100%, 100%) / erase = false </picture> Then after if (trial.choice.response == "pumpbutton") { I put
values.image_name_item +=1}]
but without closing the square bracket and I have deleted picture.balloon.width += parameters.balloonsizeincrement; picture.balloon.height += parameters.balloonsizeincrement; shape.blank.width = picture.balloon.width; shape.blank.height = picture.balloon.height; When I try to run the script I receive an error message in Element: trial.choice and the messages says: expression 'values.body_item' is invalid. Expression contains an unknown element or property name. I cannot understand what I should do... The error message means the script cannot find a <value> called "body_item" defined anywhere in the script, which you reference here: <picture body> / items = body_items / select = values.body_item/ position = (33%, 83%) / valign = bottom / size = (100%, 100%) / erase = false </picture> You need to define that global variable in the <values> element and update it accordingly in your <trial>s or elsewhere throughout the script. Hi Dave, thank you very much for your help. in the script there is a part where the <values> are specified: <values> / completed = 0 / totalearnings = 0.0 now I have added / imagenumber = 0the script runs but it get stucked when it tries to find image number 129. I am not sure where in the script I sould specify that the images number are from 1:129. if (trial.choice.response == "pumpbutton") { values.imagenumber +=1; here i should put until 128?shape.blank.width = shape.blank.width; shape.blank.height = shape.blank.height ; values.pumpcount += 1; if (values.pumpcount > 1) { values.mean_timebtwpumps = values.sum_timebtwpumps / (values.pumpcount-1); How do I know which image is selected on the first trial thoughout the script? (I mean where I have to look in the script to eventually modify it). Thanks again, I really appreciate your help. Eleonora What you need to to is reset values.imagenumber back to 0 at the start of each "round" in the task. You do that in <trial init>. <trial init> / ontrialbegin = [ ... values.countchoice = 0; values.imagenumber = 0; ] ... </trial>
|
|
|
Elo
|
|
Group: Forum Members
Posts: 5,
Visits: 31
|
+x+x+x+x+x+xHi, I would like to replace part of the code (the part that makes the iimage increasing in size) with an array of images (I want to have several images where, for example, in the first image the balloon is small, in the second it is a little bigger etc. to have 128 images). I will create this images myself, I just need a way to navigate through them. This is my first attempt, which doesn't work but will probably give you a better idea of what I'm trying to accomplish: <picture image_name_1> / items = ("body_1.jpg) ... </picture> <picture image_name_2>/ items = ("body_2.jpg)...</picture>... <picture image_name_128>/ items = ("body_128.jpg)...</picture>
... <trial init> ... if (trial.choice.response == "pumpbutton") { picture.current = picture["image_name_"+values.totalpumpcount] ... </trial> Perhaps there is a better way of doing this without needing to make 128 picture elements, but adding more elements in the items array? Thank you very much for your help, Eleonora You don't need 128 <picture> elements. You need a single <picture> element with 128 items and then you can "navigate" through them by increasing a global variable (a <values> entry) by one on a trial by trial basis. <picture image_name> / items = image_name_items / select = values.image_name_item ... </picture> <item image_name_items> / 1 = "body_1.jpg" ... / 128 = "body_128.jpg" </item> if (trial.choice.response == "pumpbutton") { values.image_name_item +=1}] Hi Dave, thank you very much for your help. I have now modified the script and put below the instructions: <item instructions> ... <instructions> <item body_items> / 1 = "body_1.jpg" / 2 = "body_2.jpg" / 3 = "body_3.jpg" / 4 = "body_4.jpg" </item> then instead of the <picture balloon> / items = ("balloon.jpg") / position = (33%, 83%) / valign = bottom / size = (100%, 100%) / erase = false </picture> I have put <picture body> / items = body_items / select = values.body_item / position = (33%, 83%) / valign = bottom / size = (100%, 100%) / erase = false </picture> Then after if (trial.choice.response == "pumpbutton") { I put
values.image_name_item +=1}]
but without closing the square bracket and I have deleted picture.balloon.width += parameters.balloonsizeincrement; picture.balloon.height += parameters.balloonsizeincrement; shape.blank.width = picture.balloon.width; shape.blank.height = picture.balloon.height; When I try to run the script I receive an error message in Element: trial.choice and the messages says: expression 'values.body_item' is invalid. Expression contains an unknown element or property name. I cannot understand what I should do... The error message means the script cannot find a <value> called "body_item" defined anywhere in the script, which you reference here: <picture body> / items = body_items / select = values.body_item/ position = (33%, 83%) / valign = bottom / size = (100%, 100%) / erase = false </picture> You need to define that global variable in the <values> element and update it accordingly in your <trial>s or elsewhere throughout the script. Hi Dave, thank you very much for your help. in the script there is a part where the <values> are specified: <values> / completed = 0 / totalearnings = 0.0 now I have added / imagenumber = 0the script runs but it get stucked when it tries to find image number 129. I am not sure where in the script I sould specify that the images number are from 1:129. if (trial.choice.response == "pumpbutton") { values.imagenumber +=1; here i should put until 128?shape.blank.width = shape.blank.width; shape.blank.height = shape.blank.height ; values.pumpcount += 1; if (values.pumpcount > 1) { values.mean_timebtwpumps = values.sum_timebtwpumps / (values.pumpcount-1); How do I know which image is selected on the first trial thoughout the script? (I mean where I have to look in the script to eventually modify it). Thanks again, I really appreciate your help. Eleonora What you need to to is reset values.imagenumber back to 0 at the start of each "round" in the task. You do that in <trial init>. <trial init> / ontrialbegin = [ ... values.countchoice = 0; values.imagenumber = 0; ] ... </trial> I can not thank you enough! It works!
|
|
|