' ' ' ' C:\WINDOWS\Desktop\e-prime class 8-16-01\tor_fmriBase\tor_fMRIBase.ebs ' Generated on: 8/19/2001 23:48:47 ' ' ' Author: ' Psychology Software Tools ' Astract: ' fmriBase v1.0.9.0 ' ' ' ' Option CStrings On Dim ebContext as Context '-------------------------------------------------------------------------- ' Class Declarations '-------------------------------------------------------------------------- '-------------------------------------------------------------------------- ' Instance Declarations '-------------------------------------------------------------------------- Dim Keyboard As KeyboardDevice Dim Mouse As MouseDevice Dim Display As DisplayDevice Dim Sound As SoundDevice Dim SessionProc As Procedure Dim Intro As TextDisplay Dim Task1BlockProc As Procedure Dim ULBlockIntro As TextDisplay Dim Task1PeriodProc As Procedure Dim Probe As TextDisplay Dim EventProc As Procedure Dim Goodbye As TextDisplay Dim IFISBlockList as Factor Dim Task1PeriodList as Factor Dim ULlist as Factor Dim ControlPeriodProc As Procedure Dim ControlEventList as Factor Dim Task2BlockProc As Procedure Dim Task2PeriodList as Factor Dim Task2BlockIntro As TextDisplay Dim Task2PeriodProc As Procedure Dim Task2EventList as Factor Dim Feedback As FeedbackDisplay Dim Feedback_State As SlideState Dim Feedback_SlideText As SlideText Dim Feedback_SlideImage As SlideImage Dim Fixation As TextDisplay Dim FixEventProc As Procedure Dim Task3BlockProc As Procedure Dim Task3PeriodList as Factor Dim Task4BlockProc As Procedure Dim ULvsLNBlockIntro As TextDisplay Dim LivNonPeriodProc As Procedure Dim LNlist as Factor Dim ULPeriodProc As Procedure Dim Task4PeriodList as Factor Dim wordsInPeriod as Factor Dim periodInstructions As TextDisplay Dim EndPrac As TextDisplay Dim queryContinue As TextDisplay Dim Wait1 As Wait Dim ULlistFixed as Factor '-------------------------------------------------------------------------- ' Package Global Script '-------------------------------------------------------------------------- ' #Const IFIS_DEBUG = True ' Used for debugging #Const USE_ICP = False ' Constants for the BSOFT DIG100/24 card Const DIG100_BASE As Integer = &H200 Const DIG100_PORT_A As Integer = DIG100_BASE + 28 Const DIG100_PORT_B As Integer = DIG100_BASE + 29 Const DIG100_PORT_C As Integer = DIG100_BASE + 30 Const DIG100_PORT_CONTROL As Integer = DIG100_BASE + 31 ' DIG100 Control port assignments for Mode 0 ' 7 6 5 4 3 2 1 0 ' 1 0 0 x x 0 x x ' | | | |___ Port2(C) (lower 4 bits) 0=output, 1=input ' | | |_____ Port1(B) (all 8 bits) 0=output, 1=input ' | | ' | |_________ Port2(C) (upper 4 bits) 0=output, 1=input ' |___________ Port0(A) (all 8 bits) 0=output, 1=input ' ' DIG100 Initialize ' Port0(A) - input, Port1(B) - input, Port2(C) - output ' 7 6 5 4 3 2 1 0 ' 1 0 0 1 0 0 1 0 = &H92 -> A-in, B-in, C-out Const DIG100_CONFIG_DATA As Integer = &H92 ' Constants for BRU configuration Const BRU_RIGHT_ONLY = 1 Const BRU_LEFT_ONLY = 2 Const BRU_RIGHT_LEFT_UNIQUE = 3 Const BRU_RIGHT_LEFT_DUPLICATE = 4 ' Constants for using joystick button as simulated RFPulse Const RFP_JOYSTICK_ADDRESS As Integer = &H201 ' game port Const RFP_JOYSTICK_PULSEBITMASK As Integer = &H20 ' 00x0 0000 Const RFP_JOYSTICK_MINPULSETRAINSPACE As Integer = 4000 Const RFP_JOYSTICK_INVERTPULSEDATA = True ' Constants for using scanner RFPulse Const RFP_SCANNER_ADDRESS As Integer = DIG100_PORT_B Const RFP_SCANNER_PULSEBITMASK As Integer = &H80 ' x000 0000 Const RFP_SCANNER_MINPULSETRAINSPACE As Integer = 4000 ' msec Const RFP_SCANNER_INVERTPULSEDATA = False ' True=0 to 1, False=1 to 0 ' Common ISM Messages Const IFIS_OPENED_MSG = "1" Const IFIS_PARAMS_GET_MSG = "2" Const IFIS_MENU_MSG = "4" 'ab Const IFIS_WAITING_MSG = "6" '? Const IFIS_STARTSCAN_MSG = "7" Const IFIS_RUNNING_MSG = "8" Const IFIS_STIMSTATUS_MSG = "9" 'na=vb=v Const IFIS_DONE_MSG = "11" Const IFIS_DATA_SAVED_MSG = "12" Const IFIS_CLOSED_MSG = "14" Const IFIS_PATIENT_REQUEST = "15" ' Common ICP Messages ' Format = Message window; message id; forecolor; backcolor; text Const strRunning = "1;1;16;11;RUNNING" Const strWaitIFIS = "1;2;16;19;WAIT EXPERMTR" Const strWaitPatientReady = "1;3;16;17;WAIT PATIENT" Const strWaitScanReady = "1;4;16;18;WAIT SCAN READY" Const strStartScan = "1;5;16;12;START SCAN" Const strNotRunning = "1;6;16;13;NOT RUNNING" Const strPeriodEnd = "2;End of Period" ' Constants for experimenter keys Const TERMINATE_KEY1 = 110 'Numpad DEL Const TERMINATE_KEY2 = 46 ' Keyboard DEL Const CONTINUE_KEY = 13 'ENTER Const SIMULATED_RFP_KEY = 48 'Numpad + BA is this outdated? ' Constants for slide image filenames Const SLIDE_ASKPATIENTREADY = "Slide3.BMP" Const SLIDE_IFISGETREADY = "Slide6.BMP" Const SLIDE_IFISGETREADY_PRESSKEY = "Slide7.BMP" Const SLIDE_IFISPREPARENEXTSCAN = "Slide8.BMP" Const SLIDE_IFISBLOCKMENU = "Slide9.BMP" Const SLIDE_FIXATION = "Slide10.BMP" Const SLIDE_IFISBLOCKFEEDBACK = "Slide9.BMP" Const SLIDE_IFISVISUALFEEDBACK = "Slide9.BMP" ' ' E-Prime object variables Dim IFISBackground As ImageDisplay Dim IFISPause As TextDisplay Dim IFISBeeper As SoundOut Dim IFISSimulatedSound As SoundOut Dim IFISFeedbackAuditory As SoundOut Dim IFISAskPatientReadyT As TextDisplay Dim IFISAskPatientReadyS As Slide Dim IFISAskPatientReadySImage As SlideImage Dim IFISGetReadyT As TextDisplay Dim IFISGetReadyS As Slide Dim IFISGetReadySImage As SlideImage Dim IFISPrepareNextScanT As TextDisplay Dim IFISPrepareNextScanS As Slide Dim IFISPrepareNextScanSImage as SlideImage Dim IFISBlockMenuT As TextDisplay Dim IFISBlockMenuS As Slide Dim IFISBlockMenuSText As SlideText Dim IFISBlockMenuSImage As SlideImage Dim IFISFixationStartControlDelayS As Slide Dim IFISFixationStartControlDelaySImage As SlideImage Dim IFISFixationEndControlDelayS As Slide Dim IFISFixationEndControlDelaySImage As SlideImage Dim IFISBlockFeedbackS As Slide Dim IFISBlockFeedbackSText As SlideText Dim IFISBlockFeedbackSImage As SlideImage Dim IFISFeedbackVisualS As Slide Dim IFISFeedbackVisualSText As SlideText Dim IFISFeedbackVisualSImage As SlideImage ' Declare the objects which abstract the IFIS Control Panel, RF Pulse Monitor ' and Button Response Units #If USE_ICP Then Dim g_ICP As IFISControlPanel Dim g_bICPEnabled As Boolean #Else Dim g_ISM As IFISSystemManager Dim g_bISMEnabled As Boolean #End If Dim g_RFP As RFPulse Dim g_BRU As BRU Dim g_bBRUEnabled As Boolean Dim g_bRFPEnabled As Boolean Dim g_nNumPeriodsDefault As Long Dim g_nPeriodADefault As Long Dim g_nPeriodBDefault As Long Dim g_nBRUConfiguration As Long Dim g_nDiscardedAcquisitionTime As Long Dim g_strResponseModeDefault As String Dim g_strRFPulseModeDefault As String Dim g_strRFPulseMode As String Dim g_bSimulateBlockMenu As Boolean Dim g_strSimulatedSound As String Dim g_nBlockID As Integer Dim g_bBlockIDChanged As Boolean Dim g_bHandledBlockID As Boolean Dim g_nBlockNum As Long Dim g_nPeriodNum As Long Dim g_nEventNum As Long Dim g_nSessionStatus As Long Dim g_nBlockStatus As Long Dim g_nPeriodStatus As Long Dim g_nEventStatus As Long Dim g_nScannerReadyStatus As Long Dim g_nPatientReadyStatus As Long Dim g_nPeriodEndTime As Long ' termination time of the procedure !WS Dim g_nPeriodStartTime As Long ' time of start of period !WS Dim g_nPeriodSetupTime As Long ' setup time to check timing duration Dim g_nStartTimePeriod As Long 'Variable for response window coding Dim g_nStartTimeWindow As Long Dim g_nHitResponseTime As Long Dim g_bInTimeWindow As Boolean Dim g_bLookingForResponse As Boolean Dim g_bPassFeedback As Boolean Dim g_nMisses As Integer Dim g_nHits As Integer Dim g_nFalseAlarms As Integer Dim g_bIFISTimingModeCumulative As Boolean 'Time events for periods in cumulative mode to realign end of period. Dim g_nBeginNoTargetZone As Long Dim g_nEndNoTargetZone As Long Dim g_nTargetWindow As Long Dim g_nEventOfPeriodNum 'Counter for the event number of a period counting 1 up Dim g_strOldTxtDataFile As String Dim g_strOldEdatDataFile As String Dim g_strNewTxtDataFile As String Dim g_strNewEdatDataFile As String Dim g_strParadigmName As String Dim g_strSystemID As String Dim g_strDataPath As String Dim g_strRunNumber As String Dim g_bRenameDataFiles As Boolean Dim g_bAbortParadigm As Boolean 'IFISTemplate variables Dim IFISwizardRecordEventHistory As Boolean ' Maintain history of last 5 events Dim IFISwizardRecordPeriodHistory As Boolean ' Maintain history of last 5 periods Dim IFISwizardBlockAccuracy As Boolean ' Reports to user the accuracy of the patient at the end of the block Dim IFISwizardTimingPrecision As Boolean ' Report the timing precision Dim IFISwizardTNBack As Boolean ' Using NBack Dim IFISwizardTemplate As Boolean ' Using IFIS Template paradigm or subset of Dim IFISwizardRecordEventHistoryState As Boolean Dim IFISwizardRecordPeriodHistoryState As Boolean Dim IFISwizardBlockAccuracyState As Boolean Dim IFISwizardTimingPrecisionState As Boolean Dim IFISwizardTNBackState As Boolean Dim IFISwizardTemplateState As Boolean Dim IFISwizardBVLogEventData As Boolean 'Logging Dim g_IFISTrialAuditoryFeedback As Boolean Dim g_IFISTrialErrorDisplay As Boolean Dim g_IFISBVLogEventData As Boolean ' Should log event-related data (at IFIS_EventEnd) to Brain Voyager data file Dim g_IFISStartControlDuration As Long ' Delay before block begins Dim g_LogCount As Integer Dim g_strBVFile as String ' BrainVoyager data file Dim IFISTrialAccuracy As Summation Dim g_IFISPeriodElapsed As Summation Dim g_IFISEventElapsed As Summation Const MaxTaskPeriodHistory As Integer = 5 Dim IFIS_TaskPeriodCondHistory(MaxTaskPeriodHistory) As String 'task Condition History Const MaxTaskEventHistory As Integer = 5 Dim IFIS_TaskEventCondHistory(MaxTaskEventHistory) As String 'task Condition History Const MAX_LOG_COUNT As Integer = 1024 Dim g_TimeLog (MAX_LOG_COUNT) as Long Dim g_TaskLog (MAX_LOG_COUNT) as String Dim g_IFISBlockStartTime As Long ' NBack variables Dim IFISNBackCount As Integer ' User defined type representing a Queue data structure. Type Queue head As Integer tail As Integer size As Integer body(10) As String End Type ' Declare the Queue that we will use for letters Dim IFISLetterQ as Queue Dim IFISZeroBackChar As String 'storage for subjects character display ' Forward declarations Declare Public Sub IFIS_Init( c As Context, s As String ) Declare Public Sub IFIS_SetNumPeriodsDefault( n As Long ) Declare Public Sub IFIS_SetPeriodADefault( n As Long ) Declare Public Sub IFIS_SetPeriodBDefault( n As Long ) Declare Public Sub IFIS_SetRFPulseModeDefault( s As String ) Declare Public Sub IFIS_SetResponseModeDefault( s As String ) Declare Public Sub IFIS_SetSimulateBlockMenu( s As String ) Declare Public Sub IFIS_SetSimulatedSound( s As String ) Declare Public Sub IFIS_SetDiscardedAcquisitionTime( n As Long ) Declare Public Sub IFIS_Yield( nMsecs As Long ) Declare Public Sub IFIS_WaitForScannerReady( c As Context ) Declare Public Sub IFIS_WaitForPatientReady( c As Context ) Declare Public Sub IFIS_SessionBegin( c As Context, objBlockList As Factor ) Declare Public Sub IFIS_SessionEnd( c As Context ) Declare Public Sub IFIS_BlockBegin( c As Context ) Declare Public Sub IFIS_BlockEnd( c As Context, Optional DataToLog As Variant ) Declare Public Sub IFIS_PeriodBegin( c As Context, s As String ) Declare Public Sub IFIS_PeriodEnd( c As Context ) Declare Public Sub IFIS_EventBegin( c As Context ) Declare Public Sub IFIS_EventEnd( c As Context ) Declare Public Sub IFIS_Feedback( c As Context, strCustomFeedback As String, nFormat As Long, nYieldTime As Long ) Declare Public Sub IFIS_StimStatus( c As Context, strStimStatus As String ) Declare Public Sub IFIS_BVLog(nTimeStamp As Long, strData As String) Declare Public Function IFIS_GetSessionStatus() As Long Declare Public Sub IFIS_SetSessionStatus( nStatus As Long ) Declare Public Function IFIS_GetBlockStatus() As Long Declare Public Sub IFIS_SetBlockStatus( nStatus As Long ) Declare Public Function IFIS_GetPeriodStatus() As Long Declare Public Sub IFIS_SetPeriodStatus( nStatus As Long ) Declare Public Function IFIS_GetEventStatus() As Long Declare Public Sub IFIS_SetEventStatus( nStatus As Long ) Declare Public Function IFIS_GetScannerReadyStatus() As Long Declare Public Sub IFIS_SetScannerReadyStatus( nStatus As Long ) Declare Public Function IFIS_GetPatientReadyStatus() As Long Declare Public Sub IFIS_SetPatientReadyStatus( nStatus As Long ) Declare Public Function IFIS_GetPeriodStartTime() As Long Declare Public Sub IFIS_SetPeriodStartTime( n As Long ) Declare Public Function IFIS_GetPeriodEndTime() As Long Declare Public Sub IFIS_SetPeriodEndTime( n As Long ) Declare Public Function IFIS_GetBRUConfiguration() As Long Declare Public Sub IFIS_SetBRUConfiguration( n As Long ) Declare Public Function IFIS_GetRFMinPulseTrainSpace() As Integer Declare Public Sub IFIS_SetRFMinPulseTrainSpace(n As Integer) Declare Public Function IFIS_GetBVEventLogStatus() As Boolean Declare Public Sub IFIS_SetBVEventLogStatus( bStatus As Boolean ) '#If IFISwizardTNBack Then Declare Public Sub IFIS_NBackSetup(c As Context,StimList as Factor) ' General purpose functions only used by NBack for now, I still prepend IFIS to note they are in the IFIS package file Declare Sub IFIS_QInit(q As Queue) Declare Function IFIS_IsUpper(s As String) As Boolean Declare Sub IFIS_QInsert(q As Queue, x As String) Declare Sub IFIS_QDelete(q as Queue) Declare Function IFIS_QItem(q As Queue, i As Integer) As String Declare Function IFIS_IsInQ(q As Queue, s As String) as Boolean Declare Function IFIS_CStrQ(q As Queue) As String '#End If ' Function used for sequence randomization Declare Public Function IFIS_fncGenerateCondSeries(intNumberOfConditions As Integer, intNumberOfTrials As Integer) As String #If USE_ICP Then ' Nothing #Else Declare Public Function IFIS_ParseTag(strSource As String, strTag As String, strValue As String, nStartPos As Integer) As Boolean Declare Public Function IFIS_ParseKnownTag(strSource As String, strTag As String, nStartPos As Integer) As String #End If ' Routines NOT directly exposed to package user '#If IFISwizardTNBack Then '**********************************Code for NBack ************** 'NBack user code '----------------------------------------------------- ' IFIS_IsUpper ' Returns TRUE if the 1st char of the string is ' in [A-Z] '----------------------------------------------------- Function IFIS_IsUpper(s as string) As Boolean Dim i As Integer i=Asc(s) IFIS_IsUpper=(Asc("A") <= i AND i <= Asc("Z")) End Function ''----------------------------------------------------- ' Queue operations ' IFIS_QInit - Initialize the queue ' IFIS_QInsert - Add a new item to the queue ' IFIS_QDelete - Remove an item from the queue ' IFIS_QItem - Retrieve a specific item from the queue ' IFIS_IsInQ - Test to see if an item exists in the queue ' IFIS_CStrQ - Helper function to print contents of the queue '----------------------------------------------------- '----------------------------------------------------- Sub IFIS_QInit(q As Queue) Dim i As Integer q.head=0 q.tail=0 q.size=0 For i=1 To 10 q.body(i)="" Next i End Sub '----------------------------------------------------- Sub IFIS_QInsert(q As Queue, x As String) If q.size=10 Then Err.Raise 999, "N-Back ", "Queue Overflow" End If q.body(q.tail)=x q.tail=((q.tail + 1) MOD 10) q.size=q.size + 1 ' Debug.Print "H=" & CStr(q.head) & "T=" & CStr(q.tail)& "S=" & Cstr(q.size)& ":" End Sub '----------------------------------------------------- Sub IFIS_QDelete(q as Queue) If q.size=0 Then Err.Raise 999, "N-Back ", "Queue underflow" End if q.head=((q.head + 1) MOD 10) q.size=q.size - 1 End Sub '----------------------------------------------------- Function IFIS_QItem(q As Queue, i As Integer) As String If Not (0 < i OR i <=10) Then Err.Raise 999, "N-Back ", "IFIS_QItem " & CStr(i) & " out of range" End If IFIS_QItem=q.body( (q.head + (i - 1)) MOD 10 ) End Function '----------------------------------------------------- Function IFIS_IsInQ(q As Queue, s As String) as Boolean Dim i As Integer IFIS_IsInQ=FALSE For i=0 To (q.size - 1) If q.body( (q.head + i) MOD 10 )=s Then IFIS_IsInQ=TRUE End If Next i End Function '----------------------------------------------------- Function IFIS_CStrQ(q As Queue) As String Dim result As String Dim i As Integer result="(" For i=1 To q.size '+1 result=result & " " & IFIS_QItem(q,i) Next i IFIS_CStrQ=result & " )" End Function '----------------------------------------------------- '#End IF ' NBack end 'End NBack code '******************************Code for Sequence randomization******************************* ' Suggested interface 'function should take in intNumTrials and intNumbConditions ' and output an array of integers of size = intNumTrials (arrChosenSequence()) Public Function IFIS_fncGenerateCondSeries(intNumberOfConditions as integer,intNumberOfTrials as integer) As String dim intNumbConditions as integer dim intNumTrials as integer dim boolEnforce1Back as boolean '********** Random Sequence Code intNumTrials = intNumberOfTrials intNumbConditions= intNumberOfConditions boolEnforce1Back = true IF intNumTrials < intNumbConditions Then MsgBox("Error, can not have less periods then conditions when using Event 3 Back Randomization") End If '********** Const crlf = Chr$(13) + Chr$(10) const strDelim = "," dim strSelectionCriterion as string dim intHightestF as integer, intLowestF as integer dim boolLegalSeries as boolean dim boolDebug as boolean boolDebug= false dim boolDebugFTables as boolean, boolDebugFlow as boolean boolDebugFlow = false boolDebugFTables = false dim intLoopCount, intMainloop as integer, int2TupleMainLoop as integer, int1TupleMainLoop as integer, intCopyLoop as integer dim intNextInSeries as integer dim intCurrLowestF as integer, intCountLowestCase1d as integer,intCountLowestCase2d as integer, intCountLowestCase3d as integer dim arrChosenSequence(1 to intNumTrials) as integer dim arrLegalCandidates(1 to intNumTrials) as integer dim boolSeriesAccepted as boolean dim boolNoSolutionFound as boolean boolLegalSeries = false boolSeriesAccepted= false dim arrCandidate1d(1 to intNumbConditions) as integer' holds potential canditates dim arrCandidate2d(1 to intNumbConditions) as integer dim arrCandidate3d(1 to intNumbConditions) as integer ' generate 3d, 2d and 1d array dim intloop1 as integer,intloop2 as integer,intloop3 as integer dim int1BackPtr as integer, int2BackPtr as integer, int3BackPtr as integer dim intCond1Back as integer,intCond2Back as integer, intCond3Back as integer dim int3DFCount as integer dim intLegalCheckLoopCount as integer intLegalCheckLoopCount= 0 ' main loop including tests do until (boolLegalSeries or (intLegalCheckLoopCount > 5)) 're dim eachloop dim arr3d(1 to intNumbConditions,1 to intNumbConditions,1 to intNumbConditions) as integer dim arr2d(1 to intNumbConditions,1 to intNumbConditions) as integer dim arr1d(1 to intNumbConditions) as integer intCond1Back = int(Rnd(1) * intNumbConditions) + 1 intCond2Back = int(Rnd(1) * intNumbConditions) + 1 intCond3Back = int(Rnd(1) * intNumbConditions) + 1 'update frequency tables arr3d(intCond3Back,intCond2Back,intCond1Back) = arr3d(intCond3Back,intCond2Back,intCond1Back) + 1 arr2d(intCond3Back,intCond2Back) = arr2d(intCond3Back,intCond2Back) + 1 arr2d(intCond2Back,intCond1Back) = arr2d(intCond2Back,intCond1Back) + 1 arr1d(intCond3Back) = arr1d(intCond3Back) + 1 arr1d(intCond2Back) = arr1d(intCond2Back) + 1 arr1d(intCond1Back) = arr1d(intCond1Back) + 1 'add to final condition array arrChosenSequence(1)=intCond3Back arrChosenSequence(2)=intCond2Back arrChosenSequence(3)=intCond1Back if boolDebug then 'printout final series debug.print crlf & "arrChosenSequence = " & crlf for intloop1 = 1 to intNumTrials debug.print arrChosenSequence(intloop1) next intloop1 end if ' boolDebug intLoopCount = 0 'main loop for filling rest of arrChosenSequence boolSeriesAccepted = false ' init main loop boolNoSolutionFound= true for intMainloop = 4 to intNumTrials boolSeriesAccepted = false ' init 'if boolDebugFlow then 'debug.print crlf & "MainLoop =" & intMainloop & " " 'end if int3BackPtr = intMainloop-2 int2BackPtr = intMainloop-1 intCountLowestCase1d = 0 intCountLowestCase2d = 0 intCountLowestCase3d = 0 'int1BackPtr = intMainloop 'debug.print crlf & "pointers 3bk, 2bk" & int3BackPtr &int2BackPtr & crlf 'debug.print "values at prointers " & arrChosenSequence(int2BackPtr)& arrChosenSequence(int3BackPtr) & crlf ' find lowest selection frequency and render a count if boolDebugFlow then debug.print crlf &"Entering 3 back" end if intCurrLowestF= 10000' init for intloop3 = 1 to intNumbConditions 'debug.print "series being tested = " & arrChosenSequence(int3BackPtr) & strDelim & arrChosenSequence(int2BackPtr) & strDelim & intloop3 & crlf 'compare if (arr3d(arrChosenSequence(int3BackPtr),arrChosenSequence(int2BackPtr),intloop3) < intCurrLowestF) then intCurrLowestF = arr3d(arrChosenSequence(int3BackPtr),arrChosenSequence(int2BackPtr),intloop3) intCountLowestCase3d = 1 arrCandidate3d(1) = intloop3 else if (arr3d(arrChosenSequence(int3BackPtr),arrChosenSequence(int2BackPtr),intloop3) = intCurrLowestF) then intCountLowestCase3d = intCountLowestCase3d + 1 ' how many instances of the lowest case have we found arrCandidate3d(intCountLowestCase3d) = intloop3 'arrLegalCandidates() = arrCandidate3d() end if ' = intCurrLowestF) end if' < intCurrLowestF) next intloop3 'copy legal candidates to array if boolDebugFlow then 'debug.print crlf & "legals = " end if for intCopyLoop = 1 to intCountLowestCase3d arrLegalCandidates(intCopyLoop)= arrCandidate3d(intCopyLoop) 'debug.print arrLegalCandidates(intCopyLoop) next intCopyLoop if (intCountLowestCase3d = 1) then ' there was a unique lowest 3tuple boolSeriesAccepted = true intNextInSeries = arrCandidate3d(1) if boolDebugFlow then strSelectionCriterion= " unique 3 back" debug.print strSelectionCriterion end if end if ''' 2tuple of main loop if (boolSeriesAccepted = false) then' check for unique lowerst 2tuple count if boolDebugFlow then 'debug.print crlf & "Entering 2 back" end if intCurrLowestF= 1000' init for intloop2 = 1 to intCountLowestCase3d if boolDebugFlow then debug.print strDelim & arrChosenSequence(int2BackPtr) & arrLegalCandidates(intloop2) & " f= " & arr2d(arrChosenSequence(int2BackPtr),intloop2) & " " end if if (arr2d(arrChosenSequence(int2BackPtr),arrLegalCandidates(intloop2)) < intCurrLowestF) then intCurrLowestF = arr2d(arrChosenSequence(int2BackPtr),arrLegalCandidates(intloop2)) intCountLowestCase2d = 1 arrCandidate2d(1) = arrLegalCandidates(intloop2) else if (arr2d(arrChosenSequence(int2BackPtr),arrLegalCandidates(intloop2)) = intCurrLowestF) then intCountLowestCase2d = intCountLowestCase2d + 1 ' how many instances of the lowest case have we found arrCandidate2d(intCountLowestCase2d) = arrLegalCandidates(intloop2) end if ' = intCurrLowestF) end if' < intCurrLowestF) if boolDebugFlow then debug.print "LowestCase2d = " & intCountLowestCase2d end if next intloop2 end if 'copy legal candidates to array if boolDebugFlow then debug.print crlf & "legals = " end if for intCopyLoop = 1 to intCountLowestCase2d arrLegalCandidates(intCopyLoop)= arrCandidate2d(intCopyLoop) 'debug.print arrLegalCandidates(intCopyLoop) next intCopyLoop 'debug.print " " & "Exit2d" ''' 1tuple of main loop if (intCountLowestCase2d = 1) then' unique lowere 2tuple found if boolDebugFlow then strSelectionCriterion="unique 2 back" debug.print strSelectionCriterion end if boolSeriesAccepted = true intNextInSeries = arrCandidate2d(1) end if if boolEnforce1Back then if (boolSeriesAccepted = false) then ' unique low f not found in 2tuple if boolDebugFlow then debug.print crlf & "Entering 1 back" end if intCurrLowestF= 1000' init for intloop1 = 1 to intCountLowestCase2d if (arr1d(arrLegalCandidates(intloop1)) < intCurrLowestF) then intCurrLowestF = arr1d(arrLegalCandidates(intloop1)) intCountLowestCase1d = 1 arrCandidate1d(1) = arrLegalCandidates(intloop1) else if (arr1d(arrLegalCandidates(intloop1)) = intCurrLowestF) then intCountLowestCase1d = intCountLowestCase1d + 1 ' how many instances of the lowest case have we found arrCandidate1d(intCountLowestCase1d) = (arrLegalCandidates(intloop1)) end if ' = intCurrLowestF) end if' < intCurrLowestF) next intloop1 end if ' (intCountLowestCase > 1) 'copy legal candidates to array if boolDebugFlow then debug.print "Legals = " end if for intCopyLoop = 1 to intCountLowestCase1d arrLegalCandidates(intCopyLoop)= arrCandidate1d(intCopyLoop) 'debug.print arrLegalCandidates(intCopyLoop) next intCopyLoop if (boolSeriesAccepted = false) then ' if no unique values found for 2d or 3d accept unique value for 1D or chose random 1D fro ' from candidates ( form all deminsions ) if intCountLowestCase1d = 1 then' unique lowere 1tuple found if boolDebugFlow then strSelectionCriterion="unique 1 back" debug.print strSelectionCriterion end if intNextInSeries = arrCandidate1d(1) else if (intCountLowestCase1d > 1) then 'intCond1Back = int(Rnd(1) * intCountLowestCase1d) + 1 intNextInSeries = arrCandidate1d(int(Rnd(1) * intCountLowestCase1d) + 1) if boolDebugFlow then strSelectionCriterion="Randomly chosen from legals" debug.print strSelectionCriterion end if' boolDebug end if end if end if '(boolSeriesAccepted = false) else if (not boolEnforce1Back) then debug.print "enforce 1back off " intNextInSeries = arrCandidate2d(int(Rnd(1) * intCountLowestCase2d) + 1) end if end if ' if boolEnforce1Back 'update final array and frequency tables arrChosenSequence(intMainloop) = intNextInSeries' test arr3d(arrChosenSequence(int3BackPtr),arrChosenSequence(int2BackPtr),intNextInSeries)= arr3d(arrChosenSequence(int3BackPtr),arrChosenSequence(int2BackPtr),intNextInSeries) + 1 arr2d(arrChosenSequence(int2BackPtr),intNextInSeries)= arr2d(arrChosenSequence(int2BackPtr),intNextInSeries) + 1 arr1d(intNextInSeries)= arr1d(intNextInSeries) + 1 next intMainloop '***** Posthoc analysis of chosen sequence '3 tuple - test intLowestF = 100 intHightestF = 0 intLoopCount = 0 for intloop1 = 1 to intNumbConditions for intloop2 = 1 to intNumbConditions for intloop3 = 1 to intNumbConditions if (arr3d(intloop1,intloop2,intloop3) < intLowestF) then intLowestF = arr3d(intloop1,intloop2,intloop3) end if if (arr3d(intloop1,intloop2,intloop3) > intHightestF) then intHightestF = arr3d(intloop1,intloop2,intloop3) end if intLoopCount = intLoopCount + 1 'debug.print "F of condition series " & intloop1 & intloop2 & intloop3 & " = " & arr3d(intloop1,intloop2,intloop3) & crlf next intloop3 next intloop2 next intloop1 if ((intHightestF - intLowestF) < 2) then ' could use simple '=' ; but this is set to cover accepted error boolLegalSeries = true else boolLegalSeries = false end if ''printout 2tuple table and post hoc analysis ' if boolLegalSeries then ' test 2-tuple only if prev. tests have passed intLowestF = 100 intLoopCount = 0 for intloop1 = 1 to intNumbConditions for intloop2 = 1 to intNumbConditions if (arr2d(intloop1,intloop2) < intLowestF) then intLowestF = arr2d(intloop1,intloop2) end if if (arr2d(intloop1,intloop2) > intHightestF) then intHightestF = arr2d(intloop1,intloop2) end if intLoopCount = intLoopCount + 1 'debug.print "F of condition series " & intloop1 & intloop2 & " = " & arr2d(intloop1,intloop2) & crlf next intloop2 next intloop1 if ((intHightestF - intLowestF) < 2) then ' could use simple '=' ; but this is set to cover accepted error boolLegalSeries = true else boolLegalSeries = false end if end if' boolLegalSeries ' test for 1-utple if boolLegalSeries then ' test 1-tuple only if prev. tests have passed intLowestF = 100 ' reinit intHightestF = 0 intLoopCount = 0 for intloop1 = 1 to intNumbConditions if (arr1d(intloop1) < intLowestF) then intLowestF = arr1d(intloop1) end if if (arr1d(intloop1) > intHightestF) then intHightestF = arr1d(intloop1) end if intLoopCount = intLoopCount + 1 'debug.print "F of condition series " & intloop1 & intloop2 & " = " & arr2d(intloop1,intloop2) & crlf next intloop1 if ((intHightestF - intLowestF) < 2) then ' could use simple '=' ; but this is set to cover accepted error boolLegalSeries = true else boolLegalSeries = false end if ' test end if 'boolLegalSeries 'for 1tuple intLegalCheckLoopCount = intLegalCheckLoopCount + 1 if BoolDebugFlow then debug.print "intLowestF= " & intLowestF & " " debug.print "intHightestF= " & intHightestF & " " debug.print "boolLegalSeries= " & boolLegalSeries & crlf end if' BoolDebugFlow loop' do until ' ************ out put final series as comma delimited string dim strOutPutSeries as string for intloop1 = 1 to intNumTrials strOutPutSeries = strOutPutSeries & arrChosenSequence(intloop1) if (intloop1 < intNumTrials) then strOutPutSeries = strOutPutSeries & strDelim end if next intloop1 if boolDebugFTables then 'final tables 'final series debug.print "intLegalCheckLoopCount" & intLegalCheckLoopCount debug.print crlf & "arrChosenSequence = " & " " for intloop1 = 1 to intNumTrials debug.print arrChosenSequence(intloop1) next intloop1 debug.print crlf' formatting ' 3 tuple intLoopCount = 0 for intloop1 = 1 to intNumbConditions for intloop2 = 1 to intNumbConditions for intloop3 = 1 to intNumbConditions intLoopCount = intLoopCount + 1 debug.print "F of condition series " & intloop1 & intloop2 & intloop3 & " = " & arr3d(intloop1,intloop2,intloop3) & crlf next intloop3 next intloop2 next intloop1 '2tuple for intloop1 = 1 to intNumbConditions intLoopCount = intLoopCount + 1 for intloop2 = 1 to intNumbConditions debug.print "F of condition series " & intloop1 & intloop2 & " = " & arr2d(intloop1,intloop2) & crlf next intloop2 next intloop1 '1tuple for intloop1 = 1 to intNumbConditions debug.print "F of condition series " & intloop1 & " = " & arr1d(intloop1) & crlf next intloop1 end if ' boolDebugFTables 'used in analysis dim FByPositionLoop1 as integer, FByPositionLoop2 as integer, FByPositionLoop3 as integer, intNumSurround as integer intNumSurround = 6 dim arrFByPosition(1 to intNumbConditions,1 to intNumSurround,1 to intNumbConditions) as integer '3d array 1-condition, 2-position surrounding, 3-surroundconditon 'position surrounding 1=3back, 2=2back, 3=1back, 4=1forward, 5=2forward, 6=3forward /* for FByPositionLoop1 = 1 to intNumTrials for FByPositionLoop2 = 1 to intNumSurround for FByPositionLoop3 = 1 to intNumbConditions intLoopCount = intLoopCount + 1' 'debug.print intLoopCount next FByPositionLoop3 next FByPositionLoop2 next FByPositionLoop1 */ IFIS_fncGenerateCondSeries=strOutPutSeries End Function Public Function IFIS_GetSessionStatus() As Long IFIS_GetSessionStatus = g_nSessionStatus End Function Public Sub IFIS_SetSessionStatus(nStatus As Long) ' TODO: Error checking for a valid value. g_nSessionStatus = nStatus End Sub Public Function IFIS_GetBlockStatus() As Long IFIS_GetBlockStatus = g_nBlockStatus End Function Public Sub IFIS_SetBlockStatus(nStatus As Long) ' TODO: Error checking for a valid value. g_nBlockStatus = nStatus End Sub Public Function IFIS_GetPeriodStatus() As Long IFIS_GetPeriodStatus = g_nPeriodStatus End Function Public Sub IFIS_SetPeriodStatus(nStatus As Long) ' TODO: Error checking for a valid value. g_nPeriodStatus = nStatus End Sub Public Function IFIS_GetEventStatus() As Long IFIS_GetEventStatus = g_nEventStatus End Function Public Sub IFIS_SetEventStatus(nStatus As Long) ' TODO: Error checking for a valid value. g_nEventStatus = nStatus End Sub Public Function IFIS_GetScannerReadyStatus() As Long IFIS_GetScannerReadyStatus = g_nScannerReadyStatus End Function Public Sub IFIS_SetScannerReadyStatus(nStatus As Long) ' TODO: Error checking for a valid value. g_nScannerReadyStatus = nStatus End Sub Public Function IFIS_GetPatientReadyStatus() As Long IFIS_GetPatientReadyStatus = g_nPatientReadyStatus End Function Public Sub IFIS_SetPatientReadyStatus(nStatus As Long) ' TODO: Error checking for a valid value. g_nPatientReadyStatus = nStatus End Sub Public Function IFIS_GetPeriodStartTime() As Long IFIS_GetPeriodStartTime = g_nPeriodStartTime End Function Public Sub IFIS_SetPeriodStartTime(n As Long) ' TODO: Error checking for a valid value. g_nPeriodStartTime = n End Sub Public Function IFIS_GetPeriodEndTime() As Long IFIS_GetPeriodEndTime = g_nPeriodEndTime End Function Public Sub IFIS_SetPeriodEndTime(n As Long) ' TODO: Error checking for a valid value. g_nPeriodEndTime = n End Sub Public Function IFIS_GetBRUConfiguration() As Long IFIS_GetBRUConfiguration = g_nBRUConfiguration End Function Public Sub IFIS_SetBRUConfiguration(n As Long) ' TODO: Error checking for a valid value. g_nBRUConfiguration = n End Sub Public Sub IFIS_SetNumPeriodsDefault(n As Long) ' TODO: Error checking for a valid value. g_nNumPeriodsDefault = n End Sub Public Sub IFIS_SetPeriodADefault(n As Long) ' TODO: Error checking for a valid value. g_nPeriodADefault = n End Sub Public Sub IFIS_SetPeriodBDefault(n As Long) ' TODO: Error checking for a valid value. g_nPeriodBDefault = n End Sub Public Sub IFIS_SetRFPulseModeDefault(s As String) ' TODO: Error checking for a valid value. g_strRFPulseModeDefault = s End Sub Public Sub IFIS_SetResponseModeDefault(s As String) ' TODO: Error checking for a valid value. g_strResponseModeDefault = s End Sub Public Sub IFIS_SetSimulateBlockMenu(s As String) ' TODO: Error checking for a valid value. g_bSimulateBlockMenu = CLogical(s) End Sub Public Sub IFIS_SetSimulatedSound(s As String) ' TODO: Error checking for a valid value. g_strSimulatedSound = s IFISSimulatedSound.Stop IFISSimulatedSound.FileName = g_strSimulatedSound If (g_strSimulatedSound <> "none") Then IFISSimulatedSound.Load End If End Sub Public Sub IFIS_SetDiscardedAcquisitionTime(n As Long) ' TODO: Error checking for a valid value. g_nDiscardedAcquisitionTime = n End Sub Public Function IFIS_GetRFMinPulseTrainSpace() As Integer If g_bRFPEnabled = True Then IFIS_GetRFMinPulseTrainSpace = g_RFP.MinPulseTrainSpace Exit Function End If IFIS_GetRFMinPulseTrainSpace = -1 End Function Public Sub IFIS_SetRFMinPulseTrainSpace(n As Integer) If g_bRFPEnabled = True Then g_RFP.MinPulseTrainSpace = n End If End Sub Public Function IFIS_GetBVEventLogStatus() As Boolean IFIS_GetBVEventLogStatus = g_IFISBVLogEventData End Function Public Sub IFIS_SetBVEventLogStatus( bStatus As Boolean ) g_IFISBVLogEventData = bStatus End Sub #If USE_ICP Then ' Nothing #Else Public Function IFIS_ParseTag(strSource As String, strTag As String, strValue As String, nStartPos As Integer) As Boolean Dim nBeginStartTagPos As Integer Dim nEndStartTagPos As Integer Dim nBeginEndTagPos As Integer Dim nEndEndTagPos As Integer nBeginStartTagPos = InStr(nStartPos, strSource, "<") If nBeginStartTagPos > 0 Then nEndStartTagPos = InStr(nBeginStartTagPos, strSource, ">") If nEndStartTagPos > 0 Then ' Found start tag, make sure there is a matching end tag strTag = Mid(strSource, nBeginStartTagPos + 1, nEndStartTagPos - nBeginStartTagPos - 1) nBeginEndTagPos = InStr(nEndStartTagPos, strSource, "") If nBeginEndTagPos > 0 Then nEndEndTagPos = nBeginEndTagPos + Len(strTag) + 2 ' Add / and > nStartPos = nEndEndTagPos + 1 strValue = Mid(strSource, nEndStartTagPos + 1, nBeginEndTagPos - nEndStartTagPos - 1) IFIS_ParseTag = True Else IFIS_ParseTag = False End If Else IFIS_ParseTag = False End If Else IFIS_ParseTag = False End If End Function Public Function IFIS_ParseKnownTag(strSource As String, strTag As String, nStartPos As Integer) As String Dim strEndTag As String Dim strValue As String Dim nStartTagPos As Integer Dim nEndTagPos As Integer If Left(strTag, 1) <> "<" Then strTag = "<" & strTag End If If Right(strTag, 1) <> ">" Then strTag = strTag & ">" End If strEndTag = "na=vb=v" If (g_bISMEnabled) Then g_ISM.SendMessage IFIS_STIMSTATUS_MSG & strStimStatus End If End Sub /* Overview: Pauses the experiment until the technologist indicates that the scanner is ready or chooses not to contiue. Parameters: c As Context The current experiment context. Remarks: (none) */ Public Sub IFIS_WaitForScannerReady(c As Context) ' Wait for scan ready signal from the experimenter/technologist #If USE_ICP Then If (g_bICPEnabled) Then g_ICP.ReadMessageFlush g_ICP.SendMessage strWaitScanReady IFIS_Yield 100 SetPCodeSleepFrequency 50 SetPCodeSleepDuration 10 SetOSThreadPriority 3 Do Loop Until g_ICP.ReadMessageCount > 0 Dim strChoice As String strChoice = g_ICP.ReadMessage strChoice = Right(strChoice, 1) ' Got a response, if terminated then we are not ready so do not continue. If ((strChoice = Chr(TERMINATE_KEY1)) Or (strChoice = Chr(TERMINATE_KEY2))) Then c.SetAttrib "UserAbort", "yes" If (g_bBlockIDChanged) Then g_nBlockID = g_nBlockID - 1 ' since showing menu again will up it g_bBlockIDChanged = False g_bHandledBlockID = True End If c.Log IFIS_SetScannerReadyStatus 1 Exit Sub End If End If #Else Dim strIn As String Dim strOut As String If (g_bISMEnabled) Then g_ISM.ReadMessageFlush ' Send out start scan strOut = IFIS_WAITING_MSG & "2" ' 2=startscan g_ISM.SendMessage strOut IFIS_Yield 100 SetPCodeSleepFrequency 50 SetPCodeSleepDuration 10 SetOSThreadPriority 3 ' Wait until the startscan arrives Do Loop Until g_ISM.ReadMessageCount > 0 Or GetUserBreakState() >= 2 If GetUserBreakState() >= 2 Then ' Received an Interrupt - Exit message IFIS_SetScannerReadyStatus 2 ' 2 means user wants to exit Exit Sub End If strIn = g_ISM.ReadMessage ' Reads body g_ISM.ReadMessageFlush Dim strState As String strState = IFIS_ParseKnownTag(strIn, "STATE", 1) If strState = "1" Then ' Scanner is not ready c.SetAttrib "UserAbort", "yes" If (g_bBlockIDChanged) Then g_nBlockID = g_nBlockID - 1 ' since showing menu again will up it g_bBlockIDChanged = False g_bHandledBlockID = True End If c.Log IFIS_SetScannerReadyStatus 1 Exit Sub End If ' Fall through if the scanner is ready End If #End If ' Indicate that scanner is now ready IFIS_SetScannerReadyStatus 0 End Sub /* Overview: Pauses the experiment until the patient indicates that they are ready or chooses to contact the technologist. Parameters: c As Context The current experiment context. Remarks: (none) */ Public Sub IFIS_WaitForPatientReady(c As Context) ' Wait for the patient to get ready #If USE_ICP Then If (g_bICPEnabled) Then g_ICP.SendMessage strWaitPatientReady IFIS_Yield 100 SetPCodeSleepFrequency 50 SetPCodeSleepDuration 10 SetOSThreadPriority 3 End If Set IFISAskPatientReadyT.Input = Keyboard("15", "", Val(IFISAskPatientReadyT.Duration), Val("1"), ebInputActionTerminate, CLogical("No"), "", "flush:Yes") IFISAskPatientReadyT.Run If IFISAskPatientReadyT.RESP = "5" Then If g_bICPEnabled Then g_ICP.SendMessage "*;PATALERT;" End If If (g_bBlockIDChanged) Then g_nBlockID = g_nBlockID - 1 ' since showing menu again will up it g_bBlockIDChanged = False g_bHandledBlockID = True End If IFIS_SetPatientReadyStatus 1 c.SetAttrib "PatientAbort", "yes" c.Log Exit Sub End If #Else Dim strIn As String Dim strOut As String If (g_bISMEnabled) Then strOut = IFIS_WAITING_MSG & "3" ' 3=patient g_ISM.SendMessage strOut IFIS_Yield 100 SetPCodeSleepFrequency 50 SetPCodeSleepDuration 10 SetOSThreadPriority 3 End If '#If IFISwizardTemplate Then If IFISwizardTemplate Then IFISAskPatientReadySImage.Filename = c.GetAttrib("IFISInstructionPath") & SLIDE_ASKPATIENTREADY IFISAskPatientReadySImage.Load Set IFISAskPatientReadyS.Input = Keyboard("15", "", Val(IFISAskPatientReadyS.Duration), Val("1"), ebInputActionTerminate, CLogical("No"), "", "flush:Yes") IFISAskPatientReadyS.Run ' Here we check if an interrupt arrived while IFISAskPatientReadyS was running. If so, we just set PatientReadyStatus to 1, but we do not ' log the PatientAbort to the context. ' Note one problem is that if this is the case, we ignore whatever the patient responded, which could have been a 5, meaning that we may be ignoring ' the patient's desire to contact the technologist. For now let's just assume the patient will hit all 5 buttons if there is an emergency. ' Also, if the paradigm was aborted, we assume the experimenter will talk to the patient anyways. If GetUserBreakState >= 2 Then IFIS_SetPatientReadyStatus 1 Exit Sub End If If IFISAskPatientReadyS.RESP = "5" Then ' This probably won't get a chance to run g_ISM.SendMessage IFIS_PATIENT_REQUEST If (g_bBlockIDChanged) Then g_nBlockID = g_nBlockID - 1 ' since showing menu again will up it g_bBlockIDChanged = False g_bHandledBlockID = True End If IFIS_SetPatientReadyStatus 1 c.SetAttrib "PatientAbort", "yes" c.Log Exit Sub End If Else Set IFISAskPatientReadyT.Input = Keyboard("15", "", Val(IFISAskPatientReadyT.Duration), Val("1"), ebInputActionTerminate, CLogical("No"), "", "flush:Yes") IFISAskPatientReadyT.Run ' Here we check if an interrupt arrived while IFISAskPatientReadyT was running. If so, we just set PatientReadyStatus to 1, but we do not ' log the PatientAbort to the context. ' Note one problem is that if this is the case, we ignore whatever the patient responded, which could have been a 5, meaning that we may be ignoring ' the patient's desire to contact the technologist. For now let's just assume the patient will hit all 5 buttons if there is an emergency. ' Also, if the paradigm was aborted, we assume the experimenter will talk to the patient anyways. If GetUserBreakState >= 2 Then IFIS_SetPatientReadyStatus 1 Exit Sub End If If IFISAskPatientReadyT.RESP = "5" Then ' This probably won't get a chance to run g_ISM.SendMessage IFIS_PATIENT_REQUEST If (g_bBlockIDChanged) Then g_nBlockID = g_nBlockID - 1 ' since showing menu again will up it g_bBlockIDChanged = False g_bHandledBlockID = True End If IFIS_SetPatientReadyStatus 1 c.SetAttrib "PatientAbort", "yes" c.Log Exit Sub End If '#End If IFISwizardTemplate End If #End If ' Indicate that patient is now ready IFIS_SetPatientReadyStatus 0 End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-------------------------------------------------------------------------- ' Package Routines '-------------------------------------------------------------------------- Public Sub IFIS_Init(c As Context, s As String) g_nBeginNoTargetZone = 1000 g_nEndNoTargetZone = 1000 g_nTargetWindow = 2000 g_bIFISTimingModeCumulative = True SetPCodeSleepFrequency 50 SetPCodeSleepDuration 10 SetOSThreadPriority 3 ' TODO: Strip all white space? IFIS_SetNumPeriodsDefault Item$(s, 1) IFIS_SetPeriodADefault Item$(s, 2) IFIS_SetPeriodBDefault Item$(s, 3) IFIS_SetRFPulseModeDefault Trim$(Item$(s, 4)) IFIS_SetResponseModeDefault Trim$(Item$(s, 5)) IFIS_SetSimulateBlockMenu Trim$(Item$(s, 6)) ' Use clock scale if ready Dim dblClockScale As Double Dim strClockScale As String '#If IFISwizardTemplate Then If IFISwizardTemplateState Then 'Code for the beginning of the session g_LogCount= 0 'initial count to zero ' Set any image filenames that rely on this path (that can be set now - some have to wait until later for processing) IFISPrepareNextScanSImage.Filename = c.GetAttrib("IFISInstructionPath") & SLIDE_IFISPREPARENEXTSCAN IFISPrepareNextScanSImage.Load IFISBlockMenuSImage.Filename = c.GetAttrib("IFISInstructionPath") & SLIDE_IFISBLOCKMENU IFISBlockMenuSImage.Load IFISFixationStartControlDelaySImage.Filename = c.GetAttrib("IFISInstructionPath") & SLIDE_FIXATION IFISFixationStartControlDelaySImage.Load IFISFixationEndControlDelaySImage.Filename = c.GetAttrib("IFISInstructionPath") & SLIDE_FIXATION IFISFixationEndControlDelaySImage.Load IFISBlockFeedbackSImage.Filename = c.GetAttrib("IFISInstructionPath") & SLIDE_IFISBLOCKFEEDBACK IFISBlockFeedbackSImage.Load IFISFeedbackVisualSImage.Filename = c.GetAttrib("IFISInstructionPath") & SLIDE_IFISVISUALFEEDBACK IFISFeedbackVisualSImage.Load 'Fixed code do not alter Set IFISTrialAccuracy = New Summation ' set to record response accuracy Set g_IFISPeriodElapsed = New Summation 'set to record period elapsed times Set g_IFISEventElapsed = New Summation ' set to record event elapsed times End If '#End If #If USE_ICP Then strClockScale = Trim$(Item$(s, 7)) If (strClockScale <> "1.0") Then dblClockScale = CDbl(strClockScale) If (dblClockScale > 0#) Then Clock.Scale = dblClockScale End If End If #Else strClockScale = ReadIni$("Timing", "ClockScale", "IFIS.ini") On Error GoTo ClockScaleError If strClockScale <> "" Then dblClockScale = CDbl(strClockScale) ' Can throw type mismatch error If dblClockScale >= 0.8 And dblClockScale <= 1.2 Then Clock.Scale = dblClockScale Else MsgBox "Invalid Clock Scale specified in IFIS.ini. Clock scaling is disabled." End If End If On Error GoTo 0 #End If c.SetAttrib "Clock.Scale", CStr(Clock.Scale) IFIS_SetDiscardedAcquisitionTime Trim$(Item$(s, 8)) IFIS_SetSimulatedSound Trim$(Item$(s, 9)) Dim strBRUConfiguration As String strBRUConfiguration = Trim$(Item$(s, 10)) Select Case strBRUConfiguration Case "right" IFIS_SetBRUConfiguration BRU_RIGHT_ONLY Case "left" IFIS_SetBRUConfiguration BRU_LEFT_ONLY Case "unique" IFIS_SetBRUConfiguration BRU_RIGHT_LEFT_UNIQUE Case "duplicate" IFIS_SetBRUConfiguration BRU_RIGHT_LEFT_DUPLICATE Case Else Err.Raise 3000, "IFIS_Init", "Unrecognized BRU configuration" End Select #If USE_ICP Then Dim strUseICP As String strUseICP = Trim$(Item$(s, 11)) strUseICP = LCase(strUseICP) #Else Dim strIn As String SetUserBreakState 0 #End If ' This sets up the experiment. The following declared variables are ' initialized with default values. If IFIS Control Panel (ICP) is ' running, we overwrite them with ICP's settings. Dim strNumPeriods As String Dim strPeriodA As String Dim strPeriodB As String Dim strRFPulseMode As String Dim strResponseMode As String Dim strDisacqTime As String strNumPeriods = CStr(g_nNumPeriodsDefault) strPeriodA = CStr(g_nPeriodADefault) strPeriodB = CStr(g_nPeriodBDefault) strResponseMode = g_strResponseModeDefault strRFPulseMode = g_strRFPulseModeDefault strDisacqTime = CStr(g_nDiscardedAcquisitionTime) Dim nTimeout As Long Dim nMaxTimeout As Long nMaxTimeout = 2000 #If USE_ICP Then ' First, see if an attempt to use ICP should be made If strUseICP = "no" Then g_bICPEnabled = False GoTo SetDefaults End If ' Request number of period information from ICP and wait for a reply Set g_ICP = New IFISControlPanel g_ICP.Enable g_ICP.ReadMessageFlush g_ICP.SendMessage "*;NUMPERIODS;" nTimeout = Clock.Read + nMaxTimeout Do Loop Until (g_ICP.ReadMessageCount > 0) Or (Clock.Read > nTimeout) ' If we got a reply then the control panel is enabled If (g_ICP.ReadMessageCount > 0) Then g_bICPEnabled = True strNumPeriods = g_ICP.ReadMessage g_ICP.SendMessage strWaitPatientReady Else ' Couldn't find the ICP so disable further communications and skip the rest. g_bICPEnabled = False g_ICP.Disable GoTo SetDefaults End If ' Request PeriodA information from ICP and wait for a reply g_ICP.ReadMessageFlush g_ICP.SendMessage "*;PERIODA;" nTimeout = Clock.Read + nMaxTimeout Do Loop Until (g_ICP.ReadMessageCount > 0) Or (Clock.Read > nTimeout) strPeriodA = g_ICP.ReadMessage ' Request PeriodB information from ICP and wait for a reply g_ICP.ReadMessageFlush g_ICP.SendMessage "*;PERIODB;" nTimeout = Clock.Read + nMaxTimeout Do Loop Until (g_ICP.ReadMessageCount > 0) Or (Clock.Read > nTimeout) strPeriodB = g_ICP.ReadMessage ' Request RFPulse mode information from ICP and wait for a reply g_ICP.ReadMessageFlush g_ICP.SendMessage "*;RFPULSE;" nTimeout = Clock.Read + nMaxTimeout Do Loop Until (g_ICP.ReadMessageCount > 0) Or (Clock.Read > nTimeout) strRFPulseMode = g_ICP.ReadMessage ' Request Discarded acquisition time information from ICP and wait for a reply g_ICP.ReadMessageFlush g_ICP.SendMessage "*;DISACQS;" nTimeout = Clock.Read + nMaxTimeout Do Loop Until (g_ICP.ReadMessageCount > 0) Or (Clock.Read > nTimeout) strDisacqTime = g_ICP.ReadMessage g_ICP.ReadMessageFlush #Else ' Create the IFIS System Manager, enable its use and connect to it. Set g_ISM = New IFISSystemManager g_ISM.Enable g_ISM.Connect g_bISMEnabled = g_ISM.IsConnected If (g_bISMEnabled) Then ' Notify paradigm is open g_ISM.SendMessage IFIS_OPENED_MSG ' Notify the patient to wait '#If IFISwizardTemplate If IFISwizardTemplateState Then IFISPrepareNextScanS.Run Else IFISPrepareNextScanT.Run End If ' #End If IFISwizardTemplate ' Always default to scanner when ISM in use. strRFPulseMode = "scanner" IFIS_SetRFPulseModeDefault strRFPulseMode Else ' We are running standalone and need to prompt for the subject and session Dim vAnswer As Variant StartupInfo_Begin: StartupInfoPrompt_Subject: vAnswer = AskBox("Please enter the Subject Number (0-32767):", 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 (0-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) < 0 Then MsgBox "The value for Session must not be less than 0" 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) ' Check to make sure that the data files generated from this information do not already exist g_strNewEdatDataFile = g_strParadigmName & "-" & c.GetAttrib("Subject") & "-" & c.GetAttrib("Session") & ".edat" g_strNewTxtDataFile = g_strParadigmName & "-" & c.GetAttrib("Subject") & "-" & c.GetAttrib("Session") & ".txt" If FileExists(g_strNewEdatDataFile) Or FileExists(g_strNewTxtDataFile) Then vAnswer = AnswerBox("A data file already exists in the current directory using subject: " & c.GetAttrib("Subject") & ", session: " & c.GetAttrib("Session") &". Overwrite?") If vAnswer <> 1 Then Goto ExperimentAbort End If End If g_bRenameDataFiles = True Goto SetDefaults ExperimentAbort: g_bAbortParadigm = true End If #End If ' At this point all the strings have the values we want to use SetDefaults: ' Determine how RF Pulse detection is to occur and optionally create/initialize ' the one and only RFPulse object If (strRFPulseMode = "scanner") Then Set g_RFP = New RFPulse g_RFP.Address = RFP_SCANNER_ADDRESS g_RFP.PulseBitMask = RFP_SCANNER_PULSEBITMASK g_RFP.MinPulseTrainSpace = RFP_SCANNER_MINPULSETRAINSPACE g_RFP.InvertPulseData = RFP_SCANNER_INVERTPULSEDATA g_RFP.Enable g_bRFPEnabled = True ElseIf (strRFPulseMode = "joystick") Then Set g_RFP = New RFPulse g_RFP.Address = RFP_JOYSTICK_ADDRESS g_RFP.PulseBitMask = RFP_JOYSTICK_PULSEBITMASK g_RFP.MinPulseTrainSpace = RFP_JOYSTICK_MINPULSETRAINSPACE g_RFP.InvertPulseData = RFP_JOYSTICK_INVERTPULSEDATA g_RFP.Enable g_bRFPEnabled = True ElseIf (strRFPulseMode = "keyboard") Then g_bRFPEnabled = True Else g_bRFPEnabled = False End If ' Initialize the BRUs if they are to be in use If strResponseMode = "bru" Then Set g_BRU = New BRU g_BRU.Address = DIG100_BASE g_BRU.Configuration = IFIS_GetBRUConfiguration g_BRU.Reset DIG100_CONFIG_DATA g_BRU.Enable g_bBRUEnabled = True Else g_bBRUEnabled = False End If ' Initialize counters for feedback and create a summation object to ' track stats for feedback g_nBlockID = 1 g_bBlockIDChanged = False g_bHandledBlockID = False g_nBlockNum = 0 g_nPeriodNum = 0 g_nEventNum = 0 ' Set the attributes we need c.SetAttrib "NumPeriods", strNumPeriods ' Debug.Print "Set NumPeriods to " & strNumPeriods c.SetAttrib "PeriodA", strPeriodA 'Debug.Print "Set PeriodA to " & strPeriodA c.SetAttrib "PeriodB", strPeriodB 'Debug.Print "Set PeriodB to " & strPeriodB c.SetAttrib "Disacq", strDisacqTime 'Debug.Print "Set Disacq to " & strDisacqTime c.SetAttrib "SystemID", c.GetAttrib("Subject") c.SetAttrib "RunID", c.GetAttrib("Session") g_strRFPulseMode = strRFPulseMode #If USE_ICP Then If (g_bICPEnabled) Then Dim strMessage1 As String Dim strMessage2 As String strMessage1 = "BEGIN" strMessage2 = "BEGIN" g_ICP.ReadMessageFlush g_ICP.SendMessage "*;PATINFO;" Do While strMessage1 <> "" And strMessage2 <> "" Do Loop Until (g_ICP.ReadMessageCount > 0) strMessage1 = g_ICP.ReadMessage If (strMessage1 <> "") Then strMessage2 = g_ICP.ReadMessage If (strMessage2 <> "") Then If strMessage1 = "Subject" Or strMessage1 = "Session" Then c.SetAttrib strMessage1, CLng(strMessage2) Else c.SetAttrib strMessage1, strMessage2 End If End If End If Loop g_ICP.SendMessage "*;EXPINIT;" Sleep 100 End If #Else If (g_bISMEnabled) Then g_ISM.SendMessage IFIS_WAITING_MSG & "3" ' 3=patient End If #End If Exit Sub ClockScaleError: MsgBox "Invalid Clock Scale specified in IFIS.ini. Clock scaling is disabled." dblClockScale = 1# Err.Clear Resume Next End Sub Public Sub IFIS_Yield(nMsecs As Long) Dim nEndYieldTime As Long nEndYieldTime = Clock.Read + nMsecs - 20 SetPCodeSleepFrequency 50 SetPCodeSleepDuration 10 SetOSThreadPriority 3 Do Loop Until (Clock.Read >= nEndYieldTime) 'SetOSThreadPriority 0 'SetPCodeSleepDuration 0 'SetPCodeSleepFrequency 100 End Sub Public Sub IFIS_SessionBegin(c As Context, objBlockList As Factor) SetOSThreadPriority 3 SetPCodeSleepDuration 10 SetPCodeSleepFrequency 50 ' Build and show the menu Dim strIn As String Dim strLetter As String Dim strMenuText As String Dim strMenuKeys As String Dim strBlockTitle As String Dim i As Integer #If USE_ICP Then ' If we have run all the Blocks then reset to first If (g_nBlockID > objBlockList.Size) Then If (g_bICPEnabled Or g_bSimulateBlockMenu) Then g_nBlockID = 1 Else objBlockList.Terminate IFIS_SetSessionStatus 1 GoTo LABEL_Exit End If End If ' Let the patient know we are preparing the next scan If (g_bICPEnabled) Then IFISPrepareNextScanT.Run End If ' Build the Block menu strMenuText = "" If Not g_bICPEnabled Then strMenuText = "[Enter]-Continue [Del]-End Experiment\n" End If strLetter = "1" strMenuKeys = "" For i = 1 To objBlockList.Size strBlockTitle = objBlockList.GetAttrib(i, "BlockTitle") strMenuText = strMenuText & strLetter & "-" If i = g_nBlockID Then strMenuText = strMenuText & "*" End If strMenuText = strMenuText & strBlockTitle & "\n" strMenuKeys = strMenuKeys & strLetter strLetter = Chr(Asc(strLetter) + 1) Next i strMenuText = Left(strMenuText, Len(strMenuText) - 1) If (g_bICPEnabled) Then ' Send the menu to IFIS to show the Block menu then wait for a command coming back g_ICP.ReadMessageFlush g_ICP.SendMessage strWaitIFIS g_ICP.SendMessage "3;" & strMenuText ' Wait for a command Dim strChoice As String Dim t As Long t = Clock.Read + 10000 Do Loop Until (g_ICP.ReadMessageCount > 0) ' Or (Clock.Read > t) Display.RestoreVideoBuffers 'if Clock.Read > t then ' strChoice = Chr(CONTINUE_KEY) ' else strChoice = g_ICP.ReadMessage strChoice = Right(strChoice, 1) ' end if ElseIf (g_bSimulateBlockMenu) Then ' Refresh the background IFISBlockMenuT.Text = "Please Choose a Block:\n" & strMenuText IFISBlockMenuT.Text = IFISBlockMenuT.Text & "\n[IFIS CONTROL PANEL OFF]\n" Set IFISBlockMenuT.Input = Keyboard( _ strMenuKeys & Chr(CONTINUE_KEY) & Chr(TERMINATE_KEY1) & Chr(TERMINATE_KEY2), _ "", Val(IFISBlockMenuT.Duration), Val("1"), ebInputActionTerminate, CLogical("No"), "", "flush:Yes") IFISBlockMenuT.Run strChoice = IFISBlockMenuT.RESP If strChoice = Chr(CONTINUE_KEY) Then strChoice = Chr(CONTINUE_KEY) ElseIf strChoice = Chr(TERMINATE_KEY1) Then strChoice = Chr(TERMINATE_KEY1) ElseIf strChoice = Chr(TERMINATE_KEY2) Then strChoice = Chr(TERMINATE_KEY2) End If Else strChoice = Chr(CONTINUE_KEY) End If SetUserBreakState 0 ' Process user's choice If strChoice = Chr(TERMINATE_KEY1) Or strChoice = Chr(TERMINATE_KEY2) Then IFIS_SetSessionStatus 1 Exit Sub ElseIf (strChoice = Chr(CONTINUE_KEY)) Then Set objBlockList.Deletion = PickOne(g_nBlockID) objBlockList.Reset g_nBlockID = g_nBlockID + 1 g_bBlockIDChanged = True Else If (CInt(strChoice) = g_nBlockID) Then g_nBlockID = g_nBlockID + 1 g_bBlockIDChanged = True End If Set objBlockList.Deletion = PickOne(Asc(strChoice) - Asc("1") + 1) objBlockList.Reset End If ' Flag that we are NOT ending yet IFIS_SetSessionStatus 0 #Else ' Check if we are here because the user wanted to end the experiment If (GetUserBreakState() >= 2) Then IFIS_SetSessionStatus 1 GoTo LABEL_Exit End If SetUserBreakState 0 ' If we have run all the Blocks then reset to first If (g_nBlockID > objBlockList.Size) Then If (g_bISMEnabled Or g_bSimulateBlockMenu) Then g_nBlockID = 1 Else objBlockList.Terminate IFIS_SetSessionStatus 1 GoTo LABEL_Exit End If End If ' Build the Block menu strMenuText = "" If g_bISMEnabled Then strMenuText = IFIS_MENU_MSG & "" Else strMenuText = "[Enter]-Continue [Del]-End Experiment\n" End If strLetter = "1" strMenuKeys = "" For i = 1 To objBlockList.Size If Not g_bISMEnabled Then strBlockTitle = objBlockList.GetAttrib(i, "BlockTitle") strMenuText = strMenuText & strLetter & "-" If i = g_nBlockID Then strMenuText = strMenuText & "*" End If strMenuText = strMenuText & strBlockTitle & "\n" strMenuKeys = strMenuKeys & strLetter strLetter = Chr(Asc(strLetter) + 1) Else strBlockTitle = objBlockList.GetAttrib(i, "BlockTitle") strMenuText = strMenuText & "" & strLetter & ") " 'If i = g_nBlockID Then ' strMenuText = strMenuText & "*" 'End If strMenuText = strMenuText & strBlockTitle & "" 'strMenuKeys = strMenuKeys & strLetter strLetter = Chr(Asc(strLetter) + 1) End If Next i If g_bISMEnabled Then strMenuText = strMenuText & "" Else strMenuText = Left(strMenuText, Len(strMenuText) - 1) End If Dim strChoice As String Dim strOut As String If (g_bISMEnabled) Then ' Send the menu to ISM to show the Block menu then wait for a command coming back g_ISM.ReadMessageFlush strOut = IFIS_WAITING_MSG & "1" ' 1=menu g_ISM.SendMessage strOut g_ISM.SendMessage strMenuText '#If IFISwizardTemplate If IFISwizardTemplateState Then IFISPrepareNextScanS.Run Else IFISPrepareNextScanT.Run End If ' #End If IFISwizardTemplate ' Wait until the menu choice arrives Do Loop Until (g_ISM.ReadMessageCount > 0) Or (GetUserBreakState() <> 0) ' In case the user minimized E-Run Display.RestoreVideoBuffers If (GetUserBreakState() <> 0) Then If (GetUserBreakState() = 1) Then ' Redisplay task menu (a bit redundant) strChoice = Chr(TERMINATE_KEY1) ElseIf GetUserBreakState() = 2 Then ' User wants to terminate and save data strChoice = Chr(TERMINATE_KEY1) Else ' User wants to terminate and NOT save data (currently not implemented) strChoice = Chr(TERMINATE_KEY1) End If Else ' User made a choice strIn = g_ISM.ReadMessage Dim strTag As String Dim nStartPosition As Integer nStartPosition = 1 strTag = "CHOICE" strChoice = IFIS_ParseKnownTag(strIn, strTag, nStartPosition) End If 'Debug.Print "Choice=[" & strChoice & "]\n" 'Debug.Print "GetUserBreakState=[" & GetUserBreakState() & "]\n" ElseIf (g_bSimulateBlockMenu) Then ' Refresh the background '#If IFISwizardTemplate If IFISwizardTemplateState Then IFISBlockMenuSText.Text = "Please Choose a Block:\n" & strMenuText & "\n[IFIS SYSTEM MANAGER OFF]\n" Set IFISBlockMenuS.Input = Keyboard( _ strMenuKeys & Chr(CONTINUE_KEY) & Chr(TERMINATE_KEY1) & Chr(TERMINATE_KEY2), _ "", Val(IFISBlockMenuS.Duration), Val("1"), ebInputActionTerminate, CLogical("No"), "", "flush:Yes") IFISBlockMenuS.Run strChoice = IFISBlockMenuS.RESP Else IFISBlockMenuT.Text = "Please Choose a Block:\n" & strMenuText IFISBlockMenuT.Text = IFISBlockMenuT.Text & "\n[IFIS SYSTEM MANAGER OFF]\n" Set IFISBlockMenuT.Input = Keyboard( _ strMenuKeys & Chr(CONTINUE_KEY) & Chr(TERMINATE_KEY1) & Chr(TERMINATE_KEY2), _ "", Val(IFISBlockMenuT.Duration), Val("1"), ebInputActionTerminate, CLogical("No"), "", "flush:Yes") IFISBlockMenuT.Run strChoice = IFISBlockMenuT.RESP End If '#End If ' IFISwizardTemplate If strChoice = Chr(CONTINUE_KEY) Then strChoice = Chr(CONTINUE_KEY) ElseIf strChoice = Chr(TERMINATE_KEY1) Then strChoice = Chr(TERMINATE_KEY1) ElseIf strChoice = Chr(TERMINATE_KEY2) Then strChoice = Chr(TERMINATE_KEY2) End If Else strChoice = Chr(CONTINUE_KEY) End If SetUserBreakState 0 ' Process user's choice If strChoice = Chr(TERMINATE_KEY1) Or strChoice = Chr(TERMINATE_KEY2) Then IFIS_SetSessionStatus 1 Exit Sub ElseIf (strChoice = Chr(CONTINUE_KEY)) Then Set objBlockList.Deletion = PickOne(g_nBlockID) objBlockList.Reset g_nBlockID = g_nBlockID + 1 g_bBlockIDChanged = True Else If (CInt(strChoice) = g_nBlockID) Then g_nBlockID = g_nBlockID + 1 g_bBlockIDChanged = True End If Set objBlockList.Deletion = PickOne(Asc(strChoice) - Asc("1") + 1) objBlockList.Reset End If ' Allow the user to update any parameters If (g_bISMEnabled) Then ' Request paradigm parameters and wait until they arrive g_ISM.ReadMessageFlush g_ISM.SendMessage IFIS_PARAMS_GET_MSG Do Loop Until (g_ISM.ReadMessageCount > 0) Or (GetUserBreakState() <> 0) If (g_ISM.ReadMessageCount > 0) Then strIn = g_ISM.ReadMessage ' Parse out parameters and add them to the Context Dim str As String Dim strKey As String Dim strValue As String Dim nStartPos As Integer Dim nEqualPos As Integer Dim bReceivedDataPath As Boolean Dim bReceivedSystemID As Boolean Dim bReceivedRunID As Boolean nStartPos = 1 Do str = IFIS_ParseKnownTag(strIn, "I", nStartPos) If str <> "" Then ' TODO: make sure str is in the form key=value nEqualPos = InStr(1, str, "=") strKey = Left(str, nEqualPos - 1) strValue = Right(str, Len(str) - nEqualPos) Debug.Print strKey & "..." & strValue If strKey = "NumPeriods" Then c.SetAttrib "NumPeriods", strValue ' Debug.Print "Set NumPeriods to " & strValue ElseIf strKey = "PeriodA" Then c.SetAttrib "PeriodA", strValue 'Debug.Print "Set PeriodA to " & strValue ElseIf strKey = "PeriodB" Then c.SetAttrib "PeriodB", strValue 'Debug.Print "Set PeriodB to " & strValue ElseIf strKey = "Disacq" Then c.SetAttrib "Disacq", strValue 'Debug.Print "Set Disacq to " & strValue ElseIf strKey = "SystemID" Then g_strSystemID = strValue c.SetAttrib "Subject", strValue c.SetAttrib "SystemID", strValue 'Debug.Print "Assigned system ID = " & g_strSystemID bReceivedSystemID = True ElseIf strKey = "RunID" Then g_strRunNumber = strValue c.SetAttrib "Session", strValue c.SetAttrib "RunID", strValue bReceivedRunID = True 'Debug.Print "Assigned run number = " & g_strRunNumber ElseIf strKey = "DataPath" Then g_strDataPath = strValue 'Debug.Print "Assigned data path = " & g_strDataPath ' Assume that if we got this we will get the run number and systemID needed to name the data file bReceivedDataPath = True Else c.SetAttrib strKey, strValue 'Debug.Print "Set " & strKey & " to " & strValue End If End If Loop Until str = "" If bReceivedSystemID And bReceivedRunID And bReceivedDataPath Then ' Got the necessary values to rename the data files g_bRenameDataFiles = True g_strNewEdatDataFile = g_strDataPath & "\\" & g_strSystemID & "\\" & g_strParadigmName & "-" & g_strSystemID & "-" & g_strRunNumber & ".edat" g_strNewTxtDataFile = g_strDataPath & "\\" & g_strSystemID & "\\" & g_strParadigmName & "-" & g_strSystemID & "-" & g_strRunNumber & ".txt" End If End If End If ' Flag that we are NOT ending yet IFIS_SetSessionStatus 0 #End If LABEL_Exit: #If USE_ICP Then If (g_bICPEnabled) Then g_ICP.SendMessage strWaitPatientReady Sleep 100 End If SetPCodeSleepFrequency -1 SetPCodeSleepDuration 0 SetOSThreadPriority 0 #Else If (g_bISMEnabled) And (GetUserBreakState() = 0) Then g_ISM.SendMessage IFIS_WAITING_MSG & "3" ' 3=patient 'IFIS_Yield 100 End If #End If End Sub Public Sub IFIS_SessionEnd(c As Context) End Sub Public Sub IFIS_BlockBegin(c As Context) g_nHits = 0 ' Set global variables for hits and false alarms for task g_nMisses = 0 g_nFalseAlarms = 0 g_bInTimeWindow = False 'Set up response time window g_bLookingForResponse = False g_bPassFeedback = False ' Set Start Control Duration to 0. g_IFISStartControlDuration = 0 ' #IF IFISwizardTemplate If IFISwizardTemplate Then If Not(Ucase$(c.GetAttrib("Feedback")) = "VISUAL" or Ucase$(c.GetAttrib("Feedback")) = "AUDITORYVISUAL" or _ Ucase$(c.GetAttrib("Feedback")) = "AUDITORY" or Ucase$(c.GetAttrib("Feedback")) = "NONE") Then MsgBox("Bad Feedback attribute, must be one of Visual, Auditory, AuditoryVisual, None") End If If Ucase$(c.GetAttrib("Feedback")) = "AUDITORY" or Ucase$(c.GetAttrib("Feedback")) = "AUDITORYVISUAL" Then g_IFISTrialAuditoryFeedback = True 'Sound on errors set false to turn off Else g_IFISTrialAuditoryFeedback = False End If If Ucase$(c.GetAttrib("Feedback")) = "VISUAL" or Ucase$(c.GetAttrib("Feedback")) = "AUDITORYVISUAL" Then g_IFISTrialErrorDisplay = True 'Display wrong set to false to turn off message Else g_IFISTrialErrorDisplay = False End If End If ' #EndIf IFISwizardTemplate 'Code for the beginning of each block '#IF IFISwizardTNBack Then If IFISWizardTNBack Then 'NBack code '************* NBack initiate code begin block ******************* IFIS_QInit IFISLetterQ IFISNBackCount = 0 'Reset IFISNBackCount (number of previous stimuli) to start up queue ' IFISZeroBackChar = LetterList.getAttrib(Random(1,18),"Letter")'Pick a letter for this trial ' c.SetAttrib "ZeroInstruct", "Search for" 'Note to make this easier and reduce load always set to X IFISZeroBackChar = "X" 'Assign a letter c.SetAttrib "ZeroBackChar",IFISZeroBackChar ' If c.GetAttrib("StimType") = "Pictures" and c.GetAttrib("NBack") <> "0" then' ' c.SetAttrib "ZeroBackChar","ExpBackGround" ' End IF End If '#End If '#If IFISwizardTemplate Then If IFISwizardTemplateState Then IFISTrialAccuracy.Reset ' Reset Cumulative accuracy g_IFISPeriodElapsed.Reset 'Reset variable to track timing accuracy for period g_IFISEventElapsed.Reset 'Reset variable to track timing accuracy for Event End If '#End If g_LogCount = 0 'Set to log condition for output of event history for some analysis paths #If USE_ICP Then If (g_bICPEnabled) Then ' Wait for Scanner ready from the experimenter/technologist IFISPrepareNextScanT.Run End If #Else Dim strOut As String Dim strIn As String If (GetUserBreakState() >= 2) Then IFIS_SetBlockStatus 1 GoTo LABEL_Exit End If If (g_bISMEnabled) Then ' Wait for Scanner ready from the experimenter/technologist '#If IFISwizardTemplate If IFISwizardTemplateState Then IFISPrepareNextScanS.Run Else IFISPrepareNextScanT.Run End If ' #End If IFISwizardTemplate End If #End If SetOSThreadPriority 3 SetPCodeSleepDuration 10 SetPCodeSleepFrequency 50 IFIS_WaitForScannerReady c If (IFIS_GetScannerReadyStatus <> 0) Then IFIS_SetBlockStatus 1 GoTo LABEL_Exit End If ' Wait for Patient to acknowledge they are ready IFIS_WaitForPatientReady c If (IFIS_GetPatientReadyStatus <> 0) Then IFIS_SetBlockStatus 1 GoTo LABEL_Exit End If ' Warn the patient and the experimenter we are about to ' start (this is also a cue for the RFPulse to trigger) '#If IFISwizardTemplate Then If IFISwizardTemplateState Then IFISGetReadySImage.Filename = c.GetAttrib("IFISInstructionPath") & SLIDE_IFISGETREADY IFISGetReadySImage.Load Else IFISGetReadyT.Text = "Get Ready!" End If ' #End If IFISwizardTemplate #If USE_ICP Then If g_strRFPulseMode <> "scanner" And Not g_bICPEnabled Then IFISGetReadyT.Text = IFISGetReadyT.Text & "\n\n\nPress Any Key To Begin." End If IFISGetReadyT.Run If (g_bICPEnabled) Then g_ICP.SendMessage strStartScan IFIS_Yield 100 SetPCodeSleepFrequency 50 SetPCodeSleepDuration 10 SetOSThreadPriority 37 End If #Else If g_strRFPulseMode <> "scanner" And Not g_bISMEnabled Then '#If IFISwizardTemplate Then If IFISwizardTemplateState Then IFISGetReadySImage.Filename = c.GetAttrib("IFISInstructionPath") & SLIDE_IFISGETREADY_PRESSKEY IFISGetReadySImage.Load Else IFISGetReadyT.Text = IFISGetReadyT.Text & "\n\n\nPress Any Key To Begin." End If ' #End If IFISwizardTemplate End If '#If IFISwizardTemplate Then If IFISwizardTemplateState Then IFISGetReadyS.Run Else IFISGetReadyT.Run End If ' #End If IFISwizardTemplate If (g_bISMEnabled) Then ' Send out start scan strOut = IFIS_WAITING_MSG & "4" ' 4=trigger g_ISM.SendMessage strOut IFIS_Yield 100 SetPCodeSleepFrequency 50 SetPCodeSleepDuration 10 SetOSThreadPriority 3 End If #End If If (g_bRFPEnabled) Then If (g_strRFPulseMode = "keyboard") Then ' keyboard only IFISPause.Duration = -1 Set IFISPause.Input = Keyboard("any", "", Val(IFISPause.Duration), Val("1"), ebInputActionTerminate, CLogical("No"), "", "flush:Yes") IFISPause.Run ElseIf (g_strRFPulseMode = "scanner") Then ' Scanner or keyboard ' Wait for RF Pulse or F6 key on numeric keypad (must be in high priority so we don't miss) 'SetPCodeSleepFrequency -1 'SetPCodeSleepDuration 0 'SetOSThreadPriority 0 g_RFP.Reset Do Loop Until g_RFP.PulseTrainActive Or GetUserBreakState() >= 2 'SetOSThreadPriority 3 'SetPCodeSleepDuration 10 'SetPCodeSleepFrequency 50 End If End If If GetUserBreakState() >= 2 Then IFIS_SetBlockStatus 1 GoTo LABEL_Exit End If #If USE_ICP Then If (g_bICPEnabled) Then g_ICP.SendMessage strRunning End If #Else If (g_bISMEnabled) Then g_ISM.SendMessage IFIS_RUNNING_MSG End If #End If ' Set the terminate condition for the period list we are ' about to run. Dim objList As FactorSpace Dim nPeriods As Long Set objList = GetFactorSpaceByName(c.GetAttrib("NameOfPeriodList")) If (objList Is Not Nothing) Then nPeriods = c.GetAttrib("Periods") Set objList.TerminateCondition = Samples(nPeriods) objList.Reset End If ' Set the start of block time c.SetAttrib "ScanStartTime", Time$ 'c.SetAttrib "BlockTime", Clock.Read ' TODO: Handle case when just running w/o RFP or ICP ' Set the end period time for the list we are about to run If (g_strRFPulseMode = "scanner") Then g_IFISBlockStartTime = g_RFP.StartTime ' First RF Pulse 'g_nPeriodEndTime = g_RFP.StartTime + CLng(c.GetAttrib("StartDelay")) Else g_IFISBlockStartTime = IFISPause.RTTime ' First simulated RF pulse (F6) 'g_nPeriodEndTime = IFISPause.RTTime + CLng(c.GetAttrib("StartDelay")) End If g_nPeriodEndTime = g_IFISBlockStartTime ' SetNextTargetOnsetTime g_nPeriodEndTime for period 1 do not move the SetNext Target Onset Time ' 1-30-00 change in the way we start the first period. The user needs to put in their own objects ' to set the screen before the first period. I now use g_nPeriodEndTime for the first setting of ' the onset time c.SetAttrib "BlockTime", g_IFISBlockStartTime SetNextTargetOnsetTime g_IFISBlockStartTime ' Reset counters used for feedback g_nBlockNum = g_nBlockNum + 1 g_nPeriodNum = 0 g_nEventNum = 0 ' Indicate ready to proceed. IFIS_SetBlockStatus 0 ' #If IFISwizardTemplate Then If IFISwizardTemplateState Then Dim objList2 As FactorSpace If Ucase$(c.GetAttrib("CounterBalance"))= "EVENT3BACK" Then Dim strBalancedSequence as String Dim intNumConditions as Integer, intNumTrials as Integer ' intNumConditions = Cint(c.GetAttrib("ConditionsSelectCount")) intNumTrials = CInt(c.GetAttrib("Periods")) Set objList2 = GetFactorSpaceByName( c.GetAttrib( "PeriodList") ) If (objList2 Is Not Nothing) Then 'Test of trial list ordering intNumConditions = objList2.order.count strBalancedSequence = IFIS_fncGenerateCondSeries(intNumConditions,intNumTrials) 'debug.print ebCrLf & "blance string\n" & strBalancedSequence & ebCrLf Set objList2.Order = ExplicitOrder( strBalancedSequence) objList2.Reset End If End If Set objList2 = GetFactorSpaceByName("IFISTaskPeriodBaseList" ) If (objList2 Is Not Nothing) Then 'Block count nPeriods = c.GetAttrib( "Periods" ) Set objList2.TerminateCondition = Samples( nPeriods ) objList2.Reset End If Dim i as Integer '#IF IFISwizardRecordPeriodHistory Then If IFISwizardRecordEventHistoryState Then For i = 1 to MaxTaskPeriodHistory IFIS_TaskPeriodCondHistory(i) = "Start" 'Lable history as start of block Next i End If '#End IF '#IF IFISwizardRecordEventHistory Then If IFISwizardRecordEventHistoryState Then For i = 1 to MaxTaskEventHistory IFIS_TaskEventCondHistory(i) = "Start" 'Lable history as start of block Next i End If '#End If ' Adjust for start control and start delay Dim nTotalDelayTime As Long nTotalDelayTime = g_IFISStartControlDuration + c.GetAttrib("StartDelay") IFIS_BVLog GetNextTargetOnsetTime + c.GetAttrib("StartDelay"),"Scan\tStartControl" IFISFixationStartControlDelayS.Duration = 0 IFISFixationStartControlDelayS.Run SetNextTargetOnsetTime GetNextTargetOnsetTime + nTotalDelayTime g_nPeriodEndTime = GetNextTargetOnsetTime ' Debug.Print "Period End Time: " & g_nPeriodEndTime & "Clock.Read: " & Clock.Read & ebcrlf End If 'IFISwizardTemplateState '#End If LABEL_Exit: #If USE_ICP Then SetPCodeSleepFrequency -1 SetPCodeSleepDuration 0 SetOSThreadPriority 0 #Else ' Don't change priority #End If End Sub Public Sub IFIS_BlockEnd(c As Context, Optional DataToLog As Variant) If (g_bRFPEnabled) Then If (g_strRFPulseMode = "keyboard") Then c.SetAttrib "RFP.StartTime", 0 c.SetAttrib "RFP.LastPulseTime", 0 c.SetAttrib "RFP.N", 0 c.SetAttrib "RFP.Total", 0 c.SetAttrib "RFP.Min", 0 c.SetAttrib "RFP.Max", 0 c.SetAttrib "RFP.Mean", 0 c.SetAttrib "RFP.STDev", 0 Else c.SetAttrib "RFP.StartTime", g_RFP.StartTime c.SetAttrib "RFP.LastPulseTime", g_RFP.LastPulseTime c.SetAttrib "RFP.N", g_RFP.n c.SetAttrib "RFP.Total", g_RFP.Total c.SetAttrib "RFP.Min", g_RFP.Min c.SetAttrib "RFP.Max", g_RFP.Max c.SetAttrib "RFP.Mean", g_RFP.Mean c.SetAttrib "RFP.STDev", g_RFP.StandardDeviation End If End If 'If GetNextTargetOnsetTime > Clock.Read Then ' time of targeted end of session ' c.SetAttrib "BlockElapsed", GetNextTargetOnsetTime - c.GetAttrib("BlockTime") ' Else ' c.SetAttrib "BlockElapsed", Clock.Read - c.GetAttrib("BlockTime") ' End If ' c.SetAttrib "BlockElapsed", Clock.Read - c.GetAttrib("BlockTime") '#If IFISwizardTemplate Then If IFISwizardTemplateState Then If c.GetAttrib("EndControlDuration") > 0 then IFIS_BVLog GetNextTargetOnsetTime,"Scan\tEndControl" IFISFixationEndControlDelayS.Duration = CLng(c.GetAttrib("EndControlDuration")) IFISFixationEndControlDelayS.Run End If End If '#End If If GetNextTargetOnsetTime <= Clock.Read Then 'WS add check end time in range c.SetAttrib "BlockElapsed", Clock.Read - c.GetAttrib("BlockTime") 'out of range Else c.SetAttrib "BlockElapsed", GetNextTargetOnsetTime - c.GetAttrib("BlockTime") 'WS end with next display End If '#If IFISwizardTemplate Then If IFISwizardTemplateState Then 'This Logs the data from the experment with a file of TestExperiment & Subject & BlockNum & .tdat Dim bLogging As Boolean bLogging = False If g_LogCount > 0 Or Not IsMissing(DataToLog) Then ' Create and open BrainVoyager data file g_strBVFile = Left(g_strNewEdatDataFile,Len(g_strNewEdatDataFile)-5) & "-" & g_nBlockNum & ".tdat" 'g_strBVFile = "Run" & c.GetAttrib("Subject") & "-" & g_nBlockNum & ".tdat" Open g_strBVFile For Output Access Write Lock Write As #2 bLogging = True End If If Not IsMissing(DataToLog) Then Dim strVariableList As String Dim nLogIndex As Integer If UCase(DataToLog) = "DEFAULT" Then strVariableList = "Subject,RunID,SessionDate,SessionTime,NumPeriods,BlockElapsed,ScanStartTime,RFP.StartTime,RFP.Total,BlockCondition,VolumeTime,StartDelay,StartControlDuration,EndControlDuration" Else strVariableList = CStr(DataToLog) End If For nLogIndex = 1 to ItemCount(strVariableList) If c.AttribExists(Item$(strVariableList,nLogIndex),False) Then Print #2, "0\tRunID\t" & Item$(strVariableList,nLogIndex) & "\t" & c.GetAttrib(Item$(strVariableList,nLogIndex)) End If Next nLogIndex End If If g_LogCount > 0 Then For nLogIndex = 1 to g_LogCount Print #2, CStr(Fix( (g_TimeLog(nLogIndex)-g_IFISBlockStartTime) ) ) & "\t" & g_TaskLog(nLogIndex) Next nLogIndex Print #2, Cstr( CLng(c.GetAttrib("BlockElapsed"))) & "\tScan\tRunEnd" If CLng(c.GetAttrib("RFP.LastPulseTime")) > 0 Then Print #2, Cstr( CLng(c.GetAttrib("RFP.LastPulseTime"))-g_IFISBlockStartTime) & "\tScan\tLastPulse\t" & c.GetAttrib("RFP.Total") Else Print #2, 0 & "\tScan\tLastPulse\t" & c.GetAttrib("RFP.Total") End If End If If bLogging Then ' Close BrainVoyager data file Close #2 End If If IFISwizardTimingPrecisionState Then c.SetAttrib "PeriodReport", "Period Report " & _ Format(g_IFISPeriodElapsed.Mean/1000.0,"##0.000") & _ "\n SD " & Format(g_IFISPeriodElapsed.StdDevP/1000.0,"##0.000") & "\nBlock " & _ Format(CSng(c.GetAttrib("BlockElapsed"))/1000.0,"##0.000") IFIS_Feedback c, c.GetAttrib("PeriodReport"), 1, 100 Else c.SetAttrib "PeriodReport", "" End If If IFISwizardBlockAccuracyState Then 'Calcuation of Block Accuracy c.SetAttrib "CumulativeAccuracy", Format(IFISTrialAccuracy.mean,"##0%") Else c.SetAttrib "CumulativeAccuracy", "" End If If IFISTrialAccuracy.N < 1 Then GoTo IFISPostFeedback IFISBlockFeedbackSText.Text = c.GetAttrib("CumulativeAccuracy") & ebcrlf & "Press any key to continue." & ebcrlf & ebcrlf & c.GetAttrib("PeriodReport") Set IFISBlockFeedbackS.Input = Keyboard("any", "", Val(IFISBlockFeedbackS.Duration), Val("1"), ebInputActionTerminate, CLogical("No"), "", "flush:Yes") IFISBlockFeedbackS.Run End If '#End If Exit Sub IFISPostFeedback: End Sub Public Sub IFIS_PeriodBegin(c As Context, strPeriodStartSignal As String) g_nEventOfPeriodNum = 0 'Reset event counter 'g_nPeriodStartTime = GetNextTargetOnsetTime ' for first period set start to greatest of target start, NextTargetOnsetTime or current time If g_nPeriodNum = 0 Then 'WS* next set of lines new first period make up for the startDelay ' If GetNextTargetOnsetTime < g_nPeriodEndTime And Clock.Read < g_nPeriodEndTime Then If Clock.Read < g_nPeriodEndTime Then g_nPeriodStartTime = g_nPeriodEndTime ' set to the end of the start delay Else ' If GetNextTargetOnsetTime > Clock.Read Then ' g_nPeriodStartTime = GetNextTargetOnsetTime 'set to current time since past start delay ' Else g_nPeriodStartTime = Clock.Read ' End If End If 'SetNextTargetOnsetTime g_nPeriodStartTime Else g_nPeriodStartTime = GetNextTargetOnsetTime End If 'WS* end new code c.SetAttrib "PeriodTime", g_nPeriodStartTime 'Debug.Print "PeriodTime: " & g_nPeriodStartTime & " Clock.Read: " & Clock.Read & ebcrlf ' TODO: WS Re-evaluate real need g_nPeriodSetupTime = g_nPeriodStartTime - g_nPeriodEndTime c.SetAttrib "PeriodSetupTime", g_nPeriodSetupTime ' Set the end period time for the list we are about to run g_nPeriodEndTime = g_nPeriodStartTime + CLng(c.GetAttrib("PeriodDuration")) g_nPeriodNum = g_nPeriodNum + 1 ' Signal beginning of new period (if enabled) If (CLogical(strPeriodStartSignal)) Then IFISBeeper.Play End If If (g_strSimulatedSound <> "none") Then IFISSimulatedSound.Play End If End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Sub IFIS_PeriodEnd(c As Context) Dim strPeriodAborted As String Dim nMaxPeriodEnd As Long strPeriodAborted = "No" '#If IFISwizardTemplate Then If IFISwizardTemplateState Then If IFISwizardRecordEventHistoryState Then Dim i As Integer 'Log the history of task events of events For i = MaxTaskPeriodHistory To 1 Step -1 c.SetAttrib "TaskPeriodHistoryM" & CStr(i), IFIS_TaskPeriodCondHistory(i) If i > 1 Then IFIS_TaskPeriodCondHistory(i) = IFIS_TaskPeriodCondHistory(i-1) Next i IFIS_TaskPeriodCondHistory(1) = IFIS_TaskPeriodCondHistory(0) End If ' IFISwizardRecordPeriodHistory End If '#End If 'IFISwizardTemplate If (GetUserBreakState() <> 0) Then Dim objList As FactorSpace ' There is not enough time to start a new trial so tell the ' list to stop running Set objList = GetFactorSpaceByName(c.GetAttrib("Running")) If (objList Is Not Nothing) Then objList.Terminate #If USE_ICP Then If (g_bICPEnabled) Then g_ICP.SendMessage "2;User break" End If #Else If (g_bISMEnabled) Then g_ISM.SendMessage "10User Break" End If #End If End If If (g_bBlockIDChanged) And (Not g_bHandledBlockID) Then g_nBlockID = g_nBlockID - 1 End If g_bHandledBlockID = False g_bBlockIDChanged = False strPeriodAborted = "Yes" nMaxPeriodEnd = Clock.Read g_nPeriodEndTime = nMaxPeriodEnd Else ' If (Clock.Read <= g_nPeriodEndTime) Then ' c.SetAttrib "PeriodElapsed", g_nPeriodEndTime - g_nPeriodStartTime ' Else ' The following is an "under estimate" of the actual setup time ' c.SetAttrib "PeriodElapsed", Clock.Read - g_nPeriodStartTime ' normal end of period ' The end of the period for a normal exit is considered the maximum of current time, NextTargetOnsetTime, and g_nPeriodEndTime ' NOTE: If user commands push the current time or NextTargetonset time beyond the g_nPeriodEndTime the periods will be ' longer and period starts times will not be exactly the specified duration. If Clock.Read > GetNextTargetOnsetTime Then nMaxPeriodEnd = Clock.Read Else nMaxPeriodEnd = GetNextTargetOnsetTime End If If g_nPeriodEndTime > nMaxPeriodEnd Then nMaxPeriodEnd = g_nPeriodEndTime End If End If 'Set the time for the targeted End period time If g_bIFISTimingModeCumulative Then 'set the time for the next period to when it should have started SetNextTargetOnsetTime g_nPeriodEndTime Else ' Set the time for the next period to be max of now, last display, or should have started SetNextTargetOnsetTime nMaxPeriodEnd End If c.SetAttrib "PeriodElapsed", nMaxPeriodEnd - g_nPeriodStartTime c.SetAttrib "PeriodAborted", strPeriodAborted ' Set target time of first event 'IF IFISDebug Then ' Debug.Print "Period End" & ebTab & Clock.Read & ebTab & "NextTargetOnsetTime" & ebTab & _ ' GetNextTargetOnsetTime & ebTab & "Period Start" & ebTab & c.GetAttrib("PeriodTime") & _ ' ebTab & "Period Elapsed" & ebTab & c.GetAttrib("PeriodElapsed") & ebTab & EbCrLf ' End IF '#If IFISwizardTemplate Then If IFISwizardTemplateState Then ' record period time for report g_IFISPeriodElapsed.AddObservation c.GetAttrib("PeriodElapsed") End If '#End If End Sub Public Sub IFIS_EventBegin(c As Context) g_nEventOfPeriodNum = g_nEventOfPeriodNum + 1 'increment event counter within a period g_nEventNum = g_nEventNum + 1 g_IFISBVLogEventData = IFISwizardBVLogEventData If Clock.Read < GetNextTargetOnsetTime Then c.SetAttrib "EventTime", GetNextTargetOnsetTime Else c.SetAttrib "EventTime",Clock.Read End If End Sub Public Sub IFIS_EventEnd(c As Context) Dim strEventAborted As String Dim nMinContinueTime As Long strEventAborted = "No" ' Terminate the current list if period time exceeded ' TODO: this could perhaps be a global set at a level above ' Contingent states ' No abort current time < g_nPeriodEndTime - nMinContinueTime => run next event ' No abort current time > g_nPeriodEndTime - nMinContinueTime => ' no more events this period ' consider end time max of GetNextTargetOnset or Clock.read ' Abort => no more envents this perod, terminate period list ' set end time max GetNextTargetOnset or Clock.read ' nMinContinueTime = c.GetAttrib("MinContinueTime") ' See if we have enough time to start a new event If ((Clock.Read >= (g_nPeriodEndTime - nMinContinueTime)) Or (GetUserBreakState() <> 0)) Then ' There is not enough time to start a new event so tell the ' list to stop running Dim objList As FactorSpace Set objList = GetFactorSpaceByName(c.GetAttrib("Running")) If (objList Is Not Nothing) Then objList.Terminate #If USE_ICP Then If (g_bICPEnabled) Then g_ICP.SendMessage strPeriodEnd End If #Else If (g_bISMEnabled) Then g_ISM.SendMessage "10End of Period" End If #End If End If If GetUserBreakState() = 0 Then ' If there is any time left over then we must delay but allow 100 ms for prerelease IFIS_Yield g_nPeriodEndTime - Clock.Read - 100 Else strEventAborted = "Yes" g_nPeriodEndTime = Clock.Read SetNextTargetOnsetTime g_nPeriodEndTime End If End If c.SetAttrib "EventAborted", strEventAborted 'c.SetAttrib "EventElapsed", GetNextTargetOnsetTime - c.GetAttrib("EventTime") If (Clock.Read <= GetNextTargetOnsetTime) Then 'WS* 1-30-00 c.SetAttrib "EventElapsed", GetNextTargetOnsetTime - c.GetAttrib("EventTime") Else ' The following is an "under estimate" of the actual setup time c.SetAttrib "EventElapsed", Clock.Read - c.GetAttrib("EventTime") End If ' If IFISdebug Then ' Debug.Print "Event End" & ebTab & Clock.Read & ebTab & "NextTargetOnsetTime" & ebTab & _ ' GetNextTargetOnsetTime & ebTab & "Event Start" & ebTab & c.GetAttrib("EventTime") & _ ' ebTab & "EventElapsed" & ebTab & c.GetAttrib("EventElapsed") & ebTab & EbCrLf ' End IF 'Provide Subject feedback if correct answer expected and feedback enabled ' BAMOD This code only executes if there is a CorrectAnswer attribute. Presently, there is NOT for VisualFlash amd NBack 'If c.AttribExists("CorrectAnswer") Then 'If c.GetAttrib("TaskProcedure") <> "VisualFlashProcedure" Then If g_IFISTrialErrorDisplay Or g_IFISTrialAuditoryFeedback Then If c.GetAttrib("CorrectAnswer") <> "" Then 'Do not score for null answer If c.GetAttrib("Probe.ACC")<> "1" Then 'Was it correct If g_IFISTrialErrorDisplay Then IFISFeedbackVisualS.Run 'Show error message If g_IFISTrialAuditoryFeedback Then IFISFeedbackAuditory.Run 'Give Feedback sound IFISTrialAccuracy.AddObservation 0 ' add error observation Else IFISTrialAccuracy.AddObservation 1 ' add correct observation End If End If End If '#If IFISwizardTemplate Then If IFISwizardTemplateState Then '#IF IFISwizardRecordEventHistory Then If IFISwizardRecordEventHistoryState Then 'Log the history of task events of events So you can look a a history of the 5 last events 'Store TaskEventHistoryM1, Store TaskEventHistoryM2, ..., TaskEventHistoryM5 'This allows you to check for a specific ordering of events (e.g., Wait, Wait, LeftMotor, Wait, Wait) Dim historyindex As Integer For historyindex = MaxTaskEventHistory to 1 step -1 'Store previous history and update history saves c.SetAttrib "TaskEventHistoryM" & Cstr(historyindex), IFIS_TaskEventCondHistory(historyindex) if historyindex > 1 then IFIS_TaskEventCondHistory(historyindex) = IFIS_TaskEventCondHistory(historyindex-1) Next historyindex IFIS_TaskEventCondHistory(1) = c.GetAttrib("StimulusLabel") IFIS_TaskPeriodCondHistory(0) = c.GetAttrib("PeriodCondition") 'lable last task period history End If '#End IF 'end of IFISwizardRecordEventHistory 'Cell count condition logging. This logs the time of each event in a file for that block 'of the time in seconds from the beginning of the run and the cell number If g_nEventOfPeriodNum = 1 Then 'Log Period if first period of event IFIS_BVLog CLng(c.GetAttrib("PeriodTime")),"Scan\tPeriodStart\t" & c.GetAttrib("PeriodCondition") End If ' Note it is the user's responsibility to perform this logging if the IFISWizard is not used. If g_IFISBVLogEventData Then IFIS_BVLog CLng(c.GetAttrib("EventTime")),"Scan\tEventStart\t" & c.GetAttrib("Stim1") 'debug.print "Log=" & c.GetAttrib("EventTime") & ebTab & c.GetAttrib("TaskNumber") & ebCrLf If CLng(c.GetAttrib("Probe.RTTime")) > 0 Then 'Log any response IFIS_BVLog CLng(c.GetAttrib("Probe.RTTime")),"Scan\tResponse\t" & c.GetAttrib("Probe.RESP") & _ "\t" & c.GetAttrib("Probe.ACC") & "\t" & c.GetAttrib("Probe.RT") End If End If End If '#End If 'IFISwizardTemplate End Sub Public Sub IFIS_Feedback(c As Context, strCustomFeedback As String, nFormat As Long, nYieldTime As Long) ' Create a line of feedback about the trial for IFIS and send it over Dim strFeedback As String #If USE_ICP Then strFeedback = "2;" #Else strFeedback = "10" #End If If (nFormat = 0) Then ' Nothing Else strFeedback = strFeedback & _ "E=" & CStr(g_nEventNum) & " " & _ "P=" & CStr(g_nPeriodNum) & " " & _ "B=" & CStr(g_nBlockNum) & " " ' Set the end period time for the list we are about to run Dim dblScanTimeElapsed As Double Dim dblPeriodTimeElapsed As Double If (g_strRFPulseMode = "scanner") Then dblScanTimeElapsed = CDbl(Clock.Read - g_RFP.StartTime) / 1000# Else dblScanTimeElapsed = CDbl(Clock.Read - IFISPause.RTTime) / 1000# End If dblPeriodTimeElapsed = CDbl(Clock.Read - g_nPeriodStartTime) / 1000# strFeedback = strFeedback & "S=" & Format$(dblScanTimeElapsed, "###0") & " " strFeedback = strFeedback & "s=" & Format$(dblPeriodTimeElapsed, "###0") & " " End If ' Concatenate the default feedback with the custom feedback and send it to the control panel. strFeedback = strFeedback & strCustomFeedback #If USE_ICP Then If (g_bICPEnabled) Then g_ICP.SendMessage strFeedback End If #Else If (g_bISMEnabled) Then strFeedback = strFeedback & "" g_ISM.SendMessage strFeedback End If #End If IFIS_Yield nYieldTime End Sub Public Sub IFIS_NBackSetup(c As Context,StimList As Factor) '*********************item selection ***************** 'TO DO null character in the 0 back? keep selection from picking letters in the queue 'StimList ' IFISNBackCount = IFISNBackCount + 1 c.SetAttrib"NBack", c.GetAttrib("TaskParameter1") ' get n back Dim BackDistractor As Integer Dim cs As CellSpec ' Find a distractor not in the queue and not IFISZeroBackChar initialize the variable Set cs=StimList.Order.GetNext 'Force selection of next list member c.update cs 'Update the context While IFIS_IsInQ(IFISLetterQ,c.GetAttrib("Letter")) or c.GetAttrib("Letter") = IFISZeroBackChar Set cs=StimList.Order.GetNext 'Force selection of next list member c.update cs 'Update the context Wend If g_nEventOfPeriodNum <= CInt(c.GetAttrib("NBack")) Then 'First NBack no targets c.SetAttrib "Probe", "Distractor" c.SetAttrib "Repeat", "New" c.SetAttrib "CorrectAnswer","3" End If 'Make first 4 items in the queue new distractors If g_nEventOfPeriodNum <=4 and c.GetAttrib("Probe") ="Distractor" Then c.SetAttrib "Repeat", "New" BackDistractor =0 'Initalize to null value If c.GetAttrib("Probe")="Target" Then 'Target variable set by NBackLetterSelect c.SetAttrib"CorrectAnswer","2" 'expect target response If c.GetAttrib("NBack")<>"0" Then c.SetAttrib "Stim", IFIS_QItem(IFISLetterQ,5-CInt(c.GetAttrib("NBack"))) ' set to the number of back wanted 'Note this is a push down que with 4 items. The 1 Back item is the fourth in the cue Else c.SetAttrib "Stim", IFISZeroBackChar End If Else 'Distractor condition c.SetAttrib"CorrectAnswer","3" 'expect distractor response If c.GetAttrib("Repeat")="New" Then c.SetAttrib "Stim", c.GetAttrib("Letter") Else ' Get from queue If c.GetAttrib("NBack")= "0" Then BackDistractor = Random(1,3) Dim i As Integer i=0 While IFISZeroBackChar = IFIS_QItem(IFISLetterQ,5-BackDistractor) BackDistractor = Random(1,4) 'if match to target allow wider search 'Note we have a possibility of an infinite loop if there were 4 targets in a row, this is very unlikely i = i + 1 If i >40 Then IFIS_QDelete IFISLetterQ ' delete last letter IFIS_QInsert IFISLetterQ, "Y" 'unused letter BackDistractor = 1 'force selection End If Wend Else i = 0 Do BackDistractor = Random(1,4) i=i+1 ' Loop until BackDistractor <> CInt(c.GetAttrib("NBack")) 'Bad line of code checked position not value Loop until (IFIS_QItem(IFISLetterQ,5-BackDistractor) <> IFIS_QItem(IFISLetterQ,5-Cint(c.GetAttrib("NBack"))) _ And (IFIS_QItem(IFISLetterQ,5-BackDistractor) <> IFISZeroBackChar)) or i > 40 If i > 40 then 'Force nove distractor IFIS_QDelete IFISLetterQ ' delete last letter IFIS_QInsert IFISLetterQ, "Y" 'unused letter BackDistractor = 1 'force selection End If End If c.SetAttrib "Stim", IFIS_QItem(IFISLetterQ,5-BackDistractor)'Note push down cure with 4 items End If End If ' debug.print "/n Stim=" & c.GetAttrib("Stim") c.SetAttrib "Que", IFIS_CStrQ(IFISLetterQ) c.SetAttrib "BackDistractor", BackDistractor 'Log the back count ' note list.Order.GetNext Debug get next item in a list 'Debug.print CStr(Clock.read)& "\t" & c.GetAttrib("Stim") & "\t" & c.GetAttrib("Que") & _ ' "\tResp\t" & c.GetAttrib("CorrectAnswer") & "\tNBack\t" & c.GetAttrib("NBack") & _ ' "\tProbe\t" & c.GetAttrib("Probe") & "\tBackDistractor\t" & CStr(BackDistractor) & ebCrLf If IFISNBackCount > 4 Then IFIS_QDelete IFISLetterQ 'Don't start deleting till 4 back IFIS_QInsert IFISLetterQ,c.GetAttrib("Stim") Const ColorList As String = "Red,Green,Yellow,Blue" c.SetAttrib "NBackColor", item$(ColorList,Cint(c.GetAttrib("NBack"))+1) c.SetAttrIb "Stim1", c.GetAttrib("Stim") '****DEBUG NOTE, LATER REPLACE STIM WITH STIM1 End Sub Public Sub IFIS_BVLog(nTimeStamp As Long, strData As String) If g_LogCount < MAX_LOG_COUNT Then g_LogCount = g_LogCount +1 Else Exit Sub End If g_TimeLog(g_LogCount) = nTimeStamp g_TaskLog(g_LogCount) = strData End Sub '-------------------------------------------------------------------------- ' User Script '-------------------------------------------------------------------------- '-------------------------------------------------------------------------- ' Implementation '-------------------------------------------------------------------------- Sub SessionProc_Run(c as Context) IFIS_Init c, "2, 10000, 10000, keyboard, bru, on, 1.0, 1000, none, unique,yes" If g_bAbortParadigm Then c.Log Exit Sub End If ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Dim WriteVal As Integer WritePort &H378, 255 Set Intro.Input = Keyboard("123456789A", "", Val(Intro.Duration), Val("1"), ebInputActionTerminate, CLogical("No"), "", "flush:Yes") Intro.Run IFISLABEL_IFISSessionBegin: If (g_strSimulatedSound <> "none") Then IFISSimulatedSound.Stop End If IFIS_SessionBegin c, IFISBlockList If (IFIS_GetSessionStatus <> 0) Then GoTo IFISLABEL_IFISSessionEnd ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' startList: If (Err.Number = ebInputAccepted) Then Err.Clear End If WritePort &H378, 251 IFISBlockList.Run c If GetUserBreakState = 0 And Feedback.ACCStats.Mean > .80 Then EndPrac.Text = "Your accuracy was " &_ Feedback.ACCStats.Mean * 100 & " %." &_ " You're ready for the real thing." EndPrac.Run GoTo expEnd ElseIf GetUserBreakState = 0 Then EndPrac.Text = "Your accuracy was too low." &_ " Let's try again." Feedback.ACCStats.Reset EndPrac.Run ' This line returns automatically to the start point ' Goto startList Else ' Reset break state to 0 SetUserBreakState 0 End If Set queryContinue.Input = Keyboard("any", "any", Val(queryContinue.Duration), Val("1"), ebInputActionTerminate, CLogical("No"), "", "flush:Yes") queryContinue.Run ' These lines run another query screen, and give the ' experimenter the option to quit or continue ' reset this just in case you do it again. Feedback.ACCStats.Reset ' This code implements an e-basic AskBox 'Dim myanswer As String 'myanswer = AskBox ("Quit or continue?") 'If myanswer = "Q" or myanswer = "q" Then ' This code implements the GUI/script version If queryContinue.RESP = "Q" or queryContinue.RESP = "q" Then Goto expEnd Else Goto startList End If expEnd: If (Err.Number = ebInputAccepted) Then Err.Clear End If GoTo IFISLABEL_IFISSessionBegin IFISLABEL_IFISSessionEnd: IFIS_SessionEnd c ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Set Goodbye.Input = Nothing Goodbye.Run c.Log End Sub Sub Task1BlockProc_Run(c as Context) ULBlockIntro.Text = c.GetAttrib("BlockTitle") &_ " Instructions...\n\nUpper vs. lower case judgment - press \n7 or 8\n\nPress a button to continue...\n" Set ULBlockIntro.Input = Keyboard("123456789A", "", Val(ULBlockIntro.Duration), Val("1"), ebInputActionTerminate, CLogical("No"), "", "flush:Yes") ULBlockIntro.Run IFIS_BlockBegin c If (IFIS_GetBlockStatus <> 0) Then Exit Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Task1PeriodList.Run c IFIS_BlockEnd c ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' c.Log End Sub Sub Task1PeriodProc_Run(c as Context) IFIS_PeriodBegin c, "off" ULlistFixed.Run c IFIS_PeriodEnd c ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' c.Log End Sub Sub EventProc_Run(c as Context) IFIS_EventBegin c ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Probe.Text = c.GetAttrib("myStimulus") Set Probe.Input = Keyboard("78", c.GetAttrib("correctResponse"), Val("2000"), Val("1"), ebInputActionNone, CLogical("No"), "ULresponse", "flush:Yes") Probe.Run c.SetAttrib "Probe.OnsetTime", Probe.OnsetTime c.SetAttrib "Probe.OnsetDelay", Probe.OnsetDelay c.SetAttrib "Probe.DurationError", Probe.DurationError c.SetAttrib "Probe.RTTime", Probe.RTTime c.SetAttrib "Probe.ACC", Probe.ACC c.SetAttrib "Probe.RT", Probe.RT c.SetAttrib "Probe.RESP", Probe.RESP c.SetAttrib "Probe.CRESP", Probe.CRESP Set Fixation.Input = Nothing Fixation.Run 'If (Probe .Input.Pending) Then '' Input is still pending ' Feedback.ActiveState = ebFeedbackStatePending 'Else ' Input is not pending so determine what happened If (Probe.RT > 0) Then ' Response collected Feedback.ACCStats.AddObservation Probe.ACC If (Probe.RT >= 0) Then Feedback.RTStats.AddObservation Probe.RT End If If (Probe.ACC = 1) Then ' Correct Feedback.ActiveState = ebFeedbackStateCorrect If (Probe.RT >= 0) Then Feedback.CorrectRTStats.AddObservation Probe.RT End If Else ' Incorrect Feedback.ActiveState = ebFeedbackStateIncorrect If (Probe.RT >= 0) Then Feedback.IncorrectRTStats.AddObservation Probe.RT End If End If Else ' No Response Feedback.ActiveState = ebFeedbackStateNoResponse If (Feedback.SumNoResponseAs = ebNoResponseAsIncorrect) Then Feedback.ACCStats.AddObservation 0 ElseIf (Feedback.SumNoResponseAs = ebNoResponseAsCorrect) Then Feedback.ACCStats.AddObservation 1 End If End If 'End If Set Feedback_SlideText = Feedback.States(ebFeedbackStateCorrect).Objects(1) Feedback_SlideText.Text = "" & _ Format$((Feedback.ACCStats.Mean / Feedback.ACCDivisor),Feedback.ACCFormat) & _ " Avg. Percent Correct" Set Feedback_SlideText = Feedback.States(ebFeedbackStateCorrect).Objects(2) Feedback_SlideText.Text = "" & _ Format$((Probe.RT / Feedback.RTDivisor), Feedback.RTFormat) & _ " Seconds Response Time" Set Feedback_SlideText = Feedback.States(ebFeedbackStateCorrect).Objects(3) Set Feedback_SlideText = Feedback.States(ebFeedbackStateIncorrect).Objects(1) Feedback_SlideText.Text = "" & _ Format$((Feedback.ACCStats.Mean / Feedback.ACCDivisor),Feedback.ACCFormat) & _ " Avg. Percent Correct" Set Feedback_SlideText = Feedback.States(ebFeedbackStateIncorrect).Objects(2) Feedback_SlideText.Text = "" & _ Format$((Probe.RT / Feedback.RTDivisor), Feedback.RTFormat) & _ " Seconds Response Time" Set Feedback_SlideText = Feedback.States(ebFeedbackStateIncorrect).Objects(3) Set Feedback_SlideText = Feedback.States(ebFeedbackStateNoResponse).Objects(1) Set Feedback.Input = Nothing Feedback.Run Dim strCustomFeedback As String strCustomFeedback = _ "A=" & Probe.ACC & ", " & _ "K=" & Probe.RESP & ", " & _ "RT=" & Probe.RT & ", " & _ "%=" & Format$( (Feedback.ACCStats.Mean * 100.0), "##0" ) IFIS_Feedback c, strCustomFeedback, 1, 200 ' Check for Ctrl + Shift (user break) and terminate if yes. If (GetUserBreakState <> 0) Then wordsInPeriod.Terminate Task4PeriodList.Terminate EndPrac.Text = "Experiment was aborted. Hang on..." Feedback.ACCStats.Reset EndPrac.Run End If ' select a random number c.SetAttrib "randISI", Random(1,499) Wait1.Duration = c.GetAttrib("randISI") Set Wait1.Input = Nothing Wait1.Run IFIS_EventEnd c ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' c.SetAttrib "Probe.OnsetTime", Probe.OnsetTime c.SetAttrib "Probe.OnsetDelay", Probe.OnsetDelay c.SetAttrib "Probe.DurationError", Probe.DurationError c.SetAttrib "Probe.RTTime", Probe.RTTime c.SetAttrib "Probe.ACC", Probe.ACC c.SetAttrib "Probe.RT", Probe.RT c.SetAttrib "Probe.RESP", Probe.RESP c.SetAttrib "Probe.CRESP", Probe.CRESP c.Log End Sub Sub ControlPeriodProc_Run(c as Context) IFIS_PeriodBegin c, "off" ControlEventList.Run c IFIS_PeriodEnd c ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' c.Log End Sub Sub Task2BlockProc_Run(c as Context) Task2BlockIntro.Text = c.GetAttrib("BlockTitle") &_ " Instructions...\n\nPlease answer the math problem by pushing the appropriate button.\n\nPress a button to continue..." Set Task2BlockIntro.Input = Keyboard("123456789A", "", Val(Task2BlockIntro.Duration), Val("1"), ebInputActionTerminate, CLogical("No"), "", "flush:Yes") Task2BlockIntro.Run IFIS_BlockBegin c If (IFIS_GetBlockStatus <> 0) Then Exit Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Task2PeriodList.Run c IFIS_BlockEnd c ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' c.Log End Sub Sub Task2PeriodProc_Run(c as Context) IFIS_PeriodBegin c, "off" Task2EventList.Run c IFIS_PeriodEnd c ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' c.Log End Sub Sub FixEventProc_Run(c as Context) IFIS_EventBegin c ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Set Fixation.Input = Nothing Fixation.Run IFIS_EventEnd c ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' c.Log End Sub Sub Task3BlockProc_Run(c as Context) ULBlockIntro.Text = c.GetAttrib("BlockTitle") &_ " Instructions...\n\nUpper vs. lower case judgment - press \n7 or 8\n\nPress a button to continue...\n" Set ULBlockIntro.Input = Keyboard("123456789A", "", Val(ULBlockIntro.Duration), Val("1"), ebInputActionTerminate, CLogical("No"), "", "flush:Yes") ULBlockIntro.Run IFIS_BlockBegin c If (IFIS_GetBlockStatus <> 0) Then Exit Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Task3PeriodList.Run c IFIS_BlockEnd c ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' c.Log End Sub Sub Task4BlockProc_Run(c as Context) ULvsLNBlockIntro.Text = c.GetAttrib("BlockTitle") &_ " Instructions...\n\nUpper vs. lower case judgment or living vs. nonliving - press \n7 or 8 for u/l\n7 or 8 for l/non\n\nPress a button to continue...\n" &_ "" Set ULvsLNBlockIntro.Input = Keyboard("123456789A", "", Val(ULvsLNBlockIntro.Duration), Val("1"), ebInputActionTerminate, CLogical("No"), "", "flush:Yes") ULvsLNBlockIntro.Run IFIS_BlockBegin c If (IFIS_GetBlockStatus <> 0) Then Exit Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Task4PeriodList.Run c IFIS_BlockEnd c ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' c.Log End Sub Sub LivNonPeriodProc_Run(c as Context) IFIS_PeriodBegin c, "off" periodInstructions.Text = c.GetAttrib("instructText") Set periodInstructions.Input = Nothing periodInstructions.Run wordsInPeriod.Run c IFIS_PeriodEnd c ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' c.Log End Sub Sub ULPeriodProc_Run(c as Context) IFIS_PeriodBegin c, "off" periodInstructions.Text = c.GetAttrib("instructText") Set periodInstructions.Input = Nothing periodInstructions.Run wordsInPeriod.Run c IFIS_PeriodEnd c ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' c.Log End Sub '-------------------------------------------------------------------------- ' InitDevices ' '-------------------------------------------------------------------------- Sub InitDevices(c As Context) SetOSThreadPriority 3 Set Keyboard = new KeyboardDevice Dim KeyboardDeviceInfo as KeyboardDeviceInfo KeyboardDeviceInfo.Reserved1 = 0 Keyboard.Open KeyboardDeviceInfo Set Mouse = new MouseDevice Dim MouseDeviceInfo as MouseDeviceInfo MouseDeviceInfo.OpenMode = ebMouseOpenModeDirect Mouse.Open MouseDeviceInfo Set Display = New DisplayDevice Dim DisplayDeviceInfo As DisplayDeviceInfo DisplayDeviceInfo.XRes = 640 DisplayDeviceInfo.YRes = 480 DisplayDeviceInfo.ColorDepth = 16 DisplayDeviceInfo.RefreshRate = 0 DisplayDeviceInfo.NumPages = 0 Display.Open DisplayDeviceInfo c.SetAttrib "Display.RefreshRate", Format$(Display.CalculatedRefreshRate, "0.000") Set Sound = New SoundDevice Dim SoundDeviceInfo As SoundDeviceInfo SoundDeviceInfo.Channels = 2 SoundDeviceInfo.SamplesPerSecond = 22050 SoundDeviceInfo.BitsPerSample = 16 Sound.Open SoundDeviceInfo SetOSThreadPriority 0 End Sub '-------------------------------------------------------------------------- ' InitObjects ' '-------------------------------------------------------------------------- Sub InitObjects(c As Context) Set SessionProc = New Procedure SessionProc.Name = "SessionProc" SessionProc.Subroutine = "SessionProc_Run" SessionProc.Tag = "" Set Intro = New TextDisplay Intro.Name = "Intro" Intro.Text = "Modified fMRIBase suite of tasks\n\nPress a button to continue. \nPress and hold all 5 buttons to contact Technologist.\n\n\nTor Wager 08-17-01" Intro.WordWrap = True Intro.BackStyle = "opaque" Intro.BackColor = CColor("black") Intro.BorderColor = CColor("black") Intro.BorderWidth = "0" Intro.ForeColor = CColor("white") Intro.X = "center" Intro.Y = "center" Intro.Width = "100%" Intro.Height = "100%" Intro.XAlign = "center" Intro.YAlign = "center" Intro.AlignVertical = "center" Intro.AlignHorizontal = "center" Intro.FontName = "Arial" Intro.FontSize = "24" Intro.FontBold = CLogical("Yes") Intro.FontItalic = CLogical("No") Intro.FontUnderline = CLogical("No") Intro.FontStrikeout = CLogical("No") Intro.ClearAfter = CLogical("yes") Intro.Tag = "" Intro.Duration = "-1" Intro.TimingMode = ebTimingModeCumulative Intro.PreReleaseTime = Val("100") Intro.OnsetSync = 1 Intro.OffsetSync = 0 Set Task1BlockProc = New Procedure Task1BlockProc.Name = "Task1BlockProc" Task1BlockProc.Subroutine = "Task1BlockProc_Run" Task1BlockProc.Tag = "" Set ULBlockIntro = New TextDisplay ULBlockIntro.Name = "ULBlockIntro" ULBlockIntro.WordWrap = True ULBlockIntro.BackStyle = "opaque" ULBlockIntro.BackColor = CColor("black") ULBlockIntro.BorderColor = CColor("black") ULBlockIntro.BorderWidth = "0" ULBlockIntro.ForeColor = CColor("white") ULBlockIntro.X = "center" ULBlockIntro.Y = "center" ULBlockIntro.Width = "100%" ULBlockIntro.Height = "100%" ULBlockIntro.XAlign = "center" ULBlockIntro.YAlign = "center" ULBlockIntro.AlignVertical = "center" ULBlockIntro.AlignHorizontal = "center" ULBlockIntro.FontName = "Arial" ULBlockIntro.FontSize = "32" ULBlockIntro.FontBold = CLogical("Yes") ULBlockIntro.FontItalic = CLogical("No") ULBlockIntro.FontUnderline = CLogical("No") ULBlockIntro.FontStrikeout = CLogical("No") ULBlockIntro.ClearAfter = CLogical("No") ULBlockIntro.Tag = "" ULBlockIntro.Duration = "-1" ULBlockIntro.TimingMode = ebTimingModeCumulative ULBlockIntro.PreReleaseTime = Val("100") ULBlockIntro.OnsetSync = 1 ULBlockIntro.OffsetSync = 0 Set Task1PeriodProc = New Procedure Task1PeriodProc.Name = "Task1PeriodProc" Task1PeriodProc.Subroutine = "Task1PeriodProc_Run" Task1PeriodProc.Tag = "" Set Probe = New TextDisplay Probe.Name = "Probe" Probe.WordWrap = True Probe.BackStyle = "opaque" Probe.BackColor = CColor("black") Probe.BorderColor = CColor("black") Probe.BorderWidth = "0" Probe.ForeColor = CColor("white") Probe.X = "center" Probe.Y = "center" Probe.Width = "100%" Probe.Height = "100%" Probe.XAlign = "center" Probe.YAlign = "center" Probe.AlignVertical = "center" Probe.AlignHorizontal = "center" Probe.FontName = "Arial" Probe.FontSize = "32" Probe.FontBold = CLogical("Yes") Probe.FontItalic = CLogical("No") Probe.FontUnderline = CLogical("No") Probe.FontStrikeout = CLogical("No") Probe.ClearAfter = CLogical("No") Probe.Tag = "" Probe.Duration = "1000" Probe.TimingMode = ebTimingModeCumulative Probe.PreReleaseTime = Val("100") Probe.OnsetSync = 1 Probe.OffsetSync = 0 Set EventProc = New Procedure EventProc.Name = "EventProc" EventProc.Subroutine = "EventProc_Run" EventProc.Tag = "" Set Goodbye = New TextDisplay Goodbye.Name = "Goodbye" Goodbye.Text = "You've finished this scanning period. Please rest while we set up the next part of the experiment.\n\nYou can move your eyes or close your eyes now, " &_ "but keep your head and body still.\n" Goodbye.WordWrap = True Goodbye.BackStyle = "opaque" Goodbye.BackColor = CColor("black") Goodbye.BorderColor = CColor("black") Goodbye.BorderWidth = "0" Goodbye.ForeColor = CColor("white") Goodbye.X = "center" Goodbye.Y = "center" Goodbye.Width = "100%" Goodbye.Height = "100%" Goodbye.XAlign = "center" Goodbye.YAlign = "center" Goodbye.AlignVertical = "center" Goodbye.AlignHorizontal = "center" Goodbye.FontName = "Arial" Goodbye.FontSize = "32" Goodbye.FontBold = CLogical("Yes") Goodbye.FontItalic = CLogical("No") Goodbye.FontUnderline = CLogical("No") Goodbye.FontStrikeout = CLogical("No") Goodbye.ClearAfter = CLogical("yes") Goodbye.Tag = "" Goodbye.Duration = "5000" Goodbye.TimingMode = ebTimingModeCumulative Goodbye.PreReleaseTime = Val("100") Goodbye.OnsetSync = 1 Goodbye.OffsetSync = 0 'Initialization for IFISBlockList Set IFISBlockList = New Factor IFISBlockList.Name = "IFISBlockList" Set IFISBlockList.Order = New SequentialOrder Set IFISBlockList.Deletion = NoDeletion IFISBlockList.ResetEveryRun = False ' Create the column headings IFISBlockList.AddAttrib "BlockTitle" IFISBlockList.AddAttrib "NameOfPeriodList" IFISBlockList.AddAttrib "Periods" IFISBlockList.AddAttrib "StartDelay" ' Add the Levels and fill their values IFISBlockList.AddLevel "1" IFISBlockList.SetWeight "1", "1" IFISBlockList.SetProc "1", "Task1BlockProc" 'Nested not specified for this level IFISBlockList.SetAttrib "1", "BlockTitle", "Upper / Lower Case" IFISBlockList.SetAttrib "1", "NameOfPeriodList", "Task1PeriodList" IFISBlockList.SetAttrib "1", "Periods", "10" IFISBlockList.SetAttrib "1", "StartDelay", "[Disacq]" IFISBlockList.AddLevel "2" IFISBlockList.SetWeight "2", "1" IFISBlockList.SetProc "2", "Task2BlockProc" 'Nested not specified for this level IFISBlockList.SetAttrib "2", "BlockTitle", "Math task" IFISBlockList.SetAttrib "2", "NameOfPeriodList", "Task2PeriodList" IFISBlockList.SetAttrib "2", "Periods", "[NumPeriods]" IFISBlockList.SetAttrib "2", "StartDelay", "[Disacq]" IFISBlockList.AddLevel "3" IFISBlockList.SetWeight "3", "1" IFISBlockList.SetProc "3", "Task4BlockProc" 'Nested not specified for this level IFISBlockList.SetAttrib "3", "BlockTitle", "UL vs LivNon Practice" IFISBlockList.SetAttrib "3", "NameOfPeriodList", "Task4PeriodList" IFISBlockList.SetAttrib "3", "Periods", "2" IFISBlockList.SetAttrib "3", "StartDelay", "[Disacq]" IFISBlockList.Filename = "" IFISBlockList.LoadMethod = ebLoadMethodScript IFISBlockList.Tag = "" Set IFISBlockList.TerminateCondition = Cycles(1) Set IFISBlockList.ResetCondition = Samples(1) IFISBlockList.Reset 'Initialization for Task1PeriodList Set Task1PeriodList = New Factor Task1PeriodList.Name = "Task1PeriodList" Set Task1PeriodList.Order = New SequentialOrder Set Task1PeriodList.Deletion = NoDeletion Task1PeriodList.ResetEveryRun = False ' Create the column headings Task1PeriodList.AddAttrib "PeriodDuration" Task1PeriodList.AddAttrib "MinContinueTime" ' Add the Levels and fill their values Task1PeriodList.AddLevel "1" Task1PeriodList.SetWeight "1", "1" Task1PeriodList.SetProc "1", "Task1PeriodProc" 'Nested not specified for this level Task1PeriodList.SetAttrib "1", "PeriodDuration", "10000" Task1PeriodList.SetAttrib "1", "MinContinueTime", "1500" Task1PeriodList.AddLevel "2" Task1PeriodList.SetWeight "2", "1" Task1PeriodList.SetProc "2", "ControlPeriodProc" 'Nested not specified for this level Task1PeriodList.SetAttrib "2", "PeriodDuration", "4000" Task1PeriodList.SetAttrib "2", "MinContinueTime", "1500" Task1PeriodList.Filename = "" Task1PeriodList.LoadMethod = ebLoadMethodScript Task1PeriodList.Tag = "" Set Task1PeriodList.TerminateCondition = Samples(2) Set Task1PeriodList.ResetCondition = Samples(2) Task1PeriodList.Reset 'Initialization for ULlist Set ULlist = New Factor ULlist.Name = "ULlist" Set ULlist.Order = New SequentialOrder Set ULlist.Deletion = NoDeletion ULlist.ResetEveryRun = False ' Create the column headings ULlist.AddAttrib "myStimulus" ULlist.AddAttrib "correctResponse" ' Add the Levels and fill their values ULlist.AddLevel "1" ULlist.SetWeight "1", "1" 'Procedure not specified for this level 'Nested not specified for this level ULlist.SetAttrib "1", "myStimulus", "ostrich" ULlist.SetAttrib "1", "correctResponse", "7" ULlist.AddLevel "2" ULlist.SetWeight "2", "1" 'Procedure not specified for this level 'Nested not specified for this level ULlist.SetAttrib "2", "myStimulus", "EVANGELIST" ULlist.SetAttrib "2", "correctResponse", "8" ULlist.AddLevel "3" ULlist.SetWeight "3", "1" 'Procedure not specified for this level 'Nested not specified for this level ULlist.SetAttrib "3", "myStimulus", "sky" ULlist.SetAttrib "3", "correctResponse", "7" ULlist.AddLevel "4" ULlist.SetWeight "4", "1" 'Procedure not specified for this level 'Nested not specified for this level ULlist.SetAttrib "4", "myStimulus", "RABBIT" ULlist.SetAttrib "4", "correctResponse", "8" ULlist.AddLevel "5" ULlist.SetWeight "5", "1" 'Procedure not specified for this level 'Nested not specified for this level ULlist.SetAttrib "5", "myStimulus", "SNAKE" ULlist.SetAttrib "5", "correctResponse", "8" ULlist.AddLevel "6" ULlist.SetWeight "6", "1" 'Procedure not specified for this level 'Nested not specified for this level ULlist.SetAttrib "6", "myStimulus", "rock" ULlist.SetAttrib "6", "correctResponse", "7" ULlist.AddLevel "7" ULlist.SetWeight "7", "1" 'Procedure not specified for this level 'Nested not specified for this level ULlist.SetAttrib "7", "myStimulus", "tree" ULlist.SetAttrib "7", "correctResponse", "7" ULlist.AddLevel "8" ULlist.SetWeight "8", "1" 'Procedure not specified for this level 'Nested not specified for this level ULlist.SetAttrib "8", "myStimulus", "joy" ULlist.SetAttrib "8", "correctResponse", "7" ULlist.AddLevel "9" ULlist.SetWeight "9", "1" 'Procedure not specified for this level 'Nested not specified for this level ULlist.SetAttrib "9", "myStimulus", "FEAR" ULlist.SetAttrib "9", "correctResponse", "8" ULlist.AddLevel "10" ULlist.SetWeight "10", "1" 'Procedure not specified for this level 'Nested not specified for this level ULlist.SetAttrib "10", "myStimulus", "TWINKIES" ULlist.SetAttrib "10", "correctResponse", "8" ULlist.Filename = "" ULlist.LoadMethod = ebLoadMethodScript ULlist.Tag = "" Set ULlist.TerminateCondition = Samples(1000) Set ULlist.ResetCondition = Samples(10) ULlist.Reset Set ControlPeriodProc = New Procedure ControlPeriodProc.Name = "ControlPeriodProc" ControlPeriodProc.Subroutine = "ControlPeriodProc_Run" ControlPeriodProc.Tag = "" 'Initialization for ControlEventList Set ControlEventList = New Factor ControlEventList.Name = "ControlEventList" Set ControlEventList.Order = New RandomOrder Set ControlEventList.Deletion = NoDeletion ControlEventList.ResetEveryRun = False ' Create the column headings ' Add the Levels and fill their values ControlEventList.AddLevel "1" ControlEventList.SetWeight "1", "1" ControlEventList.SetProc "1", "FixEventProc" 'Nested not specified for this level ControlEventList.Filename = "" ControlEventList.LoadMethod = ebLoadMethodScript ControlEventList.Tag = "" Set ControlEventList.TerminateCondition = Samples(1) Set ControlEventList.ResetCondition = Samples(1) ControlEventList.Reset Set Task2BlockProc = New Procedure Task2BlockProc.Name = "Task2BlockProc" Task2BlockProc.Subroutine = "Task2BlockProc_Run" Task2BlockProc.Tag = "" 'Initialization for Task2PeriodList Set Task2PeriodList = New Factor Task2PeriodList.Name = "Task2PeriodList" Set Task2PeriodList.Order = New SequentialOrder Set Task2PeriodList.Deletion = NoDeletion Task2PeriodList.ResetEveryRun = False ' Create the column headings Task2PeriodList.AddAttrib "PeriodDuration" Task2PeriodList.AddAttrib "MinContinueTime" ' Add the Levels and fill their values Task2PeriodList.AddLevel "1" Task2PeriodList.SetWeight "1", "1" Task2PeriodList.SetProc "1", "Task2PeriodProc" 'Nested not specified for this level Task2PeriodList.SetAttrib "1", "PeriodDuration", "[PeriodA]" Task2PeriodList.SetAttrib "1", "MinContinueTime", "1500" Task2PeriodList.AddLevel "2" Task2PeriodList.SetWeight "2", "1" Task2PeriodList.SetProc "2", "ControlPeriodProc" 'Nested not specified for this level Task2PeriodList.SetAttrib "2", "PeriodDuration", "[PeriodB]" Task2PeriodList.SetAttrib "2", "MinContinueTime", "1500" Task2PeriodList.Filename = "" Task2PeriodList.LoadMethod = ebLoadMethodScript Task2PeriodList.Tag = "" Set Task2PeriodList.TerminateCondition = Samples(2) Set Task2PeriodList.ResetCondition = Samples(2) Task2PeriodList.Reset Set Task2BlockIntro = New TextDisplay Task2BlockIntro.Name = "Task2BlockIntro" Task2BlockIntro.WordWrap = True Task2BlockIntro.BackStyle = "opaque" Task2BlockIntro.BackColor = CColor("white") Task2BlockIntro.BorderColor = CColor("black") Task2BlockIntro.BorderWidth = "0" Task2BlockIntro.ForeColor = CColor("black") Task2BlockIntro.X = "center" Task2BlockIntro.Y = "center" Task2BlockIntro.Width = "100%" Task2BlockIntro.Height = "100%" Task2BlockIntro.XAlign = "center" Task2BlockIntro.YAlign = "center" Task2BlockIntro.AlignVertical = "center" Task2BlockIntro.AlignHorizontal = "center" Task2BlockIntro.FontName = "Arial" Task2BlockIntro.FontSize = "32" Task2BlockIntro.FontBold = CLogical("Yes") Task2BlockIntro.FontItalic = CLogical("No") Task2BlockIntro.FontUnderline = CLogical("No") Task2BlockIntro.FontStrikeout = CLogical("No") Task2BlockIntro.ClearAfter = CLogical("No") Task2BlockIntro.Tag = "" Task2BlockIntro.Duration = "-1" Task2BlockIntro.TimingMode = ebTimingModeCumulative Task2BlockIntro.PreReleaseTime = Val("100") Task2BlockIntro.OnsetSync = 1 Task2BlockIntro.OffsetSync = 0 Set Task2PeriodProc = New Procedure Task2PeriodProc.Name = "Task2PeriodProc" Task2PeriodProc.Subroutine = "Task2PeriodProc_Run" Task2PeriodProc.Tag = "" 'Initialization for Task2EventList Set Task2EventList = New Factor Task2EventList.Name = "Task2EventList" Set Task2EventList.Order = New RandomOrder Set Task2EventList.Deletion = NoDeletion Task2EventList.ResetEveryRun = False ' Create the column headings Task2EventList.AddAttrib "Problem" Task2EventList.AddAttrib "Answer" ' Add the Levels and fill their values Task2EventList.AddLevel "1" Task2EventList.SetWeight "1", "1" Task2EventList.SetProc "1", "EventProc" 'Nested not specified for this level Task2EventList.SetAttrib "1", "Problem", "1+1" Task2EventList.SetAttrib "1", "Answer", "2" Task2EventList.AddLevel "2" Task2EventList.SetWeight "2", "1" Task2EventList.SetProc "2", "EventProc" 'Nested not specified for this level Task2EventList.SetAttrib "2", "Problem", "2+2" Task2EventList.SetAttrib "2", "Answer", "4" Task2EventList.AddLevel "3" Task2EventList.SetWeight "3", "1" Task2EventList.SetProc "3", "EventProc" 'Nested not specified for this level Task2EventList.SetAttrib "3", "Problem", "3+2" Task2EventList.SetAttrib "3", "Answer", "5" Task2EventList.AddLevel "4" Task2EventList.SetWeight "4", "1" Task2EventList.SetProc "4", "EventProc" 'Nested not specified for this level Task2EventList.SetAttrib "4", "Problem", "1+2" Task2EventList.SetAttrib "4", "Answer", "3" Task2EventList.Filename = "" Task2EventList.LoadMethod = ebLoadMethodScript Task2EventList.Tag = "" Set Task2EventList.TerminateCondition = Samples(1000) Set Task2EventList.ResetCondition = Samples(4) Task2EventList.Reset Set Feedback = New FeedbackDisplay Feedback.Name = "Feedback" Feedback.ACCDivisor = "1.0" Feedback.ACCFormat = "Percent" Feedback.RTDivisor = "1000.0" Feedback.RTFormat = "###0.000" Feedback.CorrectRTDivisor = "1000.0" Feedback.CorrectRTFormat = "###0.000" Feedback.IncorrectRTDivisor = "1000.0" Feedback.IncorrectRTFormat = "###0.000" Feedback.Tag = "" Feedback.Duration = "1500" Feedback.TimingMode = ebTimingModeCumulative Feedback.PreReleaseTime = Val("100") Feedback.OnsetSync = 1 Feedback.OffsetSync = 0 Set Feedback_State = New SlideState Feedback_State.X = "center" Feedback_State.Y = "center" Feedback_State.Width = "100%" Feedback_State.Height = "100%" Feedback_State.XAlign = "center" Feedback_State.YAlign = "center" Feedback_State.BorderColor = CColor("black") Feedback_State.BorderWidth = "0" Feedback_State.BackColor = CColor("black") Feedback_State.BackStyle = "opaque" Feedback_State.ClearAfter = CLogical("No") Feedback_State.Enabled = CLogical("Yes") Feedback.States.Add Feedback_State Set Feedback_SlideText = New SlideText Feedback_SlideText.Name = "Text3" Feedback_SlideText.X = "50%" Feedback_SlideText.Y = "75%" Feedback_SlideText.Width = "100%" Feedback_SlideText.Height = "10%" Feedback_SlideText.ForeColor = CColor("blue") Feedback_SlideText.BackColor = CColor("white") Feedback_SlideText.BackStyle = "transparent" Feedback_SlideText.WordWrap = True Feedback_SlideText.BorderColor = CColor("black") Feedback_SlideText.BorderWidth = "0" Feedback_SlideText.XAlign = "center" Feedback_SlideText.YAlign = "center" Feedback_SlideText.AlignHorizontal = "center" Feedback_SlideText.AlignVertical = "center" Feedback_SlideText.FontName = "Arial" Feedback_SlideText.FontSize = "32" Feedback_SlideText.FontBold = CLogical("Yes") Feedback_SlideText.FontItalic = CLogical("No") Feedback_SlideText.FontUnderline = CLogical("No") Feedback_SlideText.FontStrikeout = CLogical("No") Feedback.States(ebFeedbackStateCorrect).Objects.Add Feedback_SlideText Set Feedback_SlideText = New SlideText Feedback_SlideText.Name = "Text2" Feedback_SlideText.X = "50%" Feedback_SlideText.Y = "65%" Feedback_SlideText.Width = "100%" Feedback_SlideText.Height = "10%" Feedback_SlideText.ForeColor = CColor("blue") Feedback_SlideText.BackColor = CColor("white") Feedback_SlideText.BackStyle = "transparent" Feedback_SlideText.WordWrap = True Feedback_SlideText.BorderColor = CColor("black") Feedback_SlideText.BorderWidth = "0" Feedback_SlideText.XAlign = "center" Feedback_SlideText.YAlign = "center" Feedback_SlideText.AlignHorizontal = "center" Feedback_SlideText.AlignVertical = "center" Feedback_SlideText.FontName = "Arial" Feedback_SlideText.FontSize = "32" Feedback_SlideText.FontBold = CLogical("Yes") Feedback_SlideText.FontItalic = CLogical("No") Feedback_SlideText.FontUnderline = CLogical("No") Feedback_SlideText.FontStrikeout = CLogical("No") Feedback.States(ebFeedbackStateCorrect).Objects.Add Feedback_SlideText Set Feedback_SlideText = New SlideText Feedback_SlideText.Name = "Text1" Feedback_SlideText.Text = "Correct!" Feedback_SlideText.X = "50%" Feedback_SlideText.Y = "50%" Feedback_SlideText.Width = "100%" Feedback_SlideText.Height = "10%" Feedback_SlideText.ForeColor = CColor("blue") Feedback_SlideText.BackColor = CColor("white") Feedback_SlideText.BackStyle = "transparent" Feedback_SlideText.WordWrap = True Feedback_SlideText.BorderColor = CColor("black") Feedback_SlideText.BorderWidth = "0" Feedback_SlideText.XAlign = "center" Feedback_SlideText.YAlign = "center" Feedback_SlideText.AlignHorizontal = "center" Feedback_SlideText.AlignVertical = "center" Feedback_SlideText.FontName = "Arial" Feedback_SlideText.FontSize = "32" Feedback_SlideText.FontBold = CLogical("Yes") Feedback_SlideText.FontItalic = CLogical("No") Feedback_SlideText.FontUnderline = CLogical("No") Feedback_SlideText.FontStrikeout = CLogical("No") Feedback.States(ebFeedbackStateCorrect).Objects.Add Feedback_SlideText Set Feedback_State = New SlideState Feedback_State.X = "center" Feedback_State.Y = "center" Feedback_State.Width = "100%" Feedback_State.Height = "100%" Feedback_State.XAlign = "center" Feedback_State.YAlign = "center" Feedback_State.BorderColor = CColor("black") Feedback_State.BorderWidth = "0" Feedback_State.BackColor = CColor("black") Feedback_State.BackStyle = "opaque" Feedback_State.ClearAfter = CLogical("yes") Feedback_State.Enabled = CLogical("Yes") Feedback.States.Add Feedback_State Set Feedback_SlideText = New SlideText Feedback_SlideText.Name = "Text3" Feedback_SlideText.X = "50%" Feedback_SlideText.Y = "75%" Feedback_SlideText.Width = "100%" Feedback_SlideText.Height = "10%" Feedback_SlideText.ForeColor = CColor("red") Feedback_SlideText.BackColor = CColor("white") Feedback_SlideText.BackStyle = "transparent" Feedback_SlideText.WordWrap = True Feedback_SlideText.BorderColor = CColor("black") Feedback_SlideText.BorderWidth = "0" Feedback_SlideText.XAlign = "center" Feedback_SlideText.YAlign = "center" Feedback_SlideText.AlignHorizontal = "left" Feedback_SlideText.AlignVertical = "center" Feedback_SlideText.FontName = "Arial" Feedback_SlideText.FontSize = "32" Feedback_SlideText.FontBold = CLogical("Yes") Feedback_SlideText.FontItalic = CLogical("No") Feedback_SlideText.FontUnderline = CLogical("No") Feedback_SlideText.FontStrikeout = CLogical("No") Feedback.States(ebFeedbackStateIncorrect).Objects.Add Feedback_SlideText Set Feedback_SlideText = New SlideText Feedback_SlideText.Name = "Text2" Feedback_SlideText.X = "50%" Feedback_SlideText.Y = "65%" Feedback_SlideText.Width = "100%" Feedback_SlideText.Height = "10%" Feedback_SlideText.ForeColor = CColor("red") Feedback_SlideText.BackColor = CColor("white") Feedback_SlideText.BackStyle = "transparent" Feedback_SlideText.WordWrap = True Feedback_SlideText.BorderColor = CColor("black") Feedback_SlideText.BorderWidth = "0" Feedback_SlideText.XAlign = "center" Feedback_SlideText.YAlign = "center" Feedback_SlideText.AlignHorizontal = "left" Feedback_SlideText.AlignVertical = "center" Feedback_SlideText.FontName = "Arial" Feedback_SlideText.FontSize = "32" Feedback_SlideText.FontBold = CLogical("Yes") Feedback_SlideText.FontItalic = CLogical("No") Feedback_SlideText.FontUnderline = CLogical("No") Feedback_SlideText.FontStrikeout = CLogical("No") Feedback.States(ebFeedbackStateIncorrect).Objects.Add Feedback_SlideText Set Feedback_SlideText = New SlideText Feedback_SlideText.Name = "Text1" Feedback_SlideText.Text = "Incorrect" Feedback_SlideText.X = "50%" Feedback_SlideText.Y = "50%" Feedback_SlideText.Width = "100%" Feedback_SlideText.Height = "10%" Feedback_SlideText.ForeColor = CColor("red") Feedback_SlideText.BackColor = CColor("white") Feedback_SlideText.BackStyle = "transparent" Feedback_SlideText.WordWrap = True Feedback_SlideText.BorderColor = CColor("black") Feedback_SlideText.BorderWidth = "0" Feedback_SlideText.XAlign = "center" Feedback_SlideText.YAlign = "center" Feedback_SlideText.AlignHorizontal = "center" Feedback_SlideText.AlignVertical = "center" Feedback_SlideText.FontName = "Arial" Feedback_SlideText.FontSize = "32" Feedback_SlideText.FontBold = CLogical("Yes") Feedback_SlideText.FontItalic = CLogical("No") Feedback_SlideText.FontUnderline = CLogical("No") Feedback_SlideText.FontStrikeout = CLogical("No") Feedback.States(ebFeedbackStateIncorrect).Objects.Add Feedback_SlideText Set Feedback_State = New SlideState Feedback_State.X = "center" Feedback_State.Y = "center" Feedback_State.Width = "100%" Feedback_State.Height = "100%" Feedback_State.XAlign = "center" Feedback_State.YAlign = "center" Feedback_State.BorderColor = CColor("black") Feedback_State.BorderWidth = "0" Feedback_State.BackColor = CColor("black") Feedback_State.BackStyle = "opaque" Feedback_State.ClearAfter = CLogical("yes") Feedback_State.Enabled = CLogical("Yes") Feedback.States.Add Feedback_State Set Feedback_SlideText = New SlideText Feedback_SlideText.Name = "Text1" Feedback_SlideText.Text = "No response detected." Feedback_SlideText.X = "50%" Feedback_SlideText.Y = "50%" Feedback_SlideText.Width = "100%" Feedback_SlideText.Height = "10%" Feedback_SlideText.ForeColor = CColor("red") Feedback_SlideText.BackColor = CColor("white") Feedback_SlideText.BackStyle = "transparent" Feedback_SlideText.WordWrap = True Feedback_SlideText.BorderColor = CColor("black") Feedback_SlideText.BorderWidth = "0" Feedback_SlideText.XAlign = "center" Feedback_SlideText.YAlign = "center" Feedback_SlideText.AlignHorizontal = "center" Feedback_SlideText.AlignVertical = "center" Feedback_SlideText.FontName = "Arial" Feedback_SlideText.FontSize = "32" Feedback_SlideText.FontBold = CLogical("Yes") Feedback_SlideText.FontItalic = CLogical("No") Feedback_SlideText.FontUnderline = CLogical("No") Feedback_SlideText.FontStrikeout = CLogical("No") Feedback.States(ebFeedbackStateNoResponse).Objects.Add Feedback_SlideText Set Feedback_State = New SlideState Feedback_State.X = "center" Feedback_State.Y = "center" Feedback_State.Width = "100%" Feedback_State.Height = "100%" Feedback_State.XAlign = "center" Feedback_State.YAlign = "center" Feedback_State.BorderColor = CColor("black") Feedback_State.BorderWidth = "0" Feedback_State.BackColor = CColor("black") Feedback_State.BackStyle = "opaque" Feedback_State.ClearAfter = CLogical("yes") Feedback_State.Enabled = CLogical("Yes") Feedback.States.Add Feedback_State Set Fixation = New TextDisplay Fixation.Name = "Fixation" Fixation.Text = "+" Fixation.WordWrap = True Fixation.BackStyle = "opaque" Fixation.BackColor = CColor("black") Fixation.BorderColor = CColor("black") Fixation.BorderWidth = "0" Fixation.ForeColor = CColor("white") Fixation.X = "center" Fixation.Y = "center" Fixation.Width = "100%" Fixation.Height = "100%" Fixation.XAlign = "center" Fixation.YAlign = "center" Fixation.AlignVertical = "center" Fixation.AlignHorizontal = "center" Fixation.FontName = "Courier New" Fixation.FontSize = "72" Fixation.FontBold = CLogical("Yes") Fixation.FontItalic = CLogical("No") Fixation.FontUnderline = CLogical("No") Fixation.FontStrikeout = CLogical("No") Fixation.ClearAfter = CLogical("No") Fixation.Tag = "" Fixation.Duration = "1000" Fixation.TimingMode = ebTimingModeCumulative Fixation.PreReleaseTime = Val("100") Fixation.OnsetSync = 1 Fixation.OffsetSync = 0 Set FixEventProc = New Procedure FixEventProc.Name = "FixEventProc" FixEventProc.Subroutine = "FixEventProc_Run" FixEventProc.Tag = "" Set Task3BlockProc = New Procedure Task3BlockProc.Name = "Task3BlockProc" Task3BlockProc.Subroutine = "Task3BlockProc_Run" Task3BlockProc.Tag = "" 'Initialization for Task3PeriodList Set Task3PeriodList = New Factor Task3PeriodList.Name = "Task3PeriodList" Set Task3PeriodList.Order = New SequentialOrder Set Task3PeriodList.Deletion = NoDeletion Task3PeriodList.ResetEveryRun = False ' Create the column headings Task3PeriodList.AddAttrib "PeriodDuration" Task3PeriodList.AddAttrib "MinContinueTime" ' Add the Levels and fill their values Task3PeriodList.AddLevel "1" Task3PeriodList.SetWeight "1", "1" Task3PeriodList.SetProc "1", "ULPeriodProc" Task3PeriodList.SetNested "1", "ULlist" Task3PeriodList.SetAttrib "1", "PeriodDuration", "10000" Task3PeriodList.SetAttrib "1", "MinContinueTime", "1500" Task3PeriodList.AddLevel "2" Task3PeriodList.SetWeight "2", "1" Task3PeriodList.SetProc "2", "LivNonPeriodProc" Task3PeriodList.SetNested "2", "LNlist" Task3PeriodList.SetAttrib "2", "PeriodDuration", "10000" Task3PeriodList.SetAttrib "2", "MinContinueTime", "1500" Task3PeriodList.Filename = "" Task3PeriodList.LoadMethod = ebLoadMethodScript Task3PeriodList.Tag = "" Set Task3PeriodList.TerminateCondition = Cycles(1) Set Task3PeriodList.ResetCondition = Samples(2) Task3PeriodList.Reset Set Task4BlockProc = New Procedure Task4BlockProc.Name = "Task4BlockProc" Task4BlockProc.Subroutine = "Task4BlockProc_Run" Task4BlockProc.Tag = "" Set ULvsLNBlockIntro = New TextDisplay ULvsLNBlockIntro.Name = "ULvsLNBlockIntro" ULvsLNBlockIntro.WordWrap = True ULvsLNBlockIntro.BackStyle = "opaque" ULvsLNBlockIntro.BackColor = CColor("black") ULvsLNBlockIntro.BorderColor = CColor("black") ULvsLNBlockIntro.BorderWidth = "0" ULvsLNBlockIntro.ForeColor = CColor("white") ULvsLNBlockIntro.X = "center" ULvsLNBlockIntro.Y = "center" ULvsLNBlockIntro.Width = "100%" ULvsLNBlockIntro.Height = "100%" ULvsLNBlockIntro.XAlign = "center" ULvsLNBlockIntro.YAlign = "center" ULvsLNBlockIntro.AlignVertical = "center" ULvsLNBlockIntro.AlignHorizontal = "center" ULvsLNBlockIntro.FontName = "Arial" ULvsLNBlockIntro.FontSize = "32" ULvsLNBlockIntro.FontBold = CLogical("Yes") ULvsLNBlockIntro.FontItalic = CLogical("No") ULvsLNBlockIntro.FontUnderline = CLogical("No") ULvsLNBlockIntro.FontStrikeout = CLogical("No") ULvsLNBlockIntro.ClearAfter = CLogical("No") ULvsLNBlockIntro.Tag = "" ULvsLNBlockIntro.Duration = "-1" ULvsLNBlockIntro.TimingMode = ebTimingModeCumulative ULvsLNBlockIntro.PreReleaseTime = Val("100") ULvsLNBlockIntro.OnsetSync = 1 ULvsLNBlockIntro.OffsetSync = 0 Set LivNonPeriodProc = New Procedure LivNonPeriodProc.Name = "LivNonPeriodProc" LivNonPeriodProc.Subroutine = "LivNonPeriodProc_Run" LivNonPeriodProc.Tag = "" 'Initialization for LNlist Set LNlist = New Factor LNlist.Name = "LNlist" Set LNlist.Order = New SequentialOrder Set LNlist.Deletion = NoDeletion LNlist.ResetEveryRun = False ' Create the column headings LNlist.AddAttrib "myStimulus" LNlist.AddAttrib "correctResponse" LNlist.Filename = "" LNlist.LoadMethod = ebLoadMethodEmbedded LNlist.Tag = "" LNlist.Load Set LNlist.TerminateCondition = Cycles(1) Set LNlist.ResetCondition = Samples(10) LNlist.Reset Set ULPeriodProc = New Procedure ULPeriodProc.Name = "ULPeriodProc" ULPeriodProc.Subroutine = "ULPeriodProc_Run" ULPeriodProc.Tag = "" 'Initialization for Task4PeriodList Set Task4PeriodList = New Factor Task4PeriodList.Name = "Task4PeriodList" Set Task4PeriodList.Order = New SequentialOrder Set Task4PeriodList.Deletion = NoDeletion Task4PeriodList.ResetEveryRun = False ' Create the column headings Task4PeriodList.AddAttrib "PeriodDuration" Task4PeriodList.AddAttrib "MinContinueTime" Task4PeriodList.AddAttrib "listType" Task4PeriodList.AddAttrib "instructText" Task4PeriodList.Filename = "" Task4PeriodList.LoadMethod = ebLoadMethodEmbedded Task4PeriodList.Tag = "" Task4PeriodList.Load Set Task4PeriodList.TerminateCondition = Cycles(1) Set Task4PeriodList.ResetCondition = Samples(2) Task4PeriodList.Reset 'Initialization for wordsInPeriod Set wordsInPeriod = New Factor wordsInPeriod.Name = "wordsInPeriod" Set wordsInPeriod.Order = New SequentialOrder Set wordsInPeriod.Deletion = NoDeletion wordsInPeriod.ResetEveryRun = False ' Create the column headings wordsInPeriod.Filename = "" wordsInPeriod.LoadMethod = ebLoadMethodEmbedded wordsInPeriod.Tag = "" wordsInPeriod.Load Set wordsInPeriod.TerminateCondition = Samples(1000) Set wordsInPeriod.ResetCondition = Samples(11) wordsInPeriod.Reset Set periodInstructions = New TextDisplay periodInstructions.Name = "periodInstructions" periodInstructions.WordWrap = True periodInstructions.BackStyle = "opaque" periodInstructions.BackColor = CColor("black") periodInstructions.BorderColor = CColor("black") periodInstructions.BorderWidth = "0" periodInstructions.ForeColor = CColor("white") periodInstructions.X = "center" periodInstructions.Y = "center" periodInstructions.Width = "100%" periodInstructions.Height = "100%" periodInstructions.XAlign = "center" periodInstructions.YAlign = "center" periodInstructions.AlignVertical = "center" periodInstructions.AlignHorizontal = "center" periodInstructions.FontName = "Courier New" periodInstructions.FontSize = "44" periodInstructions.FontBold = CLogical("Yes") periodInstructions.FontItalic = CLogical("No") periodInstructions.FontUnderline = CLogical("No") periodInstructions.FontStrikeout = CLogical("No") periodInstructions.ClearAfter = CLogical("No") periodInstructions.Tag = "" periodInstructions.Duration = "1500" periodInstructions.TimingMode = ebTimingModeCumulative periodInstructions.PreReleaseTime = Val("100") periodInstructions.OnsetSync = 1 periodInstructions.OffsetSync = 0 Set EndPrac = New TextDisplay EndPrac.Name = "EndPrac" EndPrac.Text = "" EndPrac.WordWrap = True EndPrac.BackStyle = "opaque" EndPrac.BackColor = CColor("black") EndPrac.BorderColor = CColor("black") EndPrac.BorderWidth = "0" EndPrac.ForeColor = CColor("silver") EndPrac.X = "center" EndPrac.Y = "center" EndPrac.Width = "100%" EndPrac.Height = "100%" EndPrac.XAlign = "center" EndPrac.YAlign = "center" EndPrac.AlignVertical = "center" EndPrac.AlignHorizontal = "center" EndPrac.FontName = "Courier New" EndPrac.FontSize = "18" EndPrac.FontBold = CLogical("Yes") EndPrac.FontItalic = CLogical("No") EndPrac.FontUnderline = CLogical("No") EndPrac.FontStrikeout = CLogical("No") EndPrac.ClearAfter = CLogical("No") EndPrac.Tag = "" EndPrac.Duration = "4000" EndPrac.TimingMode = ebTimingModeEvent EndPrac.PreReleaseTime = Val("0") EndPrac.OnsetSync = 1 EndPrac.OffsetSync = 0 Set queryContinue = New TextDisplay queryContinue.Name = "queryContinue" queryContinue.Text = "End the practice trials and continue the experiment?\n\nPress \"q\" to quit, or any other key to return to the beginning of the block.\n\n" queryContinue.WordWrap = True queryContinue.BackStyle = "opaque" queryContinue.BackColor = CColor("white") queryContinue.BorderColor = CColor("black") queryContinue.BorderWidth = "0" queryContinue.ForeColor = CColor("black") queryContinue.X = "center" queryContinue.Y = "center" queryContinue.Width = "100%" queryContinue.Height = "100%" queryContinue.XAlign = "center" queryContinue.YAlign = "center" queryContinue.AlignVertical = "center" queryContinue.AlignHorizontal = "center" queryContinue.FontName = "Courier New" queryContinue.FontSize = "18" queryContinue.FontBold = CLogical("Yes") queryContinue.FontItalic = CLogical("No") queryContinue.FontUnderline = CLogical("No") queryContinue.FontStrikeout = CLogical("No") queryContinue.ClearAfter = CLogical("No") queryContinue.Tag = "" queryContinue.Duration = "-1" queryContinue.TimingMode = ebTimingModeEvent queryContinue.PreReleaseTime = Val("0") queryContinue.OnsetSync = 1 queryContinue.OffsetSync = 0 Set Wait1 = new Wait Wait1.Name = "Wait1" Wait1.Tag = "" Wait1.TimingMode = ebTimingModeEvent Wait1.PreReleaseTime = Val("0") Wait1.OnsetSync = 1 Wait1.OffsetSync = 0 'Initialization for ULlistFixed Set ULlistFixed = New Factor ULlistFixed.Name = "ULlistFixed" Set ULlistFixed.Order = New SequentialOrder Set ULlistFixed.Deletion = NoDeletion ULlistFixed.ResetEveryRun = False ' Create the column headings ULlistFixed.AddAttrib "myStimulus" ULlistFixed.AddAttrib "correctResponse" ' Add the Levels and fill their values ULlistFixed.AddLevel "1" ULlistFixed.SetWeight "1", "1" ULlistFixed.SetProc "1", "EventProc" 'Nested not specified for this level ULlistFixed.SetAttrib "1", "myStimulus", "ostrich" ULlistFixed.SetAttrib "1", "correctResponse", "7" ULlistFixed.AddLevel "2" ULlistFixed.SetWeight "2", "1" ULlistFixed.SetProc "2", "EventProc" 'Nested not specified for this level ULlistFixed.SetAttrib "2", "myStimulus", "EVANGELIST" ULlistFixed.SetAttrib "2", "correctResponse", "8" ULlistFixed.AddLevel "3" ULlistFixed.SetWeight "3", "1" ULlistFixed.SetProc "3", "EventProc" 'Nested not specified for this level ULlistFixed.SetAttrib "3", "myStimulus", "sky" ULlistFixed.SetAttrib "3", "correctResponse", "7" ULlistFixed.AddLevel "4" ULlistFixed.SetWeight "4", "1" ULlistFixed.SetProc "4", "EventProc" 'Nested not specified for this level ULlistFixed.SetAttrib "4", "myStimulus", "RABBIT" ULlistFixed.SetAttrib "4", "correctResponse", "8" ULlistFixed.AddLevel "5" ULlistFixed.SetWeight "5", "1" ULlistFixed.SetProc "5", "EventProc" 'Nested not specified for this level ULlistFixed.SetAttrib "5", "myStimulus", "SNAKE" ULlistFixed.SetAttrib "5", "correctResponse", "8" ULlistFixed.AddLevel "6" ULlistFixed.SetWeight "6", "1" ULlistFixed.SetProc "6", "EventProc" 'Nested not specified for this level ULlistFixed.SetAttrib "6", "myStimulus", "rock" ULlistFixed.SetAttrib "6", "correctResponse", "7" ULlistFixed.AddLevel "7" ULlistFixed.SetWeight "7", "1" ULlistFixed.SetProc "7", "EventProc" 'Nested not specified for this level ULlistFixed.SetAttrib "7", "myStimulus", "tree" ULlistFixed.SetAttrib "7", "correctResponse", "7" ULlistFixed.AddLevel "8" ULlistFixed.SetWeight "8", "1" ULlistFixed.SetProc "8", "EventProc" 'Nested not specified for this level ULlistFixed.SetAttrib "8", "myStimulus", "joy" ULlistFixed.SetAttrib "8", "correctResponse", "7" ULlistFixed.AddLevel "9" ULlistFixed.SetWeight "9", "1" ULlistFixed.SetProc "9", "EventProc" 'Nested not specified for this level ULlistFixed.SetAttrib "9", "myStimulus", "FEAR" ULlistFixed.SetAttrib "9", "correctResponse", "8" ULlistFixed.AddLevel "10" ULlistFixed.SetWeight "10", "1" ULlistFixed.SetProc "10", "EventProc" 'Nested not specified for this level ULlistFixed.SetAttrib "10", "myStimulus", "TWINKIES" ULlistFixed.SetAttrib "10", "correctResponse", "8" ULlistFixed.Filename = "" ULlistFixed.LoadMethod = ebLoadMethodScript ULlistFixed.Tag = "" Set ULlistFixed.TerminateCondition = Samples(1000) Set ULlistFixed.ResetCondition = Samples(10) ULlistFixed.Reset End Sub '-------------------------------------------------------------------------- ' InitPackages ' '-------------------------------------------------------------------------- Sub InitPackages(c As Context) g_strOldTxtDataFile = c.DataFile.Filename g_strOldEdatDataFile = Left(c.DataFile.Filename,(Len(c.DataFile.Filename)-3)) & "edat" g_strParadigmName = c.GetAttrib("Experiment") g_bRenameDataFiles = False c.SetAttrib "IFISInstructionPath","/Program Files/PST/IFIS/Resources/Instructions/" g_nSessionStatus = 0 g_nBlockStatus = 0 g_nPeriodStatus = 0 g_nEventStatus = 0 g_nScannerReadyStatus = 0 g_nPatientReadyStatus = 0 IFISwizardRecordEventHistory = False IFISwizardRecordPeriodHistory = False IFISwizardBlockAccuracy = False IFISwizardTimingPrecision = False IFISwizardTNBack = False IFISwizardTemplate = False IFISwizardRecordEventHistoryState = False IFISwizardRecordPeriodHistoryState = False IFISwizardBlockAccuracyState = False IFISwizardTimingPrecisionState = False IFISwizardTNBackState = False IFISwizardTemplateState = False IFISwizardBVLogEventData = False g_nNumPeriodsDefault = 2 g_nPeriodADefault = 10000 g_nPeriodBDefault = 10000 g_strRFPulseModeDefault = "scanner" g_strResponseModeDefault = "bru" g_bSimulateBlockMenu = True g_strSimulatedSound = "none" g_nDiscardedAcquisitionTime = 1000 g_nBRUConfiguration = BRU_RIGHT_LEFT_DUPLICATE Set IFISPause = New TextDisplay IFISPause.Text = "" IFISPause.BackStyle = "transparent" IFISPause.Duration = 0 IFISPause.OnsetSync = 0 IFISPause.OffsetSync = 0 IFISPause.TimingMode = ebTimingModeEvent Set IFISPrepareNextScanS = New Slide IFISPrepareNextScanS.Name = "IFISPrepareNextScanS" IFISPrepareNextScanS.X = "center" IFISPrepareNextScanS.Y = "center" IFISPrepareNextScanS.Width = "100%" IFISPrepareNextScanS.Height = "100%" IFISPrepareNextScanS.XAlign = "center" IFISPrepareNextScanS.YAlign = "center" IFISPrepareNextScanS.AlignVertical = "center" IFISPrepareNextScanS.AlignHorizontal = "center" IFISPrepareNextScanS.BorderColor = CColor("black") IFISPrepareNextScanS.BorderWidth = "0" IFISPrepareNextScanS.BackColor = CColor("white") IFISPrepareNextScanS.BackStyle = "opaque" IFISPrepareNextScanS.ClearAfter = CLogical("No") IFISPrepareNextScanS.Tag = "" IFISPrepareNextScanS.Duration = "0" IFISPrepareNextScanS.TimingMode = ebTimingModeEvent IFISPrepareNextScanS.PreReleaseTime = Val("0") IFISPrepareNextScanS.OnsetSync = 1 IFISPrepareNextScanS.OffsetSync = 0 Set IFISPrepareNextScanSImage = New SlideImage IFISPrepareNextScanSImage.Name = "Image1" IFISPrepareNextScanSImage.Stretch = CLogical("Yes") IFISPrepareNextScanSImage.MirrorLeftRight = CLogical("No") IFISPrepareNextScanSImage.MirrorUpDown = CLogical("No") IFISPrepareNextScanSImage.X = "center" IFISPrepareNextScanSImage.Y = "center" IFISPrepareNextScanSImage.Width = "100%" IFISPrepareNextScanSImage.Height = "100%" IFISPrepareNextScanSImage.ForeColor = CColor("black") IFISPrepareNextScanSImage.BackColor = CColor("white") IFISPrepareNextScanSImage.BackStyle = "opaque" IFISPrepareNextScanSImage.BorderColor = CColor("black") IFISPrepareNextScanSImage.BorderWidth = "0" IFISPrepareNextScanSImage.XAlign = "center" IFISPrepareNextScanSImage.YAlign = "center" IFISPrepareNextScanSImage.AlignHorizontal = "center" IFISPrepareNextScanSImage.AlignVertical = "center" IFISPrepareNextScanS.Objects.Add IFISPrepareNextScanSImage Set IFISPrepareNextScanT = New TextDisplay IFISPrepareNextScanT.Text = "Please wait..." IFISPrepareNextScanT.WordWrap = True IFISPrepareNextScanT.BackStyle = "opaque" IFISPrepareNextScanT.BackColor = CColor("white") IFISPrepareNextScanT.BorderColor = CColor("black") IFISPrepareNextScanT.BorderWidth = "0" IFISPrepareNextScanT.ForeColor = CColor("black") IFISPrepareNextScanT.X = "center" IFISPrepareNextScanT.Y = "center" IFISPrepareNextScanT.Width = "100%" IFISPrepareNextScanT.Height = "100%" IFISPrepareNextScanT.XAlign = "center" IFISPrepareNextScanT.YAlign = "center" IFISPrepareNextScanT.AlignVertical = "center" IFISPrepareNextScanT.AlignHorizontal = "center" IFISPrepareNextScanT.FontName = "Arial" IFISPrepareNextScanT.FontSize = "32" IFISPrepareNextScanT.FontBold = CLogical("Yes") IFISPrepareNextScanT.FontItalic = CLogical("No") IFISPrepareNextScanT.FontUnderline = CLogical("No") IFISPrepareNextScanT.FontStrikeout = CLogical("No") IFISPrepareNextScanT.ClearAfter = CLogical("No") IFISPrepareNextScanT.Tag = "" IFISPrepareNextScanT.Duration = "0" IFISPrepareNextScanT.TimingMode = ebTimingModeEvent IFISPrepareNextScanT.PreReleaseTime = Val("0") IFISPrepareNextScanT.OnsetSync = 1 IFISPrepareNextScanT.OffsetSync = 0 Set IFISAskPatientReadyS = New Slide IFISAskPatientReadyS.Name = "IFISAskPatientReadyS" IFISAskPatientReadyS.X = "center" IFISAskPatientReadyS.Y = "center" IFISAskPatientReadyS.Width = "100%" IFISAskPatientReadyS.Height = "100%" IFISAskPatientReadyS.XAlign = "center" IFISAskPatientReadyS.YAlign = "center" IFISAskPatientReadyS.AlignVertical = "center" IFISAskPatientReadyS.AlignHorizontal = "center" IFISAskPatientReadyS.BorderColor = CColor("black") IFISAskPatientReadyS.BorderWidth = "0" IFISAskPatientReadyS.BackColor = CColor("white") IFISAskPatientReadyS.BackStyle = "opaque" IFISAskPatientReadyS.ClearAfter = CLogical("No") IFISAskPatientReadyS.Tag = "" IFISAskPatientReadyS.Duration = "-1" IFISAskPatientReadyS.TimingMode = ebTimingModeEvent IFISAskPatientReadyS.PreReleaseTime = Val("0") IFISAskPatientReadyS.OnsetSync = 1 IFISAskPatientReadyS.OffsetSync = 0 Set IFISAskPatientReadySImage = New SlideImage IFISAskPatientReadySImage.Name = "Image1" IFISAskPatientReadySImage.Stretch = CLogical("Yes") IFISAskPatientReadySImage.MirrorLeftRight = CLogical("No") IFISAskPatientReadySImage.MirrorUpDown = CLogical("No") IFISAskPatientReadySImage.X = "center" IFISAskPatientReadySImage.Y = "center" IFISAskPatientReadySImage.Width = "100%" IFISAskPatientReadySImage.Height = "100%" IFISAskPatientReadySImage.ForeColor = CColor("black") IFISAskPatientReadySImage.BackColor = CColor("white") IFISAskPatientReadySImage.BackStyle = "opaque" IFISAskPatientReadySImage.BorderColor = CColor("black") IFISAskPatientReadySImage.BorderWidth = "0" IFISAskPatientReadySImage.XAlign = "center" IFISAskPatientReadySImage.YAlign = "center" IFISAskPatientReadySImage.AlignHorizontal = "center" IFISAskPatientReadySImage.AlignVertical = "center" IFISAskPatientReadyS.Objects.Add IFISAskPatientReadySImage Set IFISAskPatientReadyT = New TextDisplay IFISAskPatientReadyT.Text = "Are you ready?\n\nYes - press 1 (thumb).\nNo - press 5 (little finger) to contact Technologist." IFISAskPatientReadyT.WordWrap = True IFISAskPatientReadyT.BackStyle = "opaque" IFISAskPatientReadyT.BackColor = CColor("white") IFISAskPatientReadyT.BorderColor = CColor("black") IFISAskPatientReadyT.BorderWidth = "0" IFISAskPatientReadyT.ForeColor = CColor("black") IFISAskPatientReadyT.X = "center" IFISAskPatientReadyT.Y = "center" IFISAskPatientReadyT.Width = "100%" IFISAskPatientReadyT.Height = "100%" IFISAskPatientReadyT.XAlign = "center" IFISAskPatientReadyT.YAlign = "center" IFISAskPatientReadyT.AlignVertical = "center" IFISAskPatientReadyT.AlignHorizontal = "center" IFISAskPatientReadyT.FontName = "Arial" IFISAskPatientReadyT.FontSize = "32" IFISAskPatientReadyT.FontBold = CLogical("Yes") IFISAskPatientReadyT.FontItalic = CLogical("No") IFISAskPatientReadyT.FontUnderline = CLogical("No") IFISAskPatientReadyT.FontStrikeout = CLogical("No") IFISAskPatientReadyT.ClearAfter = CLogical("yes") IFISAskPatientReadyT.Tag = "" IFISAskPatientReadyT.Duration = "-1" IFISAskPatientReadyT.TimingMode = ebTimingModeEvent IFISAskPatientReadyT.PreReleaseTime = Val("0") IFISAskPatientReadyT.OnsetSync = 1 IFISAskPatientReadyT.OffsetSync = 0 Set IFISGetReadyT = New TextDisplay IFISGetReadyT.Text = "" IFISGetReadyT.WordWrap = True IFISGetReadyT.BackStyle = "opaque" IFISGetReadyT.BackColor = CColor("white") IFISGetReadyT.BorderColor = CColor("black") IFISGetReadyT.BorderWidth = "0" IFISGetReadyT.ForeColor = CColor("black") IFISGetReadyT.X = "center" IFISGetReadyT.Y = "center" IFISGetReadyT.Width = "100%" IFISGetReadyT.Height = "100%" IFISGetReadyT.XAlign = "center" IFISGetReadyT.YAlign = "center" IFISGetReadyT.AlignVertical = "center" IFISGetReadyT.AlignHorizontal = "center" IFISGetReadyT.FontName = "Arial" IFISGetReadyT.FontSize = "32" IFISGetReadyT.FontBold = CLogical("Yes") IFISGetReadyT.FontItalic = CLogical("No") IFISGetReadyT.FontUnderline = CLogical("No") IFISGetReadyT.FontStrikeout = CLogical("No") IFISGetReadyT.ClearAfter = CLogical("No") IFISGetReadyT.Tag = "" IFISGetReadyT.Duration = "1" IFISGetReadyT.TimingMode = ebTimingModeEvent IFISGetReadyT.PreReleaseTime = Val("0") IFISGetReadyT.OnsetSync = 1 IFISGetReadyT.OffsetSync = 0 Set IFISGetReadyS = New Slide IFISGetReadyS.Name = "IFISGetReadyS" IFISGetReadyS.X = "center" IFISGetReadyS.Y = "center" IFISGetReadyS.Width = "100%" IFISGetReadyS.Height = "100%" IFISGetReadyS.XAlign = "center" IFISGetReadyS.YAlign = "center" IFISGetReadyS.AlignVertical = "center" IFISGetReadyS.AlignHorizontal = "center" IFISGetReadyS.BorderColor = CColor("black") IFISGetReadyS.BorderWidth = "0" IFISGetReadyS.BackColor = CColor("white") IFISGetReadyS.BackStyle = "opaque" IFISGetReadyS.ClearAfter = CLogical("No") IFISGetReadyS.Tag = "" IFISGetReadyS.Duration = "1" IFISGetReadyS.TimingMode = ebTimingModeEvent IFISGetReadyS.PreReleaseTime = Val("0") IFISGetReadyS.OnsetSync = 1 IFISGetReadyS.OffsetSync = 0 Set IFISGetReadySImage = New SlideImage IFISGetReadySImage.Name = "Image1" IFISGetReadySImage.Stretch = CLogical("Yes") IFISGetReadySImage.MirrorLeftRight = CLogical("No") IFISGetReadySImage.MirrorUpDown = CLogical("No") IFISGetReadySImage.X = "center" IFISGetReadySImage.Y = "center" IFISGetReadySImage.Width = "100%" IFISGetReadySImage.Height = "100%" IFISGetReadySImage.ForeColor = CColor("black") IFISGetReadySImage.BackColor = CColor("white") IFISGetReadySImage.BackStyle = "opaque" IFISGetReadySImage.BorderColor = CColor("black") IFISGetReadySImage.BorderWidth = "0" IFISGetReadySImage.XAlign = "center" IFISGetReadySImage.YAlign = "center" IFISGetReadySImage.AlignHorizontal = "center" IFISGetReadySImage.AlignVertical = "center" IFISGetReadyS.Objects.Add IFISGetReadySImage Set IFISBackground = New ImageDisplay IFISBackground.FileName = "expbackground.bmp" IFISBackground.Load IFISBackground.Stretch = CLogical("Yes") IFISBackground.MirrorLeftRight = CLogical("No") IFISBackground.MirrorUpDown = CLogical("No") IFISBackground.BackStyle = "transparent" IFISBackground.BackColor = CColor("white") IFISBackground.BorderColor = CColor("black") IFISBackground.BorderWidth = "0" IFISBackground.ForeColor = CColor("black") IFISBackground.X = "center" IFISBackground.Y = "center" IFISBackground.Width = "100%" IFISBackground.Height = "100%" IFISBackground.XAlign = "center" IFISBackground.YAlign = "center" IFISBackground.AlignVertical = "center" IFISBackground.AlignHorizontal = "center" IFISBackground.ClearAfter = CLogical("No") IFISBackground.Tag = "" IFISBackground.Duration = "1" IFISBackground.TimingMode = ebTimingModeEvent IFISBackground.PreReleaseTime = Val("0") IFISBackground.OnsetSync = 1 IFISBackground.OffsetSync = 0 Set IFISBlockMenuS = New Slide IFISBlockMenuS.Name = "IFISBlockMenuS" IFISBlockMenuS.X = "center" IFISBlockMenuS.Y = "center" IFISBlockMenuS.Width = "100%" IFISBlockMenuS.Height = "100%" IFISBlockMenuS.XAlign = "center" IFISBlockMenuS.YAlign = "center" IFISBlockMenuS.AlignVertical = "center" IFISBlockMenuS.AlignHorizontal = "center" IFISBlockMenuS.BorderColor = CColor("black") IFISBlockMenuS.BorderWidth = "0" IFISBlockMenuS.BackColor = CColor("black") IFISBlockMenuS.BackStyle = "opaque" IFISBlockMenuS.ClearAfter = CLogical("Yes") IFISBlockMenuS.Tag = "" IFISBlockMenuS.Duration = "-1" IFISBlockMenuS.TimingMode = ebTimingModeEvent IFISBlockMenuS.PreReleaseTime = Val("0") IFISBlockMenuS.OnsetSync = 1 IFISBlockMenuS.OffsetSync = 0 Set IFISBlockMenuSText = New SlideText IFISBlockMenuSText.Name = "Text1" IFISBlockMenuSText.Text = "" IFISBlockMenuSText.X = "center" IFISBlockMenuSText.Y = "center" IFISBlockMenuSText.Width = "100%" IFISBlockMenuSText.Height = "100%" IFISBlockMenuSText.ForeColor = CColor("black") IFISBlockMenuSText.BackColor = CColor("white") IFISBlockMenuSText.BackStyle = "transparent" IFISBlockMenuSText.WordWrap = True IFISBlockMenuSText.BorderColor = CColor("black") IFISBlockMenuSText.BorderWidth = "0" IFISBlockMenuSText.XAlign = "center" IFISBlockMenuSText.YAlign = "center" IFISBlockMenuSText.AlignHorizontal = "center" IFISBlockMenuSText.AlignVertical = "center" IFISBlockMenuSText.FontName = "Courier New" IFISBlockMenuSText.FontSize = "18" IFISBlockMenuSText.FontBold = CLogical("Yes") IFISBlockMenuSText.FontItalic = CLogical("No") IFISBlockMenuSText.FontUnderline = CLogical("No") IFISBlockMenuSText.FontStrikeout = CLogical("No") IFISBlockMenuS.Objects.Add IFISBlockMenuSText Set IFISBlockMenuSImage = New SlideImage IFISBlockMenuSImage.Name = "Image1" IFISBlockMenuSImage.Stretch = CLogical("Yes") IFISBlockMenuSImage.MirrorLeftRight = CLogical("No") IFISBlockMenuSImage.MirrorUpDown = CLogical("No") IFISBlockMenuSImage.X = "center" IFISBlockMenuSImage.Y = "center" IFISBlockMenuSImage.Width = "100%" IFISBlockMenuSImage.Height = "100%" IFISBlockMenuSImage.ForeColor = CColor("black") IFISBlockMenuSImage.BackColor = CColor("white") IFISBlockMenuSImage.BackStyle = "opaque" IFISBlockMenuSImage.BorderColor = CColor("black") IFISBlockMenuSImage.BorderWidth = "0" IFISBlockMenuSImage.XAlign = "center" IFISBlockMenuSImage.YAlign = "center" IFISBlockMenuSImage.AlignHorizontal = "center" IFISBlockMenuSImage.AlignVertical = "center" IFISBlockMenuS.Objects.Add IFISBlockMenuSImage Set IFISBlockMenuT = New TextDisplay IFISBlockMenuT.Text = "Show Block menu..." IFISBlockMenuT.WordWrap = True IFISBlockMenuT.BackStyle = "opaque" IFISBlockMenuT.BackColor = CColor("blue") IFISBlockMenuT.BorderColor = CColor("black") IFISBlockMenuT.BorderWidth = "0" IFISBlockMenuT.ForeColor = CColor("white") IFISBlockMenuT.X = "center" IFISBlockMenuT.Y = "center" IFISBlockMenuT.Width = "100%" IFISBlockMenuT.Height = "100%" IFISBlockMenuT.XAlign = "center" IFISBlockMenuT.YAlign = "center" IFISBlockMenuT.AlignVertical = "center" IFISBlockMenuT.AlignHorizontal = "center" IFISBlockMenuT.FontName = "Courier New" IFISBlockMenuT.FontSize = "18" IFISBlockMenuT.FontBold = CLogical("Yes") IFISBlockMenuT.FontItalic = CLogical("No") IFISBlockMenuT.FontUnderline = CLogical("No") IFISBlockMenuT.FontStrikeout = CLogical("No") IFISBlockMenuT.ClearAfter = CLogical("Yes") IFISBlockMenuT.Tag = "" IFISBlockMenuT.Duration = "-1" IFISBlockMenuT.TimingMode = ebTimingModeEvent IFISBlockMenuT.PreReleaseTime = Val("0") IFISBlockMenuT.OnsetSync = 1 IFISBlockMenuT.OffsetSync = 0 Set IFISFixationStartControlDelayS = New Slide IFISFixationStartControlDelayS.Name = "IFISFixationStartControlDelayS" IFISFixationStartControlDelayS.X = "center" IFISFixationStartControlDelayS.Y = "center" IFISFixationStartControlDelayS.Width = "100%" IFISFixationStartControlDelayS.Height = "100%" IFISFixationStartControlDelayS.XAlign = "center" IFISFixationStartControlDelayS.YAlign = "center" IFISFixationStartControlDelayS.AlignVertical = "center" IFISFixationStartControlDelayS.AlignHorizontal = "center" IFISFixationStartControlDelayS.BorderColor = CColor("black") IFISFixationStartControlDelayS.BorderWidth = "0" IFISFixationStartControlDelayS.BackColor = CColor("white") IFISFixationStartControlDelayS.BackStyle = "opaque" IFISFixationStartControlDelayS.ClearAfter = CLogical("No") IFISFixationStartControlDelayS.Tag = "" IFISFixationStartControlDelayS.Duration = "500" IFISFixationStartControlDelayS.TimingMode = ebTimingModeEvent IFISFixationStartControlDelayS.PreReleaseTime = Val("0") IFISFixationStartControlDelayS.OnsetSync = 1 IFISFixationStartControlDelayS.OffsetSync = 0 Set IFISFixationStartControlDelaySImage = New SlideImage IFISFixationStartControlDelaySImage.Name = "Image1" IFISFixationStartControlDelaySImage.Stretch = CLogical("Yes") IFISFixationStartControlDelaySImage.MirrorLeftRight = CLogical("No") IFISFixationStartControlDelaySImage.MirrorUpDown = CLogical("No") IFISFixationStartControlDelaySImage.X = "center" IFISFixationStartControlDelaySImage.Y = "center" IFISFixationStartControlDelaySImage.Width = "100%" IFISFixationStartControlDelaySImage.Height = "100%" IFISFixationStartControlDelaySImage.ForeColor = CColor("black") IFISFixationStartControlDelaySImage.BackColor = CColor("white") IFISFixationStartControlDelaySImage.BackStyle = "opaque" IFISFixationStartControlDelaySImage.BorderColor = CColor("black") IFISFixationStartControlDelaySImage.BorderWidth = "0" IFISFixationStartControlDelaySImage.XAlign = "center" IFISFixationStartControlDelaySImage.YAlign = "center" IFISFixationStartControlDelaySImage.AlignHorizontal = "center" IFISFixationStartControlDelaySImage.AlignVertical = "center" IFISFixationStartControlDelayS.Objects.Add IFISFixationStartControlDelaySImage Set IFISFixationEndControlDelayS = New Slide IFISFixationEndControlDelayS.Name = "IFISFixationEndControlDelayS" IFISFixationEndControlDelayS.X = "center" IFISFixationEndControlDelayS.Y = "center" IFISFixationEndControlDelayS.Width = "100%" IFISFixationEndControlDelayS.Height = "100%" IFISFixationEndControlDelayS.XAlign = "center" IFISFixationEndControlDelayS.YAlign = "center" IFISFixationEndControlDelayS.AlignVertical = "center" IFISFixationEndControlDelayS.AlignHorizontal = "center" IFISFixationEndControlDelayS.BorderColor = CColor("black") IFISFixationEndControlDelayS.BorderWidth = "0" IFISFixationEndControlDelayS.BackColor = CColor("white") IFISFixationEndControlDelayS.BackStyle = "opaque" IFISFixationEndControlDelayS.ClearAfter = CLogical("No") IFISFixationEndControlDelayS.Tag = "" IFISFixationEndControlDelayS.Duration = "-1" IFISFixationEndControlDelayS.TimingMode = ebTimingModeCumulative IFISFixationEndControlDelayS.PreReleaseTime = Val("0") IFISFixationEndControlDelayS.OnsetSync = 1 IFISFixationEndControlDelayS.OffsetSync = 0 Set IFISFixationEndControlDelaySImage = New SlideImage IFISFixationEndControlDelaySImage.Name = "Image1" IFISFixationEndControlDelaySImage.Stretch = CLogical("Yes") IFISFixationEndControlDelaySImage.MirrorLeftRight = CLogical("No") IFISFixationEndControlDelaySImage.MirrorUpDown = CLogical("No") IFISFixationEndControlDelaySImage.X = "center" IFISFixationEndControlDelaySImage.Y = "center" IFISFixationEndControlDelaySImage.Width = "100%" IFISFixationEndControlDelaySImage.Height = "100%" IFISFixationEndControlDelaySImage.ForeColor = CColor("black") IFISFixationEndControlDelaySImage.BackColor = CColor("white") IFISFixationEndControlDelaySImage.BackStyle = "opaque" IFISFixationEndControlDelaySImage.BorderColor = CColor("black") IFISFixationEndControlDelaySImage.BorderWidth = "0" IFISFixationEndControlDelaySImage.XAlign = "center" IFISFixationEndControlDelaySImage.YAlign = "center" IFISFixationEndControlDelaySImage.AlignHorizontal = "center" IFISFixationEndControlDelaySImage.AlignVertical = "center" IFISFixationEndControlDelayS.Objects.Add IFISFixationEndControlDelaySImage Set IFISBlockFeedbackS = New Slide IFISBlockFeedbackS.Name = "IFISBlockFeedbackS" IFISBlockFeedbackS.X = "center" IFISBlockFeedbackS.Y = "center" IFISBlockFeedbackS.Width = "100%" IFISBlockFeedbackS.Height = "100%" IFISBlockFeedbackS.XAlign = "center" IFISBlockFeedbackS.YAlign = "center" IFISBlockFeedbackS.AlignVertical = "center" IFISBlockFeedbackS.AlignHorizontal = "center" IFISBlockFeedbackS.BorderColor = CColor("black") IFISBlockFeedbackS.BorderWidth = "0" IFISBlockFeedbackS.BackColor = CColor("black") IFISBlockFeedbackS.BackStyle = "opaque" IFISBlockFeedbackS.ClearAfter = CLogical("No") IFISBlockFeedbackS.Tag = "" IFISBlockFeedbackS.Duration = "10000" IFISBlockFeedbackS.TimingMode = ebTimingModeEvent IFISBlockFeedbackS.PreReleaseTime = Val("0") IFISBlockFeedbackS.OnsetSync = 1 IFISBlockFeedbackS.OffsetSync = 0 Set IFISBlockFeedbackSText = New SlideText IFISBlockFeedbackSText.Name = "Text1" IFISBlockFeedbackSText.Text = "" IFISBlockFeedbackSText.X = "center" IFISBlockFeedbackSText.Y = "center" IFISBlockFeedbackSText.Width = "100%" IFISBlockFeedbackSText.Height = "100%" IFISBlockFeedbackSText.ForeColor = CColor("black") IFISBlockFeedbackSText.BackColor = CColor("white") IFISBlockFeedbackSText.BackStyle = "transparent" IFISBlockFeedbackSText.WordWrap = True IFISBlockFeedbackSText.BorderColor = CColor("black") IFISBlockFeedbackSText.BorderWidth = "0" IFISBlockFeedbackSText.XAlign = "center" IFISBlockFeedbackSText.YAlign = "center" IFISBlockFeedbackSText.AlignHorizontal = "center" IFISBlockFeedbackSText.AlignVertical = "center" IFISBlockFeedbackSText.FontName = "Arial Black" IFISBlockFeedbackSText.FontSize = "32" IFISBlockFeedbackSText.FontBold = CLogical("No") IFISBlockFeedbackSText.FontItalic = CLogical("No") IFISBlockFeedbackSText.FontUnderline = CLogical("No") IFISBlockFeedbackSText.FontStrikeout = CLogical("No") IFISBlockFeedbackS.Objects.Add IFISBlockFeedbackSText Set IFISBlockFeedbackSImage = New SlideImage IFISBlockFeedbackSImage.Name = "Image1" IFISBlockFeedbackSImage.Stretch = CLogical("Yes") IFISBlockFeedbackSImage.MirrorLeftRight = CLogical("No") IFISBlockFeedbackSImage.MirrorUpDown = CLogical("No") IFISBlockFeedbackSImage.X = "center" IFISBlockFeedbackSImage.Y = "center" IFISBlockFeedbackSImage.Width = "100%" IFISBlockFeedbackSImage.Height = "100%" IFISBlockFeedbackSImage.ForeColor = CColor("black") IFISBlockFeedbackSImage.BackColor = CColor("white") IFISBlockFeedbackSImage.BackStyle = "opaque" IFISBlockFeedbackSImage.BorderColor = CColor("black") IFISBlockFeedbackSImage.BorderWidth = "0" IFISBlockFeedbackSImage.XAlign = "center" IFISBlockFeedbackSImage.YAlign = "center" IFISBlockFeedbackSImage.AlignHorizontal = "center" IFISBlockFeedbackSImage.AlignVertical = "center" IFISBlockFeedbackS.Objects.Add IFISBlockFeedbackSImage Set IFISFeedbackVisualS = New Slide IFISFeedbackVisualS.Name = "IFISFeedbackVisualS" IFISFeedbackVisualS.X = "center" IFISFeedbackVisualS.Y = "center" IFISFeedbackVisualS.Width = "100%" IFISFeedbackVisualS.Height = "100%" IFISFeedbackVisualS.XAlign = "center" IFISFeedbackVisualS.YAlign = "center" IFISFeedbackVisualS.AlignVertical = "center" IFISFeedbackVisualS.AlignHorizontal = "center" IFISFeedbackVisualS.BorderColor = CColor("black") IFISFeedbackVisualS.BorderWidth = "0" IFISFeedbackVisualS.BackColor = CColor("black") IFISFeedbackVisualS.BackStyle = "opaque" IFISFeedbackVisualS.ClearAfter = CLogical("No") IFISFeedbackVisualS.Tag = "" IFISFeedbackVisualS.Duration = "500" IFISFeedbackVisualS.TimingMode = ebTimingModeCumulative IFISFeedbackVisualS.PreReleaseTime = Val("100") IFISFeedbackVisualS.OnsetSync = 1 IFISFeedbackVisualS.OffsetSync = 0 Set IFISFeedbackVisualSText = New SlideText IFISFeedbackVisualSText.Name = "Text1" IFISFeedbackVisualSText.Text = "WRONG" IFISFeedbackVisualSText.X = "center" IFISFeedbackVisualSText.Y = "center" IFISFeedbackVisualSText.Width = "50%" IFISFeedbackVisualSText.Height = "50%" IFISFeedbackVisualSText.ForeColor = CColor("black") IFISFeedbackVisualSText.BackColor = CColor("red") IFISFeedbackVisualSText.BackStyle = "opaque" IFISFeedbackVisualSText.WordWrap = True IFISFeedbackVisualSText.BorderColor = CColor("yellow") IFISFeedbackVisualSText.BorderWidth = "5" IFISFeedbackVisualSText.XAlign = "center" IFISFeedbackVisualSText.YAlign = "center" IFISFeedbackVisualSText.AlignHorizontal = "center" IFISFeedbackVisualSText.AlignVertical = "center" IFISFeedbackVisualSText.FontName = "Arial Black" IFISFeedbackVisualSText.FontSize = "32" IFISFeedbackVisualSText.FontBold = CLogical("Yes") IFISFeedbackVisualSText.FontItalic = CLogical("No") IFISFeedbackVisualSText.FontUnderline = CLogical("No") IFISFeedbackVisualSText.FontStrikeout = CLogical("No") IFISFeedbackVisualS.Objects.Add IFISFeedbackVisualSText Set IFISFeedbackVisualSImage = New SlideImage IFISFeedbackVisualSImage.Name = "Image1" IFISFeedbackVisualSImage.Stretch = CLogical("Yes") IFISFeedbackVisualSImage.MirrorLeftRight = CLogical("No") IFISFeedbackVisualSImage.MirrorUpDown = CLogical("No") IFISFeedbackVisualSImage.X = "center" IFISFeedbackVisualSImage.Y = "center" IFISFeedbackVisualSImage.Width = "100%" IFISFeedbackVisualSImage.Height = "100%" IFISFeedbackVisualSImage.ForeColor = CColor("black") IFISFeedbackVisualSImage.BackColor = CColor("white") IFISFeedbackVisualSImage.BackStyle = "opaque" IFISFeedbackVisualSImage.BorderColor = CColor("black") IFISFeedbackVisualSImage.BorderWidth = "0" IFISFeedbackVisualSImage.XAlign = "center" IFISFeedbackVisualSImage.YAlign = "center" IFISFeedbackVisualSImage.AlignHorizontal = "center" IFISFeedbackVisualSImage.AlignVertical = "center" IFISFeedbackVisualS.Objects.Add IFISFeedbackVisualSImage Dim IFISBeeperSoundOutInfo As SoundOutInfo IFISBeeperSoundOutInfo.MaxLength = 5000 IFISBeeperSoundOutInfo.VolumeControl = CLogical("no") IFISBeeperSoundOutInfo.PanControl = CLogical("no") Set IFISBeeper = sound.CreateBuffer(IFISBeeperSoundOutInfo) IFISBeeper.FileName = "ding.wav" IFISBeeper.Load IFISBeeper.Loop = CLogical("No") IFISBeeper.Volume = "0" ' IFISBeeper.Pan = "0" IFISBeeper.StopAfter = CLogical("No") IFISBeeper.StartOffset = "0" IFISBeeper.StopOffset = "0" IFISBeeper.EndSoundAction = 0 IFISBeeper.Tag = "" IFISBeeper.Duration = "0" IFISBeeper.TimingMode = ebTimingModeCumulative IFISBeeper.PreReleaseTime = Val("100") IFISBeeper.OnsetSync = 0 IFISBeeper.OffsetSync = 0 Dim IFISSimulatedSoundSoundOutInfo As SoundOutInfo IFISSimulatedSoundSoundOutInfo.MaxLength = 5000 IFISSimulatedSoundSoundOutInfo.VolumeControl = CLogical("no") IFISSimulatedSoundSoundOutInfo.PanControl = CLogical("no") Set IFISSimulatedSound = sound.CreateBuffer(IFISSimulatedSoundSoundOutInfo) IFISSimulatedSound.FileName = "none" ' IFISSimulatedSound.Load IFISSimulatedSound.Loop = CLogical("Yes") IFISSimulatedSound.Volume = "0" ' IFISSimulatedSound.Pan = "0" IFISSimulatedSound.StopAfter = CLogical("No") IFISSimulatedSound.StartOffset = "0" IFISSimulatedSound.StopOffset = "4000" IFISSimulatedSound.EndSoundAction = 0 IFISSimulatedSound.Tag = "" IFISSimulatedSound.Duration = "0" IFISSimulatedSound.TimingMode = ebTimingModeCumulative IFISSimulatedSound.PreReleaseTime = Val("100") IFISSimulatedSound.OnsetSync = 0 IFISSimulatedSound.OffsetSync = 0 Dim IFISFeedbackAuditorySoundOutInfo As SoundOutInfo IFISFeedbackAuditorySoundOutInfo.MaxLength = 5000 IFISFeedbackAuditorySoundOutInfo.VolumeControl = CLogical("no") IFISFeedbackAuditorySoundOutInfo.PanControl = CLogical("no") Set IFISFeedbackAuditory = sound.CreateBuffer(IFISFeedbackAuditorySoundOutInfo) IFISFeedbackAuditory.FileName = "ding.wav" IFISFeedbackAuditory.Load IFISFeedbackAuditory.Loop = CLogical("No") IFISFeedbackAuditory.Volume = "0" ' IFISFeedbackAuditory.Pan = "0" IFISFeedbackAuditory.StopAfter = CLogical("Yes") IFISFeedbackAuditory.StartOffset = "0" IFISFeedbackAuditory.StopOffset = "0" IFISFeedbackAuditory.EndSoundAction = 0 IFISFeedbackAuditory.Tag = "" IFISFeedbackAuditory.Duration = "5000" IFISFeedbackAuditory.TimingMode = ebTimingModeCumulative IFISFeedbackAuditory.PreReleaseTime = Val("100") IFISFeedbackAuditory.OnsetSync = 1 IFISFeedbackAuditory.OffsetSync = 0 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' End Sub '-------------------------------------------------------------------------- '-------------------------------------------------------------------------- ' UnInitDevices '-------------------------------------------------------------------------- Sub UnInitDevices() Keyboard.Close Mouse.Close Set Mouse = Nothing Display.Close Set Display = Nothing Sound.Close End Sub '-------------------------------------------------------------------------- '-------------------------------------------------------------------------- ' UnInitPackages '-------------------------------------------------------------------------- Sub UnInitPackages() #If USE_ICP Then ' Send message to ICP, letting it know we are done If (g_bICPEnabled) Then g_ICP.SendMessage strNotRunning g_ICP.SendMessage "*;EXPDONE;" End If ' Lower our priority SetOSThreadPriority 3 #Else If (g_bISMEnabled) Then ' Lower our priority SetOSThreadPriority 3 ' Notify that the stimulus presentation is over g_ISM.SendMessage IFIS_DONE_MSG IFIS_Yield 100 On Error Goto FileOpProblem If g_bRenameDataFiles = False Then ' probably didn't get the information before the user aborted ' Delete the .txt and .edat data files if they exist If Dir(g_strOldTxtDataFile) <> "" Then Kill g_strOldTxtDataFile End If If Dir(g_strOldEdatDataFile) <> "" Then Kill g_strOldEdatDataFile End If Else ' Save the data If Dir(g_strOldTxtDataFile) <> "" Then ' Do this check because the user may have turned off the creation of the text file in EPrime Name g_strOldTxtDataFile As g_strNewTxtDataFile End If Name g_strOldEdatDataFile As g_strNewEdatDataFile ' Notify that the data is now saved g_ISM.SendMessage IFIS_DATA_SAVED_MSG IFIS_Yield 100 End If ' Notify that the experiment is now closed (as close as we can get from the package file) g_ISM.SendMessage IFIS_CLOSED_MSG IFIS_Yield 100 g_ISM.Disconnect IFIS_Yield 100 g_ISM.Disable Else ' standalone If g_bRenameDataFiles Then ' figure that this will most often be true On Error Goto FileOpProblem ' Save the data If Dir(g_strOldTxtDataFile) <> "" Then ' Do this check because the user may have turned off the creation of the text file in EPrime Name g_strOldTxtDataFile As g_strNewTxtDataFile End If Name g_strOldEdatDataFile As g_strNewEdatDataFile End If End If Exit Sub FileOpProblem: MsgBox "An error occured when attempting to save data. There is a chance you have lost all/some of your data." #End If ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' End Sub '-------------------------------------------------------------------------- ' UnInitObjects ' '-------------------------------------------------------------------------- Sub UnInitObjects() Set SessionProc = Nothing Set Task1BlockProc = Nothing Set Task1PeriodProc = Nothing Set EventProc = Nothing Set ControlPeriodProc = Nothing Set Task2BlockProc = Nothing Set Task2PeriodProc = Nothing Set FixEventProc = Nothing Set Task3BlockProc = Nothing Set Task4BlockProc = Nothing Set LivNonPeriodProc = Nothing Set ULPeriodProc = Nothing End Sub '-------------------------------------------------------------------------- ' Main ' '-------------------------------------------------------------------------- Sub Main() CreateDefaultPort ' 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", "tor_fMRIBase" ebContext.SetAttrib "SessionDate", Date$ ebContext.SetAttrib "SessionTime", Time$ ebContext.SetAttrib "RandomSeed", PRNG.GetSeed() If Basic.OS = ebWin32 Then WinActivate "E-Run Experiment Window" End If ' Get the StartupInfo ' Set default for GroupNumber c.SetAttrib "Group", "1" ' Set the defaults for all of the StartupInfo c.SetAttrib "Subject", "1" c.SetAttrib "Session", "1" ' Set the default Data Filename c.DataFile.Filename = CStr(c.GetAttrib("Experiment")) & "-" & CStr(c.GetAttrib("Subject")) & "-" & CStr(c.GetAttrib("Session")) & ".txt" ' 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 ' 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" End If End If ExperimentFinish: UnInitObjects UnInitPackages UnInitDevices ExperimentAbort: ' Clean up the context c.PopFrame Set c = Nothing Set ebContext = Nothing DestroyDefaultPort End Sub [DataSection_LNlist(1)] Weight Procedure Nested myStimulus correctResponse 1 turtle 7 1 PENCIL 8 1 aardvark 7 1 insect 7 1 LUGNUT 8 1 grasshopper 7 1 happiness 8 1 BOARD 8 1 LIGHT 8 1 robin 7\0 [DataSection_Task4PeriodList(1)] Weight Procedure Nested PeriodDuration MinContinueTime listType instructText 1 ULPeriodProc 10000 1500 ULlist Lower / Upper case 1 LivNonPeriodProc 10000 1500 LNlist Living / Nonliving\0 [DataSection_wordsInPeriod(1)] Weight Nested Procedure 1 \[listType\] EventProc 1 \[listType\] EventProc 1 \[listType\] EventProc 1 \[listType\] EventProc 1 \[listType\] EventProc 1 \[listType\] EventProc 1 \[listType\] EventProc 1 \[listType\] EventProc 1 \[listType\] EventProc 1 \[listType\] EventProc 1 \[listType\] EventProc\0