; Defaults: 9600,8,N,1
;
; FieldLynx Scoreboard Script
;
; Copyright (c) 1995-2018 Lynx System Developers, Inc.
;
; Written by Kirk Sigel, modified by Hugues Lacroix (4/8/2004) for FieldLynx
; Modified by Hugues Lacroix (25/07/2018)
;
; Notes:
;  + Empty lines and lines that start with a semicolon are ignored.
;
;  + Lines that start with two semicolons indicate a section header.
;    They must be one of the following:
;      ;;Initialization
;      ;;TimeRunning
;      ;;StartListHeader
;      ;;StartListTrailer
;      ;;StartList
;      ;;ResultsHeader
;      ;;ResultsTrailer
;      ;;Result
;      ;;MessageHeader
;      ;;MessageTrailer
;      ;;Message
;    The StartList* and Results* sections may have an optional
;    page number contained in square brackets immediately following the
;    section name. If more than one page is defined for a section then each
;    page will be shown, in order, when paging is enabled. Note that page
;    numbers do not need to be contiguous; they are simply used to establish
;    the order of pages. If a page number is omitted then a 0 (zero) is
;    assumed.
;    Sections may be omitted, appear in any order, and occur more than once.
;    Some sections can be omitted and they will "fall back" to other
;    sections. The StartList* sections fall back to the Results* sections.
;
;  + Format lines must begin with a value indicating which variable
;    they want to access. The special code \00 indicates that no variable
;    is being requested. If a variable is requested it will be inserted where
;    a '%s' printf style format specifier appears. There can only be one '%s'
;    specifier in lines requesting a variable and no other printf format
;    specifiers may appear. Remember, lines requesting a variable are used as
;    a printf format string and therefore must behave as such. Lines not 
;    requesting variables (code \00) can do whatever they want as these 
;    lines are not fed to a printf statement.
;
;  + Arbitrary 8 bit values are entered as \hh where h is a lowercase hex
;    digit. Note that h must be lowercase.
;
;  + Format lines can have the following commands embedded in them.
;    Note that only 10 registers (indexed 0-9) are currently implemented.
;     \U\hh   Set the 'U' value to hh. It is reset after the next command.
;     \Ui\hh  Set the 'U' value to register[hh].
;     \X\hh   Set the 'X' value to hh. It is reset after the next command.
;     \Xi\hh  Set the 'X' value to register[hh].
;     \=\hh   register[hh] = {register[U]|X|1}                 (assign)
;     \*\hh   register[hh] = register[hh] * {register[U]|X|1}  (multiply)
;     \/\hh   register[hh] = register[hh] / {register[U]|X|1}  (divide)
;     \#\hh   register[hh] = register[hh] # {register[U]|X|1}  (modulus)
;     \+\hh   register[hh] = register[hh] + {register[U]|X|1}  (add)
;     \-\hh   register[hh] = register[hh] - {register[U]|X|1}  (subtract)
;     \<\hh   register[hh] = register[hh] << {register[U]|X|1} (shift left)
;     \>\hh   register[hh] = register[hh] >> {register[U]|X|1} (shift right)
;     \&\hh   register[hh] = register[hh] & {register[U]|X|1}  (bit and)
;     \|\hh   register[hh] = register[hh] | {register[U]|X|1}  (bit or)
;     \^\hh   register[hh] = register[hh] ^ {register[U]|X|1}  (bit xor)
;     \~\hh   register[hh] = ~register[hh]                     (bit invert)
;     \F\hh   register[hh] = The result of running Function {U|0} on the 
;             next {X|<eol>} characters.
;              \U\00  IDS checksum.
;              \U\01  XOR checksum. register[hh] is used as the seed value.
;              \U\02  ADD checksum. register[hh] is used as the seed value.
;     \O\hh   Output register[hh] as an {X|1} byte value using method {U|0}.
;              \U\00  Binary little-endian (Intel byte order).
;              \U\01  Binary big-endian (Motorola byte order).
;              \U\02  ASCII text right justified space padded.
;              \U\03  ASCII text right justified zero padded.
;              \U\04  ASCII text left justified space padded.
;              \U\05  ASCII text left justified zero padded.
;     \S\hh   Scan the next {X|1} bytes into register[hh] using method {U|0}.
;              \U\00  ASCII text base 10.
;              \U\01  Binary little-endian (Intel byte order).
;              \U\02  Binary big-endian (Motorola byte order).
;     \P\hh   Run Procedure hh on the next {X|<eol>} characters.
;              \P\00  Reverse characters.
;              \P\01  Convert characters to Colorado Time format. Register[1]
;                       is the current character position on entry and the
;                       next character position on exit.
;              \P\02  Convert characters to Daktronics AllSport format.
;     \B\hh   Delete {register[U]|hh} (to beginning of line if zero) characters 
;             before the cursor or until the string contains X characters.
;     \D\hh   Delete {register[U]|hh} (to end of line if zero) characters 
;             at the cursor or until the string contains X characters.
;     \I\hh   Insert {register[U]|hh} spaces at the cursor or until the string
;             contains X characters.
;     \Ic\hh  Insert {register[U]|hh} {X's|spaces} at the cursor.
;     \L\hh   Move the cursor {register[U]|hh} positions to the left (to the 
;             beginning of the line if zero).
;     \R\hh   Move the cursor {register[U]|hh} positions to the right (to the
;             end of the line if zero).
;     \He\hh  Halt if register[hh] == {register[U]|X|0}.
;     \Hn\hh  Halt if register[hh] != {register[U]|X|0}.
;     \Hl\hh  Halt if register[hh] <  {register[U]|X|0}.
;     \Hm\hh  Halt if register[hh] <= {register[U]|X|0}.
;     \Hg\hh  Halt if register[hh] >  {register[U]|X|0}.
;     \Hh\hh  Halt if register[hh] >= {register[U]|X|0}.
;    Note that numbers 0 thru 9 can be entered directly for single character
;    embedded commands. For example, '\U\04' is the same as '\U4' and 
;    '\=\01' is the same as '\=1'.
;
;  + Be very careful about whitespace in each format line. Characters other
;    than '%s' specifiers and embedded commands and values will be sent
;    exactly as they appear on the line. This means, for instance, that using
;    tabs to make a line 'look right' in you favorite editor will cause
;    tabs to be sent to the scoreboard instead of the equivalent number of
;    spaces (probably not what you wanted).
;
; The format lines follow.

;;Initialization
\10\00Command=LayoutDraw;Clear=2;\0a

;;TimeRunning
; This is sent approximately 10 times per second.
; Line codes:
;  \00  No variable
;  \01  Formatted time
;
; The following line (if not commented) will tell ResulTV to change layouts.
;\11\00Command=LayoutDraw;Window=2;Clear=1;\0a
\11\01\01T\02%15.15s\03\04

;;StartListHeader
; This is sent once each time the scoreboard is updated with results. It
; is sent before any result lines are sent.
; Line codes:
;  \00  No variable
;  \01  OFFICIAL/UNOFFICIAL string
;  \02  Event name
;  \03  For future use
;  \04  Event number
;  \05  Round number
;  \06  Heat number
;  \07  Metric/English string
;  \08  Horizontal/Vertical string
;  \09  Vertical bar heights
;
; The following line (if not commented) will tell ResulTV to change layouts.
;\13\00Command=LayoutDraw;Name=FieldLynx_StartList;Window=1;Clear=1;\0a
\13\00\01R\02
\13\01%s\05
\13\02%s\05
\13\04%s\05
\13\05%s\05
\13\06%s\05
\13\07%s\05
\13\08%s\05
\13\09%s\05

;;StartListTrailer
; This is sent once each time the scoreboard is updated with results. It
; is sent after all result lines are sent.
; Line codes are identical to the ResultsHeader line codes.
\13\00\03\04

;;StartList
; This is sent once for each result line displayed on the scoreboard.
; Line codes:
;  \00  No variable
;  \01  Place
;  \02  Attempt
;  \03  Id
;  \04  Name
;  \05  Affiliation
;  \06  Mark
;  \07  Wind
;  \08  Mark (Converted) - Measurement system is opposite whatever is displayed in Fieldlynx
;  \09  Mark only - no vertical components
;  \0a  VComponents - Only vertical mark components (XO, etc)
;  \0b  Field Series Marks (hundredths precision)
;  \0c  Field Series Wind (horizontal jumps only)
;  \10  On Deck Athlete Place
;  \11  On Deck Athlete Attempt
;  \12  On Deck Athlete Id
;  \13  On Deck Athlete Name
;  \14  On Deck Athlete Affiliation
;  \15  On Deck First Name
;  \16  On Deck Last Name
;  \17  First Name
;  \18  Last Name
; Register[0] is initialized with the index of the current result line and
; will range from 0 through PageSize - 1.
\14\01%s\05
\14\02%s\05
\14\03%s\05
\14\04%s\05
\14\17%s\05
\14\18%s\05
\14\05%s\05
\14\06%s\05
\14\07%s\05
\14\08%s\05
\14\09%s\05
\14\0a%s\05
\14\0b%s\05
\14\0c%s\05
\14\10%s\05
\14\11%s\05
\14\12%s\05
\14\13%s\05
\14\15%s\05
\14\16%s\05
\14\14%s\05

;;ResultsHeader
; This is sent once each time the scoreboard is updated with results. It
; is sent before any result lines are sent.
; Line codes:
;  \00  No variable
;  \01  OFFICIAL/UNOFFICIAL string
;  \02  Event name
;  \03  For future use
;  \04  Event number
;  \05  Round number
;  \06  Heat number
;  \07  Metric/English string
;  \08  Horizontal/Vertical string
;  \09  Vertical bar heights
;\13\00Command=LayoutDraw;Name=FieldLynx_Results;Window=1;Clear=1;\0a
\13\00\01R\02
\13\01%s\05
\13\02%s\05
\13\04%s\05
\13\05%s\05
\13\06%s\05
\13\07%s\05
\13\08%s\05
\13\09%s\05

;;ResultsTrailer
; This is sent once each time the scoreboard is updated with results. It
; is sent after all result lines are sent.
; Line codes are identical to the ResultsHeader line codes.
\13\00\03\04

;;Result
; This is sent once for each result line displayed on the scoreboard.
; Line codes:
;  \00  No variable
;  \01  Place
;  \02  Attempt
;  \03  Id
;  \04  Name
;  \05  Affiliation
;  \06  Mark
;  \07  Wind
;  \08  Mark (Converted) - Measurement system is opposite whatever is displayed in Fieldlynx
;  \09  Mark only - no vertical components
;  \0a  VComponents - Only vertical mark components (XO, etc)
;  \0b  Field Series Marks (hundredths precision)
;  \0c  Field Series Wind (horizontal jumps only)
;  \10  On Deck Athlete Place
;  \11  On Deck Athlete Attempt
;  \12  On Deck Athlete Id
;  \13  On Deck Athlete Name
;  \14  On Deck Athlete Affiliation
;  \15  On Desk First Name
;  \16  On Desk Last Name
;  \17  First Name
;  \18  Last Name
; Register[0] is initialized with the index of the current result line and
; will range from 0 through PageSize - 1.
\14\01%s\05
\14\02%s\05
\14\03%s\05
\14\04%s\05
\14\17%s\05
\14\18%s\05
\14\05%s\05
\14\06%s\05
\14\07%s\05
\14\08%s\05
\14\09%s\05
\14\0a%s\05
\14\0b%s\05
\14\0c%s\05
\14\10%s\05
\14\11%s\05
\14\12%s\05
\14\13%s\05
\14\15%s\05
\14\16%s\05
\14\14%s\05

;;MessageHeader
; This is sent once each time the scoreboard is updated with the message. It
; is sent before any message lines are sent.
; Line codes:
;  \00  No variable
;
; The following line (if not commented) will tell ResulTV to change layouts.
;\15\00Command=LayoutDraw;Name=Message;Clear=1;\0a
\15\00\01M\02

;;MessageTrailer
; This is sent once each time the scoreboard is updated with the message. It
; is sent after all message lines are sent.
; Line codes are identical to the MessageHeader line codes.
\15\00\03\04

;;Message
; This is sent once for each message line displayed on the scoreboard.
; Line codes:
;  \00  No variable
;  \01  Text
; Register[0] is initialized with the index of the current message line and
; will range from 0 through <number of lines> - 1.
\16\01%s\05