Feedback on the same screen as stimulus

189 views
Skip to first unread message

Beckerlab

unread,
May 15, 2012, 2:12:57 PM5/15/12
to E-Prime
Hello everyone,

I am programming a delayed match to sample task. I have it essentially
running, and it works like this.

An initial stimuli is displayed, like a picture of a dog, this picture
disappears. Then, 4 pictures appear: cat, rat, dog, and pig for
example.

I need it so if the participant clicks "rat", then a red X appears
either over the rat picture (preferably), or to replace the rat
picture, to signify that this is an incorrect response. Then the
participant has to pick another response, so it's like this:

DOG
(dog disappears)

CAT DOG RAT PIG

let's say they click pig now, a red X needs to appear over PIG, and
the loop does NOT run again, instead, they are just displayed with the
4 options


CAT DOG RAT X

Now, let's say they pick cat, their options are now like this

X DOG RAT X

X's over 2 of their choices, if they click the correct option, that
option gets a green checkmark over it. The words "Correct" or
"Incorrect" also need to appear at the top of the slide if possible.

------------------

I am not sure how to go about this... I know how feedback works in
general, something like this (below) might work with slide states...
but then there would be too many possible options of x's and
checkmarks...and I'm not sure how to get the location to work.

If Stimulus.ACC = 1 Then
Feedback3.ActiveState = "Correct"
Else
Feedback3.ActiveState = "Incorrect"

End If


Any other possible solutions? Thanks!

Beckerlab

unread,
May 16, 2012, 2:41:24 PM5/16/12
to E-Prime
After even more searching...I am thinking of modifying

http://www.pstnet.com/support/samples.asp?Mode=View&SampleID=38

(Load image after mouseclick), so that the image unclicked will be my
4 options, and after clicking, it'll go to a red x

I'm thinking some script like this

If mouseclick is on a certain image and strHit=1,
display checkmark

If mouseclick is on another image and strHit = 0
display X

and if they click the correct 1, it goes to the next slide?

Hopefully it works!

David McFarlane

unread,
May 17, 2012, 2:03:30 PM5/17/12
to e-p...@googlegroups.com
Some time ago for some projects here I actually wrote an extensive
library of mouse handling routines for things like this. Sadly, I
have not packaged that up enough to send out for general use. But I
can point you in the direction of some topics and tools that you will
want to explore in order to program this for yourself. Most of these
are topics in the E-Basic Help facility (what serves as the technical
reference in E-Prime; and be warned that many of their code examples
contain programming mistakes!). It will take a fair amount of inline
code, and if you can wrap most of that up into custom functions &
subroutines in the global User Script area it will make work easier.

- MouseDevice topic, esp. MouseDevice.CursorX, .CursorY, and
.GetCursorPos, and .Buttons

- Point and Rect topics

- PointInRect topic

- SlideState.HitTest topic

- Arrays

- Clock.Read topic

- Context.SetAttrib topic

- various object & sub-object .Draw methods, e.g., SlideImage.Draw topic

- transparency, e.g., SlideImage.SourceColorKey topic

- all of the Canvas topic

And of course the usual gamut of programming concepts & structures
(e.g., loops, conditionals).

For these uses, I found it generally easier to handle the mouse
directly instead of using an input mask. Then, once you can detect &
process the subject's mouse response, you can draw over various
stimuli in a number of ways. You could just use the .Draw method of
various SlideImage or other objects, possibly combined with some
judicious use of transparency; or, simply use Canvas methods to draw
directly over display objects. You could even use offscreen Canvases
with Canvas.Copy to create spectacular effects (I made things deftly
appear and disappear that way). I will have to leave the details for
you to work out.

Finally, you might explore the example programs available at the PST
web site -- I cannot think of which ones offhand, but if you browse
through their examples you may find much of use. (Do bear in mind
that many of their examples provide models of *poor* programming
practices, but they do have the virtue of providing real working
examples, and you can build from that.)

-----
David McFarlane
E-Prime training
online: http://psychology.msu.edu/Workshops_Courses/eprime.aspx
Twitter: @EPrimeMaster (twitter.com/EPrimeMaster)

David McFarlane

unread,
May 17, 2012, 2:10:35 PM5/17/12
to e-p...@googlegroups.com
Oops, I see that you already found the PST examples, so you are ahead
of me, I should have looked first! I think you are on the right track here.

-- David McFarlane
>--
>You received this message because you are subscribed to the Google
>Groups "E-Prime" group.
>To post to this group, send email to e-p...@googlegroups.com.
>To unsubscribe from this group, send email to
>e-prime+u...@googlegroups.com.
>For more options, visit this group at
>http://groups.google.com/group/e-prime?hl=en.

Beckerlab

unread,
May 20, 2012, 6:11:21 PM5/20/12
to E-Prime
Thanks for the reply David!

