R.Muralikrishnan, MPI for Empirical Aesthetics. This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Licence. ############################################################################## ## ## ## Lexdec : Visual ERP Study with Lexical Decision Task ## ## Experiment Script for use with Presentation ## ## Author: R. Muralikrishnan ## ## ## ############################################################################## ############################################################################## # Scenario Description Language (SDL) Header Part ############################################################################## # These button codes have to correspond to those set in 'Settings -> Response' active_buttons = 3; # There are 3 active buttons defined in 'Settings -> Response' button_codes = 1,2,3; # These are the codes of those buttons response_matching = simple_matching; # Enables features not in legacy_matching # Only those button presses that one expects are logged; not all response_logging = log_active; # Needed for EEG Trigger files write_codes = true; pulse_width = 5; default_output_port = 1; # This is most probably going to be the same for everyone. # This is the LPT Parallel port that you will define in the Port settings tab of # Presentation. This will be used as the output port for sending codes to EEG. # Defining this here saves getting a port number in the PCL part from the output_manager # and calling send_code etc. Stimulus events themselves will send these for us, provided we # define the correct port_codes in each Stimulus event. # Default Settings for Font, FG and BG Colours etc. default_background_color = "0, 0, 0"; # RGB codes in decimal; #000000 => Black default_font = "Courier New Bold"; # Alternatives: "Arabic Typesetting"; "Arial Unicode MS"; default_font_size = 24; default_text_color = "000, 102, 153"; # "000, 102, 153"; # 006699 A pleasant bluish colour default_text_align = align_center; default_deltat = 0; default_picture_duration = next_picture; #/* This implies that all pictures ... #/...are shown until the next picture is shown, unless otherwise specified */ #default_all_responses = false; ############################################################################## # Scenario Description Language (SDL) Part ############################################################################## begin; # ============================ # SDL Variable Declarations: - # ============================ # # We don't use any variables. All the timer parameters appear as numbers. # ============================== # Picture Stimuli Definitions: - Everything that is shown, including text! # ============================== # Screen definition for the trial that starts an Experimental Session. # Used as the first screen that the participant sees. Operator Controlled. line_graphic { coordinates = -600, -72, -600, 71; coordinates = 600, -72, 600, 71; coordinates = -600, -70, 600, -70; coordinates = -600, 70, 600, 70; line_width = 4; line_color = 32, 32, 32; } Lin_Border; picture { # text { caption = "Welcome! The Experiment will begin shortly."; }; text { caption = " أهلا و سهلا بك في مختبر علوم الدماغ و اللغة"; }; x = 1; y = 6; line_graphic Lin_Border; x = 0; y = 0; } P_Start_Exp; # Screen definition for the Pause trial # Operator Controlled! picture { # text { caption = "Let us continue after a short break!"; }; text { caption = "لنواصل بعد فترة قصيرة من الراحة"; }; x = 0; y = 0; line_graphic Lin_Border; x = 0; y = 0; } P_Pause; # Screen definition for the Continue trial # Participant Controlled! picture { text { caption = "اضغط على زر المسافة الأصفر لتواصل"; }; x = 0; y = 0; line_graphic Lin_Border; x = 0; y = 0; } P_Continue; # Screen definition for the Interruption trial # Operator Controlled! picture { text { caption = "معذرة على هذا الخلل سنواصل بعد لحضة"; }; x = 0; y = 0; } P_Interruption; # Screen definition for showing the focus star picture { # bitmap { filename = "Focus_Star_new1.bmp"; }; # Use Focus_Star.bmp text { caption = "*"; }; x = 0; y = 0; } P_Focus_Star; # Screen definition for the End_Thanks trial picture { text {caption = "انتهت التجربة شكرا على المشاركة";}; x = 0; y = 0; line_graphic Lin_Border; x = 0; y = 0; } P_End_Thanks; #### Specific for presenting Visual Stimuli -------------------------------- # Screen definition for the trial that presents Visual Stimuli word-by-word. picture { text { caption = " "; } Txt_Visual_Stimulus; x = 0; y = 0; } P_Visual_Stimulus; #### #===================== # Trial Definitions: - #===================== /**** /# Note that the name 'Trial' could be misleading. Unless otherwise specified, /# what we mean by a 'Trial' here is actually a sub-trial or sub-task that is /# part - and thereby defines the structure - of an actual experimental trial. ****/ /**** /# Template for defining an SDL Trial. /# trial /# { /# Trial-related parameters such as trial_duration, trial_type etc. /# Trial-related parameters /# /# Stimulus event 1 such as picture, sound, video, nothing or force-FB; /# Stimulus event parameters such as time, event code etc. /# If the parameters aren't specified, the default values are used!!! /# /# Stimulus event 2; /# its parameters...and so on /# } ****/ # Screen definition of the Trial to show a Blank Screen between Experimental Trials trial { trial_duration = 100; all_responses = false; stimulus_event { picture {}; # This is the default picture, which is nothing! code = "CLS"; # Comment this out to avoid seeing this in the logfile. }; } T_Blank_Screen; # Definition of the Trial to start an Experimental Session. # Operator Controlled! trial { trial_duration = forever; # Keep running the trial... trial_type = specific_response; # ...until the following specific response. terminator_button = 3; # Operator PC - ENTER key. stimulus_event { picture P_Start_Exp; # Show P_Start_Exp. code = "هل أنت جاهز سنبدأ الأن"; }; } T_Start_Exp; # Definition of the Trial to continue further. # Participant Controlled! trial { trial_duration = forever; # Keep running the trial... trial_type = specific_response; # ...until the following specific response. terminator_button = 1,2; # Participant Joystick - L or R button. stimulus_event { picture P_Continue; # Show P_Continue. code = "Trials follow!"; }; } T_Continue; # Definition of the Trial to Launch an Experimental Trial trial { trial_duration = 400; # Run the trial for 300 ms... all_responses = false; # ..without recognising any key presses. stimulus_event { picture {}; # Show a clear screen code = ""; # Code set below in the PCL program. # port_code = ; # Port code set by the PCL program. } E_Launch_New_Trial; } T_Launch_New_Trial; # Definition of the Trial to keep showing the Focus Star for fixation. trial { trial_duration = 1000; # Show star until the next clear-screen... all_responses = false; # ..without recognising any key presses. stimulus_event { picture P_Focus_Star; # Show the focus star for fixation. code = "*"; # Comment this out later to avoid seeing this in the log file. }; } T_Keep_Showing_Star; #### Specific for presenting Visual Stimuli -------------------------------- # Definition of the Trial to present Visual Stimuli word-by-word trial { trial_duration = 2000; trial_type = specific_response; terminator_button = 1,2; # The exact response can be either of these; stimulus_event { picture P_Visual_Stimulus; code = ""; # PCL Program fills this!!! # port_code = ; # PCL Program fills this!!! # target_button = 1,2; # PCL Program sets this. } E_Visual_Stimulus; } T_Visual_Stimulus; #### # Definition of the Trial to send a code indicating that a Timeout has occurred. /*# When a button-pressed response occurs, 1 or 2 is sent to EEG depending upon the button pressed. # When a timeout occurs, nothing gets sent. Just in order to have equal number of lines in the # trigger files later, it's better to send a code indicating timeout. # (Yes, IN ADDITION to the usual code 199 that will follow.) */ trial { trial_duration = 10; all_responses = false; stimulus_event { nothing {}; # This is the default picture, which is nothing! code = "Timeout"; port_code = 3; } E_Report_Timeout_to_EEG; } T_Report_Timeout_to_EEG; # Definition of the Trial to send the response code to EEG trial { trial_duration = 20; all_responses = false; stimulus_event { nothing {}; # Basically, nothing is done! time = 15; /*# Start this event 15 seconds after the trial starts. This is to provide a delay in # sending the code to EEG to avoid trying to reach the port when it is still busy # having just received the response 1 or 2 from the button box, or the timeout code. */ # code = "Send Code"; # Comment this out to avoid seeing this in the logfile. # port_code = 196, 197 or 199, PCL Program fills this!!! } E_Response_Code_to_EEG; } T_Response_Code_to_EEG; # Definition of the Trial to show a Pause # Operator Controlled trial { trial_duration = forever; trial_type = specific_response; terminator_button = 3; stimulus_event { picture P_Pause; code = "Pause"; }; } T_Pause; # Definition of the Trial to Interrupt in the middle of a session # Operator Controlled trial { trial_duration = forever; trial_type = specific_response; terminator_button = 3; stimulus_event { picture P_Interruption; code = "Interrupted!!!"; }; } T_Interruption; # Definition of the Trial to end the session # Operator Controlled trial { trial_duration = forever; all_responses = false; trial_type = first_response; stimulus_event { picture P_End_Thanks; code = "End of Session!"; }; picture P_End_Thanks; } T_End_Thanks; ############################################################################## # Presentation Control Language (PCL) Program Part ############################################################################## begin_pcl; preset string V_Version; # Prompt the version at the beginning!!! int N_of_Trials = 400; # Number of Experimental Trials per Session. int N_of_Blocks = 8; # Number of Blocks per Session. int N_of_Trials_per_Block = N_of_Trials/N_of_Blocks; # Number of Experimental Trials per Block. input_file F_Session_List = new input_file; F_Session_List.open("Session_List_" + V_Version + ".txt"); # This is the file containing the list of stimuli for one session. # Each line in this file must correspond to one experimental trial. #### # Columns of strings in the order found in the input Session List file. string V_Stimulus_Code; string V_Item; string V_Condition; string V_Condition_Code; string V_Visual_Stimulus; string V_Expected_Response; # output_port O_Port_to_EEG = output_port_manager.get_port(1); stimulus_data D_Stimulus_Data = stimulus_manager.last_stimulus_data(); #======================== # Main Experiment Loop: - #======================== loop /*** Begin Main Loop 1 for Blocks ***/ int V_Current_Block = 1 until V_Current_Block > N_of_Blocks begin if V_Current_Block == 1 then T_Start_Exp.present(); else T_Pause.present(); end; T_Continue.present(); T_Blank_Screen.present(); T_Keep_Showing_Star.present(); T_Blank_Screen.present(); #========== # Loop 2: - #========== loop /*** Begin Loop 2 for Trials ***/ int V_Current_Trial = 1 until V_Current_Trial > N_of_Trials_per_Block begin V_Stimulus_Code = F_Session_List.get_string(); # Eg: 01SAI V_Item = F_Session_List.get_string(); # Eg: 01 V_Condition = F_Session_List.get_string(); # Eg: SAI V_Condition_Code = F_Session_List.get_string(); # Eg: 230 V_Visual_Stimulus = F_Session_List.get_string(); V_Expected_Response = F_Session_List.get_string(); # Eg: 2 (Left button => Correct) # Do filename and event-code assignments valid during this exp-trial; # Load wavefile and bitmap stimuli that are needed for this trial; /*# We do this before launching the experimental trial so as to keep # as minimal intereference as possible in trial timings. You see, # these things consume processor time, however small they are! */ E_Launch_New_Trial.set_event_code("B" + string(V_Current_Block) + " T" + string(V_Current_Trial)); # Execute the Experimental Trial!!! # A hard-coded way to tackle 08 and 09 bug in Presentation!!! if (V_Item == "08") then V_Item = "8"; elseif (V_Item == "09") then V_Item = "9"; end; E_Launch_New_Trial.set_port_code(int(V_Item)); T_Launch_New_Trial.present(); # Show clear screen for 400 ms /***************** Visual Stimulus Presentation Begins ***********************/ #### Set the target button E_Visual_Stimulus.set_target_button(int(V_Expected_Response)); #### Set the trigger to be sent on presenting the word E_Visual_Stimulus.set_event_code(V_Stimulus_Code); E_Visual_Stimulus.set_port_code(int(V_Condition_Code)); # Put the current word on the picture and redraw the text part in it. Txt_Visual_Stimulus.set_caption(V_Visual_Stimulus); Txt_Visual_Stimulus.redraw(); # Present the trial that will show the changed text on screen for x ms. T_Visual_Stimulus.present(); /***************** Visual Stimulus Presentation Ends *************************/ # Monitor the Response and send appropriate port codes to EEG!!! D_Stimulus_Data = stimulus_manager.last_stimulus_data(); # To delay sending the following codes to the Output Port!!! # Because these are almost at the same time as the Response there, so the port # cannot handle it unless there's a short delay. if (D_Stimulus_Data.type() == stimulus_hit) then E_Response_Code_to_EEG.set_port_code(196); T_Response_Code_to_EEG.present(); elseif (D_Stimulus_Data.type() == stimulus_incorrect) then E_Response_Code_to_EEG.set_port_code(197); T_Response_Code_to_EEG.present(); elseif (D_Stimulus_Data.type() == stimulus_miss) then T_Report_Timeout_to_EEG.present(); E_Response_Code_to_EEG.set_port_code(199); T_Response_Code_to_EEG.present(); end; T_Blank_Screen.present(); # Go to the Next Trial V_Current_Trial = V_Current_Trial + 1; #=========== # End Loop 2 #=========== end; /*** End Loop 2 for Trials ***/ # Go to the Next Block V_Current_Block = V_Current_Block + 1; #================ # End Main Loop 1 #================ end; /*** End Main Loop 1 for Blocks ***/ # Close all the open files F_Session_List.close(); # Finish off the session!!! T_End_Thanks.present();