How to fade from slide1 to slide2 (inline?)

David McFarlane mcfarla9 at msu.edu
Thu Jul 28 16:51:11 UTC 2011


Erika,

At 7/28/2011 12:05 PM Thursday, you wrote:
>Thank you so much for your help!  I think this code should work for
>what I want to do, but I am getting the following error when I run it.
>
>Responses is not a property of the object
>For line: nResps = Keyboard.Responses.Count

Yeah, the Keyboard object does not have a Responses 
property.  Responses would be a property of an input mask, so you 
would have to do something more like

     nResps = Slide1.InputMasks(1).Responses.Count

The "Multiple Responses" example from the PST web site might help you 
with this.

BTW, if you really do want to access Keyboard activity directly 
without going through an input mask, you could use its History property.

For more information, see the appropriate topics in the E-Basic Help 
facility (that's the closest we get to technical documentation for 
E-Prime).  Or, post a request to PST Web Support, they seem to be 
pretty generous with helping folks out with this sort of thing (in 
lieu of providing full documentation).

-- David McFarlane, Professional Faultfinder


>I do have the following color changing code that I plan to add once
>this is working:
>
>'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=255
>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$ &"")
>
>'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$ &"")
>
>Erika
>
>On Jul 28, 11:13 am, Alon Hafri <aha... at gmail.com> wrote:
> > Hi Erika,
> >
> > I did not have a chance to look at your attached script so excuse me
> > if I mention something you've already done, but I think I can offer a
> > few quick tips, and maybe others can offer follow-ups or different
> > approaches as well.
> >
> > I would make the Slide duration 0 and then use an Inline to control
> > the key presses and release, the changing color effect, and the trial
> > duration. Another thing to note is that in E-Prime registering key
> > releases is achieved with a minus sign, so for example {SPACE} is a
> > press and {-SPACE} is a release (likewise {1} is a press and {-1} is a
> > release). You have to set the CollectionMode property of the InputMask
> > to accept both presses and releases, which you can achieve I believe
> > either in the Input Mask properties window (maybe advanced settings)
> > or in code (Keyboard.CollectionMode = ebPressesAndReleases).
> >
> > First put an InLine (SetTrialStartTime) at the very beginning of the
> > trial like this. This gets the experiment time from the start of the
> > trial:
> > 
> '-----------------------------------------------------------------------------
> > Dim lngTrialStart As Long
> > lngTrialStart = Clock.Read
> > 
> '-----------------------------------------------------------------------------
> >
> > Then 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 = Keyboard.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 = Keyboard.Responses.Count
> >    Do Until Keyboard.Responses(nResps) = "{SPACE}"
> >       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 time runs out
> >    Do Until Keyboard.Responses(Keyboard.Responses.Count) = "{-SPACE}"
> >       If Clock.Read - lngTrialStart >= 2500 Then GoTo SkipInLine
> >       'insert color changing code here
> >    Loop
> > Else
> >    Sleep 1
> >    GoTo Repeat
> > End If
> >
> > 'logs the key release time:
> > c.SetAttrib "Keyrelease", Clock.Read
> > 
> '-----------------------------------------------------------------------------
> >
> > Then after the label "SkipInLine" you can have 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
> > 
> '-----------------------------------------------------------------------------
> >
> > So the trial structure would be something like:
> > SetTrialStartTime (InLine)
> > Stimulus Slide
> > Repeat label
> > WaitForKeypresses InLine
> > SkipInLine label
> > WaitForTrialEnd (InLine)
> >
> > That should do it. You said you have the color changing code, yes?
> > Good luck! If anyone else has a different way, please share!
> >
> > Alon
> >
> > On Jul 27, 2:42 pm, Erika Nyhus <Erika_Ny... at brown.edu> wrote:
> >
> > > I am trying to program an experiment in E Prime and was 
> wondering if you had
> > > any tips/examples to help me out.
> >
> > > What I am trying to do is have subjects indicate their 
> confidence in their
> > > response by the length of time they press the response 
> button.  While they
> > > are pressing the button we would like to present a visual cue (e.g. a
> > > growing bar or changing color) indicating the length of the button press.
> > > This visual cue should stop changing as soon as they release 
> the button and
> > > then should remain stable until the end of the trial period.
> >
> > > Attached is a mini-experiment in which I have gotten the color of the
> > > stimuli to change (adapted from the example given here) and then remain
> > > stable until the end of the trial period.  But I have three 
> remaining issues
> > > that I would appreciate help on.  First, the stimuli should only start
> > > changing colors when the response button is pressed.  So I need 
> to have the
> > > stimuli appear, as soon as the button is pressed it changes 
> color, and then
> > > when it is released it remains that color for the remainder of the trial.
> > > Second, I need the total trial time to be 2500 ms including stimulus
> > > appearance, change in color as the button is pressed, and as the stimulus
> > > remains stable until the end of the trial period.  The code I 
> have added in
> > > Inline3 (c.setAttrib "Dur", 2500-(ResponseTime-Slide1Time) does 
> not appear
> > > to work properly as it sometimes results in very high values 
> (e.g. Dur=5000
> > > ms) or negative values (e.g. Dur=-500 ms).  Third, I need to log the time
> > > when the response button was pressed and when it was released to get a
> > > measure of how long the button was pressed.
> >
> > > --
> > > Erika Nyhus, Ph.D.
> > > Cognitive, Linguistic, and Psychological Sciences
> > > Brown University
> > > 229 Waterman St.
> > > Providence, RI 02912-1821
> >
> > >  TestImage.es2
> > > 40KViewDownload

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