Millisecond Forums

record initial movement time

https://forums.millisecond.com/Topic27639.aspx

By nakayama - 8/22/2019

Dear Inquisit Community
My task is: participants started moving the mouse to click somewhere on the screen after clicking "A".
I recorded when the mouse started moving using "mousemove" by using "branch" to connect two trials (mousemove and click).
Is there another way to record the "mousemove" latency without separating into two trial?
? Because I wanted to avoid extra delays between trial initiation. 
thank you in advance;)
 
By Dave - 8/22/2019

nakayama - 8/22/2019
Dear Inquisit Community
My task is: participants started moving the mouse to click somewhere on the screen after clicking "A".
I recorded when the mouse started moving using "mousemove" by using "branch" to connect two trials (mousemove and click).
Is there another way to record the "mousemove" latency without separating into two trial?
? Because I wanted to avoid extra delays between trial initiation. 
thank you in advance;)
 

You can use /isvalidresponse logic:

<data>
/ columns=[subject, blockcode, trialcode, trialnum, trialduration,trialtimeout,latency, response,
values.mm_rt trial.tap.responsex,trial.tap.responsey,stimulusitem, stimulusnumber, stimulusitem, stimulusnumber]
/ separatefiles = true
</data>

<values>
/ ax=960
/ by=600
/ count = 0
/ mm_rt = -1
</values>


<block myblock>
/ trials = [1-20=start]
/ screencolor = white
</block>

<shape pencil>
/ shape = circle
/ color = black
/ size = (.5%, .5%)
</shape>

<trial start>
/ ontrialbegin = [
values.count = 0;
values.mm_rt = -1;
]
/ validresponse = (start)
/ stimulustimes = [0=screen,start]
/ inputdevice = mouse

/ responseinterrupt = immediate
/ branch = [if (trial.start.response=="start") trial.tap]
</trial>

<text mouseposition>
/ items= ("mouse xy position = <% trial.tap.responsex %><% trial.tap.responsey %>")
/ position = (50,80)
</text>

<text mouseinitialtime>
/ items= ("mouse time = <%values.mm_rt%>")
/ position = (50,50)
</text>

<text clicktime>
/ items= ("click time = <%trial.tap.latency%>")
/ position = (50,60)
</text>

<trial tap>
/ ontrialbegin = [
values.count += 1;
]
/ validresponse = (lbuttondown, mousemove)
/ stimulustimes = [0=screen]
/ isvalidresponse = [
if (trial.tap.response == "mousemove" && values.count == 1) {
values.mm_rt = trial.tap.latency; values.count += 1; false;
} else if (trial.tap.response == "mousemove" && values.count > 1) {
false;
} else true;
]
/ inputdevice = mouse
/ draw = pencil
/ showmousecursor=true
/ branch = [
trial.end
]
</trial>

<trial end>
/ stimulustimes = [0=clearscreen, mouseposition, mouseinitialtime, clicktime]
/ validresponse = (lbuttondown)
/ inputdevice = mouse
</trial>


<text start>
/ items = ("A")
/ fontstyle = ("MS UI Gothic", 5.00%, false, false, false, false, 5, 1)
/ erase = true(white)
/ txbgcolor = white
/ position = (960px,600px)

</text>


<shape screen>
/ shape = rectangle
/ color = white
/ size = (1920px, 1200px)
/ position = (960px, 600px)
/ erase = false
</shape>


By nakayama - 8/23/2019

Dave - 8/23/2019
nakayama - 8/22/2019
Dear Inquisit Community
My task is: participants started moving the mouse to click somewhere on the screen after clicking "A".
I recorded when the mouse started moving using "mousemove" by using "branch" to connect two trials (mousemove and click).
Is there another way to record the "mousemove" latency without separating into two trial?
? Because I wanted to avoid extra delays between trial initiation. 
thank you in advance;)
 

You can use /isvalidresponse logic:

<data>
/ columns=[subject, blockcode, trialcode, trialnum, trialduration,trialtimeout,latency, response,
values.mm_rt trial.tap.responsex,trial.tap.responsey,stimulusitem, stimulusnumber, stimulusitem, stimulusnumber]
/ separatefiles = true
</data>

<values>
/ ax=960
/ by=600
/ count = 0
/ mm_rt = -1
</values>


<block myblock>
/ trials = [1-20=start]
/ screencolor = white
</block>

<shape pencil>
/ shape = circle
/ color = black
/ size = (.5%, .5%)
</shape>

<trial start>
/ ontrialbegin = [
values.count = 0;
values.mm_rt = -1;
]
/ validresponse = (start)
/ stimulustimes = [0=screen,start]
/ inputdevice = mouse

/ responseinterrupt = immediate
/ branch = [if (trial.start.response=="start") trial.tap]
</trial>

<text mouseposition>
/ items= ("mouse xy position = <% trial.tap.responsex %><% trial.tap.responsey %>")
/ position = (50,80)
</text>

