Title | Useful E-Prime Script |
Version | 5th June, 2023 |
A summery regarding E-Prime script.
In designing experiments, to avoid the influence of irrelevant variables caused by subject expectancy effects, it is necessary to randomize the presentation time of masked stimuli.
Method 1
Object.duration = Random (200,600)
Method 2
Object.duration = 2 * Random (100,300)
To avoid the fatigue effect caused by long-term experiments, it is necessary to set rest intervals between trials.
Define E-Prime User Script
Dim N as Integer
Method 1
c.GetAttrib (“ListName.sample”)
if N mod 40 = 0 Then
msgbox (“It’s time to rest ! “Press SPACE to continue”)
End If
Method 2
N=N+1
If N Mod 40 = 0 Then
GoTo label1
Else
GoTo label2
End If
Choose between practice and formal testing, it can be automatic (based on accuracy) or manual (based on selection).
Method 1
If Object.RESP= 1 Then Goto Label1
Else
Goto Label2
End If
Method 2
Define E-Prime User Script
Public N as Integer
If Object.ACC=1 Then
N = N+1
End If
If (N/PracticeList.Size)<0.80 Then
N=0
GoTo label3
Else
GoTo label4
End If
Method 1
Experiment properties - Devices add Parallel Port
Method 2
Object.OnsetSignalEnabled = True
Object.OnsetSignalPort = &H0378
'Open Port
Object.OffsetSignalEnabled = True
Object.OnsetSignalPort = &H0378
'Close Port
Parallel Port
WritePort &H0378, 0
Object.OnsetSignalData = c.GetAttrib ("Code")
Serial Port
Object.Tasks.Reset If
Serial.GetState() = ebStateOpen Then
Object.Tasks.Add Serial.CreateTask ("Object.OnsetTime", 0, "WriteByte", "(custom)", c.GetAttrib("Mark"), "Byte", True)
End If
If Serial.GetState() = ebStateOpen Then
Object.Tasks.Add Serial.CreateTask ("Object.OnsetTime", 10, "WriteByte", "(custom)", ebDigit_0, "Byte", True)
End If
Socket Port
Object.Tasks.Reset
Object.Tasks.Add Socket.CreateTask("Object.OnsetTime", 0, "WriteByte", "(custom)", c.GetAttrib("Code"), "Byte", True)
Parallel Port
If Object.Acc = 1 then
WritePort &H0378,77
Else If Object.Acc = 0 then
WritePort &H0378,88
else
WritePort &H378,99
End If
End If
Serial Port
Experiment properties - Devices add Parallel Port
Const sleeptime As Integer = 5
If target.acc=1 Then
Serial.WriteByte 77
Else Serial.WriteByte 88
End If
Sleep(sleeptime)
Serial.WriteByte 0
Socket Port
Define E-Prime User Script
Const sleeptime As Integer = 5
If target.acc=1 Then
Socket.WriteByte 77
Else Socket.WriteByte 88
End If
Sleep(sleeptime)
Socket.WriteByte 0
Custom response in a TextDisplay Object
If Object.ACC = 1 Then
Feedback.Text ="Correct!"
Feedback.ForeColor = Color("Blue")
Feedback.FontSize = 28
Else
Feedback.Text ="Wrong!"
Feedback.ForeColor = Color("DarkRed")
Feedback.FontSize = 28
End If
For the color code pleae refer to https://shorturl.at/eiPS2 (PST support site) for reference.
E-Prime Command Reference https://pstnet.com/ecr/
PST support service https://support.pstnet.com/hc/en-us
PST YouTube Channel https://www.youtube.com/@PSTNET
E-Prime Google Group https://groups.google.com/g/e-prime
[TBC]