Displaying participant's choice in E-prime3

43 views
Skip to first unread message

Carlotta Maiocchi

unread,
Mar 7, 2025, 4:21:14 AMMar 7
to E-Prime
Hi all, 
I am using E-Prime 3 to design an experiment where a Stimulus is displayed and participant has to choose between two options (one on the left of the screen and one on the right). In my idea after stimulus presentation and participant's choice I would like to display the selected stimulus with a highlight, such as a rectangle around it. I've put an Inline to save the participant's response and it works:

Dim tempRespValue As String
Dim counter As Integer
counter = 0

Do While tempRespValue = "" And counter < 100
    counter = counter + 1
    Sleep 10 ' Aspetta 10 millisecondi
    On Error Resume Next
    tempRespValue = c.GetAttrib("Stimulus.RESP")
    If Err.Number <> 0 Then
        tempRespValue = ""
        Err.Clear
    End If
    On Error GoTo 0
Loop

If tempRespValue = "" Then
    'Debug.Print "⚠ ATTENZIONE: RESP ancora vuoto dopo attesa! Assegno valore di fallback..."
    tempRespValue = "b" ' oppure "n", a seconda del valore predefinito desiderato
End If

c.SetAttrib "Stimulus.RESP", tempRespValue

Debug.print "Stimulus.RESP: " & Stimulus.RESP

And I am trying to drawing a rectangle but I can't draw it on a Slide object representing the stimulus. Does anyone have an idea how to do it?

P.s. this is the Inline I'm using to draw the rectangle
Dim cnvs As Canvas
Set cnvs = Display.Canvas
Dim risposta As String

Dim offScreenCnvs As Canvas
Set offScreenCnvs = Display.CreateCanvas

offScreenCnvs.PenWidth = 5

Dim theRect As Rect
theRect.Left = 0
theRect.Top = 0
theRect.Right = Display.XRes
theRect.Bottom = Display.YRes

risposta = Stimulus.RESP
c.SetAttrib "Stimulus.RESP", risposta

Debug.Print "Risposta effettiva: " & risposta

Dim LEFTXPOS As Integer
Dim RIGHTXPOS As Integer
Dim YPOS As Integer
Dim SIZE As Integer
Dim RECT_WIDTH As Integer
Dim RECT_HEIGHT As Integer

LEFTXPOS = Display.XRes * 0.25 ' Posizione a sinistra (25% dello schermo)
RIGHTXPOS = Display.XRes * 0.50 ' Posizione a destra (75% dello schermo)
YPOS = Display.YRes * 0.40      ' Posizione verticale (centro)
SIZE = 50                     ' Dimensione del quadrato
RECT_WIDTH = SIZE       ' La larghezza del rettangolo rimane uguale a SIZE
RECT_HEIGHT = SIZE * 7  ' L'altezza diventa il doppio

offScreenCnvs.PenColor = CColor("255,0,0") ' Rosso in formato stringa
offScreenCnvs.PenWidth = 5 ' Bordo

offScreenCnvs.Clear

If risposta = "b" Then
    Debug.Print "Disegno il quadrato a sinistra"
    offScreenCnvs.Rectangle LEFTXPOS - (RECT_WIDTH / 2), YPOS - (RECT_HEIGHT / 2), LEFTXPOS + (RECT_WIDTH  / 2), YPOS + (RECT_HEIGHT  / 2)
ElseIf risposta = "n" Then
    Debug.Print "Disegno il quadrato a destra"
    offScreenCnvs.Rectangle RIGHTXPOS - (RECT_WIDTH  / 2), YPOS - (RECT_HEIGHT  / 2), LEFTXPOS + (RECT_WIDTH  / 2), YPOS + (RECT_HEIGHT  / 2)
Else
    Debug.Print "Errore: Nessuna risposta valida ricevuta."
End If

cnvs.Copy offScreenCnvs, theRect, theRect

Sleep 1000

Reply all
Reply to author
Forward
0 new messages