Guest User

Untitled

a guest
Mar 20th, 2016
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.90 KB | None | 0 0
  1. ---
  2. API: 2
  3. OpenSesame: 3.0.6
  4. Platform: posix
  5. ---
  6. set width 1024
  7. set uniform_coordinates "yes"
  8. set title "Extended template"
  9. set subject_parity "even"
  10. set subject_nr 0
  11. set start "experiment"
  12. set height 768
  13. set foreground "white"
  14. set font_size 18
  15. set font_italic "no"
  16. set font_family "mono"
  17. set font_bold "no"
  18. set experiment_path "/home/lotje/Documents/OpenSesame/Scripts/Example scripts forum questions"
  19. set description "A template containing a practice and an experimental phase"
  20. set coordinates "uniform"
  21. set compensation 0
  22. set canvas_backend "xpyriment"
  23. set bidi "yes"
  24. set background "black"
  25.  
  26. define loop block_loop
  27. set skip 0
  28. set repeat 1
  29. set order "random"
  30. set offset "no"
  31. set item "trial_sequence"
  32. set description "A single block of trials"
  33. set cycles 3
  34. set column_order ""
  35. set break_if "never"
  36. run trial_sequence
  37.  
  38. define sequence block_sequence
  39. set flush_keyboard "yes"
  40. set description "A sequence containing a single block of trials followed by feedback to the participant"
  41. run reset_feedback always
  42. run block_loop always
  43.  
  44. define inline_script define_list
  45. set description "Executes Python code"
  46. set _run ""
  47. ___prepare__
  48. lEq = [
  49. ["2 x 2 = ", "4", "multiplication"],
  50. ["2 + 3 = ", "5", "addition"],
  51. ["2 - 2 = ", "0", "subtraction"]
  52. ]
  53.  
  54. # If you want, you could randomize the list. (This won' affect
  55. # the content of the smaller lists):
  56. import random
  57. random.shuffle(lEq)
  58. __end__
  59.  
  60. define sequence experiment
  61. set flush_keyboard "yes"
  62. set description "The main sequence of the experiment"
  63. run define_list always
  64. run experimental_loop always
  65.  
  66. define loop experimental_loop
  67. set skip 0
  68. set repeat 1
  69. set order "random"
  70. set offset "no"
  71. set item "block_sequence"
  72. set description "A loop containing one or more experimental blocks"
  73. set cycles 1
  74. set column_order "practice"
  75. set break_if "never"
  76. setcycle 0 practice "no"
  77. run block_sequence
  78.  
  79. define inline_script get_equation
  80. set description "Executes Python code"
  81. set _run ""
  82. ___prepare__
  83. # Pop one equation from the list. This is without replacement:
  84. var.equation = lEq.pop()
  85.  
  86. # We now have one small list, where the first item is the
  87. # question, the second one the correct response,
  88. # and the last one the type of equation.
  89.  
  90. # (We tell OpenSesame what the correct answer is by setting the
  91. # built-in variable 'correct_response')
  92.  
  93. var.question, var.correct_response, var._type = var.equation
  94. __end__
  95.  
  96. define keyboard_response keyboard_response
  97. set timeout "infinite"
  98. set flush "yes"
  99. set duration "keypress"
  100. set description "Collects keyboard responses"
  101.  
  102. define logger logger
  103. set description "Logs experimental data"
  104. set auto_log "yes"
  105.  
  106. define feedback new_feedback
  107. set reset_variables "yes"
  108. set duration 1000
  109. set description "Provides feedback to the participant"
  110. 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
  111. 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
  112.  
  113. define reset_feedback reset_feedback
  114. set description "Resets the feedback variables, such as 'avg_rt' and 'acc'"
  115.  
  116. define sketchpad sketchpad
  117. set start_response_interval "no"
  118. set duration 0
  119. set description "Displays stimuli"
  120. 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
  121. 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
  122.  
  123. define sequence trial_sequence
  124. set flush_keyboard "yes"
  125. set description "A single trial"
  126. run get_equation always
  127. run sketchpad always
  128. run keyboard_response always
  129. run new_feedback always
  130. run logger always
Advertisement
Add Comment
Please, Sign In to add comment