How to fade from slide1 to slide2 (inline?)
enyhus
erika.nyhus at gmail.com
Tue Aug 9 18:40:21 UTC 2011
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.
More information about the Eprime
mailing list