Hi Chloe,
This isn’t a “similar issue” (which sounds like “Erin and I encountered the same bug”), but more likely just a small coding failure J Good news is that you should be able to sort it easily.
What is a type mismatch? A type mismatch is when you try to move a value from one variable to another, but they don’t have the same type. For example, it’s easy to move 15 litres of water from one bucket to another, but to convert 15 litres into weight is difficult, unless you – like sane people – use the metric system!
Anyway, E-Prime is based on visual basic for applications and as such, it allows easy conversion – usually.
So for example, we have a number 7 and a word “seitsemän”. To you the question, are they equal? Unless you know Finnish, you’ll answer “how the hell would I know?!” – that’s the type mismatch. Again, we have a number 7 and a word “seven”: are they equal? It’s not really a different question at all, is it? It’s not simple for a computer to know that 7 (a symbol) and “seven” (five letters) represent the same thing. How about 7 and “7”? Now it gets difficult: 7 is a number, “7” is a letter that represents the number. In most computer languages, these are different things (which perhaps sounds silly until you realise that there’s no inherent reason that the number 7 need be represented by “7” rather than Roman “VII”). However, Visual Basic quite often allows one to compare 7 and “7”, until it sometimes doesn’t (because there’s no good reason it should allow it to begin with).
To avoid this, 1) make sure you know what each type of variable is, 2) make sure you convert (“cast”) each type into a form you can compare them to.
Back to the problem:
Is Stim.RESP a number or a letter? Hard to say: if you press a button “2”, it becomes
If “2” = 2 then… à which is probably allowed: E-Prime will cast the “2” to integer type (2) and 2 equals 2, therefore true.
But what if you hadn’t pressed a button:
If “” = 2 then… à again, desperately E-Prime tries to cast the “” to a number, but what number is “”? It’s “how the hell should I know” (apologies to the religious inclined, and hell-dwellers-who-find-it-a-perfectly-acceptable-place-thank-you-very-much).
So better:
If cstr(Stim.RESP)=”2” then à which will explicitly convert to string (cstr) the response and compare it to another string “2”.
I hope that clarifies things. Note that the problem might not have been here: if resp is an integer, but the attribute responser is a word, it won’t work, if the variable hand is an integer, it won’t work, and so on. You can use two tricks:
Debug.print “The stim.resp was: “ & Stim.RESP & “ the responser is: “ & c.getattrib(“ResponseR”) & “.”
…above the first line to see what’s going on (check debug/output window).
Hope that helps!
Best,
Michiel
From: e-p...@googlegroups.com <e-p...@googlegroups.com>
On Behalf Of Chloe Jost
Sent: 19 September 2018 23:06
To: E-Prime <e-p...@googlegroups.com>
Subject: Re: "Type Mismatch" error upon slide timeout
Hi all.
I am having a similar issue to Erin, in which when I make a response to the Slide my experiment continues normally, but if I do not make a response I get this same error code (Type Mismatch, number 13). In this experiment, the subject has limited time to simply rate an image on the slide, and if they do not respond it will time out and move on. Any thoughts? I will include the section that the error message is citing as the issue:
If Stim.RESP=2 Then
resp=c.GetAttrib("ResponseR")
hand="Right"
ElseIf Stim.RESP=7 Then
resp=c.GetAttrib("ResponseL")
hand="Left"
Else
resp="NA"
hand="NA"
End If
c.SetAttrib "Response", resp
c.SetAttrib "Hand", hand
Thank you so much,
Chloe
On Tuesday, September 25, 2012 at 3:17:05 PM UTC-4, Erin wrote:
Hello everyone,
I have an experiment where the subject has 3 seconds to make a response each trial, after which the trial times out. On the Feedback slide, I want to display the number of trials completed, not counting trials that timed out.
To do this, I added an inline to my experiemnt. I noticed in my data output that when Stimulus.RESP = 1, the trial has been completed. So, this is the inline text I used:
If Stimulus.RESP = 1 Then
nPoints = nPoints + 1
Else
nPoints = nPoints + 0
End If
c.SetAttrib "CurrentPoints", nPoints
I also went to view -> script, and added "Dim nPoints as integer" in the user script.
When I run my experiment, it successfully displays a trial count on the feedback slide as long as I make either correct or incorrect responses. However, as soon as I let a trial time out, I get the following error, and the program terminates:
The following Runtime error occurred:
Type Mismatch
line: 640
error number: 13
I have tried adjusting a few things, but with no success. Does anyone have experience getting around this error? thanks so much
Erin
--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
e-prime+u...@googlegroups.com.
To post to this group, send email to e-p...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/e-prime/8057e341-02b7-46ce-9457-e8617296cdc4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Chloe,
Good to hear! (sorry about the rant, it happens sometimes!)
To view this discussion on the web visit https://groups.google.com/d/msgid/e-prime/8401bbcd-8e44-4a63-aed4-492c585eab8d%40googlegroups.com.