---
API: 2
---
set width 1024
set uniform_coordinates "yes"
set title "Form template"
set subject_parity "even"
set subject_nr 0
set start "experiment"
set height 768
set foreground "black"
set font_size 24
set font_italic "no"
set font_family "sans"
set font_bold "no"
set description "A simple template for form-based questionnaires"
set coordinates "relative"
set compensation 0
set canvas_backend "legacy"
set bidi "yes"
set background "white"

define notepad about_this_template
	__note__
	This template already contains the basic structure of a typical questionnaire,
	consisting of open and multiple-choice questions.

	For more information, please visit:

	- <http://osdoc.cogsci.nl/>

	Have fun with OpenSesame!
	__end__
	set description "Some pointers to help you get started!"

define sequence experiment
	set flush_keyboard "yes"
	set description "Runs a number of items in sequence"
	run about_this_template "always"
	run instructions "always"
	run question_loop "always"
	run goodbye "always"

define form_text_display goodbye
	set timeout "infinite"
	set spacing 10
	set rows "1;4;1"
	set only_render "no"
	set ok_text "Quit"
	set margins "50;50;50;50"
	set form_title "Finished"
	set form_text "Thank you for your participation!"
	set description "A simple text display form"
	set cols "1;1;1"
	set _theme "gray"
	widget 0 0 3 1 label text="[form_title]"
	widget 0 1 3 1 label center=no text="[form_text]"
	widget 1 2 1 1 button text="[ok_text]"


define form_text_display instructions
	set timeout "infinite"
	set spacing 10
	set rows "1;4;1"
	set only_render "no"
	set ok_text "Start"
	set margins "50;50;50;50"
	set form_title "<b>Instructions</b>"
	__form_text__
	Click "start" to begin this questionnaire.
	__end__
	set description "A simple text display form"
	set cols "1;1;1"
	set _theme "gray"
	widget 0 0 3 1 label text="[form_title]"
	widget 0 1 3 1 label center=no text="[form_text]"
	widget 1 2 1 1 button text="[ok_text]"


define logger logger
	set use_quotes "yes"
	set ignore_missing "yes"
	set description "Logs experimental data"
	set auto_log "no"
	log response
	log question_option1
	log question_option2
	log question_text
	log question_type
	log question_option3
	log count_question_sequence

define form_multiple_choice mc_question
	set timeout "infinite"
	set spacing 10
	__question__
	[question_text]
	__end__
	__options__
	[question_option1]
	[question_option2]
	[question_option3]
	__end__
	set margins "50;50;50;50"
	set form_var "response"
	set form_title "Multiple-choice question"
	set description "A simple multiple choice item"
	set button_text "Ok"
	set allow_multiple "no"
	set advance_immediately "yes"
	set _theme "gray"

define form_text_input open_question
	set timeout "infinite"
	set spacing 10
	set rows "1;1;6"
	set only_render "no"
	set margins "50;50;50;50"
	set form_var "response"
	set form_title "Open question"
	__form_question__
	[question_text]
	__end__
	set description "A simple text input form"
	set cols 1
	set _theme "gray"
	widget 0 0 1 1 label text="[form_title]"
	widget 0 1 1 1 label center=no text="[form_question]"
	widget 0 2 1 1 text_input focus=yes return_accepts=yes stub="" var="[form_var]"


define loop question_loop
	set skip 0
	set repeat 1
	set order "random"
	set offset "no"
	set item "question_sequence"
	set description "Repeatedly runs another item"
	set cycles 3
	set column_order "question_type;question_text;question_option1;question_option2;question_option3"
	set break_if "never"
	setcycle 0 question_option1 ""
	setcycle 0 question_option2 ""
	setcycle 0 question_option3 ""
	setcycle 0 question_text "Open question"
	setcycle 0 question_type "open"
	setcycle 1 question_option1 "A"
	setcycle 1 question_option2 "B"
	setcycle 1 question_option3 ""
	setcycle 1 question_text "Multiple-choice question (2 options)"
	setcycle 1 question_type "mc"
	setcycle 2 question_option1 "A"
	setcycle 2 question_option2 "B"
	setcycle 2 question_option3 "C"
	setcycle 2 question_text "Multiple-choice question (3 options)"
	setcycle 2 question_type "mc"
	run question_sequence

define sequence question_sequence
	set flush_keyboard "yes"
	set description "Runs a number of items in sequence"
	run mc_question "[question_type] = mc"
	run open_question "[question_type] = open"
	run logger "always"
