Change responsex and responsey from pixels to percentage


Author
Message
MattJohnson
MattJohnson
New Member (36 reputation)New Member (36 reputation)New Member (36 reputation)New Member (36 reputation)New Member (36 reputation)New Member (36 reputation)New Member (36 reputation)New Member (36 reputation)New Member (36 reputation)
Group: Forum Members
Posts: 4, Visits: 39
Hi, just wondering if there is a way to change responsex and responsey from pixels to percentages? If not, is there a way to change picture.position to pixels if you're using a values attributes as x and y values? I'm trying to build a task where participants click on a target (or close to it). The target will be masked and change location on each trial. Participants will then receive points based on how close their response is to the target; more points the closer to the target the participant clicks. I've managed to build the basic skeleton, but just stuck with mismatched response units. Any helps is greatly appreciated.
Attachments
Search paradigm_TEST_20.06.24.iqx (16 views, 2.00 KB)
Cir.PNG (20 views, 2.00 KB)
Fixation.jpeg (22 views, 73.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: 12K, Visits: 101K
MattJohnson - 6/20/2024
Hi, just wondering if there is a way to change responsex and responsey from pixels to percentages? If not, is there a way to change picture.position to pixels if you're using a values attributes as x and y values? I'm trying to build a task where participants click on a target (or close to it). The target will be masked and change location on each trial. Participants will then receive points based on how close their response is to the target; more points the closer to the target the participant clicks. I've managed to build the basic skeleton, but just stuck with mismatched response units. Any helps is greatly appreciated.

The stimulus element's (here: <picture>) xpx property gives you the horizontal pixel coordinate, the ypx gives you the vertical pixel coordinate.

https://www.millisecond.com/support/docs/current/html/language/properties/xpx.htm
https://www.millisecond.com/support/docs/current/html/language/properties/ypx.htm

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 - 6/20/2024
MattJohnson - 6/20/2024
Hi, just wondering if there is a way to change responsex and responsey from pixels to percentages? If not, is there a way to change picture.position to pixels if you're using a values attributes as x and y values? I'm trying to build a task where participants click on a target (or close to it). The target will be masked and change location on each trial. Participants will then receive points based on how close their response is to the target; more points the closer to the target the participant clicks. I've managed to build the basic skeleton, but just stuck with mismatched response units. Any helps is greatly appreciated.

The stimulus element's (here: <picture>) xpx property gives you the horizontal pixel coordinate, the ypx gives you the vertical pixel coordinate.

https://www.millisecond.com/support/docs/current/html/language/properties/xpx.htm
https://www.millisecond.com/support/docs/current/html/language/properties/ypx.htm

Here's a quick and dirty example:

<values>
/ targetx = 0
/ targety = 0
/ targetxpx = 0
/ targetypx = 0
/ points = 0
/ totalPoints = 0
/ responsex = 0
/ responsey = 0
/ distancepx = 0
</values>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>

<trial mytrial>
/ ontrialbegin = [
    values.targetx = floor(randgaussian(50,20));
    values.targety = floor(randgaussian(50,20));
    ]
/ ontrialend = [
    values.targetxpx = picture.cir.xpx;
    values.targetypx = picture.cir.ypx;
    values.responsex = trial.mytrial.responsex;
    values.responsey = trial.mytrial.responsey;
    values.distancepx = sqrt(pow((values.responsex - values.targetxpx), 2) + pow((values.responsey - values.targetypx), 2));
]
/ stimulustimes = [0 = fixation; 800 = clearscreen; 850 = cir]
/ inputdevice = mouse
/ validresponse = (lbuttondblclk)
</trial>


<item cir_file>
/ 1 = "cir.png"
</item>

<picture cir>
/ items = cir_file
/ size = (10%, 10%)
/ position = (values.targetx, values.targety)
</picture>

<text fixation>
/ items = ("+")
</text>

<data>
/ columns = (trialnum values.targetx values.targety values.targetxpx values.targetypx values.responsex values.responsey values.distancepx)
</data>

MattJohnson
MattJohnson
New Member (36 reputation)New Member (36 reputation)New Member (36 reputation)New Member (36 reputation)New Member (36 reputation)New Member (36 reputation)New Member (36 reputation)New Member (36 reputation)New Member (36 reputation)
Group: Forum Members
Posts: 4, Visits: 39
Dave - 6/20/2024
Dave - 6/20/2024
MattJohnson - 6/20/2024
Hi, just wondering if there is a way to change responsex and responsey from pixels to percentages? If not, is there a way to change picture.position to pixels if you're using a values attributes as x and y values? I'm trying to build a task where participants click on a target (or close to it). The target will be masked and change location on each trial. Participants will then receive points based on how close their response is to the target; more points the closer to the target the participant clicks. I've managed to build the basic skeleton, but just stuck with mismatched response units. Any helps is greatly appreciated.

The stimulus element's (here: <picture>) xpx property gives you the horizontal pixel coordinate, the ypx gives you the vertical pixel coordinate.

https://www.millisecond.com/support/docs/current/html/language/properties/xpx.htm
https://www.millisecond.com/support/docs/current/html/language/properties/ypx.htm

Here's a quick and dirty example:

<values>
/ targetx = 0
/ targety = 0
/ targetxpx = 0
/ targetypx = 0
/ points = 0
/ totalPoints = 0
/ responsex = 0
/ responsey = 0
/ distancepx = 0
</values>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>

<trial mytrial>
/ ontrialbegin = [
    values.targetx = floor(randgaussian(50,20));
    values.targety = floor(randgaussian(50,20));
    ]
/ ontrialend = [
    values.targetxpx = picture.cir.xpx;
    values.targetypx = picture.cir.ypx;
    values.responsex = trial.mytrial.responsex;
    values.responsey = trial.mytrial.responsey;
    values.distancepx = sqrt(pow((values.responsex - values.targetxpx), 2) + pow((values.responsey - values.targetypx), 2));
]
/ stimulustimes = [0 = fixation; 800 = clearscreen; 850 = cir]
/ inputdevice = mouse
/ validresponse = (lbuttondblclk)
</trial>


<item cir_file>
/ 1 = "cir.png"
</item>

<picture cir>
/ items = cir_file
/ size = (10%, 10%)
/ position = (values.targetx, values.targety)
</picture>

<text fixation>
/ items = ("+")
</text>

<data>
/ columns = (trialnum values.targetx values.targety values.targetxpx values.targetypx values.responsex values.responsey values.distancepx)
</data>

Fantastic! Thank you very much, Dave- much appreciated!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search