Conditional Color


Author
Message
aquirk
aquirk
Esteemed Member (2.5K reputation)Esteemed Member (2.5K reputation)Esteemed Member (2.5K reputation)Esteemed Member (2.5K reputation)Esteemed Member (2.5K reputation)Esteemed Member (2.5K reputation)Esteemed Member (2.5K reputation)Esteemed Member (2.5K reputation)Esteemed Member (2.5K reputation)
Group: Forum Members
Posts: 31, Visits: 70
I want to update the pursuit rotor task script (where a circle rotates around the screen, and participants have to keep their mouse on the circle) so that the color of the rotating circle changes dependent on whether the mouse is touching it or not. I think the code should look something like:

if (values.current_targetlocation = 0) {
shape.animatedCircle.color = white
};
else {
shape.animatedCircle.color = blue
}
]

but I can't figure out where to put this. Is there a way to put if/else statements in the color attribute? Or an attribute within the trial section I could use? /ontrialbegin doesn't seem to work.

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
aquirk - Wednesday, April 26, 2017
I want to update the pursuit rotor task script (where a circle rotates around the screen, and participants have to keep their mouse on the circle) so that the color of the rotating circle changes dependent on whether the mouse is touching it or not. I think the code should look something like:

if (values.current_targetlocation = 0) {
shape.animatedCircle.color = white
};
else {
shape.animatedCircle.color = blue
}
]

but I can't figure out where to put this. Is there a way to put if/else statements in the color attribute? Or an attribute within the trial section I could use? /ontrialbegin doesn't seem to work.

If you wish to use the Inquisit 5-version of the script, it's not technically possible to alter the color mid-trial during <trial rotate> based on whether the mouse is on- or off-target.

However, you can use the Inquisit 4-version, which is implemented differently due to the lack of bespoke animation features:

https://www.millisecond.com/download/library/v4/pursuitrotor/pursuitrotor.iqx

The Inquisit 4 version can (and does!) change the color of the circle depending on whether the cursor is on- or off-target.

aquirk
aquirk
Esteemed Member (2.5K reputation)Esteemed Member (2.5K reputation)Esteemed Member (2.5K reputation)Esteemed Member (2.5K reputation)Esteemed Member (2.5K reputation)Esteemed Member (2.5K reputation)Esteemed Member (2.5K reputation)Esteemed Member (2.5K reputation)Esteemed Member (2.5K reputation)
Group: Forum Members
Posts: 31, Visits: 70
Dave - Wednesday, April 26, 2017
aquirk - Wednesday, April 26, 2017
I want to update the pursuit rotor task script (where a circle rotates around the screen, and participants have to keep their mouse on the circle) so that the color of the rotating circle changes dependent on whether the mouse is touching it or not. I think the code should look something like:

if (values.current_targetlocation = 0) {
shape.animatedCircle.color = white
};
else {
shape.animatedCircle.color = blue
}
]

but I can't figure out where to put this. Is there a way to put if/else statements in the color attribute? Or an attribute within the trial section I could use? /ontrialbegin doesn't seem to work.

If you wish to use the Inquisit 5-version of the script, it's not technically possible to alter the color mid-trial during <trial rotate> based on whether the mouse is on- or off-target.

However, you can use the Inquisit 4-version, which is implemented differently due to the lack of bespoke animation features:

https://www.millisecond.com/download/library/v4/pursuitrotor/pursuitrotor.iqx

The Inquisit 4 version can (and does!) change the color of the circle depending on whether the cursor is on- or off-target.

Thank you!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search