Adding Instructions
Adding Instructions
Located in ExampleScripts - Instructions
Here is how you can add instructions that will show up in a headset (wherever the user looks) and on the mirrored desktop view. This can be triggered using any event (such as a yield viztask.WaitTime ). This code is also under the "ExampleScripts" folder. The default for skipping past the instruction is either with the left mouse click or controller trigger for single user and SPACEBAR on the server with multi-user.
Start and End Text
Use startExperimentText for instructions that show at the stat of the experiment or startTrialText for text that shows at the start of each trial.
yield sightlab.startTrial(startExperimentText = "test", textContinueEvent = "triggerPress")
End Experiment Text
yield sightlab.endTrial(endExperimentText = 'Done')
Example (note \n will create a new line, creating two here for an extra space)
yield sightlab.startTrial(startExperimentText= 'Look Around the Room \n\n Press Trigger when Ready')
Example: Note to have the startCondition set to 'None' in the GUI for the first trial if using startExperimentText, as the trigger will be used (can be changed to another condition in the code). Subsequent trial start and stop conditions can be set in GUI.
#Add this code to the SightLabExperiment Function:
def sightLabExperiment():
yield viztask.waitEvent(EXPERIMENT_START)
for trial in range(sightlab.getTrialCount()):
if sightlab.getTrialNumber() == 1:
yield sightlab.startTrial(startExperimentText=
'Look Around the Room \n\n Press Trigger when Ready')
elif sightlab.getTrialNumber() > 1:
yield viztask.waitEvent(TRIAL_START)
yield viztask.waitKeyDown(' ')
yield sightlab.endTrial()
viztask.schedule(sightlab.runExperiment)
viztask.schedule(sightLabExperiment)
viz.callback(viz.getEventID('ResetPosition'), sightlab.resetViewPoint)
Basic Instructions that can be brought up anytime
yield sightlab.showInstructions('test', pauseTimer = True)
yield viztask.waitEvent('triggerPress')
yield sightlab.hideInstructions()
Basic Image Instructions
quad = yield sightlab.showInstructions(image = 'sightlab_resources/media/skybox_room1.jpg')
Image Slides for Instructions
def sightLabExperiment():
while True:
#Press spacebar to cycle image instructions before first experiment starts
sightlab.instructionsImageQuad.setScale([1,1.5,1])
yield sightlab.showInstructions(image = 'sightlab_resources/sightlab_controls.jpg')
yield viztask.waitKeyDown(' ')
yield sightlab.showInstructions(image = 'sightlab_resources/sightlab_controls_oculus.jpg')
sightlab.instructionsImageQuad.setScale([1.5,1,1])
yield viztask.waitKeyDown(' ')
yield sightlab.hideInstructions()
while True:
if not sightlab.getTrialNumber() == 1:
yield viztask.waitKeyDown(' ')
yield sightlab.startTrial()
yield viztask.waitKeyDown(' ')
yield sightlab.endTrial()
viztask.schedule(sightlab.runExperiment)
viztask.schedule(sightLabExperiment)
Find also examples for adding multiple images or instruction text slides in the ExampleScripts
Another option for adding instructions at specific times and after certain conditions is to use a STIM file