; Stimulus file, SMI / Eyelink "reading / Saarbruecken" software style
# both ; and # can introduce comments. Empty lines are ignored.
# Important: "inline" text cannot contain comments, so ; and # are allowed.
# Tab is treated as space. \n forces linebreak. \_ marks invisible area break.
# Any amount of whitespace counts as word boundary. Spacing done by software.

# Classic "reading" did not break areas at every space, but we do. You can
# pool data again later.

# gaze-triggered text display (possibly with implicit drift correction)
# might not be supported yet. Unicode is not supported yet either.

# Button mapping: left / right = YES / NO, down = YES
# Y / YES / NO / N stand for YES / NO as well. Single letters (except # ;)
# stand for those letters being typed on the keyboard (no exact timing!).

define Aussage gaze stream down # define a trial class
define Anleitung nogaze nostream down  # activation at once, not gaze triggered
define Frage gaze stream left right    # this one has TWO answer buttons
# the gaze/stream stuff must be in this order, and in fact only the N is parsed!

# Bonus mode apart from gaze/nogaze: driftcorrect -> shows a drift correction
# mark which you have to look at before trial starts. Not implemented yet.

# No longer supported: stimulus from files. Multiline, with NEXTPAGE keyword.
# Anleitung intro 60000 stimulus1.txt  # class, name, timeout (msecs), stimulus
# new feature: \ at the end of a line is treated as: space, continue with
# first non-space thing on next line!

Anleitung 1-intro 60000 inline Welcome to our demonstration eyetracking\
  experiment.\nPress the YES or NO button after reading each\
  page.\nIf a page contains no question, use the YES button.
# Syntax: type (previously defined) label timeout (in milliseconds) STIMULUS
# STIMULUS can be: inline (followed by some text)
# Future versions will also support other variants.

Aussage 2-story-1 60000 inline 'What was that?' inquired Alice. 'Ree\_ling\
  and Wri\_thing, of course, to begin with,' the Mock Turtle replied; 'and\
  then the different branches of Arith\_metic - Ambi\_tion, Dis\_traction,\
  Ugli\_fication, and Deri\_sion.'

Aussage 3-image-1 60000 image -10 stimulus.pcx This is an image at the bottom.
# Syntax: Keyword is "image" (case sensitive, as is "inline", followed
# by a image/margin (pixel) distance, image file name, and some text.
# The image is analyzed at run-time, detected areas are numbered. You have
# to use 8 bit per pixel PCX images (17-190 used colors recommended).

Aussage 4-story-eel 60000 inline We also learn Draw\_ling. The\
  Draw\_ling\_-master was an old conger\_-eel, that used to come once a\
  week: he taught us Draw\_ling, Stretching, and Fainting in Coils.'

Aussage 5-image-2 60000 image 10 stimulus.pcx This is an image at the top.
# The image and the text (rendered in 16x32 zoomed 8x16 font) have to fit
# both on a VESA 1024x768 screen (compile time option: XGFX, YGFX) with 16
# bits (hardcoded for now: putpixel16, "thousands of colors") color depth.

Frage 6-quest-eel 60000 inline You have reached the end of the story.\
  So now tell me:\nWas the Drawling\_-master a concrete eel?

# *** We do NOT produce the old style logfiles anymore: ***
# Eyelink / reading used this (no longer needed?) Logfile format:
#   --- LogTable ---  Date: dd.mm.yyyy Time: hh:mm:ss
# (then an empty line)
# page	line	word	left	top	right	bottom	text
# (then an empty line again)
# (then lines with those fields, space separated (xxx in pixels), e.g.)
# 1	2	3	xxx	xxx	xxx	xxx	Hello

# Eyelink / reading also logged in SMI Eyelink format (*** we do not! ***):
# (status messages: "GAZE CONTROL TRIAL",
#                   "READING TRIAL n/n PAGE 1/1 IDENT foo")

# Eyelink uses 250 Hz sampling rate. If 2 samples in a row in no region,
# reset average x / y and dwelltime. If 2 samples in a row in region 0
# and > 0.5 sec dwelltime -> do gaze trigger! Can include drift correction
# by comparing region center with average gaze position.
# If 2 samples in a row in same region: when we were in a word before:
# leave word. When we are in a word now: enter word. (reading_trial.c)
# Operator screen always shows region number, soundtimestamp, ...

# If trial could not be loaded (-> skip trial):
#   "TRIAL ERROR"
# "DISPLAY_COORDS xxx xxx xxx xxx" (display size: left top right bottom)
#    (coordinates are converted to "size if font would be 8x16 pixels"!)
# If text mode trial:
#   "TRIALID fooPAGE1" (we do not use PAGE1, no multipage support)
# If load error, only log
#   "TRIAL ERROR"
# for each word:
#   "INFO WORD area left top right bottom Hello" (area: number)
# If gaze triggered:
#   "TARGET ON" (when screen is drawn)
#   "TRIGGER MAIN area avgx avgy rcx rcy dwelltime" (rcx = region center x)
#   or "DISPLAY STILL OFF BUT TIMEOUT" (for gaze activation)
# else:
#   "DISPLAY ON", "SYNCTIME" (zero time mark)
# not in Eyelink but in NEWTRACK, for image trials:
#   "IMAGETRIAL xxx xxx xxx xxx filename.pcx" (numbers are image info:)
#   (min_used_y, max_used_y, reserved_text_lines, area_count)
#   (using coordinates converted to "if font would be 8x16 pixels")
# if of interest:
#   "EYE_USED 0 LEFT", "EYE_USED 1 RIGHT",
# all the time:
#   "ENTER WORD area avgx avgy x y Hello" (or "PCX/5" for 5th image area etc.)
#   (Eyelink uses "(graphical)" for all graphical items)
#   (image areas use area numbers at the upper end of the range)
#   "LEAVE WORD area avgx avgy x y dwelltime soundtimestamp"
#   (soundtimestamp is always 0 in NEWTRACK, there is no sound support yet)
# logging why trial ended:
#   "TIMEOUT"
#   "ANSWERBUTTON a KEY b" (keyboard mode, a = 128 + button, b = ascii)
#   "ENDBUTTON x" (buttonbox mode)
# at the end:
#   "TRIAL_RESULT x" (> 128 if keyboard, 0 if no result)
# even for non-text trials:
#   "EXPERIMENT ABORTED" (^C)
#   "TRIAL ABORTED" (skipped by ESC key or loading error)
#   "TRIAL OK" (normal case)
#   "TRIAL ERROR" (any error during trial)
#   "TRIAL REPEATED" (e.g. due to calibration during trial)
