DMDX Help.

ExpireIf Keyword

<ExpireIf signal>

    Switch introduced in version of DMDX to expire a given frame's duration when a given signal is received to facilitate interfacing with eye trackerssignal must exist on some input device and begin with a + or a - as per usual DMDX input button names and only one <expireif> can be used per item.  While the abort item keywords will terminate digital video and sound related tasks this keyword only advances the display queue, it doesn't terminate anything.  Note signal does not have to be mapped to any response and if signal is not received as the item is being displayed the frame <ExpireIf> occurs in will be displayed for whatever duration it has been set to (either the default or some specific duration).  Usual usage of this keyword would be to trigger a change in a display based upon the point of gaze of an eye tracker where one is using the tcpip input device and defining a region of the screen with <2Did tcpipreply>.
    So our task is going to be to present a sentence on the screen and have the subject decide if there are misspellings in it but when they look at the word mouse it will change to moose.  We'll detect when the point of gaze hits a target on the screen and when it does redisplay the sentence with the target word modified in the next tic of the display.  Similar to the example in the <send> documentation that parses a given field out of the reply from the host we've connected to here I've gussied up the Debug Monitor build to send Best Point Of Gaze fields (so <ACK number="1" BPOGV="1" BPOGX="0.6655" BPOGY="0.8477"> for example) that sweep across the screen and we're going to set up a <2Did tcpipreply> device to trigger a response when the gaze hits our targets bounding box.
    So we set up our tcpipreply 2Did device passing it the names of the X and Y POG fields and we also pass it the validated field BPOGV=''1'' so we only process valid data (two single quotes here get collapsed to a double quote), if your eye tracker didn't provide anything like that you'd feed it a string guaranteed to be in the TCP/IP reply.  We also set up a signal (or "button") named word with some dummy coordinates as we won't know where that target will be till later.  Once we've defined the macros we'll be using to capture the target coordinates we display our target sentence in white on white broken up into individual frames so we can see where the target is displayed with <storecoords> and then we set the button rectangle for our word button to those coordinates with <setbuttonrect>.  Then we set the emulated eye tracker going (here we're asking for 600 total ACKs 16 milliseconds apart) and display our pre-test target sentence.  At some time DMDX will get a reply that matches the target's location and DMDX will expire the first frame before it reaches it's 10 second maximum duration and then we draw the post-test sentence with the target modified and turn the subject response clock on:

<ep> <safemode 1> <fd 600>
<2did tcpipreply,BPOGX,BPOGY,BPOGV=''1'' word,1,2,3,4>
<id keyboard> <id tcpip>
0 "test 2did expireif" m.l.++ m.t.++ m.r.++ m.b.++;
1 d2 <px .2> <dwc 255,255,255 stat> "Hickory ", "dickory ", "dock, ", "the ", <storecoords .l., .t., .r., .b.> "mouse ", "ran ", "up ", "the ", "clock " c ; 
~1 <sbr +word,~.l., ~.t.,~.r., ~.b.> <! note that's a separate item from the storecoords one otherwise those macros won't contain the right data>; 

1 <SEND "<requestack num=600 delay=1000 subsequentdelay=16>">
  "send <requestack num=600 delay=1000 subsequentdelay=16>" <fd 30> / c;

+702 <x .2> "Hickory dickory dock, the mouse ran up the clock" <expireif +word> /
     <x .2> "Hickory dickory dock, the moose ran up the clock" * ;
0 "end" <SEND "<requestack num=0>">;

    Unlike a lot of other examples in here we're not continuously running so you'll notice several frames use the legacy continue switch C.

DMDX Index