<text mouseinitialtime>
/ items= ("mouse time = <%values.mm_rt%>")
/ position = (50,50)
</text>

<text clicktime>
/ items= ("click time = <%trial.tap.latency%>")
/ position = (50,60)
</text>

<trial tap>
/ ontrialbegin = [
values.count += 1;
]
/ validresponse = (lbuttondown, mousemove)
/ stimulustimes = [0=screen]
/ isvalidresponse = [
if (trial.tap.response == "mousemove" && values.count == 1) {
values.mm_rt = trial.tap.latency; values.count += 1; false;
} else if (trial.tap.response == "mousemove" && values.count > 1) {
false;
} else true;
]
/ inputdevice = mouse
/ draw = pencil
/ showmousecursor=true
/ branch = [
trial.end
]
</trial>

<trial end>
/ stimulustimes = [0=clearscreen, mouseposition, mouseinitialtime, clicktime]
/ validresponse = (lbuttondown)
/ inputdevice = mouse
</trial>


<text start>
/ items = ("A")
/ fontstyle = ("MS UI Gothic", 5.00%, false, false, false, false, 5, 1)
/ erase = true(white)
/ txbgcolor = white
/ position = (960px,600px)

</text>


<shape screen>
/ shape = rectangle
/ color = white
/ size = (1920px, 1200px)
/ position = (960px, 600px)
/ erase = false
</shape>



Thank you Dave, for your helpful script;)
I have another question: is it possible to record the offset of the mouse movement instead of mouse click? So instead of clicking to terminate the trial, participants just stopped moving the mouse to end the trial.
I didn't find a syntax something like "non-mousemove" and tried something like "!mousemove" but failed.
 Thank you in advance;)
By Dave - 8/25/2019

nakayama - 8/24/2019
Dave - 8/23/2019
nakayama - 8/22/2019
Dear Inquisit Community
My task is: participants started moving the mouse to click somewhere on the screen after clicking "A".
I recorded when the mouse started moving using "mousemove" by using "branch" to connect two trials (mousemove and click).
Is there another way to record the "mousemove" latency without separating into two trial?
? Because I wanted to avoid extra delays between trial initiation. 
thank you in advance;)
 

You can use /isvalidresponse logic:

<data>
/ columns=[subject, blockcode, trialcode, trialnum, trialduration,trialtimeout,latency, response,
values.mm_rt trial.tap.responsex,trial.tap.responsey,stimulusitem, stimulusnumber, stimulusitem, stimulusnumber]
/ separatefiles = true
</data>

<values>
/ ax=960
/ by=600
/ count = 0
/ mm_rt = -1
</values>


<block myblock>
/ trials = [1-20=start]
/ screencolor = white
</block>

<shape pencil>
/ shape = circle
/ color = black
/ size = (.5%, .5%)
</shape>

<trial start>
/ ontrialbegin = [
values.count = 0;
values.mm_rt = -1;
]
/ validresponse = (start)
/ stimulustimes = [0=screen,start]
/ inputdevice = mouse

/ responseinterrupt = immediate
/ branch = [if (trial.start.response=="start") trial.tap]
</trial>

<text mouseposition>
/ items= ("mouse xy position = <% trial.tap.responsex %><% trial.tap.responsey %>")
/ position = (50,80)
</text>

<text mouseinitialtime>
/ items= ("mouse time = <%values.mm_rt%>")
/ position = (50,50)
</text>

<text clicktime>
/ items= ("click time = <%trial.tap.latency%>")
/ position = (50,60)
</text>

<trial tap>
/ ontrialbegin = [
values.count += 1;
]
/ validresponse = (lbuttondown, mousemove)
/ stimulustimes = [0=screen]
/ isvalidresponse = [
if (trial.tap.response == "mousemove" && values.count == 1) {
values.mm_rt = trial.tap.latency; values.count += 1; false;
} else if (trial.tap.response == "mousemove" && values.count > 1) {
false;
} else true;
]
/ inputdevice = mouse
/ draw = pencil
/ showmousecursor=true
/ branch = [
trial.end
]
</trial>

<trial end>
/ stimulustimes = [0=clearscreen, mouseposition, mouseinitialtime, clicktime]
/ validresponse = (lbuttondown)
/ inputdevice = mouse
</trial>


<text start>
/ items = ("A")
/ fontstyle = ("MS UI Gothic", 5.00%, false, false, false, false, 5, 1)
/ erase = true(white)
/ txbgcolor = white
/ position = (960px,600px)

</text>


<shape screen>
/ shape = rectangle
/ color = white
/ size = (1920px, 1200px)
/ position = (960px, 600px)
/ erase = false
</shape>



Thank you Dave, for your helpful script;)
I have another question: is it possible to record the offset of the mouse movement instead of mouse click? So instead of clicking to terminate the trial, participants just stopped moving the mouse to end the trial.
I didn't find a syntax something like "non-mousemove" and tried something like "!mousemove" but failed.
 Thank you in advance;)

No, I can't think of a way to make that happen.