How to click a button to return event


Author
Message
ben liu
ben liu
New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)
Group: Forum Members
Posts: 1, Visits: 6
I hope that when the continue button, start, and end buttons are pressed, the event can be returned through the following port, but it seems that the event is sent out when the screen show.
How to send event when pressing button ?
Thank you so muck.





--------------------------------------------------------------------------------------------------------------------
<trial instructions>
/ ontrialbegin = [
    if (trial.instructions.trialcount > 0){
        button.continuebutton.skip = true;
        button.start.skip = false;
    } else {
        button.continuebutton.skip = false;
        button.start.skip = true;        
    };
]

/ stimulustimes = [1=clearscreen, instructions , continuebutton , start , end, myPort]
/ inputdevice = mouse
/ validresponse = (continuebutton, start, end)

/ ontrialend = [
    if (trial.instructions.response == "continuebutton") {
        
        port.myPort.setitem(1);
    } else if (trial.instructions.response == "start") {
        
        port.myPort.setitem(2);
    } else if (trial.instructions.response == "end") {
        
        port.myPort.setitem(3);
    }
]
/ recorddata = false
</trial>


<port myPort>
/ port = COM3
/ subport = data
/ items = ("00000100","00000101","00000110") //4,5,6
</port>
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: 102K
ben liu - 7/21/2024
I hope that when the continue button, start, and end buttons are pressed, the event can be returned through the following port, but it seems that the event is sent out when the screen show.
How to send event when pressing button ?
Thank you so muck.





--------------------------------------------------------------------------------------------------------------------
<trial instructions>
/ ontrialbegin = [
    if (trial.instructions.trialcount > 0){
        button.continuebutton.skip = true;
        button.start.skip = false;
    } else {
        button.continuebutton.skip = false;
        button.start.skip = true;        
    };
]

/ stimulustimes = [1=clearscreen, instructions , continuebutton , start , end, myPort]
/ inputdevice = mouse
/ validresponse = (continuebutton, start, end)

/ ontrialend = [
    if (trial.instructions.response == "continuebutton") {
        
        port.myPort.setitem(1);
    } else if (trial.instructions.response == "start") {
        
        port.myPort.setitem(2);
    } else if (trial.instructions.response == "end") {
        
        port.myPort.setitem(3);
    }
]
/ recorddata = false
</trial>


<port myPort>
/ port = COM3
/ subport = data
/ items = ("00000100","00000101","00000110") //4,5,6
</port>

<port> elements are stimulus elements like any other. You need to "display" them just like any other stimulus element. In this case, if you want a stimulus (here: a <port>) "displayed" upon a response, you need to make use of the <trial>'s /responsemessage.

You should take a look at the Auditory Oddball Task in the library, which illustrates proper use of <port> elements.

https://www.millisecond.com/download/library/oddball


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search