How to fade from slide1 to slide2 (inline?)
Erika Nyhus
Erika_Nyhus at brown.edu
Tue Aug 9 18:42:04 UTC 2011
Attached is a mini-experiment implementing this code.
Erika
On Tue, Aug 9, 2011 at 2:40 PM, enyhus <erika.nyhus at gmail.com> wrote:
> Thank you for all your help so far. I have tried integrating my color
> changing code with the code you have provided, but the color does not
> change nor are the key press and release being recorded. I was
> wondering if you had any more advice on getting this to work.
>
> First I put an InLine (SetTrialStartTime) at the very beginning of the
> trial like this. This sets up the initial color and gets the
> experiment time from the start of the
> trial:
>
>
> '-----------------------------------------------------------------------------
> 'create all the variables you'll need:
> dim r as integer
> dim g as integer
> dim b as integer
> dim vr as string
> dim vb as string
> dim vg as string
> dim stepcounter as integer
> dim Slide1Time as integer
> dim ResponseTime as integer
>
> 'assign value 255 to the red green and blue channels, rgb 255,255,255
> is white
> r=0
> b=255
> g=255
>
> 'map the integer values of r, g, and b onto the string variables vr,
> vb and vg
> vr$= r
> vb$= b
> vg$= g
>
> 'use the string rgb variables to modify the backgroundcolor of the
> textobject
>
> CSlideText(Slide1.States(Slide1.ActiveState).Objects("Text1")).forecolor=CColor
> (""& vr$ &","& vg$ &","& vb$ &"")
>
> Dim lngTrialStart As Long
> lngTrialStart = Clock.Read
>
> '-----------------------------------------------------------------------------
>
> Then I added a label "Repeat" after the stimulus slide and before the
> next
> InLine, and another label "SkipInLine" after the next inline:
>
> Then the following InLine (WaitForKeypresses):
>
>
> '-----------------------------------------------------------------------------
> If Clock.Read - lngTrialStart >= 2500 Then GoTo SkipInLine
>
> Dim nResps As Long
>
> nResps = Slide1.InputMasks(1).Responses.Count
>
> 'waits for the initial keypress
> If nResps > 0 Then
>
> 'loops until either a response is made or the trial time runs out:
> nResps = Slide1.InputMasks(1).Responses.Count
> Do Until Slide1.InputMasks(1).Responses(nResps).RESP = "{1}"
> If Clock.Read - lngTrialStart >= 2500 Then GoTo SkipInLine
> Sleep 1
> Loop
>
> 'logs the keypress time:
> c.SetAttrib "Keypress", Clock.Read
>
> 'loops the color changing code until either the release or the
> trial time runs out
> Do Until Slide1.InputMasks(1).Responses(nResps).RESP = "{-1}"
> If Clock.Read - lngTrialStart >= 2500 Then GoTo SkipInLine
> 'insert color changing code here
> 'First the values of green and blue will be decreased by 5 points,
> we started at 255,255,255 and this way after 50 repeats we will end at
> 255,0,0, which is pure red
> r = r
> g = g - 5
> b = b - 5
>
> 'Map the integer values of rgb onto the string variables of rgb
> vr$= r
> vb$= b
> vg$= g
>
> 'Assign the new value to forecolor
>
> CSlideText(Slide1.States(Slide1.ActiveState).Objects("Text1")).forecolor=CColor
> (""& vr$ &","& vg$ &","& vb$ &"")
> Slide1.draw
> Loop
> Else
> Sleep 1
> GoTo Repeat
> End If
>
> 'logs the key release time:
> c.SetAttrib "Keyrelease", Clock.Read
>
> '-----------------------------------------------------------------------------
>
> Then after the label "SkipInLine" I added a simple InLine
> (WaitForTrialEnd) that waits untilt 2500 ms has passed from the start
> of the trial until the trial end:
>
>
> '-----------------------------------------------------------------------------
> Do Until Clock.Read - lngTrialStart >= 2500
> Sleep 1
> Loop
>
> '-----------------------------------------------------------------------------
>
> Erika
>
> On Jul 28, 2:17 pm, David McFarlane <mcfar... at msu.edu> wrote:
> > Erika,
> >
> > At 7/28/2011 01:55 PM Thursday, you wrote:
> >
> > >I have changed all the code to use
> > >Slide1.InputMasks(1).Responses.Count, but I am getting the following
> > >error when I run it.
> >
> > >Operator type mismatch
> > >For line: Do Until Slide1.InputMasks(1).Responses(nResps) = "{SPACE}"
> >
> > Um, Slide1.InputMasks(1).Responses gets you to the
> > ResponseDataCollection object associated with Slide1.InputMasks(1),
> > and Slide1.InputMasks(1).Responses(nResps) only gets you to a
> > particular ResponseData object, not any of its component
> > properties. You have to drill down a little further to specific
> > ResponseData properties, e.g.,
> >
> > Do Until Slide1.InputMasks(1).Responses(nResps).RESP = "{SPACE}"
> >
> > Please, please read through all the relevant topics in the E-Basic
> > Help facility. This would also all become clear if you would take a
> > course on VBA, or give yourself some training using a book like "VBA
> > for Dummies". It is a huge mistake to try to get an intricate
> > program to work without understanding *how* it works -- even if it
> > *appears* to work to you, chances are it does not really do what you
> > think it does, and you will unwittingly publish invalid results.
> >
> > -- 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.
>
>
--
Erika Nyhus, Ph.D.
Cognitive, Linguistic, and Psychological Sciences
Brown University
229 Waterman St.
Providence, RI 02912-1821
--
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.linguistlist.org/pipermail/eprime/attachments/20110809/d11967c6/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestImage.es2
Type: application/octet-stream
Size: 25952 bytes
Desc: not available
URL: <http://listserv.linguistlist.org/pipermail/eprime/attachments/20110809/d11967c6/attachment.obj>
More information about the Eprime
mailing list