SHARE
TWEET

Untitled

a guest Sep 30th, 2012 213 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Generated by OpenSesame 0.27~pre11 (Frisky Freud)
  2. # Sun Sep 30 14:49:15 2012 (posix)
  3. # <http://www.cogsci.nl/opensesame>
  4.  
  5. set mouse_backend "legacy"
  6. set subject_parity "even"
  7. set response2 ""
  8. set height "768"
  9. set sound_buf_size "512"
  10. set font_italic "no"
  11. set custom_cursor "yes"
  12. set synth_backend "legacy"
  13. set title "Example for Sylvia"
  14. set coordinates "relative"
  15. set start "experiment"
  16. set sampler_backend "legacy"
  17. set font_family "mono"
  18. set foreground "white"
  19. set font_bold "no"
  20. set description "In this example it is checked whether the text input is an integer between 0 and 100."
  21. set background "black"
  22. set font_size "18"
  23. set keyboard_backend "legacy"
  24. set canvas_backend "legacy"
  25. set compensation "0"
  26. set subject_nr "0"
  27. set width "1024"
  28.  
  29. define sketchpad warning_msg
  30.         set duration "1000"
  31.         set description "Displays stimuli"
  32.         draw textline 0 0 "Please choose a number between 0 and 100 as text input." center=1 color=white font_family=mono font_size=18 font_italic=no font_bold=no show_if="always"
  33.  
  34. define sequence experiment
  35.         run warning_msg "never"
  36.         run form_base "never"
  37.         run inline_script "always"
  38.  
  39. define inline_script inline_script
  40.         ___run__
  41.         # Make a list containing all allowed text inputs, that is,
  42.         # integers between 0 and 100:
  43.         # For documentation about the built-in Python function range(), see:
  44.         # http://docs.python.org/library/functions.html#range
  45.         allowed_list = range(0,101,1)
  46.        
  47.         # Keep showing the form as long as its incomplete.
  48.         # For documentation about while loops in Python, see:
  49.         # http://wiki.python.org/moin/WhileLoop
  50.         while True:
  51.        
  52.                 # Make a variable storing whether the form is completely filled
  53.                 # in on or not. The starting value is False. If one of the
  54.                 # 'checks' below is not met, its set to True:
  55.                 incomplete = False
  56.        
  57.                 # Execute the prepared form_base:
  58.                 exp.items["form_base"].prepare()
  59.                 exp.items["form_base"].run()
  60.        
  61.                 # Check whether the variable "response" is a number between 0 and 100,
  62.                 # that is, whether it is one of the allowed responses from the list
  63.                 # defined above:
  64.                 if not self.get("response") in allowed_list:
  65.                         incomplete = True
  66.                        
  67.                 # If incomplete is still False, break out of this while loop
  68.                 # and continue with the experiment.
  69.                 if not incomplete:
  70.                         break
  71.        
  72.                 # If the form turns out to be incomplete, show a warning.
  73.                 else:
  74.                         exp.items["warning_msg"].prepare()
  75.                         exp.items["warning_msg"].run()
  76.        
  77.                         # Next, the form_base will be executed again.
  78.                         # This continues as long as the form is incomplete.
  79.         __end__
  80.         set _prepare ""
  81.         set description "Executes Python code"
  82.  
  83. define form_base form_base
  84.         set rows "1;1;1"
  85.         set cols "1;1"
  86.         set allow_empty "no"
  87.         widget 0 0 2 1 label text="Indicate your confidence (0-100%)"
  88.         widget 0 1 2 1 text_input var="response"
  89.         widget 0 2 2 1 button text="Next"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top