Millisecond Forums

Send markers to the eye-tracker through everytime a response is made

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

By nidhi_desai - 1/12/2021

Inside a trial where a participant can press a button multiple times, I need to send markers to the eye-tracker using <port> for every response given by a participant. I would appreciate some suggestions on how to do this. I can think of branching to another <trial> everytime a button is pressed, but is there a better and less cumbersome solution to this?
By Dave - 1/12/2021

nidhi_desai - 1/12/2021
Inside a trial where a participant can press a button multiple times, I need to send markers to the eye-tracker using <port> for every response given by a participant. I would appreciate some suggestions on how to do this. I can think of branching to another <trial> everytime a button is pressed, but is there a better and less cumbersome solution to this?

You can send the marker via /responsemessage and you can have a trial accept multiple responses by implementing /stop logic.

https://www.millisecond.com/support/docs/v6/html/language/attributes/stop_trial.htm

For the sake of example, assume you want to allow an unlimited number of pressing either the E or I key for a duration of 10 seconds:

<block myblock>
/ trials = [1=mytrial]
</block>

<trial mytrial>
/ stop = [
    trial.mytrial.elapsedtime >= 10000;
]
/ stimulustimes = [0=clearscreen,mytext]
/ validresponse = ("E", "I")
/ responsemessage = ("E", Epress, 100)
/ responsemessage = ("I", Ipress, 100)
</trial>

<text mytext>
/ items = ("Press the E and I keys. You have 10 seconds.")
/ erase = false
</text>

<text Epress>
/ items = ("Pressed E")
/ position = (50%, 90%)
</text>

<text Ipress>
/ items = ("Pressed I")
/ position = (50%, 90%)
</text>


Every time one of the keys is pressed, the respective /responsemessage is triggered. Here, it just displays a <text> on the screen, but you can just as well send a <port> signal via /responsemessage attributes.
By nidhi_desai - 1/19/2021

Dave - 1/12/2021
nidhi_desai - 1/12/2021
Inside a trial where a participant can press a button multiple times, I need to send markers to the eye-tracker using <port> for every response given by a participant. I would appreciate some suggestions on how to do this. I can think of branching to another <trial> everytime a button is pressed, but is there a better and less cumbersome solution to this?

You can send the marker via /responsemessage and you can have a trial accept multiple responses by implementing /stop logic.

https://www.millisecond.com/support/docs/v6/html/language/attributes/stop_trial.htm

For the sake of example, assume you want to allow an unlimited number of pressing either the E or I key for a duration of 10 seconds:

<block myblock>
/ trials = [1=mytrial]
</block>

<trial mytrial>
/ stop = [
    trial.mytrial.elapsedtime >= 10000;
]
/ stimulustimes = [0=clearscreen,mytext]
/ validresponse = ("E", "I")
/ responsemessage = ("E", Epress, 100)
/ responsemessage = ("I", Ipress, 100)
</trial>

<text mytext>
/ items = ("Press the E and I keys. You have 10 seconds.")
/ erase = false
</text>

<text Epress>
/ items = ("Pressed E")
/ position = (50%, 90%)
</text>

<text Ipress>
/ items = ("Pressed I")
/ position = (50%, 90%)
</text>


Every time one of the keys is pressed, the respective /responsemessage is triggered. Here, it just displays a <text> on the screen, but you can just as well send a <port> signal via /responsemessage attributes.

I used this above solution along with /isvalidresponse to dynamically change the value of the text displayed as a response to the button press. I have attached my code here. In it I use the following code to update the values of the text. 
<expressions>
/setText = text.Spress.setitem(values.checkS, 1)
</expressions>

I am doing this as I need to have the flexibility to have Spress as a text or a port based on if have eye-tracker added in my code. This method was suggested in one of my other post https://www.millisecond.com/forums/Topic30397.aspx.
But this results in the text not displayed when S key is pressed. Could you suggest some solution to this problem or how might I go about having a dynamic value of the response text/port stimuli?
By Dave - 1/19/2021

nidhi_desai - 1/19/2021
Dave - 1/12/2021
nidhi_desai - 1/12/2021
Inside a trial where a participant can press a button multiple times, I need to send markers to the eye-tracker using <port> for every response given by a participant. I would appreciate some suggestions on how to do this. I can think of branching to another <trial> everytime a button is pressed, but is there a better and less cumbersome solution to this?

