Multiple correct answers script

395 views
Skip to first unread message

Ellie van Setten

unread,
Apr 17, 2014, 6:01:13 AM4/17/14
to e-p...@googlegroups.com
Hello Everyone,

I have been working on getting the accuracy for a repetition detection task with multiple correct answers. Unfortunately my institute does not want to update their E-prime to a newer version where this is easily done. I work with E-prime 2.09.90


Dim sCorrectResponses as String
sCorrectResponses = c.GetAttrib("CorrectResponses")

if Instr(1, sCorrectResponses, TextDisplay1.RESP,1)=0 then
   TextDisplay1.ACC = 0
else
   TextDisplay1.ACC = 1
end if

c.SetAttrib "TextDisplay1.ACC", TextDisplay1.ACC

I thinks it looks very good and should work, but I get an error: 

No default property for the object

Line: 471
Column:9

I have made an attribute that is called CorrectResponses in my triallist, and even named my tekstdisplay TekstDisplay1, So I would really not know why I have this problem. 
Do you have any suggestions what I could do to solve this problem or another way in which I could get the accuracy for multiple correct answers without updating to a newer E-prime version

Best,

Ellie

David McFarlane

unread,
Apr 17, 2014, 12:08:34 PM4/17/14
to e-p...@googlegroups.com
Ellie,

First, what does the offending Line 471 actually say? And in what context?

Generally, the "No default property for the object" error means that
you tried to execute a line like

TextDisplay1 = 0

or

c.SetAttrib "TextDisplay1.ACC", TextDisplay1

and these will not work because you have not specified what property
of the object to use, and, well, the object does not have a default
property to use when you do not explicitly specify one.

Second, I am curious -- How did you get E-prime 2.09.90? The public
versions jumped straight from 2.0.8.90 to 2.0.10.242.

Regards,
-- David McFarlane

/----
Stock reminder: 1) I do not work for PST. 2) PST's trained staff
take any and all questions at https://support.pstnet.com , and they
strive to respond to all requests in 24-48 hours, so make full use of
it. 3) In addition, PST offers several instructional videos on their
YouTube channel (http://www.youtube.com/user/PSTNET ). 4) If you do
get an answer from PST staff, please extend the courtesy of posting
their reply back here for the sake of others.
\----

Ellie van Setten

unread,
Apr 17, 2014, 1:11:03 PM4/17/14
to e-p...@googlegroups.com
Dear David,

Thank you for your fast reply. The line the error was referring to was:

if Instr(1, sCorrectResponses, TextDisplay1.RESP,1)=0 then
TextDisplay1.ACC = 0

It seems correct to me, but I keep getting the error.

The version I use was 2.08.90 the 9 was a typo.

Best,

Ellie

David McFarlane

unread,
Apr 17, 2014, 3:17:50 PM4/17/14
to e-p...@googlegroups.com
Ellie,

Hmm. First, I do not see anything wrong with that code. And to be
sure, I went ahead and directly copied your code into a little test
program, using EP2.0.8.90 (same version as you), and it both compiled
and ran without error.

If you have not already, then you should make a minimal example that
shows this error. Mine looks like this:

SessionProc
List1
Proc1
TextDisplay1
InLine1

List1 has an attribute named "CorrectResponses", and InLine1 has your
code, verbatim. No need to even enter anything else for the various
objects, as this is already enough to check any syntax errors.

If you still get the error in this minimal test, then something must
be peculiar on your system. Try it out on another machine.

Good luck,
-- David McFarlane

David McFarlane

unread,
Apr 17, 2014, 3:22:16 PM4/17/14
to e-p...@googlegroups.com
Ellie,

Oh, and if you do *not* get the error in the minimal example, but
still get it in your original program, then my money says that the
error occurs somewhere else than in the bit of code that you posted,
and has something to do with the reasons in my first reply.

Regards,
-- David

Ellie van Setten

unread,
Apr 24, 2014, 4:29:25 AM4/24/14
to e-p...@googlegroups.com
Dear David,

I have followed your advise, in another script on another computer it worked just fine... so I still don't know why I got the error
I have modified the script I found slightly in two ways that may be of use for people using an older version of E-prime because the script I found only works for experiments where an answer is given every time and without an answer it does not continue.

Working with multiple correct answers in case not always an answer is required:

Dim sCorrectResponses as String
sCorrectResponses = c.GetAttrib("CorrectResponses")

'determine if there is an response

Dim resp as integer
if Stimulus.RESP = "" then
    resp = 0
else
    resp = 1
end if   

' perform a case-insensitive search operation
if  (resp = 1 AND (Instr(1, sCorrectResponses, Stimulus.RESP, 1)=0)) OR (resp = 0 AND sCorrectresponses <>"") then
    Stimulus.ACC = 0
else
      Stimulus.ACC = 1
end if

'  save the accuracy as attribute

c.SetAttrib "Stimulus.ACC", Stimulus.ACC


and to make it work for situations were a response is always required, so a failure or responses that are too late are also seen as incorrect:

Dim sCorrectResponses as String
sCorrectResponses = c.GetAttrib("CorrectResponses")

' perform a case-insensitive search operation
if Instr(1, sCorrectResponses, W2.RESP, 1)=0 OR (W2.RESP = "")then
       W2.ACC = 0
else
  W2.ACC = 1
end if
' and also save the accuracy as attribute


c.SetAttrib "W2.ACC", W2.ACC


For these scipts to work you need to have an attribiute in your stimulus list that contains all correct responses called "CorrectResponses" (without comma's and spaces). In the first scirpt the accuracy to a text display called Stimulus is logged and in the second script to W2. Hope this may help others with a similar problem.

Best,

Ellie



Op donderdag 17 april 2014 21:22:16 UTC+2 schreef McFarlane, David:
Reply all
Reply to author
Forward
0 new messages