Global variable script problem: type mismatch

Recursion infinityparadox at gmail.com
Sun Jul 26 16:58:51 UTC 2009


Turns out it was a stupid mistake on my part! I neglected to add
quotes around the subject response in the script that increments the
global variables. You do get an error here without an ElseIf, though.
Thanks so much for your help, Liwenna! I really appreciate it.

On Jul 26, 5:10 am, liwenna <liwe... at gmail.com> wrote:
> Ow and for the second question...
>
> ----------------------------------------------
> If InputSlide.RESP = "1" Then
>      Feedback1.Run c
> If InputSlide.RESP = "4" Then
>      Feedback2.Run c
> Else
>      Feedback3.run c
> End If
> ----------------------------------------------
>
> Of there's only two allowable inputs (1 and 4) then a non-response
> should automatically sort under 'Else' and show the third
> feedbackslide. Alternatively you could try
>
> If InputSlide.RESP = "" Then
>      Feedback3.run c
>
> but not entirely sure whether that will work.
>
> Again, no e-prime at hand so not sure if it works, but I think it
> should.
>
> Best regards,
>
> liwenna
>
> On Jul 26, 11:06 am, liwenna <liwe... at gmail.com> wrote:
>
> > Hello S.
>
> > No e-prime at hand at the moment (nor in the coming week), but a first
> > thing that you could try is to change the elseif in the second
> > statement of the if-part in if:
>
> > If InputSlide.RESP = 1 Then
> >         g_nTotalPositive = g_nTotalPositive + 1
> > If InputSlide.RESP = 4 Then
> >         g_nTotalNegative = g_nTotalNegative + 1
> > Else
> > End If
>
> > It's a hunch but I think I remember that doing just that fixed a
> > similar problem for me at times.
>
> > Best regards,
>
> > liwenna
>
> > On Jul 25, 4:52 pm, Recursion <infinitypara... at gmail.com> wrote:
>
> > > I'm having a little problem with a script I wrote to keep track of
> > > subject responses. Just to clear up any ambiguity with the variable
> > > names, know that a keyboard response of '1' indicates a "positive"
> > > response--the subject agrees with the statement on screen. A keyboard
> > > response of '4' is a negative response--disagreement.
>
> > > The problem is that there is a time-out condition--subjects only have
> > > 5 seconds to respond. The script works fine, except in cases where the
> > > slide is allowed to timeout. In such a case, I get a type mismatch
> > > error pointing to the first line in the If statement. Here's the
> > > script:
>
> > > -------------------------------------------------------------------------------------------
> > > 'Calculates total trial number
> > > 'Calculates total number of positive subject resp
> > > 'Calculates total number of negative subject resp
> > > g_nTotalTrials = g_nTotalTrials + 1
>
> > > If InputSlide.RESP = 1 Then
> > >         g_nTotalPositive = g_nTotalPositive + 1
> > > ElseIf InputSlide.RESP = 4 Then
> > >         g_nTotalNegative = g_nTotalNegative + 1
> > > Else
> > > End If
>
> > > c.SetAttrib "TrialCounter", g_nTotalTrials 'set for display and
> > > logging
> > > c.SetAttrib "TotalPositive", g_nTotalPositive 'set for display and
> > > logging
> > > c.SetAttrib "TotalNegative", g_nTotalNegative 'set for display and
> > > logging
> > > ------------------------------------------------------------------------------------------
>
> > > Perhaps I should consider some sort of typecast? Is a failure to
> > > respond of type bool? Come to think of it, I'm not entirely certain of
> > > this. I have another script that runs a contingent branch on the slide
> > > objects used for feedback. Here's that script:
>
> > > ----------------------------------------------
> > > If InputSlide.RESP = "1" Then
> > >      Feedback1.Run c
> > > Else
> > >      Feedback2.Run c
> > > End If
> > > ----------------------------------------------
>
> > > I'd like to change this to lead to a third feedback slide object in
> > > the event that the subject fails to respond within 5 minutes--but to
> > > do this I need to know how a failure to respond in time is even coded--
> > > what its type is.
>
> > > Thanks so much!
> > > S
--~--~---------~--~----~------------~-------~--~----~
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