Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- API: 2
- OpenSesame: 3.0.6
- Platform: posix
- ---
- set width 1024
- set uniform_coordinates "yes"
- set title "Extended template"
- set subject_parity "even"
- set subject_nr 0
- set start "experiment"
- set height 768
- set foreground "white"
- set font_size 18
- set font_italic "no"
- set font_family "mono"
- set font_bold "no"
- set experiment_path "/home/lotje/Documents/OpenSesame/Scripts/Example scripts forum questions"
- set description "A template containing a practice and an experimental phase"
- set coordinates "uniform"
- set compensation 0
- set canvas_backend "xpyriment"
- set bidi "yes"
- set background "black"
- define loop block_loop
- set skip 0
- set repeat 1
- set order "random"
- set offset "no"
- set item "trial_sequence"
- set description "A single block of trials"
- set cycles 3
- set column_order ""
- set break_if "never"
- run trial_sequence
- define sequence block_sequence
- set flush_keyboard "yes"
- set description "A sequence containing a single block of trials followed by feedback to the participant"
- run reset_feedback always
- run block_loop always
- define inline_script define_list
- set description "Executes Python code"
- set _run ""
- ___prepare__
- lEq = [
- ["2 x 2 = ", "4", "multiplication"],
- ["2 + 3 = ", "5", "addition"],
- ["2 - 2 = ", "0", "subtraction"]
- ]
- # If you want, you could randomize the list. (This won' affect
- # the content of the smaller lists):
- import random
- random.shuffle(lEq)
- __end__
- define sequence experiment
- set flush_keyboard "yes"
- set description "The main sequence of the experiment"
- run define_list always
- run experimental_loop always
- define loop experimental_loop
- set skip 0
- set repeat 1
- set order "random"
- set offset "no"
- set item "block_sequence"
- set description "A loop containing one or more experimental blocks"
- set cycles 1
- set column_order "practice"
- set break_if "never"
- setcycle 0 practice "no"
- run block_sequence
- define inline_script get_equation
- set description "Executes Python code"
- set _run ""
- ___prepare__
- # Pop one equation from the list. This is without replacement:
- var.equation = lEq.pop()
- # We now have one small list, where the first item is the
- # question, the second one the correct response,
- # and the last one the type of equation.
- # (We tell OpenSesame what the correct answer is by setting the
- # built-in variable 'correct_response')
- var.question, var.correct_response, var._type = var.equation
- __end__
- define keyboard_response keyboard_response
- set timeout "infinite"
- set flush "yes"
- set duration "keypress"
- set description "Collects keyboard responses"
- define logger logger
- set description "Logs experimental data"
- set auto_log "yes"
- define feedback new_feedback
- set reset_variables "yes"
- set duration 1000
- set description "Provides feedback to the participant"
- draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="your response was: [response]" x=0 y=0 z_index=0
- draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="correctness: [correct]" x=0 y=64 z_index=0
- define reset_feedback reset_feedback
- set description "Resets the feedback variables, such as 'avg_rt' and 'acc'"
- define sketchpad sketchpad
- set start_response_interval "no"
- set duration 0
- set description "Displays stimuli"
- draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=40 html=yes show_if=always text="[_type]" x=0 y=-192 z_index=0
- draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=40 html=yes show_if=always text="[question]" x=0 y=0 z_index=0
- define sequence trial_sequence
- set flush_keyboard "yes"
- set description "A single trial"
- run get_equation always
- run sketchpad always
- run keyboard_response always
- run new_feedback always
- run logger always
Advertisement
Add Comment
Please, Sign In to add comment