I have tried to combine the 2 segments, but it won't work for some
reason... I am not sure why... I am having trouble trying to decipher
what
"If c.GetAttrib("Check" & nCheck & "Image") = "checkempty.bmp" Then

c.SetAttrib "Check" & nCheck & "Image", "checkfull.bmp" "

Means? What is nCheck?

I just wanted to have a statement where If the stringhit = 1, then if
you clicked on it a check will appear, else a red X... not sure what
I'm doing wrong

Thanks in advance!

David McFarlane

unread,
May 21, 2012, 2:52:00 PM5/21/12
to e-p...@googlegroups.com
nCheck is a variable. If you look further up in the code then you
should be able to figure out what it does (that's all I would do).

-- David McFarlane
Message has been deleted

David McFarlane

unread,
May 22, 2012, 10:17:41 AM5/22/12
to E-Prime
See the "Mid", "Context.GetAttrib", and "Context.SetAttrib" topics in
the E-Basic Help facility.

As for "brackets vs. quotes"... Well, this gets indirectly to a pet
peeve of mine. You see, rational programming languages (such as C)
use the same sytax for "subroutines" and "functions", and the best
languages eliminate that distinction altogether (e.g., in C
everything is a function -- "subroutines" are nothing more than
functions that return void). Alas, VBA (and thus E-Basic) makes a
hard distinction between these two concepts. This includes different
syntax. The arguments to VBA Functions *must* be enclosed in
parentheses (), while the arguments to VBA Subroutines must *not* be
enclosed in parentheses! Sheesh! And if you fail to do that, then
you will get an error message that is entirely unrelated to the
syntax error! I cannot tell you how many hours I have lost in
debugging errors due to this absurd difference in syntax.

Anyway, if you are unsure how to use E-Prime, then you should first
follow my advice in these two essays:
http://groups.google.com/group/e-prime/browse_thread/thread/5425e03968cab428
http://groups.google.com/group/e-prime/browse_thread/thread/b0ce54870b723fc3

It would also not hurt if you took a course specific to E-Prime,
e.g., http://psychology.msu.edu/Workshops_Courses/eprime.aspx .

In short, as in any serious enterprise, you need to first take time
out to get proper training, and that means including training time in
projected deadlines.

-- David McFarlane


At 5/22/2012 09:49 AM Tuesday, Beckerlab wrote:
>Hey David,
>
>I understand the code (I think), up until here:
>
> If Mid(strHit, 1, 5) = "Check" Then
>
> Dim nCheck As Integer
> nCheck = CInt(Mid(strHit, 6, 1))
>
> Debug.Print nCheck
>
> If c.GetAttrib("Check" & nCheck & "Image") =
> "checkempty.bmp" Then
>
> c.SetAttrib "Check" & nCheck & "Image",
> "checkfull.bmp"
>
>I don't know what the numbers 5,1 and 6,1 refer to...or why GetAttrib
>and SetAttrib have a different syntax (brackets vs. quotes?)...or what
>they do. I think it's if you click on one, the other image will show,
>but I am not sure of the logistics... I am also not sure how I would
>modify for my case. I need it so it's not a single image, but all of
>the images in the attribute that change if clicked. How do I reference
>attributes like this? Attributename.Triallist?
>
>My deadline is approaching and I am still quite unsure of how to use E-
>prime...I am also not new to programming, so I am very frustrated...
>
>Thanks for any help in advance.
Message has been deleted

Beckerlab

unread,
May 22, 2012, 10:30:17 AM5/22/12
to E-Prime
Hi David, thanks for the quick reply.

I wrote my post in frustration and have deleted it...as it was just
frustration.

I have written this


'Store the number of the checkbox clicked.
Dim nCheck As Integer
nCheck = CInt(Mid(strHit, 5, 1))

Debug.Print nCheck

If c.GetAttrib("Check" & nCheck & "Image") =
c.GetAttrib("CorrectAnswer") then

c.SetAttrib "Check" & nCheck & "Image", "redbox.jpg"

Else c.GetAttrib("Check" & nCheck & "Image") = c.GetAttrib("Check" &
nCheck & "Image") then

c.SetAttrib "Check" & nCheck & "Image", "checkempty.bmp"
End If


I keep getting an error that says "Can't Assign Constant"

Susan Campbell

unread,
May 22, 2012, 10:42:23 AM5/22/12
to e-p...@googlegroups.com
Hi,

Your problem is the "Else c.GetAttrib()=c.GetAttrib() Then" line -- that should either just be "Else" with no condition, or "ElseIf" if you want to do a logical test. It's a problem with the overload of the "=" operator in VBA, I guess -- it's trying to do an assignment, since it doesn't see any reason to do a test.

HTH,
Susan
Reply all
Reply to author
Forward
0 new messages