You can send the marker via /responsemessage and you can have a trial accept multiple responses by implementing /stop logic.

https://www.millisecond.com/support/docs/v6/html/language/attributes/stop_trial.htm

For the sake of example, assume you want to allow an unlimited number of pressing either the E or I key for a duration of 10 seconds:

<block myblock>
/ trials = [1=mytrial]
</block>

<trial mytrial>
/ stop = [
    trial.mytrial.elapsedtime >= 10000;
]
/ stimulustimes = [0=clearscreen,mytext]
/ validresponse = ("E", "I")
/ responsemessage = ("E", Epress, 100)
/ responsemessage = ("I", Ipress, 100)
</trial>

<text mytext>
/ items = ("Press the E and I keys. You have 10 seconds.")
/ erase = false
</text>

<text Epress>
/ items = ("Pressed E")
/ position = (50%, 90%)
</text>

<text Ipress>
/ items = ("Pressed I")
/ position = (50%, 90%)
</text>


Every time one of the keys is pressed, the respective /responsemessage is triggered. Here, it just displays a <text> on the screen, but you can just as well send a <port> signal via /responsemessage attributes.

I used this above solution along with /isvalidresponse to dynamically change the value of the text displayed as a response to the button press. I have attached my code here. In it I use the following code to update the values of the text. 
<expressions>
/setText = text.Spress.setitem(values.checkS, 1)
</expressions>

I am doing this as I need to have the flexibility to have Spress as a text or a port based on if have eye-tracker added in my code. This method was suggested in one of my other post https://www.millisecond.com/forums/Topic30397.aspx.
But this results in the text not displayed when S key is pressed. Could you suggest some solution to this problem or how might I go about having a dynamic value of the response text/port stimuli?

I cannot, because that is not possible. Basically, you cannot manipulate the response message stimulus while the trial is running.
By nidhi_desai - 1/19/2021

Dave - 1/19/2021
nidhi_desai - 1/19/2021
Dave - 1/12/2021
nidhi_desai - 1/12/2021
Inside a trial where a participant can press a button multiple times, I need to send markers to the eye-tracker using <port> for every response given by a participant. I would appreciate some suggestions on how to do this. I can think of branching to another <trial> everytime a button is pressed, but is there a better and less cumbersome solution to this?

You can send the marker via /responsemessage and you can have a trial accept multiple responses by implementing /stop logic.

https://www.millisecond.com/support/docs/v6/html/language/attributes/stop_trial.htm

For the sake of example, assume you want to allow an unlimited number of pressing either the E or I key for a duration of 10 seconds:

<block myblock>
/ trials = [1=mytrial]
</block>

<trial mytrial>
/ stop = [
    trial.mytrial.elapsedtime >= 10000;
]
/ stimulustimes = [0=clearscreen,mytext]
/ validresponse = ("E", "I")
/ responsemessage = ("E", Epress, 100)
/ responsemessage = ("I", Ipress, 100)
</trial>

<text mytext>
/ items = ("Press the E and I keys. You have 10 seconds.")
/ erase = false
</text>

<text Epress>
/ items = ("Pressed E")
/ position = (50%, 90%)
</text>

<text Ipress>
/ items = ("Pressed I")
/ position = (50%, 90%)
</text>


Every time one of the keys is pressed, the respective /responsemessage is triggered. Here, it just displays a <text> on the screen, but you can just as well send a <port> signal via /responsemessage attributes.

I used this above solution along with /isvalidresponse to dynamically change the value of the text displayed as a response to the button press. I have attached my code here. In it I use the following code to update the values of the text. 
<expressions>
/setText = text.Spress.setitem(values.checkS, 1)
</expressions>

I am doing this as I need to have the flexibility to have Spress as a text or a port based on if have eye-tracker added in my code. This method was suggested in one of my other post https://www.millisecond.com/forums/Topic30397.aspx.
But this results in the text not displayed when S key is pressed. Could you suggest some solution to this problem or how might I go about having a dynamic value of the response text/port stimuli?

I cannot, because that is not possible. Basically, you cannot manipulate the response message stimulus while the trial is running.

Thank you for letting me know.