Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Generated by OpenSesame 0.27.2 (Frisky Freud)
- # Sat Jun 8 13:23:54 2013 (posix)
- # <http://www.cogsci.nl/opensesame>
- set foreground "white"
- set subject_parity "even"
- set description "A template containing a practice and an experimental phase"
- set title "Extended template"
- set compensation "0"
- set coordinates "relative"
- set height "768"
- set mouse_backend "xpyriment"
- set width "1024"
- set sampler_backend "legacy"
- set keyboard_backend "legacy"
- set background "black"
- set subject_nr "0"
- set canvas_backend "xpyriment"
- set start "experiment"
- set synth_backend "legacy"
- define inline_script declare_trial_count
- set _run ""
- ___prepare__
- # Determine the trial count.
- # The built-in counter 'count_trial_sequence'
- # starts counting at zero (in line with the zero-based
- # indexing generally used in Python).
- # Therefore, we want to add '1' to the
- # counter variable you want to show to
- # the participant.
- # Firstly, we 'get' the in-the-GUI-defined variable
- # 'count_trial_sequence' to use it in an inline_script.
- # To do so, we use the built-in experiment function
- # self.get(). This function takes one argument, namely the
- # name of the OpenSesame variable:
- # For more info, see:
- # http://osdoc.cogsci.nl/python-inline-code/experiment-functions/#experiment.get
- trial_count = self.get("count_trial_sequence")
- # Next, we add '1' to the trial_count:
- trial_count = trial_count + 1
- # To determine how many trials the participant still
- # has to do, we use the previously-defined
- # variable 'total', which we 'get' with self.get():
- trials_remaining = self.get("total") - trial_count
- # Finally, we have to set the here-defined variables to
- # make them available in the GUI:
- exp.set("trial_count", trial_count)
- exp.set("trials_remaining", trials_remaining)
- __end__
- set description "Executes Python code"
- define inline_script declare_total
- set _run ""
- ___prepare__
- # Declare the total number of trials, which should correspond
- # to the number of trials in the block loop
- # (depending on 'cycles' and 'repeat').
- total = 5
- # To make an in-an-inline_script-item-defined variable
- # available in the GUI (e.g., in our case, a sketchpad item)
- # as well, we 'set' the variable by using the built-in
- # experiment function exp.set().
- # This function takes two arguments: the name
- # of the variable and its value.
- # For more information, see:
- # http://osdoc.cogsci.nl/python-inline-code/experiment-functions/#experiment.set
- exp.set("total", total)
- __end__
- set description "Executes Python code"
- define loop block_loop
- set repeat "1"
- set description "A single block of trials"
- set item "trial_sequence"
- set column_order ""
- set cycles "5"
- set order "random"
- run trial_sequence
- define sketchpad sketchpad
- set duration "0"
- set description "Displays stimuli"
- set start_response_interval "no"
- draw fixdot 0 0 color=white show_if="always"
- draw textline 0 -192 "This is trial [trial_count]/[total]" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
- draw textline 0 -96 "You still have [trials_remaining] trials to go..." center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
- define sequence experiment
- set flush_keyboard "yes"
- set description "The main sequence of the experiment"
- run declare_total "always"
- run experimental_loop "always"
- define sequence trial_sequence
- set flush_keyboard "yes"
- set description "A single trial"
- run declare_trial_count "always"
- run sketchpad "always"
- run keyboard_response "always"
- run logger "always"
- define loop experimental_loop
- set repeat "1"
- set description "A loop containing one or more experimental blocks"
- set item "block_sequence"
- set column_order "practice"
- set cycles "1"
- set order "random"
- setcycle 0 practice "no"
- run block_sequence
- define keyboard_response keyboard_response
- set description "Collects keyboard responses"
- set timeout "infinite"
- set flush "yes"
- define logger logger
- set description "Logs experimental data"
- 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 block_loop "always"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement