Terminate list at set time, even if current sample no completed.

David McFarlane mcfarla9 at msu.edu
Mon Nov 11 21:00:26 UTC 2013


I would have said to set stimulus PreRelease to same as Duration and 
use inline code after the stimulus to look for the timeout, but I 
like Paul's solution much, much better and will add that to my own 
bag of tricks (thanks, Paul!).

Just a couple more thoughts on this:

1) Shouldn't the line

     timeLeft = 120000 - Stimulus.TargetOnsetTime

instead read

     timeLeft = 120000 - (Stimulus.TargetOnsetTime - FirstOnset)

?  Also, the first time the initialization line

     FirstOnset = Stimulus.TargetOnsetTime

runs, Stimulus.Target is 0, and that may adversely affect the 
Duration for the first run of Stimulus.  This could be fixed by 
instead using GetNextTargetOnset time, thus,

     FirstOnset = GetNextTargetOnsetTime

Also, timeLeft is based on the OnsetTime of the previous run of 
Stimulus, but I think you need to take into account how long that run 
lasted.  You could do that by using GetNextTargetOnsetTime 
instead.  Putting that all together, the inline code might instead read

     ' FirstOnset is a global variable which is declared in the user section of
     ' the script window
     If (FirstOnset = 0) Then FirstOnset = GetNextTargetOnsetTime
     Dim timeLeft As Long
     timeLeft = 120000 - (GetNextTargetOnsetTime- FirstOnset)
     If (timeLeft > 0) Then
         Stimulus.Duration = timeLeft
     Else
         Stimulus.Duration = 0
     End If

Finally, instead of a FirstOnset you might instead use a LastOffset, 
thus (also using Iif() to suit my own peculiar tastes),

     ' LastOffset is a global variable which is declared in the user section of
     ' the script window
     If (LastOffset = 0) Then LastOffset = GetNextTargetOnsetTime + 120000
     Dim timeLeft as Long
     timeLeft = LastOffset - GetNextTargetOnsetTime
     Stimulus.Duration = Iif( timeLeft > 0, timeLeft, 0 )
     ' or set Stimulus.Duration as an attribute reference


2) Alternatively, set your stimulus to use Cumulative timing mode, 
and set its Duration to 120000.   Define FirstOnset in global User 
Script as before.  Then in inline code at the start of the Procedure, use

     ' FirstOnset is a global variable which is declared in the user section of
     ' the script window
     If (FirstOnset = 0) Then FirstOnset = GetNextTargetOnsetTime
     SetNextTargetOnsetTime FirstOnset

(see the SetNextTargetOnsetTime topic in the E-Basic Help 
facility).  Now each run of the stimulus will behave as though it 
started at the onset of the first run of the stimulus, and end 12000 
ms after the start of the first run.


It just depends on whether you prefer to manipulate stimulus Duration 
or NextTargetOnsetTime.  In any case, given the general principles, 
Kate and others should readily figure out the specifics.

I went ahead and attached a demo program for each solution.  Thanks 
again, Paul, for the great inspiration!

-- David McFarlane


At 11/11/2013 03:15 AM Monday, Paul Groot wrote:
>Hi Kate,
>
>Because the 'exit list' condition is tested at the end of each 
>trial, eprime doesn't handle timeout values that occur during the 
>trial itself. Even if the trial only contains a single object. The 
>solution is to limit the duration of the individual object(s).
>
>This is what I would do (assuming that the TextDisplay object is 
>called Stimulus):
>
>1) Create a global variable in the user section of the script window:
>
>Dim FirstOnset As Long ' onsettime of first stimulus
>
>2) Insert an inline script at the start of the trial procedure that 
>calculates the total time left, and use this value to change the 
>stimulus duration from infinite to the leftover time:
>
>' FirstOnset is a global variable which is declared in the user 
>section of the script window
>If FirstOnset=0 Then
>FirstOnset = Stimulus.TargetOnsetTime
>End If
>
>Dim timeLeft As Long
>timeLeft = 120000 - Stimulus.TargetOnsetTime
>If timeLeft>0 Then
>Stimulus.Duration = timeLeft
>Else
>Stimulus.Duration = 0
>End If
>
>Things can get a bit more complex if the trial contains several 
>objects, though.
>
>Also also see the attached example.
>
>Best
>Paul
>
>
>
>On 11 November 2013 03:39, Kate Cox 
><<mailto:katehmcox at gmail.com>katehmcox at gmail.com> wrote:
>Hi I'm very new to eprime and have no script background so please be 
>gentle :).
>What I'm trying to do: present participants with a series of 
>mathematical equations which they must answer, using the keyboard. 
>They must answer as many equations as they can in 2 minutes. After 2 
>minutes the task will terminate (and go on to the next task) even if 
>they are part way through giving an answer. The outcomes i'm 
>measuring are accuracy, RT of correct responses and number of 
>correct responses in the 2 minute time window.
>What is working and how I have it set up: I have 300 potential 
>equations in a list called "TrialList", which are presented on a 
>TextDisplay. This works perfectly.
>Answers typed on the keyboard are echoed on the screen and logged. 
>When an answer is complete the participant presses ENTER and the the 
>next equation in my list is shown. This works perfectly.
>In the TextDisplay properties, under the Duration/Input tab I have 
>duration as infinite, timing mode as Event, the keyboard as the only 
>device, allowable responses is any, time limit is same as duration 
>and End action is terminate.
>In the list properties, under the Reset/Exit tab I have set Exit 
>List to "After 120 seconds"
>The problem: I can't get the task to terminate at exactly 2 minutes. 
>At the moment it appears to stop when the trial that is running at 2 
>minute mark is terminated (ie the participant presses enter).  For 
>example if a participant starts an equation at 1:55 then the task 
>won't stop at 2:00 it will wait until they submit their answer and 
>that trial is terminated. As some of my participants aren't 
>particularly fast to provide their responses this may end up being 
>closer to 3 minutes than 2.
>I'm pretty useless with script but I've found the bit that refers to 
>the termination settings and it looks like this:
>Set TrialList.TerminateCondition = TimedMSecs(120000)
>Set TrialList.ResetCondition = Samples(300)
>TrialList.Reset
>I've tried searching this group and the Eprime guide for the answers 
>but can't find how to fix it. I know some people have mentioned some 
>script that terminates at a particular clock setting  but my script 
>seems to look different to theirs so I'm not sure how to implement 
>it. Also this maths task is part of a larger battery of tasks so how 
>a participant performs on earlier tasks will determine where the 
>running clock is when they get up to the maths problems (ie a 
>participant who is faster at earlier tasks may start the math task 
>at the 5 minute mark and someone who is slower might start it at the 
>7 minute mark, so the running clock will be different 2 minutes into 
>the math task).
>
>I hope all this makes sense. Any help would be hugely appreciated.
>thank you in advance
>Kate

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+unsubscribe at googlegroups.com.
To post to this group, send email to e-prime at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/e-prime/5281458c.2cdd320a.723a.ffff9c50SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
For more options, visit https://groups.google.com/groups/opt_out.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SetTaskDuration_byDuration.es2
Type: application/octet-stream
Size: 61692 bytes
Desc: not available
URL: <http://listserv.linguistlist.org/pipermail/eprime/attachments/20131111/75d8ceeb/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SetTaskDuration_byNextTargetOnset.es2
Type: application/octet-stream
Size: 61664 bytes
Desc: not available
URL: <http://listserv.linguistlist.org/pipermail/eprime/attachments/20131111/75d8ceeb/attachment-0001.obj>


More information about the Eprime mailing list