Millisecond Forums

Programming Cyberball with button press delivered via parallel port

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

By Belinda - 3/17/2016

Hi Inquisit,

I am running a Cyberball experiment using fMRI. Responses are provided by a button press apparatus delivered through a true parallel port. This system has been used extensively with Presentation software in other paradigms. For Cyberball, I have adapted the available Cyberball Inquisit code from the Millisecond website. I have been successful in defining the parallel port and observing button presses via the parallel port during Cyberball, but have not succeeded in triggering a ball toss from the participant with a button press. Basically the program stalls once the participant (Player 2) has received the ball, and while the buttons can be pressed and the light signals are being received, no ball toss occurs and no responses are recorded in the data file. I think the problem is with how the validresponses are defined.

Below are versions of the code we have tried. Note it is the 3 player version of Cyberball

First in setting up the ports, we have tried 2 versions and both seem to work.  We’re not clear if we need an offset button as when this is programmed into the trial definition, our button presses are lost (i.e. signal from the port drops out).
Defining the port version 1:
<defaults>
/ minimumversion = "3.0.1.0"
/ lptaddresses = (lpt3=E050)
/ inputdevice = lpt3
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 0)
</defaults>

<port onsetbutton1>
/ port = lpt3
/subport = data
/ items = ("00000001")
</port>

<port onsetbutton2>
/ port = lpt3
/subport = data
/ items = ("00000011")
</port>

<port offsetbutton>
/ port = lpt3
/subport = data
/ items = ("00000000")
</port>

Defining the port version 2:
<defaults>
/ minimumversion = "3.0.1.0"
/ lptaddresses = (lpt3=E050)
/ inputdevice = lpt3
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 0)
</defaults>

port buttonpress>
/ port = lpt3
/ subport = data
/ items = (1,3)
/ erase = true(0)
</port>


Trial definition involving participant as Player 2 – Version 1
<trial 1to2>
/ stimulusframes = [1= player1, player2, player3, player1label, player2label, player3label, 1to2, port.onsetbutton1, port.onsetbutton2]
/ inputdevice = lpt3
/ validresponse = (00000001, 00000011)
/ branch = [if (trial.1to2.response == 00000001) trial.2to1]
/ branch = [if (trial.1to2.response == 00000011) trial.2to3]
</trial>

Trial definition involving participant as Player 2 – Version 2
<trial 1to2>
/ stimulusframes = [1= player1, player2, player3, player1label, player2label, player3label, 1to2, buttonpress]
/ inputdevice = lpt3
/ validresponse = (1, 3)
/ branch = [if (trial.1to2.response == 1) trial.2to1]
/ branch = [if (trial.1to2.response == 3) trial.2to3]
</trial>

Note that both these Trial definitions produce the same result: the program cannot move beyond the participant receiving the ball.
My concern is that:
-          We have not adequately defined what the button press responses correspond to
-          That the program is not aware that it is waiting for input from the port (e.g. using the pretrial or posttrial signal commands, although I’m unsure about how these can be used in branched trials as 2 responses are possible).

I’d appreciate any advice about how to properly define the port and trials to enable button presses to trigger the ball toss. I have trawled through the forum and found some helpful ideas, but none have solved the problem. Apologies if my questions are rudimentary as I’m new to Inquisit.

Many thanks in advance.

Best wishes,

Belinda


By Dave - 3/17/2016

To figure out what the script "sees" as the responses associated with the various buttons on the box, set up a simple script like

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

<trial mytrial>
/ inputdevice = lpt3
/ validresponse = anyresponse
</trial>

Look at the resulting data file's 'response' column. The values you find there are what you need to use in the /validresponse, /branch etc. attributes (try them with and without quotes).

<port> elements have  nothing to do with any of the above. <port> elements are stimuli (just like <text>, <picture>, etc.), i.e. they are signals you can have the script *send out* through the parallel port via a <trial>'s /stimulustimes, /stimulusframes, /responsemessage, etc.

Hope this helps.
By Belinda - 3/19/2016

Hi Supreme Being,

Thanks very much for your reply - that makes sense! I'll give that a go.

Thanks again,

Belinda