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.
Start and End Text
Use startExperimentText for instructions that show at the start of the experiment or startTrialText for text that shows at the start of each trial.
Example (note: \n will create a new line, creating two here for an extra space)
yieldsightlab.startTrial(startExperimentText="Look Around the Room \n\n Press Trigger when Ready")
Example: Note, 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 or code.
#Add this code to the SightLabExperiment Function:defsightLabExperiment():yieldviztask.waitEvent(EXPERIMENT_START)fortrialinrange(sightlab.getTrialCount()):ifsightlab.getTrialNumber()==1:yieldsightlab.startTrial(startExperimentText='Look Around the Room \n\n Press Trigger when Ready')else:yieldviztask.waitEvent(TRIAL_START)yieldviztask.waitKeyDown(' ')yieldsightlab.endTrial()viztask.schedule(sightlab.runExperiment)viztask.schedule(sightLabExperiment)viz.callback(viz.getEventID('ResetPosition'),sightlab.resetViewPoint)
One Other Method for using code
ifi!=0:#event to start every subsequent trialyieldviztask.waitKeyDown(' ')# — start trial once, with instructions only on trial 1 —ifi==0:yieldsightlab.startTrial(startExperimentText="Press Spacebar to Start",textContinueKey=' ')else:yieldsightlab.startTrial()
Basic Instructions
Instructions with GUI and start condition set in GUI
defsightLabExperiment():yieldviztask.waitEvent(EXPERIMENT_START)yieldviztask.waitTime(0.1)yieldsightlab.showInstructions('Look Around the Room')fortrialinrange(sightlab.getTrialCount()):yieldviztask.waitEvent(TRIAL_START)yieldsightlab.hideInstructions()
Basic Instructions that can be brought up anytime.
For instructions to show at the start, place showInstructions and waitEvent before sightlab.startTrial() . In this case you don't need hideInstructions or pauseTImer
defsightLabExperiment():yieldviztask.waitEvent(EXPERIMENT_START)yieldsightlab.showInstructions('Do Something.\n\n Click Trigger or Left Mouse Button To Start')yieldviztask.waitEvent('triggerPress')foriinrange(0,sightlab.getTrialCount()):yieldsightlab.startTrial()
Can also use the same start condition as the trials, such as spacebar in this example
defsightLabExperiment():yieldviztask.waitEvent(EXPERIMENT_START)yieldsightlab.showInstructions("Press 'a' to toggle basketball \n\n Press Spacebar to Continue")foriinrange(0,sightlab.getTrialCount()):yieldviztask.waitKeyDown(' ')yieldsightlab.startTrial()
Image Based Instructions
defsightLabExperiment():whileTrue:#Press spacebar to cycle image instructions before first experiment startssightlab.instructionsImageQuad.setScale([1,1.5,1])yieldsightlab.showInstructions(image='sightlab_resources/sightlab_controls.jpg')yieldviztask.waitKeyDown(' ')yieldsightlab.showInstructions(image='sightlab_resources/sightlab_controls_oculus.jpg')sightlab.instructionsImageQuad.setScale([1.5,1,1])yieldviztask.waitKeyDown(' ')yieldsightlab.hideInstructions()whileTrue:ifnotsightlab.getTrialNumber()==1:yieldviztask.waitKeyDown(' ')yieldsightlab.startTrial()yieldviztask.waitKeyDown(' ')yieldsightlab.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
You can also download a .jpg of an instructions (such as creating a slide in Google slides and downloading as a .jpg) then adding that .jpg to your 3d scene by using File-Add. You can then move the image by right clicking and choosing "Add-Transform" to use the move tools. This model with the instructions can then be added as a trial with tracking turned off.