<div>Thank you very much!</div>
<div>the term Slide was only an exemple sorry... what I do not understand is the "magic number"?</div>
<div>I've never used that script can you help me and explaining what does this mean?</div>
<div> </div>
<div>Thank you so much for your help!</div>
<div> </div>
<div>On monday I'll try the new script for the response and I'll let you know!</div>
<div> </div>
<div>thanks</div>
<div>sara<br><br></div>
<div class="gmail_quote">2009/5/8 David McFarlane <span dir="ltr"><<a href="mailto:mcfarla9@msu.edu">mcfarla9@msu.edu</a>></span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br>Oops, in my hasty copy & paste, I myself forgot to change the name of<br>"Slide" in my examples. Please change "Slide" to something like<br>
"StimSlide". Sorry.<br><font color="#888888"><br>-- David McFarlane, Professional Faultfinder<br></font>
<div>
<div></div>
<div class="h5"><br><br>At 5/8/2009 10:18 AM Friday, David McFarlane wrote:<br><br>>I don't know about anything else, but the code as written will<br>>produce an error because the name "Slide" is reserved. You cannot<br>
>have a Slide named simply "Slide", you will need to change that to<br>>"Slide1" or "StimSlide" or whatever.<br>><br>>Also, on a style and efficiency note, there is no need to do two<br>
>separate If-Then tests on .ACC, you only need to test once for<br>>whether it or not it equals 0 and then branch as necessary, thus:<br>><br>>If (Slide.Acc = 1) Then<br>> WritePort &H378, c.GetAttrib("Trigger") + 100<br>
>Else<br>> WritePort &H378, c.GetAttrib("Trigger") + 200<br>>End If<br>><br>>Knowing that any non-zero value evaluates to "True", you could get<br>>rid of the explicit test and further compact this to simply:<br>
><br>>If Slide.Acc Then<br>> WritePort &H378, c.GetAttrib("Trigger") + 100<br>>Else<br>> WritePort &H378, c.GetAttrib("Trigger") + 200<br>>End If<br>><br>>Finally, let's get rid of the "magic number" and use a constant (and<br>
>ideally, put the constant in the global User Area):<br>><br>>Const LptDataPort as Integer = &H378<br>>If Slide.Acc Then<br>> WritePort LptDataPort, c.GetAttrib("Trigger") + 100<br>>Else<br>
> WritePort LptDataPort, c.GetAttrib("Trigger") + 200<br>>End If<br>><br>>But to truly compact and obfuscate this, you could use the venerable<br>>Iif() function, thus:<br>><br>>Const LptDataPort as Integer = &H378<br>
>WritePort LptDataPort, c.GetAttrib("Trigger") + Iif( Slide.Acc, 100, 200 )<br>><br>>-- David McFarlane, Professional Faultfinder<br>><br>><br>>At 5/7/2009 04:41 PM Thursday, Sara wrote:<br>><br>
> >Hi, I'm running an experiment with e prime while I'm recording the EEG<br>> >(with analyzer), I would like to trigger te response (correct or<br>> >answer) can you help me?<br>> ><br>> >I thought this was the right :<br>
> ><br>> >If Slide.Acc= 1 then WritePort &H378, c.GetAttrib ("Trigger")+ 100<br>> >If Slide.Acc= 0 then WritePort &H378, c.GetAttrib ("Trigger")+ 200<br>> ><br>> >can you help me?<br>
> >Thank you very much!<br>> >Sara<br>><br>><br>><br><br></div></div></blockquote></div><br>
<br>
--~--~---------~--~----~------------~-------~--~----~<br>
You received this message because you are subscribed to the Google Groups "E-Prime" group. <br> To post to this group, send email to e-prime@googlegroups.com <br> To unsubscribe from this group, send email to e-prime+unsubscribe@googlegroups.com <br> For more options, visit this group at http://groups.google.com/group/e-prime?hl=en<br>
-~----------~----~----~----~------~----~------~--~---<br>
<br>