mouse movement question


Author
Message
peter
peter
Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)
Group: Forum Members
Posts: 36, Visits: 140
/ ontrialbegin = [picture.bord.hposition = 1px * mouse.x; picture.bord.vposition = 1px * mouse.y]

When the trial loops internally across multiple iterations the line of code above fixes the displayed image (picture.board) to the movement of the mouse. Meaning, for example, that as the mouse is moved towards the bottom right, the picture.bord moves with it towards the bottom right. I would like to reverse these relationships so that as you move the mouse towards the bottom right the image (picture.bord) moves towards the top left.
I would be very grateful for any assistance in cracking this.
Many thanks
Peter

Dave
Dave
Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)Supreme Being (974K reputation)
Group: Administrators
Posts: 11K, Visits: 76K
peter - 11/2/2021
/ ontrialbegin = [picture.bord.hposition = 1px * mouse.x; picture.bord.vposition = 1px * mouse.y]

When the trial loops internally across multiple iterations the line of code above fixes the displayed image (picture.board) to the movement of the mouse. Meaning, for example, that as the mouse is moved towards the bottom right, the picture.bord moves with it towards the bottom right. I would like to reverse these relationships so that as you move the mouse towards the bottom right the image (picture.bord) moves towards the top left.
I would be very grateful for any assistance in cracking this.
Many thanks
Peter

Here's an ancient example ( https://www.millisecond.com/forums/FindPost4421.aspx ), code slightly cleaned up and adapted to Inquisit 6 syntax.

<defaults>
/ inputdevice = mouse
/ screencolor = (white)
/ fontstyle = ("Verdana", 3.00%, true)
/ txcolor = (black)
/ txbgcolor = (white)
</defaults>

<values>
/ x = 0px
/ y = 0px
/ mirrorx = true // mirror horizontally
/ mirrory = true // mirror vertically
</values>

<expressions>
/ x = 1px*abs(values.x-(values.mirrorx*display.canvaswidth))
/ y = 1px*abs(values.y-(values.mirrory*display.canvasheight))
</expressions>

<expt>
/ blocks = [1=example]
</expt>

<block example>
/ trials = [1=start]
</block>

<trial start>
/ stimulusframes = [1=clickhere]
/ validresponse = (lbuttondown)
/ ontrialend = [values.x=trial.start.responsex; values.y=trial.start.responsey]
/ branch = [trial.move]
/ recorddata = false
</trial>

<trial move>
/ ontrialend = [values.x=trial.move.responsex;
    values.y=trial.move.responsey;
]
/ stimulusframes = [1=clearscreen, dot, coordinates]
/ validresponse = (mousemove, lbuttondown, rbuttondown)
/ numframes = 1
/ branch = [if (trial.move.response=="lbuttondown") {
        return trial.end;
    } else if (trial.move.response == "rbuttondown") {
        return trial.pause;
    } else if (trial.move.response == "mousemove") {
        trial.move;
    };
]
/ recorddata = false
</trial>

<trial pause>
/ stimulusframes = [1=coordinates]
/ validresponse = (mousemove, lbuttondown)
/ numframes = 1
/ ontrialend = [values.x=trial.pause.responsex; values.y=trial.pause.responsey]
/ branch = [if (trial.pause.response=="lbuttondown") {
        return trial.move;
    } else {
        return trial.pause;
    };
]
/ recorddata = false
</trial>

<trial end>
/ stimulusframes = [1=clearscreen, goodbye]
/ validresponse = (lbuttondown)
/ recorddata = true
</trial>

<shape dot>
/ shape = circle
/ width = 4%
/ color = (blue)
/ erase = false
/ hposition = expressions.x
/ vposition = expressions.y
</shape>

<text coordinates>
/ items = ("x=<%values.x%> | y=<%values.y%>")
/ position = (50%, 5%)
/ size = (27.5%, 4%)
/ vjustify = center
/ erase = false
</text>

<text clickhere>
/ items = ("Click to start.")
</text>

<text goodbye>
/ items = ("Goodbye!")
</text>

peter
peter
Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)Partner Member (973 reputation)
Group: Forum Members
Posts: 36, Visits: 140
Dave - 11/2/2021
peter - 11/2/2021
/ ontrialbegin = [picture.bord.hposition = 1px * mouse.x; picture.bord.vposition = 1px * mouse.y]

When the trial loops internally across multiple iterations the line of code above fixes the displayed image (picture.board) to the movement of the mouse. Meaning, for example, that as the mouse is moved towards the bottom right, the picture.bord moves with it towards the bottom right. I would like to reverse these relationships so that as you move the mouse towards the bottom right the image (picture.bord) moves towards the top left.
I would be very grateful for any assistance in cracking this.
Many thanks
Peter

Here's an ancient example ( https://www.millisecond.com/forums/FindPost4421.aspx ), code slightly cleaned up and adapted to Inquisit 6 syntax.

<defaults>
/ inputdevice = mouse
/ screencolor = (white)
/ fontstyle = ("Verdana", 3.00%, true)
/ txcolor = (black)
/ txbgcolor = (white)
</defaults>

<values>
/ x = 0px
/ y = 0px
/ mirrorx = true // mirror horizontally
/ mirrory = true // mirror vertically
</values>

<expressions>
/ x = 1px*abs(values.x-(values.mirrorx*display.canvaswidth))
/ y = 1px*abs(values.y-(values.mirrory*display.canvasheight))
</expressions>

<expt>
/ blocks = [1=example]
</expt>

<block example>
/ trials = [1=start]
</block>

<trial start>
/ stimulusframes = [1=clickhere]
/ validresponse = (lbuttondown)
/ ontrialend = [values.x=trial.start.responsex; values.y=trial.start.responsey]
/ branch = [trial.move]
/ recorddata = false
</trial>

<trial move>
/ ontrialend = [values.x=trial.move.responsex;
    values.y=trial.move.responsey;
]
/ stimulusframes = [1=clearscreen, dot, coordinates]
/ validresponse = (mousemove, lbuttondown, rbuttondown)
/ numframes = 1
/ branch = [if (trial.move.response=="lbuttondown") {
        return trial.end;
    } else if (trial.move.response == "rbuttondown") {
        return trial.pause;
    } else if (trial.move.response == "mousemove") {
        trial.move;
    };
]
/ recorddata = false
</trial>

<trial pause>
/ stimulusframes = [1=coordinates]
/ validresponse = (mousemove, lbuttondown)
/ numframes = 1
/ ontrialend = [values.x=trial.pause.responsex; values.y=trial.pause.responsey]
/ branch = [if (trial.pause.response=="lbuttondown") {
        return trial.move;
    } else {
        return trial.pause;
    };
]
/ recorddata = false
</trial>

<trial end>
/ stimulusframes = [1=clearscreen, goodbye]
/ validresponse = (lbuttondown)
/ recorddata = true
</trial>

<shape dot>
/ shape = circle
/ width = 4%
/ color = (blue)
/ erase = false
/ hposition = expressions.x
/ vposition = expressions.y
</shape>

<text coordinates>
/ items = ("x=<%values.x%> | y=<%values.y%>")
/ position = (50%, 5%)
/ size = (27.5%, 4%)
/ vjustify = center
/ erase = false
</text>

<text clickhere>
/ items = ("Click to start.")
</text>

<text goodbye>
/ items = ("Goodbye!")
</text>
Thank you for that, i will take a look and try to pick out what i need.
regards
Peter

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search