Mastering E-Prime: How to Learn E-Prime Programming

David McFarlane mcfarla9 at msu.edu
Thu May 12 16:21:46 UTC 2011


Ben,

At 5/11/2011 11:07 AM Wednesday, ben robinson wrote:
>Clock.Scale?  amazing.  thank you, david!

Since you mention it, I will expand that detail a little more.  As 
you found, Clock.Scale allows you to speed up (or slow down) the 
clock rate in E-Prime.  It is meant primarily for synchronizing the 
clock to other equipment, but I find it very handy for speeding up test runs.

I am going to give you a bit of enhanced inline code for safely using 
Clock.Scale for this purpose, but first I need to motivate this with 
a story.  When I discovered Clock.Scale many years ago, first I would 
simply put it in an inline in my program for my test runs.  Of 
course, then I had to remember to remove or disable my Clock.Scale 
before using the program with subjects, imagine the trouble if I 
forgot!  At first I would try to remember to delete the line before 
running subjects, but then I would have to type it back in for new 
test runs.  Then I tried merely commenting it out as needed, which 
left the line in place but still ran the risk of me forgetting to 
comment it out as needed.  Then I tried putting it into its own 
inline, and "deleting" that to Unreferenced E-Objects as needed, and 
dragging it back into SessionProc for test runs.  Again, that ran the 
risk of forgetting to disable my Clock.Scale for subject runs.

I thought I could get more clever, so I decided to use a "secret 
handshake" to start test runs, which would then present a warning 
reminder before setting the Clock.Scale.  I wanted to use a negative 
Session number, but E-Prime didn't like that so I settled on 11111 
(that's five ones).  Then I thought, in addition to a warning, it 
should give the user a chance to bail out.  Then I thought, as long 
as it does all that, why not have it ask me for the Clock.Scale 
value, so I can change it from run to run?  And log the Clock.Scale 
value?  And give me a chance to enter arbitrary comments to 
log?  Etc.  Now I can just leave that code in place and invoke it 
only for test runs, during subject runs it has no effect.

So this keeps evolving, but here is the current bit of code that I 
put into its own inline at the start of almost every project (I like 
to name the inline "DeveloperInitCode"):


'/----------------------------------------------------------------------
' Inline code to enable various development aids.

Const  DebugTrigger = 11111
Const  ClockScaleAskDefault as Single = 0.05
Dim  x

If c.GetAttrib("Session") = DebugTrigger Then
     Beep
     x = AnswerBox( "You entered a session number of " & DebugTrigger   _
         & ".\nThis enables some extra developer testing script added"  _
         & " by the developer of this experiment."                      _
         & "\nIf this is not what you meant, use Cancel to quit the"    _
         & " experiment now.", "OK", "Cancel", , "DeveloperInit Notice" )
     If (x <> 1) Then Exit Sub
     ' Use Clock.Scale to speed up, or slow down, the experiment running
     ' time for development testing:
     x = AskBox( "Clock.Scale (use 1 to run with normal timing): ", _
         ClockScaleAskDefault )
     If IsEmpty(x) Then Exit Sub
     Clock.Scale = x
     c.SetAttrib "Clock.Scale", Clock.Scale
     c.SetAttrib "Comment", AskBox( "Comment:" )
End If
'\----------------------------------------------------------------------


Sometimes I crank the Clock.Scale all the way down (up?) to 0.01, 
speeding the run up by a factor of 100.  This works great for 
programs that do not wait for subject responses (such as fMRI) -- 
e.g., I can run through a 15 min experiment in 9 s and then look at 
the .edat file to see what stimuli got presented when, etc.

Now, if only I had an easy programmable way to disable and re-enable 
self-paced responses for test runs!

-- David McFarlane, Professional Faultfinder

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.



More information about the Eprime mailing list