trigger the response

David McFarlane mcfarla9 at msu.edu
Fri May 8 14:24:07 UTC 2009


Oops, in my hasty copy & paste, I myself forgot to change the name of 
"Slide" in my examples.  Please change "Slide" to something like 
"StimSlide".  Sorry.

-- David McFarlane, Professional Faultfinder


At 5/8/2009 10:18 AM Friday, David McFarlane wrote:

>I don't know about anything else, but the code as written will
>produce an error because the name "Slide" is reserved.  You cannot
>have a Slide named simply "Slide", you will need to change that to
>"Slide1" or "StimSlide" or whatever.
>
>Also, on a style and efficiency note, there is no need to do two
>separate If-Then tests on .ACC, you only need to test once for
>whether it or not it equals 0 and then branch as necessary, thus:
>
>If (Slide.Acc = 1) Then
>      WritePort &H378, c.GetAttrib("Trigger") + 100
>Else
>      WritePort &H378, c.GetAttrib("Trigger") + 200
>End If
>
>Knowing that any non-zero value evaluates to "True", you could get
>rid of the explicit test and further compact this to simply:
>
>If Slide.Acc Then
>      WritePort &H378, c.GetAttrib("Trigger") + 100
>Else
>      WritePort &H378, c.GetAttrib("Trigger") + 200
>End If
>
>Finally, let's get rid of the "magic number" and use a constant (and
>ideally, put the constant in the global User Area):
>
>Const LptDataPort as Integer = &H378
>If Slide.Acc Then
>      WritePort LptDataPort, c.GetAttrib("Trigger") + 100
>Else
>      WritePort LptDataPort, c.GetAttrib("Trigger") + 200
>End If
>
>But to truly compact and obfuscate this, you could use the venerable
>Iif() function, thus:
>
>Const LptDataPort as Integer = &H378
>WritePort LptDataPort, c.GetAttrib("Trigger") + Iif( Slide.Acc, 100, 200 )
>
>-- David McFarlane, Professional Faultfinder
>
>
>At 5/7/2009 04:41 PM Thursday, Sara wrote:
>
> >Hi, I'm running an experiment with e prime while I'm recording the EEG
> >(with analyzer), I would like to trigger te response (correct or
> >answer) can you help me?
> >
> >I thought this was the right :
> >
> >If Slide.Acc= 1 then WritePort &H378, c.GetAttrib ("Trigger")+ 100
> >If Slide.Acc= 0 then WritePort &H378, c.GetAttrib ("Trigger")+ 200
> >
> >can you help me?
> >Thank you very much!
> >Sara
>
>
>

--~--~---------~--~----~------------~-------~--~----~
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