Advance to different SlideStates for different responses

Paul Groot pfc.groot at gmail.com
Sat Aug 25 08:35:54 UTC 2012


Hi Erin

I think you missed one important ingredient: the HitTest method. This
function is required to determine which object was selected. It will return
the name of the object. The GetCursorPos function is also required to get
the current cursor coordinates because the HitTest function requires a
screen coordinate. The Stimulus slide should contain a mouse input mask and
have a duration of infinite because you would like to catch a single mouse
click. The InputMask Correct attribute is of no use because you will have
to check the accuracy explicitly.

Here is a small example script that could work. This inline script assumes
you also added a list attribute with the name CorrectImage. It contains
values L or R to indicate correct left or right selection. These L/R values
should be identical to the names of the SlideImage objects!

Dim ptMouse As Point
Dim strHit As String
Dim strCorrectImage As String

Dim theState as SlideState
Set theState = Stimulus.States (Stimulus.ActiveState)

'get current mouse coordinate
Mouse.GetCursorPos ptMouse.x, ptMouse.y

'and check which object was selected (if any)
strHit = theState.HitTest(ptMouse.x, ptMouse.y)

'get the correct selection from the trial list
'This attribute should contain 'L' or 'R' in this example
strCorrectImage = c.GetAttrib("CorrectImage")

'compare both strings ignoring case
'ACC is not set automatically, so must do this explicitly
If strcomp(strHit,strCorrectImage,1)=0 Then
   Stimulus.ACC = 1
   Select Case UCase(strCorrectImage)
   Case "L"
      ImageFeedback.ActiveState = "LeftCorrect"
   Case "R"
      ImageFeedback.ActiveState = "RightCorrect"
   Case Else
      Debug.Assert False
   End Select

Else
   Stimulus.ACC = 0
   ImageFeedback.ActiveState = "Incorrect"
End If

You also might add the following lines before and after the Stimulus slide
to show and hide the cursor:

Mouse.ShowCursor True
Mouse.ShowCursor False

Hope I didn't make any mistakes in the example because I didn't have the
opportunity to test it myself.

Cheers
Paul



2012/8/24 Erin <erin.siebert at gmail.com>

> Hello everyone,
> I have a simple experiment that displays two images on the screen.  The
> two SlideImages are named "LeftImage" and "RightImage," and are diplayed on
> a Slide named "Stimulus."  On each trial, one image is correct, and one is
> incorrect; responses are made with a mouse click on an image.
>
> After a response is made, I want to advance to the Slide
> "ImageFeedback," displaying one of three SlideStates "LeftCorrect,"
> "RightCorrect," or "Incorrect," depending on the response.
>
> I am tring to figure out what the appropriate inline script would be to
> accomplish this.  I am thinking something similar to the following may
> work, but I know this isn't quite right:
>
>
> If strHit = c.GetAttrib("LeftImage") and Stimulus.ACC=1, Then
> Set ImageFeedback.ActiveState = "LeftCorrect"
>
> Else
>
> If strHit = c.GetAttrib("RightImage") and Stimulus.ACC=1, Then
> Set ImageFeedback.ActiveState = "RightCorrect"
>
> Else
>
> If Stimulus.ACC=0,
> Set ImageFeedback.ActiveState = "Incorrect"
>
> End If
>
>
>
> I looked at the example programs "Response Areas For Mouse Input" and
> "LoadImageUpunMouseClick."  I also searched though the Google Group, and
> found some similar posts, but was unable to come up with an inline script
> solution that worked.  Any help would be very appreciated.  I will post the
> solution that I get to work.  Thanks so much!
>
>
>
> Erin
>
>
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/e-prime/-/xIDmOlnPo4YJ.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 https://groups.google.com/groups/opt_out.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.linguistlist.org/pipermail/eprime/attachments/20120825/a84e6a6b/attachment.htm>


More information about the Eprime mailing list