' ' ' ' C:\Documents and Settings\Sunjing Ji\Desktop\simple.ebs ' Generated on: 10/2/2008 23:35:56 ' ' ' This file generated with E-Studio interface. ' E-Prime Copyright © 1996-2005 Psychology Software Tools. ' ALL RIGHTS RESERVED ' ' Legal use of this experiment script requires a full E-Prime or Runtime License. ' ' ' Author: ' (University of Arizona) ' ' ' ' Option CStrings On Dim ebContext as Context '-------------------------------------------------------------------------- ' Class Declarations '-------------------------------------------------------------------------- '-------------------------------------------------------------------------- 'InitTextDisplayDefaults '-------------------------------------------------------------------------- Sub InitTextDisplayDefaults(theTextDisplay As TextDisplay) If theTextDisplay Is Nothing Then Exit Sub theTextDisplay.X = "center" theTextDisplay.Y = "center" theTextDisplay.Width = "100%" theTextDisplay.Height = "100%" theTextDisplay.ForeColor = CColor("black") theTextDisplay.BackColor = CColor("white") theTextDisplay.BackStyle = "opaque" theTextDisplay.BorderColor = CColor("black") theTextDisplay.BorderWidth = CLng("0") theTextDisplay.XAlign = "center" theTextDisplay.YAlign = "center" theTextDisplay.AlignHorizontal = "center" theTextDisplay.AlignVertical = "center" theTextDisplay.WordWrap = True theTextDisplay.ClearAfter = CLogical("No") theTextDisplay.FontName = "Courier New" theTextDisplay.FontSize = "18" theTextDisplay.FontBold = CLogical("Yes") theTextDisplay.FontItalic = CLogical("No") theTextDisplay.FontUnderline = CLogical("No") theTextDisplay.FontStrikeout = CLogical("No") End Sub '-------------------------------------------------------------------------- 'InitSlideStateDefaults '-------------------------------------------------------------------------- Sub InitSlideStateDefaults(theSlideState As SlideState) If theSlideState Is Nothing Then Exit Sub theSlideState.X = "center" theSlideState.Y = "center" theSlideState.Width = "100%" theSlideState.Height = "100%" theSlideState.BackColor = CColor("white") theSlideState.BackStyle = "opaque" theSlideState.BorderColor = CColor("black") theSlideState.BorderWidth = CLng("0") theSlideState.XAlign = "center" theSlideState.YAlign = "center" theSlideState.ClearAfter = CLogical("No") theSlideState.Enabled = CLogical("Yes") End Sub '-------------------------------------------------------------------------- 'InitSlideVisualStimDefaults '-------------------------------------------------------------------------- Sub InitSlideVisualStimDefaults(theSlideVisualStim As SlideVisualStim) If theSlideVisualStim Is Nothing Then Exit Sub theSlideVisualStim.X = "center" theSlideVisualStim.Y = "center" theSlideVisualStim.Width = "25%" theSlideVisualStim.Height = "25%" theSlideVisualStim.ForeColor = CColor("black") theSlideVisualStim.BackColor = CColor("white") theSlideVisualStim.BackStyle = "opaque" theSlideVisualStim.BorderColor = CColor("black") theSlideVisualStim.BorderWidth = CLng("0") theSlideVisualStim.XAlign = "center" theSlideVisualStim.YAlign = "center" theSlideVisualStim.AlignHorizontal = "center" theSlideVisualStim.AlignVertical = "center" End Sub '-------------------------------------------------------------------------- 'InitSlideTextDefaults '-------------------------------------------------------------------------- Sub InitSlideTextDefaults(theSlideText As SlideText) If theSlideText Is Nothing Then Exit Sub InitSlideVisualStimDefaults theSlideText theSlideText.WordWrap = True theSlideText.FontName = "Courier New" theSlideText.FontSize = "18" theSlideText.FontBold = CLogical("Yes") theSlideText.FontItalic = CLogical("No") theSlideText.FontUnderline = CLogical("No") theSlideText.FontStrikeout = CLogical("No") End Sub '-------------------------------------------------------------------------- 'InitSlideImageDefaults '-------------------------------------------------------------------------- Sub InitSlideImageDefaults(theSlideImage As SlideImage) If theSlideImage Is Nothing Then Exit Sub InitSlideVisualStimDefaults theSlideImage theSlideImage.Stretch = CLogical("No") theSlideImage.MirrorLeftRight = CLogical("No") theSlideImage.MirrorUpDown = CLogical("No") theSlideImage.UseSourceColorKey = CLogical("No") theSlideImage.SourceColorKey = CColor("black") End Sub '-------------------------------------------------------------------------- 'InitSlideSoundBufferDefaults '-------------------------------------------------------------------------- Sub InitSlideSoundBufferDefaults(theSoundBuffer As SoundBuffer) If theSoundBuffer Is Nothing Then Exit Sub theSoundBuffer.Loop = CLogical("No") theSoundBuffer.StopAfter = CLogical("Yes") theSoundBuffer.StartOffset = "0" theSoundBuffer.StopOffset = "0" End Sub '-------------------------------------------------------------------------- ' Instance Declarations '-------------------------------------------------------------------------- Dim Display As DisplayDevice Dim Sound As SoundDevice Dim Keyboard As KeyboardDevice Dim Mouse As MouseDevice Dim SessionProc As Procedure Dim Instructions As TextDisplay Dim InstructionsEchoClients As EchoClientCollection Dim FirstRun As List Dim FirstProc As Procedure Dim Slide1 As Slide Dim Slide1EchoClients As EchoClientCollection Dim Slide1_State As SlideState Dim Slide1_SlideText As SlideText Dim FeedbackDisplay1 As FeedbackDisplay Dim FeedbackDisplay1_State As SlideState Dim FeedbackDisplay1_SlideText As SlideText Dim Wait1 As Wait '-------------------------------------------------------------------------- ' Package Declare Script '-------------------------------------------------------------------------- '-------------------------------------------------------------------------- ' User Script '-------------------------------------------------------------------------- '-------------------------------------------------------------------------- ' Package Global Script '-------------------------------------------------------------------------- '-------------------------------------------------------------------------- ' Package Routines '-------------------------------------------------------------------------- '-------------------------------------------------------------------------- ' Implementation '-------------------------------------------------------------------------- Sub SessionProc_Run(c as Context) Instructions.InputMasks.Reset If Keyboard.GetState() = ebStateOpen Then InstructionsEchoClients.RemoveAll Instructions.InputMasks.Add Keyboard.CreateInputMask("{ANY}", "", CLng(Instructions.Duration), CLng("1"), ebEndResponseActionTerminate, CLogical("Yes"), "", "", "ResponseMode:All ProcessBackspace:Yes") End If Instructions.Run FirstRun.Run c #If RUNTIME_VERSION_MAJOR > 1 Or (RUNTIME_VERSION_MAJOR = 1 And RUNTIME_VERSION_MINOR >= 2) Then ' Log clock timing information c.SetAttrib "Clock.Information", Clock.Information #End If c.Log End Sub Sub FirstProc_Run(c as Context) Select Case Slide1.ActiveState Case "Default" Set Slide1_SlideText = CSlideText(Slide1.States.Item("Default").Objects(1)) Slide1_SlideText.Text = c.GetAttrib("Word") Set Slide1_SlideText = Nothing End Select Slide1.InputMasks.Reset If Keyboard.GetState() = ebStateOpen Then Slide1EchoClients.RemoveAll Slide1.InputMasks.Add Keyboard.CreateInputMask("yn", c.GetAttrib("Correct"), CLng(Slide1.Duration), CLng("1"), ebEndResponseActionTerminate, CLogical("Yes"), "", "", "ResponseMode:All ProcessBackspace:Yes") End If Slide1.Run c.SetAttrib Slide1.Name & ".RTTime", Slide1.RTTime c.SetAttrib Slide1.Name & ".ACC", Slide1.ACC c.SetAttrib Slide1.Name & ".RT", Slide1.RT c.SetAttrib Slide1.Name & ".RESP", Slide1.RESP c.SetAttrib Slide1.Name & ".CRESP", Slide1.CRESP Wait1.Run If Slide1.ACC = 1 Then 'Set the ActiveState to Correct FeedbackDisplay1.ActiveState = "Correct" 'Add an observation to the accuracy stats FeedbackDisplay1.AccStats.AddObservation Slide1.Acc 'Add an observation to the response time stats ' unless the user did not respond and the author ' does not want us to add the no response RT If Len(Slide1.RESP) > 0 Then FeedbackDisplay1.RTStats.AddObservation Slide1.RT FeedbackDisplay1.CorrectRTStats.AddObservation Slide1.RT End If Else 'Is it incorrect or no response? If Len(Slide1.RESP) > 0 Then 'Set the ActiveState to Incorrect FeedbackDisplay1.ActiveState = "Incorrect" 'Set the accuracy stats FeedbackDisplay1.AccStats.AddObservation Slide1.Acc 'Set the RT stats FeedbackDisplay1.RTStats.AddObservation Slide1.RT FeedbackDisplay1.IncorrectRTStats.AddObservation Slide1.RT Else 'Set the ActiveState to NoResponse FeedbackDisplay1.ActiveState = "NoResponse" 'Does the author want to consider a NoResponse ' to sum as an incorrect response in the ACC stats? If FeedbackDisplay1.CollectNoRespACCStats = True Then FeedbackDisplay1.AccStats.AddObservation Slide1.Acc End If End If End If Select Case FeedbackDisplay1.ActiveState Case "Correct" Set FeedbackDisplay1_SlideText = CSlideText(FeedbackDisplay1.States.Item("Correct").Objects(1)) FeedbackDisplay1_SlideText.Text = "" & _ Format$((FeedbackDisplay1.ACCStats.Mean / FeedbackDisplay1.ACCDivisor),FeedbackDisplay1.ACCFormat) & _ " Average Percent Correct" Set FeedbackDisplay1_SlideText = Nothing Set FeedbackDisplay1_SlideText = CSlideText(FeedbackDisplay1.States.Item("Correct").Objects(2)) FeedbackDisplay1_SlideText.Text = "" & _ Format$((Slide1.RT / FeedbackDisplay1.RTDivisor), FeedbackDisplay1.RTFormat) & _ " Seconds Response Time" Set FeedbackDisplay1_SlideText = Nothing Set FeedbackDisplay1_SlideText = CSlideText(FeedbackDisplay1.States.Item("Correct").Objects(3)) Set FeedbackDisplay1_SlideText = Nothing Case "Incorrect" Set FeedbackDisplay1_SlideText = CSlideText(FeedbackDisplay1.States.Item("Incorrect").Objects(1)) FeedbackDisplay1_SlideText.Text = "" & _ Format$((FeedbackDisplay1.ACCStats.Mean / FeedbackDisplay1.ACCDivisor),FeedbackDisplay1.ACCFormat) & _ " Average Percent Correct" Set FeedbackDisplay1_SlideText = Nothing Set FeedbackDisplay1_SlideText = CSlideText(FeedbackDisplay1.States.Item("Incorrect").Objects(2)) FeedbackDisplay1_SlideText.Text = "" & _ Format$((Slide1.RT / FeedbackDisplay1.RTDivisor), FeedbackDisplay1.RTFormat) & _ " Seconds Response Time" Set FeedbackDisplay1_SlideText = Nothing Set FeedbackDisplay1_SlideText = CSlideText(FeedbackDisplay1.States.Item("Incorrect").Objects(3)) Set FeedbackDisplay1_SlideText = Nothing Case "NoResponse" Set FeedbackDisplay1_SlideText = CSlideText(FeedbackDisplay1.States.Item("NoResponse").Objects(1)) Set FeedbackDisplay1_SlideText = Nothing Case "Pending" End Select FeedbackDisplay1.Run c.SetAttrib Slide1.Name & ".RTTime", Slide1.RTTime c.SetAttrib Slide1.Name & ".ACC", Slide1.ACC c.SetAttrib Slide1.Name & ".RT", Slide1.RT c.SetAttrib Slide1.Name & ".RESP", Slide1.RESP c.SetAttrib Slide1.Name & ".CRESP", Slide1.CRESP c.Log End Sub '-------------------------------------------------------------------------- ' InitDevices ' '-------------------------------------------------------------------------- Sub InitDevices(c As Context) SetOSThreadPriority 3 Set Display = New DisplayDevice Display.Name = "Display" Dim DisplayDisplayDeviceInfo As DisplayDeviceInfo DisplayDisplayDeviceInfo.XRes = 640 DisplayDisplayDeviceInfo.YRes = 480 DisplayDisplayDeviceInfo.ColorDepth = 16 DisplayDisplayDeviceInfo.RefreshRate = 0 DisplayDisplayDeviceInfo.NumPages = 0 'Load values from context if they exist If c.AttribExists(Display.Name & ".XRes") Then DisplayDisplayDeviceInfo.XRes = CLng(c.GetAttrib(Display.Name & ".XRes")) If c.AttribExists(Display.Name & ".YRes") Then DisplayDisplayDeviceInfo.YRes = CLng(c.GetAttrib(Display.Name & ".YRes")) If c.AttribExists(Display.Name & ".ColorDepth") Then DisplayDisplayDeviceInfo.ColorDepth = CLng(c.GetAttrib(Display.Name & ".ColorDepth")) 'Open the device, unless the context values indicate otherwise Dim DisplayOpen As Boolean DisplayOpen = True If c.AttribExists(Display.Name & ".Open") Then DisplayOpen = CLogical(c.GetAttrib(Display.Name & ".Open")) If DisplayOpen = True Then Display.Open DisplayDisplayDeviceInfo c.SetAttrib Display.Name & ".RefreshRate", Format$(Display.CalculatedRefreshRate, "0.000") End If Set Sound = New SoundDevice Sound.Name = "Sound" Dim SoundSoundOutDeviceInfo As SoundDeviceInfo SoundSoundOutDeviceInfo.Channels = 2 SoundSoundOutDeviceInfo.SamplesPerSecond = 22050 SoundSoundOutDeviceInfo.BitsPerSample = 16 'Load values from context if they exist If c.AttribExists(Sound.Name & ".Channels") Then SoundSoundOutDeviceInfo.Channels = CLng(c.GetAttrib(Sound.Name & ".Channels")) If c.AttribExists(Sound.Name & ".SamplesPerSecond") Then SoundSoundOutDeviceInfo.SamplesPerSecond = CLng(c.GetAttrib(Sound.Name & ".SamplesPerSecond")) If c.AttribExists(Sound.Name & ".BitsPerSample") Then SoundSoundOutDeviceInfo.BitsPerSample = CLng(c.GetAttrib(Sound.Name & ".BitsPerSample")) Set Keyboard = New KeyboardDevice Keyboard.Name = "Keyboard" Dim KeyboardKeyboardDeviceInfo as KeyboardDeviceInfo KeyboardKeyboardDeviceInfo.CollectionMode = ebPressesOnly KeyboardKeyboardDeviceInfo.CapsLock = ebCapsLockOff KeyboardKeyboardDeviceInfo.NumLock = ebNumLockOn 'Load values from context if they exist If c.AttribExists(Keyboard.Name & ".CollectionMode") Then KeyboardKeyboardDeviceInfo.CollectionMode = CLng(c.GetAttrib(Keyboard.Name & ".CollectionMode")) If c.AttribExists(Keyboard.Name & ".CapsLock") Then KeyboardKeyboardDeviceInfo.CapsLock = CLng(c.GetAttrib(Keyboard.Name & ".CapsLock")) If c.AttribExists(Keyboard.Name & ".NumLock") Then KeyboardKeyboardDeviceInfo.NumLock = CLng(c.GetAttrib(Keyboard.Name & ".NumLock")) If c.AttribExists(Keyboard.Name & ".EmulateDeviceName") Then KeyboardKeyboardDeviceInfo.EmulateDeviceName = c.GetAttrib(Keyboard.Name & ".EmulateDeviceName") 'Open the device, unless the context values indicate otherwise Dim KeyboardOpen As Boolean KeyboardOpen = True If c.AttribExists(Keyboard.Name & ".Open") Then KeyboardOpen = CLogical(c.GetAttrib(Keyboard.Name & ".Open")) If KeyboardOpen = True Then Keyboard.Open KeyboardKeyboardDeviceInfo End If Set Mouse = New MouseDevice Mouse.Name = "Mouse" Dim MouseMouseDeviceInfo as MouseDeviceInfo MouseMouseDeviceInfo.OpenMode = ebMouseOpenModeDirect MouseMouseDeviceInfo.CollectionMode = ebPressesOnly MouseMouseDeviceInfo.ShowCursor = False 'Load values from context if they exist If c.AttribExists(Mouse.Name & ".OpenMode") Then MouseMouseDeviceInfo.OpenMode = CLng(c.GetAttrib(Mouse.Name & ".OpenMode")) If c.AttribExists(Mouse.Name & ".CollectionMode") Then MouseMouseDeviceInfo.CollectionMode = CLng(c.GetAttrib(Mouse.Name & ".CollectionMode")) If c.AttribExists(Mouse.Name & ".ShowCursor") Then MouseMouseDeviceInfo.ShowCursor = CLogical(c.GetAttrib(Mouse.Name & ".ShowCursor")) If c.AttribExists(Mouse.Name & ".EmulateDeviceName") Then MouseMouseDeviceInfo.EmulateDeviceName = c.GetAttrib(Mouse.Name & ".EmulateDeviceName") 'Open the device, unless the context values indicate otherwise Dim MouseOpen As Boolean MouseOpen = True If c.AttribExists(Mouse.Name & ".Open") Then MouseOpen = CLogical(c.GetAttrib(Mouse.Name & ".Open")) If MouseOpen = True Then Mouse.Open MouseMouseDeviceInfo End If SetOSThreadPriority 0 End Sub '-------------------------------------------------------------------------- ' InitObjects ' '-------------------------------------------------------------------------- Sub InitObjects(c As Context) Set SessionProc = New Procedure SessionProc.Name = "SessionProc" SessionProc.Tag = "" SessionProc.Subroutine = "SessionProc_Run" Set Instructions = New TextDisplay Instructions.Name = "Instructions" Instructions.Tag = "" Set InstructionsEchoClients = New EchoClientCollection InitTextDisplayDefaults Instructions Instructions.Text = "hello, welcome to the experiment.\n\nyou will see words and be asked to judge whether they are real words or not.\n\nPress any key to begin" Instructions.BackColor = CColor("navy") Instructions.ForeColor = CColor("silver") Instructions.Duration = CLng("-1") Instructions.TimingMode = ebTimingModeEvent Instructions.PreRelease = Val("0") Instructions.OnsetSync = 1 Instructions.OffsetSync = 0 Set FirstRun = New List FirstRun.Name = "FirstRun" FirstRun.Tag = "" 'Initialization for FirstRun Set FirstRun.Order = New RandomOrder Set FirstRun.Deletion = NoDeletion FirstRun.ResetEveryRun = False ' Create the column headings FirstRun.AddAttrib "Word" FirstRun.AddAttrib "Correct" FirstRun.Filename = "" FirstRun.LoadMethod = ebLoadMethodEmbedded FirstRun.Load Set FirstRun.TerminateCondition = Cycles(1) Set FirstRun.ResetCondition = Samples(4) FirstRun.Reset Set FirstProc = New Procedure FirstProc.Name = "FirstProc" FirstProc.Tag = "" FirstProc.Subroutine = "FirstProc_Run" Set Slide1 = New Slide Slide1.Name = "Slide1" Slide1.Tag = "" Set Slide1EchoClients = New EchoClientCollection Slide1.Duration = CLng("-1") Slide1.TimingMode = ebTimingModeEvent Slide1.PreRelease = Val("0") Slide1.OnsetSync = 1 Slide1.OffsetSync = 0 Set Slide1_State = New SlideState Slide1_State.Name = "Default" InitSlideStateDefaults Slide1_State Slide1.States.Add Slide1_State, "Default" Set Slide1_SlideText = New SlideText Slide1_SlideText.Name = "Text1" InitSlideTextDefaults Slide1_SlideText Slide1_SlideText.X = "284" Slide1_SlideText.Y = "228" Slide1_SlideText.Width = "100%" Slide1_SlideText.Height = "100%" Slide1_SlideText.BackStyle = "transparent" Slide1.States.Item("Default").Objects.Add Slide1_SlideText, "Text1" Slide1.ActiveState = "Default" Set FeedbackDisplay1 = New FeedbackDisplay FeedbackDisplay1.Name = "FeedbackDisplay1" FeedbackDisplay1.Tag = "" FeedbackDisplay1.ACCDivisor = "1.0" FeedbackDisplay1.ACCFormat = "Percent" FeedbackDisplay1.RTDivisor = "1000.0" FeedbackDisplay1.RTFormat = "###0.000" FeedbackDisplay1.CorrectRTDivisor = "1000.0" FeedbackDisplay1.CorrectRTFormat = "###0.000" FeedbackDisplay1.IncorrectRTDivisor = "1000.0" FeedbackDisplay1.IncorrectRTFormat = "###0.000" FeedbackDisplay1.CollectNoRespACCStats = True FeedbackDisplay1.Duration = CLng("1500") FeedbackDisplay1.TimingMode = ebTimingModeEvent FeedbackDisplay1.PreRelease = Val("0") FeedbackDisplay1.OnsetSync = 1 FeedbackDisplay1.OffsetSync = 0 Set FeedbackDisplay1_State = New SlideState FeedbackDisplay1_State.Name = "Correct" InitSlideStateDefaults FeedbackDisplay1_State FeedbackDisplay1.States.Add FeedbackDisplay1_State, "Correct" Set FeedbackDisplay1_SlideText = New SlideText FeedbackDisplay1_SlideText.Name = "Text3" InitSlideTextDefaults FeedbackDisplay1_SlideText FeedbackDisplay1_SlideText.Y = "45%" FeedbackDisplay1_SlideText.Width = "75%" FeedbackDisplay1_SlideText.Height = "10%" FeedbackDisplay1_SlideText.ForeColor = CColor("blue") FeedbackDisplay1_SlideText.BackStyle = "transparent" FeedbackDisplay1_SlideText.AlignHorizontal = "left" FeedbackDisplay1.States.Item("Correct").Objects.Add FeedbackDisplay1_SlideText, "Text3" Set FeedbackDisplay1_SlideText = New SlideText FeedbackDisplay1_SlideText.Name = "Text2" InitSlideTextDefaults FeedbackDisplay1_SlideText FeedbackDisplay1_SlideText.Y = "35%" FeedbackDisplay1_SlideText.Width = "75%" FeedbackDisplay1_SlideText.Height = "10%" FeedbackDisplay1_SlideText.ForeColor = CColor("blue") FeedbackDisplay1_SlideText.BackStyle = "transparent" FeedbackDisplay1_SlideText.AlignHorizontal = "left" FeedbackDisplay1.States.Item("Correct").Objects.Add FeedbackDisplay1_SlideText, "Text2" Set FeedbackDisplay1_SlideText = New SlideText FeedbackDisplay1_SlideText.Name = "Text1" InitSlideTextDefaults FeedbackDisplay1_SlideText FeedbackDisplay1_SlideText.Text = "Correct!" FeedbackDisplay1_SlideText.Y = "20%" FeedbackDisplay1_SlideText.Width = "75%" FeedbackDisplay1_SlideText.Height = "10%" FeedbackDisplay1_SlideText.ForeColor = CColor("blue") FeedbackDisplay1_SlideText.BackStyle = "transparent" FeedbackDisplay1_SlideText.AlignHorizontal = "left" FeedbackDisplay1.States.Item("Correct").Objects.Add FeedbackDisplay1_SlideText, "Text1" Set FeedbackDisplay1_State = New SlideState FeedbackDisplay1_State.Name = "Incorrect" InitSlideStateDefaults FeedbackDisplay1_State FeedbackDisplay1.States.Add FeedbackDisplay1_State, "Incorrect" Set FeedbackDisplay1_SlideText = New SlideText FeedbackDisplay1_SlideText.Name = "Text3" InitSlideTextDefaults FeedbackDisplay1_SlideText FeedbackDisplay1_SlideText.Y = "45%" FeedbackDisplay1_SlideText.Width = "75%" FeedbackDisplay1_SlideText.Height = "10%" FeedbackDisplay1_SlideText.ForeColor = CColor("red") FeedbackDisplay1_SlideText.BackStyle = "transparent" FeedbackDisplay1_SlideText.AlignHorizontal = "left" FeedbackDisplay1.States.Item("Incorrect").Objects.Add FeedbackDisplay1_SlideText, "Text3" Set FeedbackDisplay1_SlideText = New SlideText FeedbackDisplay1_SlideText.Name = "Text2" InitSlideTextDefaults FeedbackDisplay1_SlideText FeedbackDisplay1_SlideText.Y = "35%" FeedbackDisplay1_SlideText.Width = "75%" FeedbackDisplay1_SlideText.Height = "10%" FeedbackDisplay1_SlideText.ForeColor = CColor("red") FeedbackDisplay1_SlideText.BackStyle = "transparent" FeedbackDisplay1_SlideText.AlignHorizontal = "left" FeedbackDisplay1.States.Item("Incorrect").Objects.Add FeedbackDisplay1_SlideText, "Text2" Set FeedbackDisplay1_SlideText = New SlideText FeedbackDisplay1_SlideText.Name = "Text1" InitSlideTextDefaults FeedbackDisplay1_SlideText FeedbackDisplay1_SlideText.Text = "Incorrect" FeedbackDisplay1_SlideText.Y = "20%" FeedbackDisplay1_SlideText.Width = "75%" FeedbackDisplay1_SlideText.Height = "10%" FeedbackDisplay1_SlideText.ForeColor = CColor("red") FeedbackDisplay1_SlideText.BackStyle = "transparent" FeedbackDisplay1_SlideText.AlignHorizontal = "left" FeedbackDisplay1.States.Item("Incorrect").Objects.Add FeedbackDisplay1_SlideText, "Text1" Set FeedbackDisplay1_State = New SlideState FeedbackDisplay1_State.Name = "NoResponse" InitSlideStateDefaults FeedbackDisplay1_State FeedbackDisplay1.States.Add FeedbackDisplay1_State, "NoResponse" Set FeedbackDisplay1_SlideText = New SlideText FeedbackDisplay1_SlideText.Name = "Text1" InitSlideTextDefaults FeedbackDisplay1_SlideText FeedbackDisplay1_SlideText.Text = "No response detected." FeedbackDisplay1_SlideText.Y = "20%" FeedbackDisplay1_SlideText.Width = "75%" FeedbackDisplay1_SlideText.Height = "10%" FeedbackDisplay1_SlideText.ForeColor = CColor("red") FeedbackDisplay1_SlideText.BackStyle = "transparent" FeedbackDisplay1_SlideText.AlignHorizontal = "left" FeedbackDisplay1.States.Item("NoResponse").Objects.Add FeedbackDisplay1_SlideText, "Text1" Set FeedbackDisplay1_State = New SlideState FeedbackDisplay1_State.Name = "Pending" InitSlideStateDefaults FeedbackDisplay1_State FeedbackDisplay1.States.Add FeedbackDisplay1_State, "Pending" Set Wait1 = New Wait Wait1.Name = "Wait1" Wait1.Tag = "" Wait1.Duration = CLng("200") Wait1.TimingMode = ebTimingModeEvent Wait1.PreRelease = Val("0") Wait1.OnsetSync = 1 Wait1.OffsetSync = 0 End Sub '-------------------------------------------------------------------------- ' InitPackages ' '-------------------------------------------------------------------------- Sub InitPackages(c As Context) End Sub '-------------------------------------------------------------------------- ' InitGlobals ' '-------------------------------------------------------------------------- Sub InitGlobals(c As Context) End Sub '-------------------------------------------------------------------------- '-------------------------------------------------------------------------- '-------------------------------------------------------------------------- ' UnInitGlobals '-------------------------------------------------------------------------- Sub UnInitGlobals() End Sub '-------------------------------------------------------------------------- ' UnInitDevices '-------------------------------------------------------------------------- Sub UnInitDevices() Display.Close Set Display = Nothing Keyboard.Close Set Keyboard = Nothing Mouse.Close Set Mouse = Nothing End Sub '-------------------------------------------------------------------------- '-------------------------------------------------------------------------- ' UnInitPackages '-------------------------------------------------------------------------- Sub UnInitPackages() End Sub '-------------------------------------------------------------------------- ' UnInitObjects ' '-------------------------------------------------------------------------- Sub UnInitObjects() Set SessionProc = Nothing Set Instructions = Nothing Set InstructionsEchoClients = Nothing Set FirstRun = Nothing Set FirstProc = Nothing Set Slide1 = Nothing Set Slide1EchoClients = Nothing Set FeedbackDisplay1 = Nothing Set Wait1 = Nothing End Sub '-------------------------------------------------------------------------- ' Main ' '-------------------------------------------------------------------------- Sub Main() ' Create and initialize the default context, data file, ' and provide global access to the context. Dim c As Context Set c = New Context Set c.DataFile = New DataFile c.PushNewFrame Set ebContext = c ' Set the log level names c.SetLogLevelName 1, "Session" c.SetLogLevelName 2, "Block" c.SetLogLevelName 3, "Trial" c.SetLogLevelName 4, "SubTrial" c.SetLogLevelName 5, "LogLevel5" c.SetLogLevelName 6, "LogLevel6" c.SetLogLevelName 7, "LogLevel7" c.SetLogLevelName 8, "LogLevel8" c.SetLogLevelName 9, "LogLevel9" c.SetLogLevelName 10, "LogLevel10" ' Set standard logging items ebContext.SetAttrib "Experiment", "simple" ebContext.SetAttrib "SessionDate", Date$ ebContext.SetAttrib "SessionTime", Time$ 'Initialize global variables for packages InitGlobals c CreateDefaultPort If Basic.OS = ebWin32 Then WinActivate "E-Run Experiment Window" End If ' Get the StartupInfo ' Set the defaults for all of the StartupInfo If Not c.AttribExists("Subject") Then c.SetAttrib "Subject", "1" If Not c.AttribExists("Session") Then c.SetAttrib "Session", "1" ' Determine if StartupInfo.UseDefaults exists and is True/False to override prompts for StartupInfo parameters Dim bStartupInfoUseDefaults As Boolean bStartupInfoUseDefaults = False If c.AttribExists("StartupInfo.UseDefaults") Then bStartupInfoUseDefaults = CLogical(c.GetAttrib("StartupInfo.UseDefaults")) If Not bStartupInfoUseDefaults Then Dim vAnswer As Variant StartupInfo_Begin: StartupInfoPrompt_Subject: vAnswer = AskBox("Please enter the Subject Number (1-32767, 0=No Data Logging):", c.GetAttrib("Subject")) If Not IsEmpty(vAnswer) then If Not IsNumeric(vAnswer) then MsgBox "Please enter an integer value" GoTo StartupInfoPrompt_Subject ElseIf CLng(vAnswer) < 0 Then MsgBox "The value for Subject must not be less than 0" GoTo StartupInfoPrompt_Subject ElseIf CLng(vAnswer) > 32767 Then MsgBox "The value for Subject must be not be greater than 32767" GoTo StartupInfoPrompt_Subject End If Else GoTo ExperimentAbort End if c.SetAttrib "Subject", CStr(vAnswer) StartupInfoPrompt_Session: vAnswer = AskBox("Please enter the Session Number (1-32767):", c.GetAttrib("Session")) If Not IsEmpty(vAnswer) then If Not IsNumeric(vAnswer) then MsgBox "Please enter an integer value" GoTo StartupInfoPrompt_Session ElseIf CLng(vAnswer) < 1 Then MsgBox "The value for Session must not be less than 1" GoTo StartupInfoPrompt_Session ElseIf CLng(vAnswer) > 32767 Then MsgBox "The value for Session must be not be greater than 32767" GoTo StartupInfoPrompt_Session End If Else GoTo ExperimentAbort End if c.SetAttrib "Session", CStr(vAnswer) ' Display the summary Dim strSummary As String strSummary = "Subject: " & c.GetAttrib("Subject") & "\n" strSummary = strSummary & "Session: " & c.GetAttrib("Session") & "\n" strSummary = strSummary & "\nContinue with the above startup info?" Dim nSummaryAnswer As Integer nSummaryAnswer = MsgBox(strSummary, ebYesNoCancel + ebQuestion, "Summary of Startup Info") If nSummaryAnswer = ebNo Then GoTo StartupInfo_Begin ElseIf nSummaryAnswer = ebCancel Then GoTo ExperimentAbort End If End If 'If the attribute Clock.Scale.Override exists ' then use it for to set the Clock.Scale value If c.AttribExists("Clock.Scale.Override") Then Clock.Scale = CDbl(c.GetAttrib("Clock.Scale.Override")) End If ' Set the Filenames for the data files Dim strFilenameRecovery As String Dim strFilenameEDAT As String 'If the attribute DataFile.Filename.Override exists ' then use it for the .txt and .edat filenames If c.AttribExists("DataFile.Filename.Override") Then ' Set the default Data Filename strFilenameRecovery = CStr(c.GetAttrib("DataFile.Filename.Override")) & ".txt" strFilenameEDAT = CStr(c.GetAttrib("DataFile.Filename.Override")) & ".edat" Else ' Set the default Data Filename strFilenameRecovery = CStr(c.GetAttrib("Experiment")) & "-" & CStr(c.GetAttrib("Subject")) & "-" & CStr(c.GetAttrib("Session")) & ".txt" strFilenameEDAT = CStr(c.GetAttrib("Experiment")) & "-" & CStr(c.GetAttrib("Subject")) & "-" & CStr(c.GetAttrib("Session")) & ".edat" End If 'Set the name of the data file c.DataFile.Filename = strFilenameRecovery ' If we are logging data, then prompt to overwrite the data file if it exists If CLng(c.GetAttrib("Subject")) <> 0 Then If FileExists(c.DataFile.Filename) Or FileExists(strFilenameEDAT) Then If ebYes <> MsgBox("WARNING: The data file and/or recovery file already exists:\nFILE: " & c.DataFile.Filename & "\n\nDo you want to overwrite?", ebYesNo + ebQuestion) Then GoTo ExperimentAbort End If End If End If ' Set defaults for RandomSeed and GroupNumber if StartupInfo did not assign their values If Not c.AttribExists("RandomSeed") Then c.SetAttrib "RandomSeed", PRNG.GetSeed() If Not c.AttribExists("Group") Then c.SetAttrib "Group", "1" 'Set the random seed Randomize CLng(c.GetAttrib("RandomSeed")) ' Initialize all system devices, packages, and objects InitDevices c InitPackages c InitObjects c ' If we are logging data, then open the datafile If CLng(c.GetAttrib("Subject")) <> 0 Then c.DataFile.Open c.LogHeader End If #If RUNTIME_VERSION_MAJOR > 1 Or (RUNTIME_VERSION_MAJOR = 1 And RUNTIME_VERSION_MINOR >= 2) Then ' Log clock timing information c.SetAttrib "Clock.Information", Clock.Information #End If ' Start the running of the Experiment SessionProc.Run c ' Clean up the context and close the datafile If CLng(c.GetAttrib("Subject")) <> 0 Then c.DataFile.Close ' Attempt to convert the recovery file into a data file Dim nConvert As Long nConvert = c.DataFile.Convert(ebProgressSimple) If nConvert = 0 Then ' Settings in E-Studio are set to not remove E-Recovery file Else ' The datafile failed to convert! MsgBox "ERROR: The datafile did not convert!\nFILE: " & c.DataFile.Filename & "\n\nIt is recommended that you recover your data with the E-Recovery utility" MsgBox c.DataFile.GetLastErrorMessage() End If End If ExperimentFinish: UnInitObjects UnInitPackages UnInitDevices UnInitGlobals ExperimentAbort: ' Clean up the context c.PopFrame Set c = Nothing Set ebContext = Nothing DestroyDefaultPort End Sub [DataSection_FirstRun(1)] Weight Nested Procedure Word Correct 1 FirstProc falcon y 1 FirstProc rigid y 1 FirstProc bnick n 1 FirstProc brick y\0