Gwen's Complete TFRC

From Gwen Morse's Wiki
Jump to: navigation, search

Save this as .tfrc in your home directory. Read *all* comments or you will blow something up.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;                           TFRC file                             ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;

/set LASTMOD=TFRC last modified: 04/08/2014

;;; Updated so all macros work under 5.0.
;;; Definitions that must come 'first'

/def -Fag -hREDEF gag_redef
/def -Fag -h'conflict' gag_conflict
/def -hload -Fag gag_load

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; setting TF system defaults I like
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

/more off
/visual on
/redef on
/set maildelay=0
/set oldslash=off
/set cleardone=on
/set quiet=on
/set wrapspace=2
/set insert=on
/set histsize=100000
/set ptime=0
/set max_trig=20000
/set pedantic=off
/set keepalive=on
/set warn_5keys=off

/eval /set nl=$[char(10)]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Multi-Machine Status check
;;; Written by Gwen Morse
;;;
;;; Enter the directories where you keep your tf files.
;;; Home directory if-else help from "Sizer" <sizer at san dot rr dot com>
;;; The if-else check is to see 'which' machine I am running TF on.
;;; I do this because I use TF on multiple machines and OS-es.
;;; That way, I can copy one tfrc file between multiple machines
;;; rather than try to maintain separate files with specific code for each.
;;;
;;; I make use of the "STATUS" definition in later macros to determine
;;; "which" machine I'm on.
;;;
;;; COMPNAME is the name of the computer in Windows (usually found in the My
;;; Computer/Properties tab).
;;; HOME is the home directory (on linux or windows type /cd in tinyfugue 
;;; to get the exact home path)
;;; the HOME path of /arpa/gm/g/goldmoon is my main free sdf.org shell account.
;;; the HOME path of /arpa/tz/t/tfshell is my backup free sdf.org shell account.
;;; the HOME path of /home/user is on my n900 tablet phone
;;; the /else option is the settings for running Tinyfugue off my USB stick.
;;; the PERSON = Kahlyla check is to allow me to share my .tfrc with a friend
;;;   who also wants to use the same macros.
;;;
;;; I used to only access the n900 and USB stick in locations where syntax 
;;; highlighting would call attention to my activities. For those two 
;;; connections, I turned off colors to be less obtrusive.
;;;
;;; On the n900, the enter button on the physical keyboard sends the code for 
;;; a backspace. To get it to work properly, you have to force it to send 
;;; a NEWLINE. The n900 has a 3.75" 800x480 screen which doesn't allow for as 
;;; many 'lines' of text as a laptop or desktop. I find an isize of 2 
;;; works best for me.
;;;
;;; When running from USB stick the system can't find my ruby libraries. I set
;;; it by hand using the built-in command /setenv.
;;;
;;; This should show how, with a little bit of effort, you can use the 
;;; same config file on multiple computers

;; This is set up here so I can change it on specific machines as needed.
/set isize=5

;; this is so my friend Kahlyla can share the same .tfrc file with me.
;; Uncomment the next line if you're Kahlyla

/set PERSON=Kahlyla

/if (COMPNAME=~"MsPiggy") \
    /cd /cygdrive/d/Dropbox/Tinyfugue/%;\
    /set LIBDIR=/cygdrive/c/Tinyfugue/tf-lib%;\
    /def LOGDIR=/cygdrive/d/Dropbox/Tinyfugue/logs%;\
    /def LOCALLIBDIR=/cygdrive/d/Dropbox/TinyFugue/locallib %;\
    /def LOGFILE=/cygdrive/d/Dropbox/Tinyfugue/logs/tiny.log%;\
    /set DECDIR=/cygdrive/d/Dropbox/Tinyfugue/logs/decompile%;\
    /def KILLDIR=/cygdrive/d/Dropbox/Tinyfugue/logs/kills/%;\
    /set SHELL=rxvt%;\
    /set status=w3d%;\
    /set BASEOS=windows%;\
/elseif (HOME=~"/arpa/tz/t/tfshell") \
    /cd /arpa/tz/t/tfshell/%;\
    /set LIBDIR=/arpa/tz/t/tfshell/share/tf-lib%;\
    /def LOGDIR=/arpa/tz/t/tfshell/logs %;\
    /set DECDIR=/arpa/tz/t/tfshell/logs/decompile %;\
    /set status=arpa%;\
    /set PERSON=Kahlyla%;\
    /set BASEOS=linux%;\
    /set isize=3%;\
/elseif (HOME=~"/arpa/gm/g/goldmoon") \
    /cd /arpa/gm/g/goldmoon/%;\
    /set LIBDIR=/arpa/gm/g/goldmoon/share/tf-lib%;\
    /def LOGDIR=/arpa/gm/g/goldmoon/logs %;\
    /set DECDIR=/arpa/gm/g/goldmoon/logs/decompile %;\
    /def KILLDIR=/arpa/gm/g/goldmoon/logs/kills/%;\
    /set status=arpa%;\
    /set BASEOS=linux%;\
/elseif (HOME=~"/home/user") \
    /cd /home/user/MyDocs/DropN900/Tinyfugue/ %;\
    /def LIBDIR=/usr/share/tf-lib%;\
    /def LOGDIR=/home/user/MyDocs/DropN900/Tinyfugue/logs %;\
    /def DECDIR=/home/user/MyDocs/DropN900/Tinyfugue/logs/decompile %;\
    /def KILLDIR=/home/user/MyDocs/DropN900/Tinyfugue/logs/kills/%;\
    /set status=n900%;\
    /def key_nkpEnt = /dokey NEWLINE%;\
    /set isize=2%;\
    /set BASEOS=linux%;\
/elseif (OSTYPE=~"Benjamin") \
    /def LOGDIR=/cygdrive/c/Users/goldmoon/Documents/logs %;\
    /def LIBDIR=/cygdrive/c/Program Files/Tinyfugue/tf-lib%;\
    /def LOCALLIBDIR=/cygdrive/c/Program Files/Tinyfugue/locallib %;\
    /def LOGFILE=/cygdrive/c/Program Files/Tinyfugue/logs/tiny.log %;\
    /set DECDIR=/cygdrive/c/Program Files/Tinyfugue/decompile %;\
    /def KILLDIR=/cygdrive/c/Program Files/Tinyfugue/logs/kills/%;\
    /set status=ben %;\
    /set BASEOS=windows%;\
/elseif (HOSTNAME=~"cowspot") \
    /cd /home/goldmoon/Dropbox/Tinyfugue/%;\
    /def LIBDIR=/usr/local/share/tf-lib%;\
    /def LOGDIR=/home/goldmoon/Dropbox/Tinyfugue/logs%;\
    /def LOCALLIBDIR=/home/goldmoon/Dropbox/Tinyfugue/locallib%;\
    /set DECDIR=/home/goldmoon/Dropbox/Tinyfugue/logs/decompile%;\
    /set status=lincowspot%;\
    /set BASEOS=linux%;\
/elseif (HOME=~"/home/goldmoon") \
    /cd /home/goldmoon/Dropbox/Tinyfugue/%;\
    /def LIBDIR=/usr/local/share/tf-lib%;\
    /def LOGDIR=/home/goldmoon/Dropbox/Tinyfugue/logs%;\
    /def LOCALLIBDIR=/home/goldmoon/Dropbox/Tinyfugue/locallib%;\
    /set DECDIR=/home/goldmoon/Dropbox/Tinyfugue/logs/decompile%;\
    /set status=linux%;\
    /set BASEOS=linux%;\
;@@ E:\Program Files (x86)\Druware\TinyFugue for Windows\tf.exe @@%;\
/elseif (PERSON=~"Kahlyla") \
    /cd /cygdrive/e/Program Files (x86)/Druware/Tinufugue for Windows/%;\
    /def LOGDIR=/cygdrive/e/Program Files (x86)/Druware/Tinufugue for Windows/logs%;\
    /set DECDIR=/cygdrive/e/Program Files (x86)/Druware/Tinufugue for Windows/logs/decompile%;\
    /set status=kahlyla%;\
    /set BASEOS=windows%;\
    /set isize=3%;\
/else \
    /cd /cygdrive/f/Tf%;\
    /def LOGDIR=/cygdrive/f/Tf/logs%;\
    /def LIBDIR=/cygdrive/f/Tf/locallib%;\
    /def LOCALLIBDIR=/cygdrive/f/Tf/locallib%;\
    /def LOGFILE=/cygdrive/f/Tf/logs/tiny.log%;\
    /set DECDIR=/cygdrive/f/Tf/logs/decompile%;\
    /def KILLDIR=/cygdrive/f/Tf/logs/kills/%;\
    /setenv RUBYLIB=/cygdrive/f/Tf/ruby/1.8/%;\
    /setenv SHELL=/cygdrive/f/Tf/bash.exe%;\
    /color_off%;\
    /set status=usb%;\
    /set BASEOS=windows%;\
/endif

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; loading lib programs I like
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

/require stack-q.tf
/require tools.tf
/require world-q.tf
/require spc-page.tf
/require kbstack.tf
/require complete.tf
/require textutil.tf
/require spell.tf
/require lisp.tf

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Special Logging Macros
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Put together from definitions by Andrew Mortimer and members of the
; Tinyfugue mailing list

; When I connect to a world, it starts logging (-w) to the file
; 'date_worldname.log', where date is in the format Year-Month-Day. For
; example: 1997-12-02_<world>.log. It also writes the time the log starts 
; in the file. This format keeps logs in date order in the directory.

;;; This version doesn't include the multi-machine 'status' check:
/def -Fp100 -h'connect' connect_log = \
  /log -w ${LOGDIR}/$[ftime("%Y-%m-%d", time())]_${world_name}.log %;\
  /eval /echo -ag -w${world_name} \
%========================================================================== %;\
  /eval /echo -ag -w${world_name} \
%=            Log for world *** ${world_name} ***, started $(/time %%c) %;\
  /eval /echo -ag -w${world_name} \
%==========================================================================

;;; Logs will overwrite each other if they have the exact same name and 
;;; are synced from different machines. This macro will slightly change 
;;; the names of logs to make them unique on each machine.
;;; Below are multiple 'status' choices plus an 'else' for 'everything else'.
;;; This version includes the multi-machine 'status' check:

/def -Fp100 -h'connect' connect_log = \
/if ({status}=~"piggy") \
  /log -w ${LOGDIR}/$[ftime("%Y",time())]/$[ftime("%Y-%m-%d", time())]_p_${world_name}.log %;\
  /eval /echo -ag -w${world_name} \
%============================================================================== %;\
  /eval /echo -ag -w${world_name} \
%=            Log for world *** ${world_name} ***, started $(/time %%c) %;\
  /eval /echo -ag -w${world_name} \
%============================================================================== %;\
/elseif ({HOSTNAME}=~"cowspot") \
  /log -w ${LOGDIR}/$[ftime("%Y",time())]/$[ftime("%Y-%m-%d", time())]_c_${world_name}.log %;\
  /eval /echo -ag -w${world_name} \
%============================================================================== %;\
  /eval /echo -ag -w${world_name} \
%=            Log for world *** ${world_name} ***, started $(/time %%c) %;\
  /eval /echo -ag -w${world_name} \
%============================================================================== %;\
/elseif ({status}=~"linux") \
  /log -w ${LOGDIR}/$[ftime("%Y",time())]/$[ftime("%Y-%m-%d", time())]_z_${world_name}.log %;\
  /eval /echo -ag -w${world_name} \
%============================================================================== %;\
  /eval /echo -ag -w${world_name} \
%=            Log for world *** ${world_name} ***, started $(/time %%c) %;\
  /eval /echo -ag -w${world_name} \
%============================================================================== %;\
/elseif ({status}=~"winbox") \
  /log -w ${LOGDIR}/$[ftime("%Y",time())]/$[ftime("%Y-%m-%d", time())]_${world_name}.log %;\
  /eval /echo -ag -w${world_name} \
%============================================================================== %;\
  /eval /echo -ag -w${world_name} \
%=            Log for world *** ${world_name} ***, started $(/time %%c) %;\
  /eval /echo -ag -w${world_name} \
%============================================================================== %;\
/elseif ({status}=~"usb") \
  /log -w ${LOGDIR}/$[ftime("%Y",time())]/$[ftime("%Y-%m-%d", time())]_u_${world_name}.log %;\
  /eval /echo -ag -w${world_name} \
%============================================================================== %;\
  /eval /echo -ag -w${world_name} \
%=            Log for world *** ${world_name} ***, started $(/time %%c) %;\
  /eval /echo -ag -w${world_name}s \
%============================================================================== %;\
/elseif ({status}=~"ben") \
  /log -w ${LOGDIR}/$[ftime("%Y",time())]/$[ftime("%Y-%m-%d", time())]_b_${world_name}.log %;\
  /eval /echo -ag -w${world_name} \
%============================================================================== %;\
  /eval /echo -ag -w${world_name} \
%=            Log for world *** ${world_name} ***, started $(/time %%c) %;\
  /eval /echo -ag -w${world_name} \
%============================================================================== %;\
/elseif ({status}=~"arpa") \
  /log -w ${LOGDIR}/$[ftime("%Y",time())]/$[ftime("%Y-%m-%d", time())]_a_${world_name}.log %;\
  /eval /echo -ag -w${world_name} \
%============================================================================== %;\
  /eval /echo -ag -w${world_name} \
%=            Log for world *** ${world_name} ***, started $(/time %%c) %;\
  /eval /echo -ag -w${world_name} \
%============================================================================== %;\
/elseif ({status}=~"n900") \
  /log -w ${LOGDIR}/$[ftime("%Y",time())]/$[ftime("%Y-%m-%d", time())]_n_${world_name}.log %;\
  /eval /echo -ag -w${world_name} \
%============================================================================== %;\
  /eval /echo -ag -w${world_name} \
%=            Log for world *** ${world_name} ***, started $(/time %%c) %;\
  /eval /echo -ag -w${world_name} \
%============================================================================== %;\
/elseif ({status}=~"l3d") \
  /log -w ${LOGDIR}/$[ftime("%Y",time())]/$[ftime("%Y-%m-%d", time())]_d_${world_name}.log %;\
  /eval /echo -ag -w${world_name} \
%============================================================================== %;\
  /eval /echo -ag -w${world_name} \
%=            Log for world *** ${world_name} ***, started $(/time %%c) %;\
  /eval /echo -ag -w${world_name} \
%============================================================================== %;\
/else \
  /log -w ${LOGDIR}/$[ftime("%Y",time())]/$[ftime("%Y-%m-%d", time())]_v_${world_name}.log %;\
  /eval /echo -ag -w${world_name} \
%============================================================================== %;\
  /eval /echo -ag -w${world_name} \
%=            Log for world *** ${world_name} ***, started $(/time %%c) %;\
  /eval /echo -ag -w${world_name} \
%============================================================================== %;\
/endif

; Lets /dc function like 'QUIT' to trigger the disconnect (needed to close the log)
; written by 'Brack <slayer at kaiwan dot com>'

/def -F -1ag -h'conflict' gagconflict
/def -Fiq dc = /if /@dc %*%; /then /trigger -hdisconnect %*%; /endif

; This lets you return to the special logging after shutting it off with /log off.
; Note, if the original special log was during the previous calendar 'day', then,
; /relog will start a new log!
;
; Syntax: '/relog'

/def -i -q relog = /connect_log

;This is the disconnect function, noting the time the log ended and closing the file.

/def -Fp100 -h'disconnect' disconnect_log = \
  /eval /echo -ag -w${world_name} \
%============================================================================== %;\
  /eval /echo -ag -w${world_name} \
%=            Log for world *** ${world_name} ***, ended $(/time %%c) %;\
  /eval /echo -ag -w${world_name} \
%============================================================================== %;\
  /log -w${world_name} off

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;  World.tf file info
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;
/addworld -T"tiny" NOWHERE nowhere guest guest localhost 9999
;;

;;;;;;;;;;;;;;;;;;;;;;;
;; Sneaky world system
;; Pretend you have multiple computers you play from, and you have a character
;; (or characters) that you only want to be able to play from a specific account.
;; (Stealth RP!)
;; You can use a modified form of the below macro (coupled with the {status} variable
;; shown earlier) to only add world(s) when you're on the 'correct' account.

/def -F tsc=\
  /if (status =~ "arpa") \
    /addworld -T"tiny.mush" tsc palemoon.com 9990%;\
  /endif
/tsc

;;;;;;;;;;;;;;;;;;;;


;; Define the worlds you play here.
;; CrystalMUSH
/addworld -T"tiny.mush.cm.sing" cm crystalmush.kydance.net 6886
;;@@ ss world is here to get rid of error messages that the world is not defined. @@%;\
/addworld -T"tiny.mush.cm.sing" ss crystalmush.kydance.net 6886
;; Serenity MUSH
/addworld -T"tiny.penn.ff" ff serenitymush.com 2020
;; Realm of Despair
/adddiku -T"diku.rod" rod realmsofdespair.com 4000

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; hilite.tf file 
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; Make pages, multipages, and whispers stand outlines
;;; Gwen: I like to make my pages/multipages/whispers that I send out hilighted
;;; also, not just the ones people send to me. To discriminate between them,
;;; I use the non-bold form of the color I use for the incoming communication
;;; of the same type. This mostly helps me visually separate any remote
;;; conversation from action in my location.
;;; The bold/non bold highlighting was originally suggested to me by
;;; Jacob Rosenberg (Jacob@ManyMUs including CrystalMUSH).

;bold cyan color pages
/def -i -p2 -aBCcyan -t'* pages[,:] *' hl_page1
/def -i -p2 -aBCcyan -t'You sense that * is looking for you in *' hl_page2
/def -i -p2 -aBCcyan -t'From afar, *' hl_page3
/def -i -p2 -aCcyan -t'Long distance to *' hl_page4
/def -i -p2 -aCcyan -t'You paged *' hl_page5

;bold green multi-pages
/def -i -p3 -aBCgreen -t'* pages (*) *' hl_mpage1
/def -i -p5 -aBCgreen -mregexp -t"(multipages|multi-pages)" hl_mpage2
/def -i -p5 -aCgreen -mregexp -t"(multipage|multi-page)" hl_mpage3
/def -i -p6 -aBCgreen -t'(To: *)' hl_mpage4
/def -i -p4 -aCgreen -t'(To: *) Long Distance, *' hl_mpage5
/def -i -p5 -aCgreen -t'(To: *) * pages: *' hl_mpage6
/def -i -p5 -aCgreen -t'You contacted (*) with *' hl_mpage7
/def -i -p5 -aBCgreen -t'( To: *) *' hl_mpage8

;bold blue color whispers
/def -i -p2 -aBCblue -t'* whispers[,:] *' hl_whisper1
/def -i -p3 -aBCblue -t'You sense *' hl_whisper2

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Full-line highlights (odds and ends)
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;rgb530 (orange)

;When someone triggers a character @adesc (bold magenta)
;; /def -p5 -aCrgb530 -t'* looked at *' hl_adesc
;; /def -p5 -aCrgb530 -t'* is looking at *' hl_adesc2

/def -p5 -aCmagenta -t'* looked at *' hl_adesc
/def -p5 -aCmagenta -t'* is looking at *' hl_adesc2

;hilite Activity in bg worlds
/def -p2 -F -hACTIVITY -aBCwhite hl_activity

;<OOC> Code
/def -p14 -aBCyellow -t'<OOC> *' hl_ooc
;/def -p2 -aCyellow -t'Room page: *' hl_ooc_2

;+watch code
/def -i -p5 -aBCgreen -t'<Watch> *' hl_watch

;MUX 'game' messages
/def -i -p5 -F -aBCgreen -t'GAME:*' hl_watch2

;+finger pemits
/def -i -p5 -F -aBCgreen -t'* +fingered you.' hl_finger

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Partial highlights of importance
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;Channels
;Any '[ ]' or '>'
;rgb520 (reddish orange/brownish looking).
/def -i -p9 -P0xCred -F -t'\\[*\\]' tiny_sh1
/def -i -p8 -P0xCred -mregexp -F -t"^\\[.*\\]" tiny_sh2
/def -i -p8 -P0xCred -mregexp -F -t"^[A-Za-z0-9 _-]*>" tiny_sh3
/def -i -p7 -P0xCred -mregexp -F -t"^<.*> " tiny_sh4

; Warnings
/def -i -p3 -F -P1xBCred -t'(ALERT>)' par_alert
/def -i -p1 -P0BCred -F -t'^[^ ]+ >>' night_chan

; Table-talk conversation partially in white
/def -i -p7 -P0xBCwhite -t'^(At|In|Outside) (your|the) [^,:]*[,:]' par_place1

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Gag lines
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;Gags

/def -i -p3 -ag -mregexp -t"^You own a (floating|disconnected) room" floating_gag

/def -i -p3 -ag -mglob -t'Warning \'thing-desc\' for*' floating_gag2

/def -i -p3 -ag -t"*Saving your work*" savework_gag

/def -i -p3 -ag -t"START LOG NOW*" startlog_gag

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;  Keybindings & Color Bindings
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; Update home to include my keyboard (rxvt)

/~keyseq home ^[[1~  ^[OH    ^[[H    ^[[7~
/~keyseq end ^[[4~   ^[OF    ^[[F    ^[[8~

;; CTRL-u will clear your entire input buffer
;; Designed for Kahlyla@CM to work like similar zMUD command

/def -b'^U' = /kb_backward_kill_line%; /dokey_deol

;;; CTRL-w will work like ALT-w with World_Queue
/def -b'^w' = /to_active_or_prev_world

;;; Function Keys
;;; Directions for binding to function keys
;;; If you want to bind a command to a particular function key, 
;;; put it directly after the equal sign. The command has to be designed
;;; to work if sent to the buffer.
;;; Example: if you want to send the word "stop" out to the world if you 
;;; hit f1, then /def -i key_f1 = /send -w stop
;;; if instead you always want to connect to the world "cm" when you hit 
;;; f1, then /def -i key_f1 = /world cm
;;;
;;; You can also bind function keys on a per-world basis (letting same 
;;; function key do  different things depending on which world you're 
;;; using). In that key, design one set  for each and put a -w'<worldname>' 
;;; after the -i for each /def


/def -i key_f1 =
/def -i key_f2 =
/def -i key_f3 =
/def -i key_f4 =
/def -i key_f5 =
/def -i key_f6 =
/def -i key_f7 =
/def -i key_f8 =
/def -i key_f9 =
/def -i key_f10 =
/def -i key_f11 =
/def -i key_f12 =


/if (PERSON =~ "Kahlyla")\
  /def -i key_f1 = %;\
  /def -i key_f2 = /send -w enter kahlyla's sled %;\
  /def -i key_f3 = %;\
  /def -i key_f4 = %;\
  /def -i key_f5 = %;\
  /def -i key_f6 = %;\
  /def -i key_f7 = /send -w view scan map %;\
  /def -i key_f8 = /send -w tl 8 %;\
  /def -i key_f9 = /send -w tr 8 %;\
  /def -i key_f10 = %;\
  /def -i key_f11 = %;\
  /def -i key_f12 = /send -w stop %;\
/else \
  /def -i key_f1 =/recall 10000 *Kahlyla* %;\
  /def -i key_f2 =/recall 10000 Code>* %;\
  /def -i key_f3 =/recall 10000 Public>* %;\
  /def -i key_f4 =/recall 10000 Singer>* %;\
  /def -i key_f5 =/recall 10000 *Regan* %;\
  /def -i key_f6 = %;\
  /def -i key_f7 = %;\
  /def -i key_f8 = %;\
  /def -i key_f9 = %;\
  /def -i key_f10 =/heal %;\
  /def -i key_f11 = %;\
  /def -i key_f12 =/mana%;\
/endif

;;; Peter's directions
/def key_nkp5 = stop
/def key_nkp1 = southwest
/def key_nkp2 = south
/def key_nkp3 = southeast
/def key_nkp4 = west
/def key_nkp6 = east
/def key_nkp7 = northwest
/def key_nkp8 = north
/def key_nkp9 = northeast

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;        RGB color codes
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; set 256 color variable
;;; This is an "or" check for if/else, so either will match.

/if (TERM =~ "xterm-256color" | BASEOS =~ "linux")\
  /set COLORS=256%;\
/else \
  /set COLORS=16%;\
/endif%;\


;; 256 Color bindings (example using a variable)
;; /set Cpink=rgb525
;; /eval /def -aC%{Cpink} -tpattern name = body (to use)

;+finger pemits
;; /eval /def -p10000 -aC%{Corange} -t'Room Page: *' hl_ooc_2

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Odds and Ends (doesn't fit anywhere else)
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
; What time people connect and disconnect.
/def -i -p10 -F -t'* has connected.' contime_trig = \
  /send -w @pemit me=\[time()\]

/def -i -p10 -F -t'* has disconnected.' discontime_trig = \
  /send -w @pemit me=\[time()\]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
; Execute a command everywhere we're connected
; Posted on the TF list by David Moore <dmoore at UCSD dot EDU>

/def command_in_all =\
  /let body=%{*}%;\
  /command_in_all_ $(/listsockets -s)

/def command_in_all_ =\
  /while ({#}) \
    /repeat -S -w%{1} 1 %{body}%;\
    /shift%;\
  /done

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Auto-idler
;;; Gwen Morse


;; Diku's don't seem to have an ignored garbage character like MU's @@
;; You can 'save' however and this is a safe command to send multiple times.
;; It's supposed to save your game status and it's good for your character.
;;
;; New Radiant Action: Now only sends idler command if you're connected to
;; at least one world. Added OCT 26 2011.
;; Time set to 1 minute 30 seconds to get around my CrystalMUSH autostop
;; which is configured to 2 minutes.
;;
;; Feb 28 2014, modified code to borrow Christian Robinson's idler features.
;;

/def -i idler = \
  /let _worlds= %;\
  /let i=1 %;\
  /let _sockets=$(/listsockets -s) %;\
  /let _line=$(/nth %{i} %{_sockets}) %;\
  /while (_line !~ "") \
    /let _worlds=%_worlds %_line %;\
    /test ++i %; \
    /let _line=$(/nth %{i} %{_sockets}) %;\
  /done %;\
  /for i 1 $(/length %{_worlds}) \
    /send -w\$(/nth \%{i} \%{_worlds}) @@ %;\
  /repeat  -0:1:30 1 /idler %;\
  /set idlerpid %?

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;----------------------------------------------------------------------
;;; TF stuff, by Tiercel/JBB, batzel at cceb dot med dot upenn dot edu
;;;----------------------------------------------------------------------
;;; MUSHcode escaper. If you've typed a long line of code (or grabbed
;;; it with /fuguedit), you don't want to have to go through by hand to
;;; escape out all those characters MUSH will eat. Instead, with this
;;; loaded, just hit esc-e, and it escapes all the odd characters in
;;; what you've just typed (or /redit'd).
;;; RATING: **** (Very useful for heavy coders or for teaching people code)

/def -ib'^[e' = /test kbgoto(kblen() + 1) %;\
  /grab $(/escape %%[]{}\ $[kbhead()])

/def -i -F eschelp = %;/echo%;/echo *** Tiercel's MUSHcode Escaper Help %;\
  /echo If you've typed a long line of code (or grabbed it with Fuguedit), %;\
  /echo you don't want to have to go through by hand to escape out all those %;\
  /echo characters MUSH will eat. Instead, with this loaded, just hit esc-e, %;\
  /echo and it escapes all the odd characters in the command line. %;\
  /echo %;/

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Manage a list of help-commands for different modules
;; The point is, if you forget a macro's name, you still
;; remember /helplist, and thus easily find the missing name
;; Antti Pietikinen (heidel at operamail dot com)
;; 2005

/def -i help_helplist=\
  /echo -aB Help for help-list:%;\
  /echo /help_add <command> <short description> Add a command to be shown on help-list%;\
  /echo /help_list%;\
  /echo /helplist%;\
  /echo /help-list                              Show added help-commands.


/def -i help_add=\
  /if (strstr(help_list,textencode({*})) == -1) \
    /test help_list := strcat(help_list," ",textencode({*}))%;\
  /endif

/def -i help-list=\
  /if ({#}==0) \
    /if (help_list !~ "") \
      /help-list %{help_list}%;\
    /else \
      /echo -aB % No help commands set%;\
    /endif%;\
  /else \
    /echo -aB % List of help commands:%;\
    /while ({#}) \
      /let help_string=$[textdecode({1})]%;\
      /let help_command=$[substr(help_string,0,strstr(help_string," "))]%;\
      /let help_desc=$[substr(help_string,strstr(help_string," "))]%;\
      /echo -aCgreen -p - $[pad(help_command,-20)] @{Cyellow}%{help_desc}%;\
      /shift%;\
    /done%;\
  /endif

/def -i help_list=/help-list
/def -i helplist=/help-list

/help_add /help_helplist maintain a list of help-commands

/if (!loaded_help_list_file) \
  /echo -p @{Cgreen}% Help list loaded, @{xBCyellow}/help-list@{xnCgreen} to show helps available%;\
  /endif
/set loaded_help_list_file 1

;;;
;;; Sample Helplist config for other macros

;;; /help_add /help_pathfinder find the cheapest path from a to b

;;; /def -i help_pathfinder=\
;;;     /echo -aB Pathfinder help:%;\
;;;     /echo /path_find <start> <destination>      Find the path from <start> to <destination>%;\
;;;     /echo ( see the file for help about creating the paths )%;\
;;;     /echo

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; IDE Highlighting
;;;
;;; I'm sure most of you have worked on a IDE that uses syntax highlighting if you're into
;;; any sort of coding at all, you all know how useful it can be. Of course, MUSHes didn't
;;; have that -- till now. If you paste the following into your .tfrc (for tinyfugue
;;; users; others probably will have to modify this code) and then do line joins if
;;; necessary, you'll get some form of syntax highlighting.
;;; Author: Kamikaze: http://www.imsa.edu/~kamikaze/

/def -p10 -F hilight_cmd1 = /def -PBCwhite -F -t"%1"
/def -p10 -F hilight_cmd2 = /def -PBCwhite -F -t"%1"
/def -p10 -F hilight_cmd3 = /def -PBCwhite -F -t"%1"
/def -p10 -F hilight_cmd4 = /def -PBCwhite -F -t"%1"
/def -p10 -F hilight_cmd5 = /def -PBCwhite -F -t"%1"
/def -p10 -F -PBCyellow -t'(\{|\})'
/def -p10 -F -PBCred -t'(\[|\])'
/def -p10 -F -PBCgreen -t'(\(|\))'
/def -p10 -F -PBCblue -t'(=|;|/|\%0|\%1|\%2|\%3|\%4|\%5|\%6|\%7|\%8|\%9|\%#|\%@|\%N)'
/def -p10 -F -PBCmagenta -t'(\%r|\%b|\%t|\%s|\%p|\%o|\%!|\%l)'
/def -p10 -F -PBCcyan -t'(\%q0|\%q1|\%q2|\%q3|\%q4|\%q5|\%q6|\%q7|\%q8|\%q9|\%Q0|\%Q1|\%Q2|\%Q3|\%Q4|\%Q5|\%Q6|\%Q7|\%Q8|\%Q9)'
/def -p10 -F -PBCmagenta -t'(,)'
/hilight_cmd1 (@@|@allhalt|@allquota|@atrchown|@atrlock|@attribute|@boot|@cemit|@channel|@chat|@chown)
/hilight_cmd1 (@chownall|@chzone|@chzoneall|@clock|@clone|@command|@config|@cpattr|@create|@dbck)
/hilight_cmd1 (@decompile|@destroy|@dig|@disable|@doing|@dolist|@drain|@dump|@edit|@elock|@emit|@enable)
/hilight_cmd2 (@entrances|@eunlock|@find|@firstexit|@fixdb|@force|@function|@gedit|@grep|@halt|@hide|@kick)
/hilight_cmd2 (@link|@listmotd|@list|@lock|@log|@mail|@map|@motd|@mvattr|@name|@newpassword|@notify|@nuke)
/hilight_cmd2 (@oemit|@open|@parent|@password|@pcreate|@pemit/list|@pemit|@poll|@poor|@power|@ps|@purge|@quota)
/hilight_cmd3 (@recycle|@rejectmotd|@remit|@restart|@rwall|@rwallemit|@rwallpose|@scan|@search|@select)
/hilight_cmd3 (@shutdown|@sitelock|@squota|@stats|@sweep|@switch|@tel|@teleport|@toad|@trigger|@ulock|@unlock)
/hilight_cmd3 (@undestroy|@unlink|@unlock|@unrecycle|@uptime|@uunlock|@verb|@version|@wait|@wall|@wallemit)
/hilight_cmd4 (@wallpose|@warnings|@wcheck|@wipe|@wizemit|@wizmotd|@wizpose|@wizwall|@zemit|@desc|@dol)
/hilight_cmd4 (@sel|@fo|@no|@listen|@lemit|@femit|@fpose|@fsay|@mudwho|@alias|@last|@robot|@readcache)
/hilight_cmd5 (@setq|@set)

; Hilite various Tiny-MUSH specific settings (dbrefs, flags, @'s, etc)
; written by Andrew Mortimer

/def -F -p1000 -P0BCred -mregexp -F -t'#[0-9]+' tiny_dbrefnum
/def -F -p1000 -P0BCred -mregexp -F -t'#-1' tiny_dbreferr
/def -F -p1000 -P1BCred -mregexp -F -t'#[0-9]+([A-Za-z\$+&@]+( \[[^]]+\])?)' tiny_dbrefflag
/def -F -p1000 -P0Cwhite -mregexp -F -t'@[A-Za-z_]+' tiny_atcomm
/def -F -p1000 -P1Cwhite -mregexp -F -t'^([ ]*[^;()# ]+)(\\(#[0-9]+\\))?:.*' tiny_heads

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; defining Improved Fugue Edit command
;;;
;;; FROM: http://www.chaoticmux.org/~kareila/TF/
;;;
;;; FugueEdit macro (ed obj/attr)
;;; Probably the most common tf macro out there is one that will grab 
;;; the text of an attribute into the input buffer for editing. The 
;;; incarnation I was given required some softcode to implement, and 
;;; the only tf-side code you had to define was the gag-trigger that 
;;; got the input. This worked, but I was annoyed that I had to
;;; port this piece of softcode to every game I was on. So I recoded 
;;; it to be defined entirely within tf. It uses the usual 
;;; syntax: "/ed <obj>/<attr>".
;;;
;;; FugueEdit macro (ed obj/attr) coded by Kareila@ChaoticMUX
;;; based on mushcode that originated with van@TinyTIM
;;; and has mutated several times since then.
;;; Thanks to Gwen Morse for the incentive to make improvements.  :)
;;;
;;; Gwen: works -- very nice! And, look, I get credit 
;;; for "inspiring" improvements!

; edmarker can be anything you like - no spaces allowed.

/set edmarker FugueEdit
/eval /def -p100 -ag -t'%{edmarker} > *' edtrig = /grab %%-2

/def ed = \
  /if (regmatch('/',{*})) \
    /let edobj %PL %; \
    /let edattr %PR %; \
    /def -n1 -t#* -q -ag tempedtrig = \
      @pemit me = switch(%%*, \
      #-1, I don't see that here., \
      #-2, I don't know which one you mean!, \
      %{edmarker} > &%{edattr} %{edobj} = \
      [get(%%*/%{edattr})]) %; \
    /send @pemit me = locate(me, %{edobj}, *) %; \
  /else /echo %% %{edmarker}: ed argument must be of form <obj>/<attr> %; \
  /endif
/def -h"send ed *" edhook = /ed %-1

/def ng = \
  /if (regmatch('/',{*})) \
    /echo %% %{edmarker}: ng argument must be a valid object name %; \
  /else \
    /def -n1 -t#* -q -ag tempngtrig = \
      @pemit me = switch(%%*, \
      #-1, I don't see that here., \
      #-2, I don't know which one you mean!, \
      %{edmarker} > @name %* = [translate(fullname(%%*))]) %; \
    /send @pemit me = locate(me, %*, *) %; \
  /endif
/def -h"send ng *" nghook = /ng %-1

/def lock = \
  /if (regmatch('/',{*})) \
    /let edobj %PL %; \
    /let edattr %PR %; \
    /def -n1 -t#* -q -ag templocktrig = \
      @pemit me = switch(%%*, \
      #-1, I don't see that here., \
      #-2, I don't know which one you mean!, \
      %{edmarker} > @lock/%{edattr} %{edobj} = \
      [lock(%%*/%{edattr})]) %; \
    /send @pemit me = locate(me, %{edobj}, *) %; \
  /else \
    /def -n1 -t#* -q -ag templocktrig = \
      @pemit me = switch(%%*, \
      #-1, I don't see that here., \
      #-2, I don't know which one you mean!, \
      %{edmarker} > @lock %* = [lock(%%*)]) %; \
    /send @pemit me = locate(me, %*, *) %; \
  /endif
/def -h"send lock *" lockhook = /lock %-1

/def edhelp = \
  /echo -p @{h}ed <obj>/<attr>:@{n} \
    edits the given attribute on the given object. %; \
  /echo -p @{h}ng <obj>:@{n} \
    grabs the name of the given object for editing. %; \
  /echo -p @{h}lock <obj>[/<type>]:@{n} \
    edits the given lock (default lock if no type given).

/help_add /help_ed Fugue Edit command

/def -i help_ed=\
  /echo -aB Fugue Edit help:%;\
  /echo /ed <obj>/<attr>            Edits the given attribute on the given object.%;\
  /echo /ng <obj>                   Grabs the name of the given object for editing.%;\
  /echo /lock <obj>[/<type>]        Edits the given lock (default lock if no type given).%;\
  /_echo

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; FROM: http://www.chaoticmux.org/~kareila/TF/
;;; When I first started using tf, I almost never bothered to define 
;;; types for my worlds because they were all tiny derivatives and I 
;;; wanted all my macros to work everywhere. But as I gained experience, 
;;; I discovered world typing can be a nifty tool for customizing tf's 
;;; behavior. These macros make "pub message" MUX-based syntax do the right 
;;; thing on TinyMUSH, TinyMURE, RhostMUSH and PennMUSH, so I don't have to
;;; remember which world is which kind once I've defined the world with 
;;; the corresponding type. To make them work for you, just define your 
;;; worlds with the appropriate type, e.g. 
;;; "/addworld -Ttiny.mux chaotic chaoticmux.org 4201". Also included 
;;; are macros to emulate MUX's "lastpaged" behavior on TinyMUSH and RhostMUSH, 
;;; as well as macros from my brief foray into LP MUDs that make 
;;; "message and :message work in place of say message and emote message 
;;; on lp typed worlds. (Ugh!)

;;; Hooks to catch MUX comsys commands on Rhost, TinyMUSH, MURE, MUX

/def -Ttiny.mux -h"send pub *" muxpub = /send pub %-1
/def -Ttiny.rhost -h"send pub *" rhostpub = /send =pub %-1
/def -Ttiny.mush -h"send pub *" mushpub = /send =pub %-1
/def -Ttiny.mush3 -h"send pub *" mushpub = /send pub %-1
/def -Ttiny.mure -h"send pub *" murepub = /send @com 0=%-1
/def -Ttiny.penn -h"send pub *" pennpub = /send +Public %-1

;; A similar pub switch (by Gwen Morse) added 04 Mar 2014

/def pub = \
  /if (${world_type} =/ "*mush3*") \
    /send -w pub %*%;\
  /elseif (${world_type} =/ "*cm*") \
    /send -w public %*%;\
  /elseif (${world_type} =/ "*mux*") \
    /send -w pub %*%;\
  /elseif (${world_type} =/ "*mure*") \
    /send -w @com 0= %*%;\
  /elseif (${world_type} =/ "*penn*") \
    /send -w +Public %*%;\
  /else \
    /echo -w TFRC: World type not defined.%;\
  /endif

;;; Hooks to allow prefix says and emotes on MUDs.

/def -mregexp -T'^lp' -h'SEND ^:(.*)$' lppose = /send emote %P1
/def -mregexp -T'^lp' -h'SEND ^"(.*)$' lpsay = /send say %P1

;;; Hooks to imitate MUX "lastpage" behavior on Rhost, TinyMUSH
;;; Adapted from 'news lastpage' on Godlike Edge

/def -Ttiny.rhost -mregexp -h'SEND ^(page|p) (.+)=(.*)$' \
        lastpage_new_rhost = /lastpage_new %*
/def -Ttiny.rhost -mregexp -h'SEND ^(page|p) ([^=]*)$' \
        lastpage_old_rhost = /lastpage_old %*
/def -Ttiny.mush -mregexp -h'SEND ^(page|p) (.+)=(.*)$' \
        lastpage_new_mush = /lastpage_new %*
/def -Ttiny.mush -mregexp -h'SEND ^(page|p) ([^=]*)$' \
        lastpage_old_mush = /lastpage_old %*

/def lastpage_new = /set lastpage_${world_name}=%{P2} %; /send %{P0}
/def lastpage_old = \
     /let varname=lastpage_${world_name}%;\
     /let name=$(/set %{varname})%;\

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; FROM: http://www.chaoticmux.org/~kareila/TF/
;;; Macro for quickly cloning a copy of an object to a different mush
;;; without the need to log a @decompile.  http://www.amtgard.com/~marvin/
;;; This is a useful macro I got from Pedersen's web page, which 
;;; unfortunately appears to have bitten the proverbial dust since I 
;;; snarfed it. It defines a macro, /clone, that can be used to quickly 
;;; reproduce an object between worlds you are connected to, with no 
;;; intermediate logfile.

/def clone = \
    /def -t&* -p100 -q -ag -w%1 cloneitampertrig = /send -w%2 \%* %; \
    /def -t@* -p100 -q -ag -w%1 cloneitattrig = /send -w%2 \%* %; \
    /def -tCLONEDONE -p10 -q -ag -w%1 cloneitdone = /purge cloneit* %; \
    /def -tCLONEDONE -p1000 -n1 -q -ag -w%1 cloneitgagfirst %; \
    /send -w%1 OUTPUTSUFFIX CLONEDONE %; \
    /send -w%1 @decompile %3 %; \
    /send -w%1 OUTPUTSUFFIX %; \
    /send -w%1 @pemit \%#=Object is now sent.

/def clonehelp = /help_clone

/help_add /help_clone copies items from one world to another

/def -i help_clone = \
  /echo -aB Clone help:%;\
  /echo /clone <worldfrom> <worldto> <object>       Copies <object> from <worldfrom> to <worldto>%;\
  /echo

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; FROM: http://www.chaoticmux.org/~kareila/TF/
;;; TF multidescer coded by Kareila@ChaoticMUX, May 2003
;;;
;;; Syntax: /showdescs, /listdescs, /showdesc <desc>, /setdesc [<obj>=]<desc>
;;;
;;; To add a desc: /set desc_<descname> <description> (see examples below)
;;;
;;; World specific adjustment and @dolist list support by Gwen Morse.

; Descriptions start here (descs "have" to come before the commands)

/set desc_testa %r[space(5)]the first short and boring test description
/set desc_testb the second short and boring test description
/set desc_testc This is a really long and boring test description.  The \
  real purpose of this description is to demonstrate how descriptions that \
  are broken across multiple lines need to be continued with backslashes \
  in order for the file to scan correctly.  The extra spaces at the \
  beginnings of lines are parsed out by TF.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Descer Commands are defined here

/help_add /help_descs Multi-descer commands

/def -i help_descs=\
  /echo -aB Multi-Descer help:%;\
  /echo /showdescs                  Print all the descs available for this world.%;\
  /echo /listdescs                  List the names of all the descs for this world.%;\
  /echo /showdesc <desc>            Print the text of the selected desc.%;\
  /echo /setdesc [<obj>]=<desc>     Set <object> to the selected desc.%;\

/def helpdescs = /help_descs

/def showdescs = /showdescs_ $(/listvar -mglob -s desc_${world_name}_*)

/def showdescs_ = \
  /while ({#}) \
    /test regmatch('^desc_${world_name}_',{1}) %; \
    /showdesc %PR %; /shift %; \
  /done

/def listdescs = /listdescs_ $(/listvar -mglob -s desc_${world_name}_*)

/def listdescs_ = \
  /while ({#}) \
    /test regmatch('^desc_${world_name}_',{1}) %; \
    /set listdescs_temp %{listdescs_temp} %PR %; /shift %; \
  /done %; \
  /echo Available descriptions: %{listdescs_temp} %; /unset listdescs_temp

/def showdesc = \
  /if ($(/eval /echo %%desc_${world_name}_%*) =~ '') \
    /echo %% showdesc: No such description "%*". %;\
  /else \
    /eval /echo -p @{h}%*:@{n} %%desc_${world_name}_%* %; \
  /endif

/def setdesc = \
  /if (regmatch('=',{*})) \
    /if ($(/eval /echo %%desc_${world_name}_%PR) =~ '') \
      /echo %% setdesc: No such description "%PR". %; \
    /else \
      /echo %% Setting description "%PR" on object "%PL". %; \
      /eval /send @desc %PL = %%desc_${world_name}_%PR %; \
      /eval /send @dolist [num(%PL)] = %%desc_list_${world_name}_%PR %; \
    /endif %; \
  /elseif ($(/eval /echo %%desc_${world_name}_%*) =~ '') \
    /echo %% setdesc: No such description "%*". %; \
  /else \
    /echo %% Setting description "%*". %; \
    /eval /send @desc me = %%desc_${world_name}_%* %; \
    /eval /send @dolist [num(me)] = %%desc_list_${world_name}_%* %; \
  /endif

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; FROM: http://www.chaoticmux.org/~kareila/TF/
;;; Cool shell-like hacks to grab previous commands from input history.
;;; Inputs beginning with ! echo and execute the last matching command.
;;; If ` is pressed, it grabs the last matching command for editing.
;;; Kareila  02/03/1999

/def -p1000 -mregexp -h'SEND ^!(.*)$' resend = \
  /let matchtxt=$(/recall -i /1 %P1*) %; \
  /if (strlen(matchtxt)) \
    /echo %% %matchtxt %; \
    /send %matchtxt %; \
  /else \
    /beep 1 %; \
  /endif

/def -b'`' reedit = \
  /if (regmatch('^!', (kbhead()))) \
    /let matchtxt=$(/recall -i /1 $[substr((kbhead()),1)]*) %; \
    /if (strlen(matchtxt)) \
      /grab %matchtxt %; \
    /else \
      /beep 1 %; \
    /endif %; \
  /else \
    /@test input("`") %; \
  /endif

/help_add /help_shell shell-like commands to grab previous commands

/def -i help_shell = \
  /echo -aB Shell help:%;\
  /echo Inputs beginning with ! echo and execute the last matching command.%;\
  /echo If ` is pressed, it grabs the last matching command for editing.%;\
  /echo

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; /Think command
;;;
;;; By Gwen Morse
;;; added March 16 2014

/def think = \
  /if (${world_type} =/ "*tiny*") \
    /send -w @remit [loc(me)]=[name(me)] . o O ( %* )%;\
  /endif

/help_add /help_think to show a thought bubble on a MUSH

/def -i help_think = \
  /echo -aB Think help:%;\
  /echo /think <text>          You will think . o O ( <text> ) in the world.%;\
  /echo

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Debugging Code help (MUSH/MUX)
;;;
;;; Original Source Mux-In-A-Minute Globals code. Ported to TF by Gwen Morse
;;; Gwen: DOES NOT YET WORK -- work in progress!
;;;

/def debug=[setq(0,num(%*))][setq(1,locate(me,r(0),*))]; @switch \
     [isdbref(r(1))][controls(me,r(1))]=0?,{@pemit me=I'm sorry, but I can't see \
     {'%*'} here.},10,{@pemit me=I'm sorry, but you can't modify that object.},11,{@set \
     r(1)=VERBOSE; @set r(1)=TRACE; @pemit me=Debugging is now on for [name(r(1))].}

/def debugstop=[setq(0,num(%*))][setq(1,locate(me,r(0),*))]; @switch \
     [isdbref(r(1))][controls(me,r(1))]=0?,{@pemit me=I'm sorry, but I can't see {'%*'} \
     here.},10,{@pemit me=I'm sorry, but you can't modify that object.},11,{@set \
     r(1)=!VERBOSE; @set r(1)=!TRACE; @pemit me=Debugging is now off for [name(r(1))].}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; From Neerth, Lusternia player: http://forums.lusternia.com/index.php?showtopic=841
;;;
;;; typing /keys inside tf will show you a list of a bunch of command-altering and -navigating commands
;;;

/def keys = \
    /echo -paCblue $[strrep("=",80)] %; \
    /echo -paCbrightmagenta @{BCbrightcyan}CTR+A@{n}  $[pad("cursor to beginning of line",-31)]  @{BCbrightcyan}CTR+E@{n}  cursor to end of line %; \
    /echo -paCbrightmagenta @{BCbrightcyan}ESC b@{n}  $[pad("cursor back one word",-31)]  @{BCbrightcyan}ESC f@{n}  cursor forward one word %; \
    /echo -paCbrightmagenta @{BCbrightcyan}ESC j@{n}  $[pad("flush (after scrolling back)",-31)]  @{BCbrightcyan}ESC v@{n}  toggle insert/overwrite mode %; \
    /echo -paCblue $[strrep("=",80)] %; \
    /echo -paCbrightyellow @{BCbrightcyan}CTR+D@{n}  $[pad("delete character",-31)]  @{BCbrightcyan}CTR+T@{n}  transpose characters %; \
    /echo -paCbrightyellow @{BCbrightcyan}CTR+K@{n}  $[pad("delete to end of line",-31)]  @{BCbrightcyan}CTR+U@{n}  delete back to front of line %; \
    /echo -paCbrightyellow @{BCbrightcyan}CTR+W@{n}  $[pad("delete backward word",-31)]  @{BCbrightcyan}CTR+V@{n}  delete forward word (do twice) %; \
    /echo -paCblue $[strrep("=",80)] %; \
    /echo -paCbrightmagenta @{BCbrightcyan}ESC c@{n}  $[pad("capitalize next word",-31)]  @{BCbrightcyan}ESC l@{n}  make next word all lowercase %; \
    /echo -paCbrightmagenta @{BCbrightcyan}ESC u@{n}  $[pad("make next word all uppercase",-31)]  @{BCbrightcyan}ESC .@{n}  input last word of previous line %; \
    /echo -paCblue $[strrep("=",80)]

/help_add /help_keys to screen print useful key combinations

/def -i help_keys = \
  /echo -aB Think help:%;\
  /echo /keys                  prints useful key combinations to the screen%;\

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; MUSH/MUX data-base cloning
; Based on a count script by Michael Hunger (mh14 at inf dot tu-dresden dot de)
; Expanded to clone by Gwen Morse (gwen dot morse at gmail dot com)
; Used OUTPREFIX examples provided by Kareila at chaoticMUX
;
; Handy little macro to @dec items incrementally in a database, one 
; item at a time. Requires Wiz powers (or, will only @dec dbrefs you 
; actually own).
;
; type: /dbc <number>
; where <number> is the *last* number in the database you want to log.
; @stats will tell you last # in database.
;
; Macro tells you the number and name of each item being cloned, and then
; @decompiles it to a log. Starts with #0
;

/def -w -q -F dbc = \
;;; if a parameter was given
        /if ({#} > 0)%;\
          /log -w${world_name} off %;\
          /more off %;\
          /log -w %{DECDIR}/$[ftime("%Y-%m-%d",time())]_decompile_${world_name}.log%;\
;;; set variables (grabs from number entered)
          /set counter=-1%;\
          /set end_counter=%1 %;\
        /else%;\
        /endif%;\
;;; if end not reached call itself in 2 (-2) seconds
        /if (++counter<=end_counter)%;\
          /send -w @pemit me=\%r\%r[center(+++++,70,=)]%;\
          /send -w @pemit me =\%r@@DBC> Now working with object #%counter, name: [edit(name(#%counter),\%b,_)] %; \
          /send -w @decompile #%counter %; \
          /repeat -w -2 1 /dbc%;\
        /endif%;\
;;; if end reached end log
        /if (counter==end_counter) %;\
          /log -w off %;\
          /repeat -w -1 1 /relog %;\
        /endif

;; /dbs <number>
;; works like dbc, except each object is written to a separate file.

/def -w -q -F dbs = \
;;; if a parameter was given
      /if ({#} > 0) %;\
        /log -w${world_name} off %;\
        /more off %;\
        ;@@set variables (grabs from number entered)@@%;\
        /set counter= -1 %;\
        /set end_counter=%1 %;\
      /endif%;\
;;; if end reached end log
      /if (counter==end_counter) %;\
        /more off %;\
        /relog %;\
      /endif%;\
;;; if end not reached call itself in 2 (-2) seconds
      /if (++counter<=end_counter)%;\
        /send -w @pemit me=@@DBS> Now working with object #%counter, name: [edit(name(#%counter),\%b,_)] %; \
        /def -q -ag -n1 -p1000 -t'@@DBS> Decompile done!' dbs_hide %; \
        /send -w @decompile #%counter %; \
        /send OUTPUTSUFFIX DBS> Decompile done! %; \
        /send OUTPUTSUFFIX %; \
        /repeat -w -2 1 /dbs%;\
      /endif

/def -w -F -p100 -mregexp -t"^DBO Search List (.*)" dbstats_set = \
  /set HASH=%{P1} %;\
  /set HASH

/def -w -q -F dbo = \
  /if (regmatch('me',%{*})) \
    /send -w think DBO Search List [search(me)]%;\
  /elseif (regmatch('thing*',%{*})) \
    /send -w think DBO Search List [search(type=thing)]%;\
  /elseif (regmatch('room*',%{*})) \
    /send -w think DBO Search List [search(type=room)]%;\
  /endif

;;; Alternate @stats check to automagically tell /dbc what the ending # should be.
;;; Gwen: The check will set DBSTATS, it's integrated with /dbc.

/def -w -F -p100 -mregexp -t"^The universe contains ([0-9]+) objects" dbstats_set = \
    /set DBSTATS=%{P1} %;\

;;;;;; DBC checks needed for DBC scripts

/def -p100 -qi -t'@@DBS> Now working with object *' dbs_start = \
    /log -w %{DECDIR}/working/$[ftime("%Y-%m-%d",time())]_${world_name}_%{counter}_%8.log

/def -p100 -qi -t'@@DBS> Decompile done!' dbs_end = \
    /log -w off

/help_add /help_dbc decompile and log objects in a MUSH database

/def -i help_dbc = \
  /echo -aB Decompile help:%;\
  /echo /dbc <number>          where <number> is the *last* dbref to decompile%;\
  /echo /dbs <number>          each item is logged to a separate file%;\
  /echo This can be used to decompile items in a MUSH database. You either%;\
  /echo need EXAMINE powers or you need to own the objects.%;\
  /echo These macros tell you the number and name of each item being cloned,%;\
  /echo and then @decompiles each to a log. The count starts with #0.%;\
  /echo

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; /mushpp
;
; Comments from Gwen:
;
; Written by Christian Robinson: http://christianrobinson.name/Perl/mushpp.html
;
; As per Christian Robinson:
;
; You can fairly easily use this within TinyFugue with the following macro:
;
;
;/def mushpp = /quote -w -dexec -0 !/home/goldmoon/Dropbox/Tinyfugue/mushpp.pl -o /echo %*

/def unformat = /quote -w -dexec -0 !/home/goldmoon/Dropbox/Tinyfugue/mushpp.pl -o /echo unformat.txt

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; /Fix
; By Gwen Morse (gwen dot morse at gmail dot com)
;
; This is to send a coding fix based on a specific file that I always
; have in my home directory.
;

/def -w fix = \
  /quote -0 -w 'fix.txt %;\

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Antti Pietikinen (heidel at operamail dot com)
;; 2005
;;
;; Usage: type "/memo <text>" and it will add text to a memo text file.
;; Type "/memo" and it will print your memo file entries to your screen.
;;
;;
;; add a line to memo.txt, or show the memos
;; Gwen Morse renamed from /note to /memo and slightly adjusted format

/def -F -i memo=\
  /if ({#}==0) \
    /_echo%;\
    /echo -aB MEMOS:%;\
    /echo -aB =====%;\
    /quote -S /echo - '"memo.txt"%;\
    /echo -aB =====%;\
    /return%;\
  /else \
    /let filehandle=$[tfopen("memo.txt","a")]%;\
    /if (filehandle != -1) \
      /test tfwrite(filehandle,{*})%;\
      /echo % Memo added: %{*}%;\
      /test tfclose(filehandle)%;\
    /endif%;\
  /endif

/help_add /help_memo simulates a memo pad 

/def -i help_memo = \
  /echo -aB Memo help:%;\
  /echo /memo <text>           add <text> to a memo text file%;\
  /echo /memo                  print memo file entries to the screen

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; trigger.tf file info
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;utilities.tf (formerly mylib.tf)
;This contains functions that are used by other .TF files.
;=========================================================

;;; The following Virtual array is needed to make later macros function
;;; Please do not remove

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Virtual Array
;;;
;;; Originally submitted to the Tinyfugue mailing list by Galvin 
;;; <kairo at mediaone dot net> Modfied by Michael Hunger 
;;; <mh14 at inf.tu-dresden dot de> Possibly modified by other members 
;;; of the Tinyfugue mailing list.
;;;
;;; NOTES FROM GALVIN:
;;;
;;; You may store anything to be abbreviated in these lists, e.g. weapons,
;;; friends, npcs, scores etc.
;;;
;;; If you use text not containing other characters than letters, 
;;; numbers and _ you may also use this as an simple key-value hash list
;;; e.g. /set_array weapon s1 sword_with_a_very_long_id
;;;
;;; /def wield = /get_array weapon %1%;wield %?
;;;
;;; Usage:
;;; instead of: wield sword_with_a_very_long_id
;;; just use: /wield s1
;;;
;;; Some Examples:
;;; /test put_array('test_array', 1, 367382)
;;; /test put_array('test_array', 2, 'a string')
;;; /test echo(get_array('test_array', 1))
;;; /test echo(get_array('test_array', 2))
;;;
;;; You should see 367382 and a string echoed to your screen.
;;;
;;; Passing an array to a function
;;;
;;; /def function_array = \
;;; /test array1 := get_array({*}, 1) %;\
;;; /test array2 := get_array({*}, 2) %;\
;;; /test echo(strcat(array1, ':', array2))
;;;
;;; /test function_array('test_array')
;;;
;;; What I wrote here was just some stuff off the top of my 
;;; head real quick.  Hope it helps. Oh and /listarray is a 
;;; real good debuging tool, I use this as well. 
;;; SO /listarray test_array should return:
;;; test_array[1]:=367382
;;; test_array[2]:=a string
;;; test_array[3]:=
;;;
;;; /listarray only lists up till a blank entry, I thought 
;;; about using entry 0 as the # of elements but decided 
;;; that some people may want to start arrays from 0 and not 1.
;;;
;;; Some get_array_count examples:
;
; /test put_array('halloween', 1, 'skeleton')
; /test put_array('halloween', 2, 'owls')
; /test put_array('halloween', 3, 'boo!')
;
; /test echo(get_array_count('halloween', 1))
; returns 3
; /test echo(get_array_count('halloween', 2))
; returns 2
;
; /test put_2array('double', 1, 1 , 'hmm')
; /test put_2array('double, 1, 2, 'burp!')
; /test put_2array('double, 1, 3, 'damn')
; /test echo(get_2array_count('double', 1, 1)
;
;;; Notes from Galvin (<kairo at mediaone dot net>)
;
; I made some changes and added some new functions to arrays, 
; I overhauled the code as well.
;
; new functions
;
; tfwrite_array() : write an array to disk
; tfread_array() : read an array from disk
; strstr_array() : search for a string in an array
; list_array() was listarray() : good for debugging, lists arrays.
;
; changes:
;  strstr_array() replaces get_array_count()
;   x := (strstr_array("my array", 0, 1000, '"") -1) will do the same
;   thing as:
;   get_array_count("my array", 0)
;   strstr_array() returns -1 if it doesn't find the element
;
;  list_array now uses /listvar to get the data to list, it 
;  reformats it to make it look like the old listarray.
;
;------------------------------------------------------------------------
;Get array / get 2array : A virtual array function to similate a real array
;usage:
;get_array("Array name here", I) & get_2array("array name", I, I2)
;example get_array("Dir_Array", 43) returns the 43rd element from "Dir_Stack"
;
;------------------------------------------------------------------------
/def get_array = \
/return _array_%1_%2

/def get_2array = \
/return _array_%1_%2_%3

;------------------------------------------------------------------------
;PUT array / put 2array: A virtual array function to similate a real array
;usage:
;put_array("Array name here", I, st) & put_2array("array name", I, I2, st)
;example put_array("Dir_Array", 43, "sw") puts "sw" at element 43 in
;"Dir_Array"
;------------------------------------------------------------------------
/def put_array = \
/IF (strlen({3}) > 0) \
  /set _array_%1_%2=%3%;\
/ELSE \
  /unset _array_%1_%2%;\
/ENDIF%;\

/def put_2array = \
/IF (strlen({4}) > 0) \
  /set _array_%1_%2_%3=%4%;\
/ELSE \
  /unset _array_%1_%2_%3%;\
/ENDIF%;\

;------------------------------------------------------------------------
;PURGE array : Purges a virtual array made by get_array & put_array
;usage:
;purge_array("Array name here")
;example purge_array("Dir_Array"), deletes the whole array from memory
;NOTE: Purge array starts from element 0
;NOTE: this can also purge double dimensioned arrays too.
;------------------------------------------------------------------------
/def purge_array = \
/quote -S /unset `/listvar -s _array_%1_*

;--------------------------------------------------------------------------
;listarray / list2array
;USAGE:
;/listarray array_name <num> & /list2array array_name <num> <num2>
;Will list the whole array of array_name starting from element <num>
;/list2array only lists the second dimension from <start>
;--------------------------------------------------------------------------
/def listarray = \
/test LA_Count := %2 - 1%;\
/test LA_Element := " "%;\
/while (strlen(LA_Element) > 0) \
  /test ++LA_Count%;\
  /test LA_Element := get_array({1}, LA_Count)%;\
  /test echo(strcat({1}, "[", LA_Count, "]:=", LA_Element))%;\
/DONE

/def list2array = \
/test LA2_Count := -1%;\
/test LA2_Element := " "%;\
/while (LA2_Count < 255) \
  /test ++LA2_Count%;\
  /test LA2_Element := get_2array({1}, {2}, LA2_Count)%;\
  /IF (strlen(LA2_Element) > 0) \
    /test echo(strcat({1}, "[", {2}, "][", LA2_Count, "]:=", LA2_Element))%;\
  /ENDIF%;\
/DONE
;--------------------------------------------------------------------------
; list_array() / list_2array()
;
; List an array in an easy to read format.
; USAGE:
; list_array("array_name", startindex)
; list_2array("array_name", startindex1, startindex2)
; /list_array <array_name> <startindex>
; /list_2array <array_name> <startindex1> <startindex2>
;
; "array_name" : Name of the array you want to list. (function form only)
; startindex   : Starting element you want to list from.
; startindex1  : Starting element of startindex2 you want to list from.
; startindex2  : Starting element of startindex1
;--------------------------------------------------------------------------
/def list_array = \
  /def list_array2 = \
    /test la_rawname := {1} %%;\
    /test la_name := {2} %%;\
    /test la_index := substr(la_rawname, strlen(la_name) + 8, 256) %%;\
    /IF (la_index >= {3}) \
      /test echo(strcat(la_name, '[', la_index, '] :=', get_array(la_name, la_index))) %%;\
    /ENDIF %;\
  /quote -S /test list_array2("`"/listvar -s _%1_array_*"", {1}, {2}) %;\
  /undef list_array2

/def list_2array = \
  /test la2_i2F := 0 %;\
  /def list_2array2 = \
    /test la2_rawname := {1} %%;\
    /test la2_name := {2} %%;\
    /test la2_rawindex := substr(la2_rawname, strlen(la2_name) + 8, 256) %%;\
    /test la2_pos := strstr(la2_rawindex, '_') %%;\
    /test la2_index1 := substr(la2_rawindex, 0, la2_pos) %%;\
    /test la2_index2 := substr(la2_rawindex, la2_pos + 1, 255) %%;\
    /IF (la2_index1 >= {3}) \
      /IF ( (la2_i2F = 0) & (la2_index2 >= {4}) )\
        /test la2_i2F := 1 %%;\
      /ENDIF %%;\
      /IF (la2_i2F = 1) \
        /test echo(strcat(la2_name, '[', la2_index1, '][', la2_index2, '] :=', get_2array(la2_name, la2_index1, la2_index2))) %%;\
      /ENDIF %%;\
    /ENDIF %;\
  /quote -S /test list_2array2("`"/listvar -s _%1_array_*"", {1}, {2}, {3}) %;\
  /undef list_2array2
;--------------------------------------------------------------------------
;
;GET array count / GET 2array count
; Written by: Ian Leisk who may actually be "Galvin", but, may not (kairo at attbi dot com)!
;usage:
;get_array_count("Array name here", start)
;get_2array_count("Array name here", index, start)
;
;NOTE:
;These will count the number of elements starting at "start" till the first
;empty element.
;Get_array2_count will count the number of elements starting at index
;from "start"
;--------------------------------------------------------------------------

/def get_array_count = \
  /test GA_Name := {1} %;\
  /test GA_Count := {2} - 1 %;\
  /test GA_Element := " " %;\
  /while (strlen(GA_Element) > 0) \
    /test ++GA_Count %;\
    /test GA_Element := get_array(GA_Name, GA_Count) %;\
  /DONE %;\
  /return GA_Count - 1

/def get_2array_count = \
  /test GA2_Name := {1} %;\
  /test GA2_Index := {2} %;\
  /test GA2_Count := {3} -1 %;\
  /test GA2_Element := " " %;\
  /while (strlen(GA2_Element) > 0) \
    /test ++GA2_Count %;\
    /test GA2_Element := get_2array(GA2_Name, GA2_Index, GA2_Count) %;\
  /DONE %;\
  /return GA2_Count - 1

;========================================================================
; tfwrite_array() / tfwrite_2array()
;
; Writes a virtual array to a disk file.
; USAGE:
; tfwrite_array(file_variable, "array_name", start_index, size)
; tfwrite_2array(file_variable, "array_name", index, start_index, size)
;
; file_variable : File variable of a tfopened file.
; "array_name"  : Name of the array.
; start_index   : The element you want to start writing from.
; index         : Start_index of index [first dimension] (tfwrite_2array only)
; Size          : Number of elements to write.
;
; NOTES: tfwrite_2array() can't write the whole array to disk.  You must
;        write each dimension at a time.
;========================================================================
/def tfwrite_array = \
  /let file_ %{1} %;\
  /let array_ %{2} %;\
  /let start_ %{3} %;\
  /let size_ %{4} %;\
  /let count_ 0 %;\
  /WHILE (++count_ <= size_) \
    /test tfwrite(file_, get_array(array_, start_)) %;\
    /test ++start_ %;\
  /DONE

/def tfwrite_2array = \
  /let file_ %{1} %;\
  /let array_ %{2} %;\
  /let index_ %{3} %;\
  /let start_ %{4} %;\
  /let size_ %{5} %;\
  /let count_ 0 %;\
  /WHILE (++count_ <= size_) \
    /test tfwrite(file_, get_2array(array_, index_, start_)) %;\
    /test ++start_ %;\
  /DONE

;========================================================================
; tfread_array() / tfread_2array()
;
; reads an array file from disk
; USAGE:
; x := tfread_array(file_variable, "array_name", start_index, size)
; x := tfread_2array(file_variable, "array_name", index, start_index, size)
;
; x             : Number of records read.
; file_variable : File variable of a tfopened file.
; "array_name"  : Name of the array.
; start_index   : Starting element you want to read into.
; index         : Start_index of index [first dimension] (tfread_2array only)
; size          : Number of elements to read.
;========================================================================
/def tfread_array = \
  /let file_ %{1} %;\
  /let array_ %{2} %;\
  /let start_ %{3} %;\
  /let size_ %{4} %;\
  /let count_ 0 %;\
  /let done_ 0 %;\
  /let err_ 0 %;\
  /let st_ 0 %;\
  /test st_ := '' %;\
  /WHILE (!done_) \
    /test err_ := tfread(file_, st_) %;\
    /IF ( (err_ != -1) & (count_ < size_) ) \
      /test put_array(array_, start_, st_) %;\
      /test ++count_ %;\
      /test ++start_ %;\
    /ELSE \
      /test done_ := 1 %;\
    /ENDIF %;\
  /DONE %;\
  /RETURN count_

/def tfread_2array = \
  /let file_ %{1} %;\
  /let array_ %{2} %;\
  /let index_ %{3} %;\
  /let start_ %{4} %;\
  /let size_ %{5} %;\
  /let count_ 0 %;\
  /let done_ 0 %;\
  /let err_ 0 %;\
  /let st_ 0 %;\
  /test st_ := '' %;\
  /WHILE (!done_) \
    /test err_ := tfread(file_, st_) %;\
    /IF ( (err_ != -1) & (count_ < size_) ) \
      /test put_2array(array_, index_, start_, st_) %;\
      /test ++count_ %;\
      /test ++start_ %;\
    /ELSE \
      /test done_ := 1 %;\
    /ENDIF %;\
  /DONE %;\
  /RETURN count_

;========================================================================
; strstr_array() / strstr_2array()
;
; Searches for a value in a virtual array and returns what element its found in.
; NOTE: This only checks all the items in a single array record. 
;
; USAGE:
; x := strstr_array("array_name", start_index, size, value)
; x := strstr_2array("array_name", index, start_index, size, value)
;
; x             : Element of "array_name" that value was found in.
;                 -1 is returned if value was not found.
; "array_name"  : Name of the array.
; start_index   : Element to start searching at
; index         : Start_index of index [first dimension] (strstr_2arrat only).
; size          : Number of elements to search.
; value         : The item your searching for.
;
; NOTES: Strstr_2array can't search all dimensions, 
;        you must search each dimension at a time.
;        If value = "" then it will return the first element that is blank.
;========================================================================
/def strstr_array = \
  /let array_ %{1} %;\
  /let start_ %{2} %;\
  /let size_ %{3} %;\
  /let value_ 0 %;\
  /test value_ := {4} %;\
  /let count_ 0 %;\
  /let pos_ 0 %;\
  /let st_ 0 %;\
  /test st_ := '' %;\
  /let element_ -1 %;\
  /WHILE ( (++count_ <= size_) & (element_ = -1) ) \
    /test st_ := get_array(array_, start_) %;\
    /IF (value_ =~ '') \
      /IF (st_ =~ '') \
        /test element_ := start_ %;\
      /ENDIF %;\
    /ELSE \
      /test pos_ := strstr(st_, value_) %;\
      /IF (pos_ > -1) \
        /test element_ := start_ %;\
      /ENDIF %;\
    /ENDIF %;\
    /test ++start_ %;\
  /DONE %;\
  /RETURN element_

/def strstr_2array = \
  /let array_ %{1} %;\
  /let index_ %{2} %;\
  /let start_ %{3} %;\
  /let size_ %{4} %;\
  /let value_ 0 %;\
  /test value_ := {5} %;\
  /let count_ 0 %;\
  /let pos_ 0 %;\
  /let st_ 0 %;\
  /let element_ -1 %;\
  /test st_ := '' %;\
  /WHILE ( (++count_ <= size_) & (element_ = -1) ) \
    /test st_ := get_2array(array_, index_, start_) %;\
    /IF (value_ =~ '') \
      /IF (st_ =~ '') \
        /test element_ := start_ %;\
      /ENDIF %;\
    /ELSE \
      /test pos_ := strstr(st_, value_) %;\
      /IF (pos_ > -1) \
        /test element_ := start_ %;\
      /ENDIF %;\
    /ENDIF %;\
    /test ++start_ %;\
  /DONE %;\
  /RETURN element_

;========================================================================
; searchstr_2array()
;
; Searches for a value in all dimensions of a virtual array and returns
; each array record its found in. Multiple matches are put into a 
; space-delimited list
;
; Modified by Regan @ Many MU's
;
; USAGE:
; x := searchstr_2array("array_name", index, start_index, size, value)
;
; x             : Element of "array_name" that value was found in.
;                 -1 is returned if value was not found.
; "array_name"  : Name of the array.
; start_index   : Element to start searching at
; index         : Start_index of index [first dimension] (searchstr_2array only).
; size          : Number of elements to search.
; value         : The item your searching for.
;
;        If value = "" then it will return the first element that is blank.
;========================================================================

/def searchstr_2array = \
  /let array_ %{1} %;\
  /let index_ %{2} %;\
  /let start_ %{3} %;\
  /let size_ %{4} %;\
  /let value_ 0 %;\
  /test value_ := {5} %;\
  /let count_ 0 %;\
  /let pos_ 0 %;\
  /let st_ 0 %;\
  /let element_ -1 %;\
  /test blank_ := ' ' %;\
  /test list_ := '' %;\
  /test st_ := '' %;\
  /WHILE (++count_ <= size_) \
    /test st_ := get_2array(array_, start_, index_) %;\
    /IF (value_ =~ '') \
      /IF (st_ =~ '') \
        /test element_ := start_ %;\
        /IF (list_ =~ '') \
          /test list_ := element_ %;\
        /ELSE \
          /test temp_ := strcat(list_, blank_) %:\
          /test list_ := strcat(temp_, element_) %;\
        /ENDIF %;\
      /ENDIF %;\
    /ELSE \
      /test pos_ := strstr(st_, value_) %;\
      /IF (pos_ > -1) \
        /test element_ := start_ %;\
        /IF (list_ =~ '') \
          /test list_ := element_ %;\
        /ELSE \
          /test temp_ := strcat(list_, blank_) %;\
          /test list_ := strcat(temp_, element_) %;\
        /ENDIF %;\
      /ENDIF %;\
    /ENDIF %;\
    /test ++start_ %;\
  /DONE %;\
  /RETURN list_

;==============================================================================
; chr2chr()
;
; Changes one character to difference character in a string
; USAGE:
; x := chr2chr("string", "searchchar", "changechar")
;
; x           : contains "string" with all "." as "_".
; "string"    : any string.
; "searchar"  : The character to be changed in "string".
; "changechar : The character to replace each occrance of "searchar" in
;               "string"."
;==============================================================================
/def chr2chr = \
  /let st_ 0 %;\
  /test st_ := {1} %;\
  /let searchchar_ 0 %;\
  /test searchchar_ := {2} %;\
  /let changechar_ 0 %;\
  /test changechar_ := {3} %;\
  /let pos_ -1 %;\
  /let pos2_ 0 %;\
  /let done_ 0 %;\
  /WHILE (!done_) \
    /test pos2_ := pos_ %;\
    /test pos_ := strchr(substr(st_, pos_ + 1), searchchar_) %;\
    /IF (pos_ > -1) \
      /test pos_ := pos_ + pos2_ + 1 %;\
      /IF (substr(st_, pos_, 1) =~ searchchar_) \
        /test st_ := strcat(substr(st_, 0, pos_), changechar_, substr(st_, pos_ + 1)) %;\
      /ENDIF %;\
    /ELSE \
      /test done_ := 1 %;\
    /ENDIF %;\
  /DONE %;\
  /RETURN st_

;==============================================================================
; tfwrite_vars()
; Write variables to a disk file.
; USAGE:
; x := tfwrite_vars("variables", "matching", file_variable)
;
; x             : Number of variables written to disk.
; "variables"   : A string matching the variables you want to write to disk.
; "matching"    : "simple": straightforward string comparison.
;                 "glob"  : shell-like matching (as before version 3.2).
;                 "regexp": regular expression.
;                 ""      : defaults to "glob"
; file_variable : File variable of a tfopened file.
;
; EXAMPLES:
; /set movie_title lord of the rings
; /set movie_year 2001
; /set movie_length 2 hours 59 min
; /test file_ := tfopen("movies.dat", "w")
; /test tfwrite_vars("movie_*", "glob", file_)
; /test tfclose(file_)
;
; This will write all 3 variables to disk.
;
; NOTES: The variables must be global variables made with /set or
;        /test var := value.
;==============================================================================
/def tfwrite_vars = \
  /let vars_ %{1} %;\
  /let matching_ 0 %;\
  /test matching_ := {2} %;\
  /IF (matching_ =~ '') \
    /test matching_ := "glob" %;\
  /ENDIF %;\
  /let file_ %{3} %;\
  /let count_ 0 %;\
  /def tfwrite_vars2 = \
    /let var_ %%{1} %%;\
    /test ++count_ %%;\
    /test echo(strcat('::',$$[var_],'::')) %%;\
    /test tfwrite(file_, strcat(':',var_,'=',$$[var_], ':')) %;\
  /quote -S /test tfwrite_vars2("`"/listvar -m$[matching_] -s $[vars_]"") %;\
  /undef tfwrite_vars2 %;\
  /return count_

;==============================================================================
; tfread_vars()
; Reads variables to a from a disk file that was written by tfwrite_vars()
; USAGE:
; x := tfread_vars(file_variable)
;
; x             : number of variables read.
; file_variable : File variable of a tfopened file.
;
; EXAMPLES:
;
; /test file_ := tfopen("movies.dat", "r")
; /test tfread_vars(file_)
; /test tfclose(file_)
;
; Now the variables will be set to the same values as shown in the
; tfwrite_vars() examples.
;
; NOTE: The variables do not have to exist prior to reading since they're
;       already written in the file by tfwrite_vars()
;==============================================================================
/def tfread_vars = \
  /let file_ %{1} %;\
  /let done_ 0 %;\
  /let st_ 0 %;\
  /let pos_ 0 %;\
  /let var_ 0 %;\
  /let value_ 0 %;\
  /let err_ 0 %;\
  /let count_ 0 %;\
  /WHILE (!done_) \
    /test err_ := tfread(file_, st_) %;\
    /IF (err_ != -1) \
      /test ++count_ %;\
      /test st_ := substr(st_, 1, strlen(st_) - 2) %;\
      /test pos_ := strstr(st_, '=') %;\
      /test var_ := substr(st_, 0, pos_) %;\
      /test value_ := substr(st_, pos_ +1) %;\
      /eval /test $[var_] := value_ %;\
    /ELSE \
      /test done_ := 1 %;\
    /ENDIF %;\
  /DONE %;\
  /RETURN count_

;==============================================================================
; push_stack()
;
; Adds a value on to a virtual stack which then can be popped using
; pop_stack_first() or pop_stack_last()
; USAGE:
; err := push_stack("stack_name", value)
;
; "stack_name" : Name of the stack.
; value        : Numeric or string.
; err          : returns 0 if stack is full. Returns 1 for success.
;
; EXAMPLES:
; /test push_stack('bags', 'bag1')
; /test echo(pop_stack_last('bags'))
; This will display 'bag1' on the screen.
;==============================================================================
/def push_stack = \
  /let ss_ 0 %;\
  /let ssm_ 0 %;\
  /let sei_ 0 %;\
  /test ss_ := _stack_%1_size %;\
  /test ssm_ := _stack_%1_size_max %;\
  /test sei_ := _stack_%1_end_index %;\
  /IF (ss_ < ssm_) \
    /test ++ss_ %;\
    /test _stack_%1_%{sei_} := strcat({2}) %;\
    /test _stack_%1_size := ss_ %;\
    /test _stack_%1_size_max := ssm_ %;\
    /IF (++sei_ > ssm_) \
      /test sei_ := 1 %;\
    /ENDIF %;\
    /test _stack_%1_end_index := sei_ %;\
    /RETURN 1 %;\
  /ELSE \
    /RETURN 0 %;\
  /ENDIF

;==============================================================================
; pop_stack_first()
; Returns the value that was first added to the stack with push_stack() and
; then removes the value from the stack.
; USAGE:
; x := pop_stack_first("stack_name")
;
; "stack_name" : Name of the stack.
; x            : Can be numerical or string.  Contains the item that was pushed
;                on to the stack with push_stack()
; TIP: use stack_empty() to check for empty stack prior to popping.
;      pop_stack_first() will not tell you if the stack is empty or not.
;==============================================================================
/def pop_stack_first = \
  /let ss_ 0 %;\
  /let ssm_ 0 %;\
  /let ssi_ 0 %;\
  /let st_ 0 %;\
  /test ss_ := _stack_%1_size %;\
  /test ssm_ := _stack_%1_size_max %;\
  /test ssi_ := _stack_%1_start_index %;\
  /IF (ss_ > 0) \
    /test --ss_ %;\
    /test st_ := _stack_%1_%{ssi_} %;\
    /unset _stack_%1_%{ssi_} %;\
    /IF (++ssi_ > ssm_) \
      /test ssi_ := 1 %;\
    /ENDIF %;\
    /test _stack_%1_size := ss_ %;\
    /test _stack_%1_size_max := ssm_ %;\
    /test _stack_%1_start_index := ssi_ %;\
    /RETURN st_ %;\
  /ENDIF %;\

;==============================================================================
; pop_stack_last()-
;
; Returns the value that was last added to the stack with push_stack() and then
; removes the value from the stack.
; USAGE:
; x := pop_stack_last("stack_name")
;
; "stack_name" : Name of the stack.
; x            : Can be numerical or string.  Contains the item that was pushed
;                on to the stack with push_stack()
;
; TIP: use stack_empty() to check for empty stack prior to popping.
;      pop_stack_last() will not tell you if the stack is empty or not.
;==============================================================================
/def pop_stack_last = \
  /let ss_ 0 %;\
  /let ssm_ 0 %;\
  /let sei_ 0 %;\
  /let st_ 0 %;\
  /test ss_ := _stack_%1_size %;\
  /test ssm_ := _stack_%1_size_max %;\
  /test sei_ := _stack_%1_end_index %;\
  /IF (ss_ > 0) \
    /test --ss_ %;\
    /IF (--sei_ < 1) \
      /test sei_ := ssm_ %;\
    /ENDIF %;\
    /test _stack_%1_size := ss_ %;\
    /test _stack_%1_size_max := ssm_ %;\
    /test _stack_%1_end_index := sei_ %;\
    /test st_ := _stack_%1_%{sei_} %;\
    /unset _stack_%1_%{sei_} %;\
    /RETURN st_ %;\
  /ENDIF

;==============================================================================
; stack_size()
;
; Returns how many items are currently on the stack
; USAGE:
; x := stack_size("stack_name")
;
; "stack_name" : Name of the stack.
; x            : Numerical value. number of items currently on the stack
;==============================================================================
/def stack_size = \
  /eval /RETURN _stack_%1_size * 1

;==============================================================================
; stack_empty()
;
; Tells you if the stack if empty or not.
; USAGE:
; x := stack_empty("stack_name")
;
; "stack_name" : Name of the stack.
; x            : 0 = stack not empty.  1 = stack is empty
;==============================================================================
/def stack_empty = \
  /eval /RETURN (_stack_%1_size == 0)

;==============================================================================
; init_stack()
;
; Creates a new stack with a name
; USAGE:
; init_stack("stack_name", max_size)
;
; "stack_name" : Name of the new stack being created.
; max_size     : Max number of items you wish there to be in the stack
;
; NOTES:  Its best to always use init_stack() prior to using any stack functions
;         Setting size to 0 will default to 2 billion for a size.
;==============================================================================
/def init_stack = \
  /test purge_stack({1}) %;\
  /test _stack_%1_start_index := 1 %;\
  /test _stack_%1_end_index := 1 %;\
  /test _stack_%1_size := 0 %;\
  /IF ({2} == 0) \
    /test _stack_%1_size_max := 2000000000 %;\
  /ELSE \
    /test _stack_%1_size_max := %2 %;\
  /ENDIF

;==============================================================================
; purge_stack()
;
; Purges a virtual stack created by push_stack()
; USAGE:
; purge_stack("stack_name")
;
; "stack_name" : Name of the stack to purge.
;
; NOTES: _*_start_index - Keeps track of the first item pushed
;        _*_end_index   - Keeps track of the last item pushed
;        _*_size        - Keeps track of how many items in the stack
;        _*_size_max    - Total number of items that are allowed to be in
;                         the stack
;==============================================================================
/def purge_stack = \
  /IF ({1} !~ '') \
    /quote -S /unset `/listvar -mglob -s _stack_%1* %;\
  /ENDIF

;========================================================================
; list_stack()
;
; List the stack in an easy to read format.
; USAGE:
; list_stack("stack_name", startindex)
; /list_stack <stack_name> <startindex>
;
; "stack_name" : Name of the stack you want to list. (function form only)
; startindex   : Starting element in the stack you want to list from.
;========================================================================
/def list_stack = \
  /let name_ %{1} %;\
  /let startindex_ 0 %;\
  /test startindex_ := {2} %;\
  /let index_ 0 %;\
  /def list_stack2 = \
    /let rawname_ %%{1} %%;\
    /test index_ := substr(rawname_, strlen(name_) + 8, 256) %%;\
    /IF (index_ >= startindex_) \
      /eval /test echo(strcat(name_, '[', index_, '] :=', _stack_%%{name_}_%%{index_})) %%;\
    /ENDIF %;\
  /quote -S /test list_stack2("`"/listvar -mglob -s _stack_%1_*"") %;\
  /undef list_stack2

;==============================================================================
; delay()
;
; Delays an X number of seconds before returning.
; USAGE:
; delay(seconds)
;==============================================================================
/def delay = \
  /let seconds_ %{1} %;\
  /let ctime_ 0 %;\
  /test ctime_ := get_time(0) %;\
  /WHILE ( (get_time(0) - ctime_) < seconds_ ) \
  /DONE

;==============================================================================
; get_time()
;
; returns hours, minutes, seconds in integer format
; USAGE:
; x := get_time(0)
; x := get_time(raw_time)
;
; x        : Time in seconds.
; 0        : Current time in seconds returned.
; raw_time : Raw time, raw time gets passed back from tinyfugue's time() function.
;            This will get converted to seconds.
;==============================================================================
/def get_time = \
  /let st_ 0 %;\
  /let hours_ 0 %;\
  /let min_ 0 %;\
  /let sec_ 0 %;\
  /IF ({*} = 0) \
    /test st_ := ftime('%%H:%%M:%%S', time()) %;\
  /ELSE \
    /test st_ := ftime('%%H:%%M:%%S', {*}) %;\
  /ENDIF %;\
  /test hours_ := substr(st_, 0, 2) %;\
  /test min_ := substr(st_, 3, 2) %;\
  /test sec_ := substr(st_, 6, 2) %;\
  /return time2sec(hours_, min_, sec_)

;==============================================================================
; time2sec()
;
; converts hours, min, sec to total seconds
; USAGE:
;
; x := time2sec(hours, min, sec)
;
; x      : The total time in seconds of hours, min, sec.
; hours  : Can range from 0 to 23.
; min    : Can range from 0 to 59.
; sec    : Can range from 0 to 59.
;==============================================================================
/def time2sec = \
  /let h_ %{1} %;\
  /let m_ %{2} %;\
  /let s_ %{3} %;\
  /return h_ * 3600 + m_ * 60 + s_

;==============================================================================
; sec2time()
;
; converts total seconds back into hours, min, sec
; USAGE:
; sec2time("time_rec", seconds)
;
; "time_rec" : Contains the hours, min, seconds passed back.
;              get_rec("time_rec", "hours") = hours.
;              get_rec("time_rec", "min") = minutes.
;              get_rec("time_rec", "sec") = seconds.
; seconds    : Value in seconds.
;
; NOTES: "time_rec" can be any record name you want.
;        If "" is specified for "time_rec" then no record gets used. See how this
;        is used in sec2clock.  Local vars are set in calling function to get
;        back the values from this function.
;==============================================================================
/def sec2time = \
  /let rec_ 0 %;\
  /test rec_ := {1} %;\
  /let int_ %{2} %;\
  /IF (rec_ !~ '') \
    /let hours_ 0 %;\
    /let min_ 0 %;\
    /let sec_ 0 %;\
  /ENDIF %;\
  /test hours_ := int_ / 3600 %;\
  /let rem_ $[int_ - (hours_ * 3600)] %;\
  /test min_ := rem_ / 60 %;\
  /test rem_ := rem_ - (min_ * 60) %;\
  /test sec_ := rem_ %;\
  /IF (rec_ !~ '') \
    /test del_rec(rec_, '') %;\
    /test add_rec(rec_, 'hours', hours_) %;\
    /test add_rec(rec_, 'min', min_) %;\
    /test add_rec(rec_, 'sec', sec_) %;\
  /ENDIF

;==============================================================================
; sec2clock()
;
; similar to sec2time except it turns seconds into a clock reading AM/PM
; USAGE:
; x := sec2clock(value)
;
; x     : Time returned formatted in ##:##pm.  Example : "3:04am"
; value : Total seconds of time ranging over a 24 hour period.
;==============================================================================
/def sec2clock = \
  /let rawtime_ %{1} %;\
  /let hours_ 0 %;\
  /let min_ 0 %;\
  /let sec_ 0 %;\
  /let pm_ 0 %;\
  /let st_ 0 %;\
  /test sec2time('', rawtime_) %;\
  /IF (min_ <= 9) \
    /test min_ := strcat('0', min_) %;\
  /ENDIF %;\
  /IF (rawtime_ > 12 * 3600) \
    /test pm_ := 1 %;\
    /test hours_ := hours_ - 12 %;\
  /ELSE \
    /test pm_ := 0 %;\
  /ENDIF %;\
  /test st_ := strcat(hours_, ':', min_) %;\
  /IF (pm_) \
    /test st_ := strcat(st_, 'pm') %;\
  /ELSE \
    /test st_ := strcat(st_, 'am') %;\
  /ENDIF %;\
  /return st_

;==============================================================================
; num2commas()
;
; returns a number formatted with comma's
; USAGE:
; x := num2commas(value)
;
; x     : Value returned with commas. Example 1,345 from 1345.
; value : Any number.
;==============================================================================
/def num2commas = \
  /let st_ %{1} %;\
  /let count_ $[strlen(st_)] %;\
  /let count2_ 0 %;\
  /let st2_ 0 %;\
  /test st2_ := '' %;\
  /WHILE (--count_ >= 0) \
    /IF ( (count2_ = 3) & (substr(st_, count_, 1) !~ '-') ) \
      /test st2_ := strcat(',', st2_) %;\
      /test count2_ := 0 %;\
    /ENDIF %;\
    /test st2_ := strcat(substr(st_, count_, 1), st2_) %;\
    /test ++count2_ %;\
  /DONE %;\
  /return st2_

;==============================================================================
; send_macro()
;
; Sends a macro to tinyfugue
; USAGE:
; send_macro("macro")
;
; "macro"   : A tinyfugue macro like "/help"
;
; NOTES: If "macro" doesn't begin with a "/" it will send it to the world you're
;        currently connected to.
;==============================================================================
/def send_macro = \
  /def send_macro2 = \
    %* %;\
  /send_macro2 %;\
  /undef send_macro2

;==============================================================================
; strip_space()
;
; Strips all leading spaces from a string.
; USAGE:
; x := strip_space("string")
;
; x        : Returned "string" with no leading spaces.
; "string" : Any string
;==============================================================================
/def strip_space = \
  /let st_ 0 %;\
  /test st_ := {1} %;\
  /let st2_ 0 %;\
  /let count_ -1 %;\
  /test st2_ := '' %;\
  /WHILE (++count_ <= strlen(st_) & substr(st_, count_, 1) =~ ' ') \
  /DONE %;\
  /return substr(st_, count_, 255)

;==============================================================================
; strip_right()
;
; Strips all trailing spaces from a string.
; USAGE:
; x := strip_right("string")
;
; x        : Returned "string" with no leading spaces.
; "string" : Any string
;==============================================================================
/def strip_right = \
  /let st_=%* %;\
  /RETURN st_

;==============================================================================
; parse_string()
;
; This function will parse a string by the separator you choose and place the
; elements back into an array of your choosing.
; USAGE:
; parse_string("array", "sep", "string")
;
; "array"  : get_array("data", 0) = number of elements returned.
;            get_array("data", 1, 2, 3..) = "string" parsed out.
; "sep"    : The divider of elements in string.
; "string" : The string you want parsed.
;
; EXAMPLE:
; parse_string("data", " ", "hp(45/100) sp(450/500)")
;
; get_array("data", 0) = 2
; get_array("data", 1) = "hp(45/100)"
; get_array("data", 2) = "sp(450/500)"
;==============================================================================
/def parse_string = \
  /let array_ %{1} %;\
  /let sep_ 0 %;\
  /test sep_ := {2} %;\
  /let data_ 0 %;\
  /test data_ := {3} %;\
  /let count_ -1 %;\
  /let parcount_ 0 %;\
  /let ch_ 0 %;\
  /let st_ 0 %;\
  /let len_ 0 %;\
  /test ch_ := '' %;\
  /test st_ := '' %;\
  /test len_ := strlen(data_) %;\
  /test purge_array(array_) %;\
  /WHILE (++count_ <= len_) \
    /test ch_ := substr(data_, count_, 1) %;\
    /IF ( (ch_ =~ sep_) | (count_ = len_) ) \
      /test ++parcount_ %;\
      /test put_array(array_, parcount_, st_) %;\
      /test st_ := '' %;\
    /ELSE \
      /test st_ := strcat(st_, ch_) %;\
    /ENDIF %;\
  /DONE %;\
  /test put_array(array_, 0, parcount_)

;==============================================================================
; search_literal()
;
; Search for a character in a string of characters.  Characters will be skipped
; in the string that start with a literal-switch.  The position of the character
; found will be based on the string returned with no literal switches.
; USAGE:
; x := search_literal("data", "string", char, litchar)
;
; x         : Position of char in "string". -1 returned if nothing found.
; "data"    : Record that contains the following:
;             /rec :data.pos:    = position
;             /rec :data.st:     = "string" with no literal switches.
; "string"  : String being searched.
; char      : Char to search for in "string" skipping literal switches.
; litchar   : The literal-switch of your choosing.
;
; EXAMPLES:
; x := search_literal("data", "/A/C/car/rocks", "c", "/")
; RETURNS:
; x := 7
; /rec :data.pos:   = 7
; /rec :data.st:    = "ACcarrocks"
;
; NOTES: To use a literal-switch as data in the "data" use two of them in a row.
;        like "\\" would mean "\"
;==============================================================================
/def search_literal = \
  /let rec_ 0 %;\
  /test rec_ := {1} %;\
  /let string_ 0 %;\
  /test string_ := {2} %;\
  /let char_ 0 %;\
  /test char_ := {3} %;\
  /let litchar_ 0 %;\
  /test litchar_ := {4} %;\
  /let string2_ 0 %;\
  /let lastch_ 0 %;\
  /let ch_ 0 %;\
  /let count_ -1 %;\
  /let pos_ -1 %;\
  /let length_ $[strlen(string_)] %;\
  /test string2_ := '' %;\
  /test lastch_ := '' %;\
  /test ch_ := '' %;\
  /WHILE (++count_ <= length_) \
    /test lastch_ := ch_ %;\
    /test ch_ := substr(string_, count_, 1) %;\
    /IF (ch_ =~ litchar_) \
      /IF (substr(string_, count_ + 1, 1) =~ litchar_) \
        /test string2_ := strcat(string2_, litchar_) %;\
        /test ++count_ %;\
      /ENDIF %;\
    /ELSE \
      /IF ( (lastch_ !~ litchar_) & (ch_ =~ char_) & (pos_ = -1) ) \
        /test pos_ := strlen(string2_) %;\
      /ENDIF %;\
      /test string2_ := strcat(string2_, ch_) %;\
    /ENDIF %;\
  /DONE %;\
  /test del_rec(rec_, '') %;\
  /test add_rec(rec_, 'pos', pos_) %;\
  /test add_rec(rec_, 'st', string2_) %;\
  /RETURN pos_

;==============================================================================
; find_string()
;
; Finds a string within a string and return the starting position, end
; position and length in a virtual array.
; USAGE:
; x := find_string("pos", "string", "search", stringpos, skip)
;
; x          : -1 no string found, 1 string found.
; "pos"      : Position data returned in a record.
;              /rec :pos.found:        = 1 if string found -1 if not found.
;              /rec :pos.st:           = search data found.
;              /rec :pos.start:        = starting location in "string".
;              /rec :pos.end:          = ending location in "string".
;              /rec :pos.len:          = length of sub string found.
; "string"   : String being searched.
; "search"   : String your searching for.
; stringpos  : Position in string to start searching at.
; skip       : Number of matches to skip before returning a real match.
;
; EXAMPLES:
; find_string("pos", "Status is currently 45.65 degrees", "y * d", 0, 0)
; RETURNS:
; /rec :pos.found:        = 1           {string found}
; /rec :pos.st:           = "y 45.65 d" {actual data found}
; /rec :pos.start:        = 18          {starting position}
; /rec :pos.end:          = 26          {ending position}
; /rec :pos.len:          = 9           {length}
;
; To pull out just the 45.65 in the example above you would need to do:
; find_string("pos", "Status is currently 45.65 degrees", "y (*) d", 0, 0)
;
; NOTES: Anything in () is returned, you can only have one set of () and
;        one "*" in your search.  Use ~( ~) ~* if you want that as part of
;        your search data. When using () with *, the * must be inside the
;        () or you may get strange results.
;==============================================================================
/def find_string2 = \
  /let string_ 0 %;\
  /test string_ := {1} %;\
  /let search_ := 0 %;\
  /test search_ := {2} %;\
  /let skip_ %{3} %;\
  /let searchl_ $[strlen(search_)] %;\
  /let count_ 0 %;\
  /let count2_ 0 %;\
  /let done_ 0 %;\
  /let pos_ 0 %;\
  /let pos2_ 0 %;\
  /WHILE (!done_) \
    /test pos_ := strstr(string_, search_) %;\
    /IF (pos_ > -1) \
      /test ++count2_ %;\
      /IF (count2_ > skip_) \
        /test pos_ := pos2_ + pos_ %;\
        /test done_ := 1 %;\
      /ELSE \
        /test string_ := substr(string_, pos_ + searchl_) %;\
        /test pos2_ := pos2_ + pos_ + searchl_ %;\
      /ENDIF %;\
    /ELSE \
      /test done_ := 1 %;\
    /ENDIF %;\
  /DONE %;\
  /IF (count2_ <= skip_) \
    /test pos_ := -1 %;\
  /ENDIF %;\
  /RETURN pos_

/def find_string3 = \
  /let string_ 0 %;\
  /test string_ := {1} %;\
  /let searchL_ 0 %;\
  /test searchL_ := {2} %;\
  /let searchR_ 0 %;\
  /test searchR_ := {3} %;\
  /let skip_ %{4} %;\
  /let count_ 0 %;\
  /let count2_ 0 %;\
  /let done_ 0 %;\
  /let posL_ 0 %;\
  /let posR_ 0 %;\
  /let pos2_ 0 %;\
  /WHILE (!done_) \
    /test posL_ := strstr(string_, searchL_) %;\
    /IF (posL_ > -1) \
      /test string_ := substr(string_, posL_ + strlen(searchL_)) %;\
      /test posR_ := strstr(string_, searchR_) %;\
      /IF (posR_ > -1) \
        /test ++count2_ %;\
        /IF (count2_ > skip_) \
          /test length_ := posR_ + strlen(searchL_) + strlen(searchR_) %;\
          /test pos_ := pos2_ + posL_ %;\
          /test done_ := 1 %;\
        /ELSE \
          /test pos2_ := pos2_ + posL_ + strlen(searchL_) %;\
        /ENDIF %;\
      /ELSE \
        /test done_ := 1 %;\
      /ENDIF %;\
    /ELSE \
      /test done_ := 1 %;\
    /ENDIF %;\
  /DONE %;\
  /IF (count2_ <= skip_) \
    /test pos_ := -1 %;\
  /ENDIF %;\
  /RETURN pos_

/def find_string = \
  /let rec_ 0 %;\
  /test rec_ := {1} %;\
  /let string_ 0 %;\
  /test string_ := {2} %;\
  /let search_ 0 %;\
  /test search_ := {3} %;\
  /let stringpos_ %{4} %;\
  /let skip_ 0 %;\
  /test skip_ := {5} %;\
  /let found_ -1 %;\
  /let pos_ -1 %;\
  /let pos2_ 0 %;\
  /let end_ 0 %;\
  /let length_ 0 %;\
  /let left_ 0 %;\
  /let right_ 0 %;\
  /let st_ 0 %;\
  /let searchL_ 0 %;\
  /let searchR_ 0 %;\
  /test right_ := 0 %;\
  /test st_ := '' %;\
  /test searchL_ := '' %;\
  /test searchR_ := '' %;\
  /test string_ := substr(string_, stringpos_) %;\
  /IF (search_ !~ '') \
    /IF ( (search_ =~ '*') | (search_ =~ "(*)") ) \
      /IF ( (skip_ = 0) & (string_ !~ '') )\
        /test found_ := 1 %;\
        /test pos_ := 0 %;\
        /test end_ := strlen(string_) - 1 %;\
        /test length_ := end_ + 1 %;\
        /test st_ := string_ %;\
      /ENDIF %;\
    /ELSE \
      /test del_rec(rec_, '') %;\
      /test left_ := search_literal(rec_, search_, '(', '~') %;\
      /test right_ := search_literal(rec_, search_, ')', '~') %;\
      /test pos2_ := search_literal(rec_, search_, '*', '~') %;\
      /test search_ := get_rec(rec_, 'st') %;\
      /IF (left_ + right_ > 0) \
        /test search_ := strcat(substr(search_, 0, left_), \
          substr(search_, left_ + 1, right_ - left_ - 1), \
          substr(search_, right_ + 1)) %;\
        /test right_ := right_ - 2 %;\
        /IF (pos2_ > -1) \
          /test --pos2_ %;\
        /ENDIF %;\
      /ENDIF %;\
      /IF (pos2_ = -1) \
        /test found_ := find_string2(string_, search_, skip_) %;\
        /IF (found_ > -1) \
          /test pos_ := found_ %;\
          /test length_ := strlen(search_) %;\
          /test end_ := pos_ + length_ - 1 %;\
          /test st_ := search_ %;\
          /test found_ := 1 %;\
          /IF (left_ + right_ > 0) \
            /test length_ := right_ - left_ + 1 %;\
            /test pos_ := pos_ + left_ %;\
            /test end_ := pos_ + right_ - 1 %;\
            /test st_ := substr(string_, pos_, length_) %;\
          /ENDIF %;\
        /ENDIF %;\
      /ELSE \
        /test searchL_ := substr(search_, 0, pos2_) %;\
        /test searchR_ := substr(search_, pos2_ + 1) %;\
        /IF (find_string3(string_, searchL_, searchR_, skip_) > -1) \
          /test found_ := 1 %;\
          /test end_ := pos_ + length_ - 1 %;\
          /test st_ := substr(string_, pos_, length_) %;\
          /IF (left_ + right_ > 0) \
            /test pos_ := pos_ + left_ %;\
            /test end_ := end_ - (strlen(search_) - right_) + 1 %;\
            /test length_ := end_ - pos_ +1 %;\
            /test st_ := substr(string_, pos_, length_) %;\
          /ENDIF %;\
        /ENDIF %;\
      /ENDIF %;\
    /ENDIF %;\
  /ENDIF %;\
  /test del_rec(rec_, '') %;\
  /IF (found_ = 1) \
    /test pos_ := pos_ + stringpos_ %;\
    /test end_ := end_ + stringpos_ %;\
  /ENDIF %;\
  /test add_rec(rec_, 'found', found_) %;\
  /test add_rec(rec_, 'st', st_) %;\
  /test add_rec(rec_, 'start', pos_) %;\
  /test add_rec(rec_, 'end', end_) %;\
  /test add_rec(rec_, 'len', length_) %;\
  /RETURN found_

;==============================================================================
; search_replace()
;
; Searches for a string and replaces each occurrence with a new string.
; USAGE
; x := search_replace("record", "string", "search", "replace", count, skip)
;
; x         : -1 no searches done, >=1 = how many searches were done.
; "record"  : /rec :record.replace:    = How many replaces were done. -1 = none
;             /rec :record.st:         = New string with replaced parts.
; "string"  : String to have parts to be replaced.
; "search"  : Sub string in "string" to be replaced.
; "replace" : New sub string that will replace each "search" string found.
; count     : How many replacements to do. 0 = unlimited.
; skip      : How many matches you want to skip before replacing. 0 = no skip.
;
; EXAMPLES:
; search_replace("search", "Status is currently 45.65 degrees", "y (*) d", "34.2", 0, 0)
; RETURNS:
; /rec :search.replace:      = 1 (1 replacement was done)
; /rec :search.st:           = "Status is currently 32.2 degrees"
;
; NOTES: Anything in () is replaced.  You can only have one set of () and
;        one "*" in your search.  Use ~( ~) ~* if you want that as part of
;        your search data. When using () with *, the * must be inside the
;        () or you may get strange results.
;==============================================================================
/def search_replace = \
  /let rec_ %{1} %;\
  /let string_ 0 %;\
  /test string_ := {2} %;\
  /let search_ 0 %;\
  /test search_ := {3} %;\
  /let replace_ 0 %;\
  /test replace_ := {4} %;\
  /let count_ %{5} %;\
  /let skip_ %{6} %;\
  /let count2_ 0 %;\
  /let pos_ 0 %;\
  /let done_ 0 %;\
  /let start_ 0 %;\
  /let length_ 0 %;\
  /let end_ 0 %;\
  /WHILE (!done_) \
    /IF (find_string(rec_, string_, search_, pos_, skip_) != -1) \
      /IF ( (count2_ < count_) | (count_ = 0) ) \
        /test ++count2_ %;\
        /test skip_ := 0 %;\
        /test start_ := get_rec(rec_, "start") %;\
        /test length_ := get_rec(rec_, "len") %;\
        /test end_ := start_ + length_ %;\
        /test string_ := strcat(substr(string_, 0, start_), \
                                replace_, \
                                substr(string_, end_)) %;\
        /test pos_ := start_ + strlen(replace_) %;\
      /ELSE \
        /test done_ := 1 %;\
      /ENDIF %;\
    /ELSE \
      /test done_ := 1 %;\
    /ENDIF %;\
  /DONE %;\
  /test del_rec(rec_, '') %;\
  /IF (count2_ = 0) \
    /test count2_ := -1 %;\
  /ENDIF %;\
  /test add_rec(rec_, 'replace', count2_) %;\
  /test add_rec(rec_, 'st', string_) %;\
  /RETURN count2_


;<----------------------------------------------------------->
;< <INTERNAL> - used to purge variables
;< Written by: Nokie Quickfingers (jeff at billimek dot com)
;< 01/23/2002
;<----------------------------------------------------------->
/def purge_vars = \
        /let purge_vars=$(/listvar -s %{*})%;\
        /let off=$[strchr(purge_vars," ")]%;\
        /while (off>-1) \
          /unset $[substr(purge_vars,0,off)]%;\
          /let purge_vars=$[substr(purge_vars,off+1)]%;\
          /let off=$[strchr(purge_vars," ")]%;\
        /done%;\
        /unset %purge_vars%;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; $Id: lists.txt,v 1.1 1998/03/03 22:32:11 dittmar Exp dittmar $
;;;
;;; coded by Susan Dittmar 
;;; (dittmar dot ph dash cip dot uni dash koeln dot de), October 1997,
;;; bigger changes January 1998

;;; I'll describe the usage of this little tinyfugue-library with the
;;; syntax of help files. This way, if you use your own help texts with
;;; tinyfugue (like with the /help command by Johan van Selst), you can
;;; just copy this part to your help file, you just have to remove the
;;; semicolons.

;;; The library requires tinyfugue Version 4.0 for the file 
;;; handling part, the rest of the code will work with earlier 
;;; versions too.

;;; &lists
;;;
;;; I wrote these commands to make some triggers much easier.
;;; The commands only keep track of variables which contain items
;;; seperated by '|'. These variables (lists) then can be used for
;;; global maching, like
;;;    /if /test {variable} =/ "{%{list}}" %; /then ...
;;;
;;; For each list there is a variable with the name <list>__count which
;;; counts the number of items in the list. If you only add and remove
;;; single items, this number will be up to date, else it can be
;;; computed.
;;;
;;; the commands are
;;; /addlist <list> <item>    adds <item> to the list if it does not exist                          
;;; /addlist <list>           echos the whole list
;;; addlist <arguments>       executes /addlist with it's arguments and
;;;                           writes the necessary commands to reproduce the
;;;                           list to the file you specified
;;; /remlist <list> <item>    removes <item> from the list if it exists
;;; /remlist <list> -a        clears the whole list
;;; remlist <arguments>       executes /remlist with it's arguments and
;;;                           writes the necessary commands to reproduce the
;;;                           list to the file you specified
;;; /countlist <list>         counts the number of items in the list
;;; /changeListFile <filename>    changes the file for saving lists to a
;;;                           file called <filename>. In case such a file
;;;                           already exists, the new things will be appended,
;;;                           nothing in the file will be lost
;;; /foreach <variable> <list name> <command>    executes a loop. In each
;;;                           turn one item of the list is assigned to the
;;;                           variable <variable>, then the command <command>
;;;                           (this can be a list of commands separated by %;
;;;                           if you need) is executed with this value of
;;;                           the variable <variable>
;;;
;;; /isamember(str, list, n)  return the item number of 'n'th item match that
;;;                           exactly string matches 'str' in 'list'. If no
;;;                           'n'th item match, return 0.
;;;
;;; #change
;;; #changes
;;; 5.1.1998:
;;;   * added the counter <list>__count
;;;   * added /countlist
;;; 22.1.1998:
;;;   * added writing to a file (addlist, remlist, /changeListFile)
;;;   * added command /foreach
;;; 28.1.1998:
;;;   * added the list __LIST, which contains the name of all lists
;;;     which were used
;;; 29.1.1998:
;;;   * added /sortlist <list> command
;;;   * added /saveAllLists command (sorts and then saves all lists stored
;;;     in __LIST)
;;;
;;; 20.2.2014:
;;;   * added Joe Pelkey's isamember() function. 
;;;   * Cleanup work by Jacob Finn (super aardvark at gmail) @ TF mailing list

;;;
;;; #author
;;; #bug
;;; #bugs
;;; #typo
;;; #typos
;;; #suggestion
;;; #suggestions
;;; The commands have been written by Susan Dittmar 
;;; An actual version can be obtained from 
;;; http://www.ph-cip.uni-koeln.de/~dittmar/tf. Please send bug reports 
;;; and suggestions to the author.
;;; 

/require alias.tf

/def addlist = \
    /let list=%1%;\
    /if (list =~ "") /echo %%% you must provide the list name %; /endif %;\
    /let item=%-1%;\
    /if ({list} !~ "__LIST") \
        /if /test {list} !/ "%{__LIST}" %; /then \
            /addlist __LIST %{list} %;\
        /endif %;\
    /endif %;\
    /if (item =~ "") \
        /eval /echo \% List %{list} contains %%{%{list}}%;\
;        /eval /echo /addlist %{list} %%{%{list}}%;\
        /break%;\
    /endif%;\
;    /eval /eval /echo item=%{item}, list=%%{%{list}} %;\
    /eval /eval /if (item =/ "{%%{%{list}}}") \
        /break%%%;\
    /elseif (%{list} =~ "") \
        /set %{list}=%{item}%%%;\
        /set %{list}__count=1%%%;\
    /else \
        /set %{list}=%%{%{list}}|%{item}%%%;\
        /set %{list}__count=$$$[%%{%{list}__count}+1]%%%;\
    /endif



/def remlist =\
    /let list=%1%;\
    /if (list =~ "") \
        /echo %%% you must provide the list name %;\
        /break %;\
    /endif %;\
    /let item=%-1%;\
    /if (item =~ "") \
        /echo \% Use /remlist <list> <item> or /remlist <list> -a for all.%;\
        /break%;\
    /endif%;\
    /eval /eval /if ((item =~ "-a")|(item =~ "%%{%{list}}")) \
        /set %{list}=%%%;\
        /set %{list}__count=0%%%;\
    /elseif (item =/ "{%%{%{list}}}") \
        /set %{list}=$$$(/_lists_remove %%%{item}| %%%{%%{list}})%%%;\
        /set %{list}=$$$(/_lists_remove |%%%{item} %%%{%%{list}})%%%;\
        /set %{list}__count=$$$[%%{%{list}__count}-1]%%%;\
    /endif

/def _lists_remove = \
    /let old=%1%;\
    /let left=%;\
    /let right=%-1%;\
    /while /let i=$[strstr(right, old)]%; /test i >= 0%; /do \
         /test left := strcat(left, substr(right, 0, i), new)%;\
         /test right := substr(right, i + strlen(old))%;\
    /done%;\
    /echo - %{left}%{right}


/def countlist =\
    /let list=%1%;\
    /if (list =~ "") \
        /echo %%% you must provide the list name %;\
        /break %;\
    /endif %;\
    /eval /if ({%{list}} =~ "") \
            /set %{list}__count=0%%;\
            /break %%;\
        /else \
            /set %{list}__count=1%%;\
        /endif %;\
    /eval /let right=%%{%{list}}%%;\
        /while /let i=$$[strchr(right, "|")]%%; /test i >= 0%%; /do \
             /test right := substr(right, i + 1)%%;\
             /eval /set %{list}__count=$$$[%%{%{list}__count}+1]%%;\
        /done

  
/def sortlist =\
    /let list=%1%;\
    /if (list =~ "") \
        /echo %%% you must provide the list name %;\
        /break %;\
    /endif %;\
    /countlist %{list}%;\
    /let countmax=$(/eval /echo - %%{%{list}__count})%;\
    /foreach j %{list} /append_array _list %%{j} %;\
    /sort_array _list %;\
    /remlist %{list} -a %;\
    /let j=1 %;\
    /while (j<=countmax) \
        /eval /addlist %{list} %%{_list__%{j}} %;\
        /test ++j %;\
    /done %;\
    /clear_array _list


/def changeListFile = \
    /if ({#} != 1) \
        /echo -e %%% usage: /changeListFile <filename> %;\
        /break %;\
    /endif %;\
    /test tfclose(_filehandle_lists) %;\
    /set _filehandle_lists=$[tfopen({1},"a")]
    

/alias addlist \
    /if ({#} = 1) \
        /test tfwrite({_filehandle_lists},strcat("/set ",{1},"=",{%{1}})) %;\
    /elseif ({#} > 1) \
        /test tfwrite({_filehandle_lists},strcat("/addlist ",{*})) %;\
    /endif %;\
    /addlist %{*}

/alias remlist \
    /if ({#} >= 2) \
        /test tfwrite({_filehandle_lists},strcat("/remlist ",{*})) %;\
    /endif %;\
    /remlist %{*}



/def foreach = \
    /if ({#} < 3) \
        /echo -e %%% usage: /foreach <variable> <list> <command> %;\
        /break %;\
    /endif %;\
    /if ({1} =~ "__i") \
        /echo -e %%% /foreach: don't use __i as variable %;\
        /break %;\
    /endif %;\
    /let variable=%{1}%;\
    /let list=$(/eval /echo - %%{%{2}})%;\
    /let command=%{-2}%;\
    /while ({list} !~ "") \
        /let __i=$[strstr({list},"|")] %;\
        /if (__i<0) \
            /let %{variable}=%{list} %;\
            /let list=%;\
        /else \
            /let %{variable}=$[substr({list},0,__i)] %;\
            /let list=$[substr({list},__i+1)] %;\
        /endif %;\
        /eval -s0 %{command} %;\
    /done



/def saveAllLists = \
    /sortlist __LIST %;\
    addlist __LIST %;\
    /foreach i __LIST /eval /sortlist %%{i} %%; addlist %%{i} %;\


;;; /isamember() function for pipe-delimited lists cribbed from
;;; a collection of list macros that were the work of Joe Pelkey
;
; isamember(str, list, n)    = return the item number of 'n'th item match that
;                             exactly string matches 'str' in 'list'. If no
;                             'n'th item match, return 0.

/def isamember = \
  /let _str=%; \
  /let _listin=%; \
  /let _nmatch=1%; \
  /let _listleft=%; \
  /test _str := {1}%; \
  /test _listin := {2}%; \
  /test ({#} >= 3) & (({3} > 0) & (_nmatch := trunc({3})))%; \
  /while /test _nmatch > 0%; /do \
     /if /test regmatch(strcat("(?-i)((?:^|\\\\|)", _str, ")(\\\\||$$)"), _listin)%; /then \
      /test (_listleft := strcat(_listleft, {PL}, {P1})), \
        (_listin := strcat({P2}, {PR}))%; \
    /else \
      /return 0%; \
    /endif%; \
    /test _nmatch := (_nmatch - 1)%; \
  /done%; \
  /return (strlen({_listleft}) - strlen(replace("|", "", {_listleft})) + 1)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Random @doings on Individual Worlds using Galvin's array
;
; Using the Virtual Array package, I can randomize @doing messages sent 
; when I connect to any particular world I'm playing on (assuming I have 
; the messages pre-configured into an array for that world).
;
; This useage is keyed to logging in specific worlds (the array varies 
; by world-name). It could easily be modified to work on ANY connected 
; world.
;
; Sample code:
;
;/test put_array('galli_doing', 0, '@doing SORTER: Please feed Reality Monkey!')
;/test put_array('galli_doing', 1, '@doing SORTER: Tallying the flaws.')
;/test put_array('galli_doing', 2, '@doing SORTER: Michiko\'s Lucky Charm.')

/def -p100000 -F -1 -w -h"CONNECT" doing_connect_hook = /redoing

;;; If I don't like the @doing I ended up with, I can call it again with '/redoing'

/def -i -F -w -q redoing = \
  /send -w TFRC: Choosing one of your @doings.%;\
  /test doing_value := get_array('${world_name}_doing',rand(0,get_array_count('${world_name}_doing',0)))%;\
  /repeat -w -1 1 /send -w %{doing_value}%;\
  /repeat -w -1 1 /send -w @pemit me=%{doing_value}

/test put_array('ss_doing', 0, '@doing SINGER: It\'s not easy bein\' green...')
/test put_array('ss_doing', 1, '@doing SINGER: Un-naturally Blonde!')
/test put_array('ss_doing', 2, '@doing SINGER: Cut...Pack...Blow...')
/test put_array('ss_doing', 4, '@doing SINGER: Bring me sugar...')
/test put_array('ss_doing', 5, '@doing SINGER: Cough up love and touch up.')
/test put_array('ss_doing', 6, '@doing SINGER: In *these* shoes?')

/test put_array('galli_doing', 0, '@doing SORTER: Please feed Reality Monkey!')
/test put_array('galli_doing', 1, '@doing SORTER: Tallying the flaws.')
/test put_array('galli_doing', 2, '@doing SORTER: Michiko\'s Lucky Charm.')
/test put_array('galli_doing', 3, '@doing SORTER: @set me=SortRP_OK')

/test put_array('coder_doing', 0, '@doing Code Wiz: Do not poke the Coder!')
/test put_array('coder_doing', 1, '@doing Code Wiz: @TOADs if harassed!')
/test put_array('coder_doing', 2, '@doing Code Wiz: Do not taunt the Coder!')
/test put_array('coder_doing', 3, '@doing Code Wiz: Responds well to chocolate!')
/test put_array('coder_doing', 4, '@doing Code Wiz: Hugs *always* appreciated')
/test put_array('coder_doing', 5, '@doing Code Wiz: ItsNotStupidItsAdvanced')

/test put_array('jamra_doing', 0, '@doing Little Miss Loud!')
/test put_array('jamra_doing', 1, '@doing Little Miss Brightly-Colored!')
/test put_array('jamra_doing', 2, '@doing Little Miss Tattoos!')
/test put_array('jamra_doing', 3, '@doing Little Miss Midwife!')
/test put_array('jamra_doing', 4, '@doing Little Miss Egyptian Dancing Girl!')

/test put_array('git_doing', 0, '@doing Code Wiz: Buttkicking for Goodness!')
/test put_array('git_doing', 1, '@doing Code Wiz: Don\'tTeachMyHamsterToSuckEggs!')
/test put_array('git_doing', 2, '@doing Code Wiz: StepAsideEvil,HeroComingThrough!')
/test put_array('git_doing', 3, '@doing Code Wiz: TheButtsOfEvilAwaitMyBootprint!')
/test put_array('git_doing', 4, '@doing Code Wiz: BooThinksYou\'reJustDucky!')
/test put_array('git_doing', 5, '@doing Code Wiz: Good has no need of low profiles!')
/test put_array('git_doing', 6, '@doing Code Wiz: Go for the eyes, Boo!!!')
/test put_array('git_doing', 7, '@doing Code Wiz: Full plate and packin\' steel!')
/test put_array('git_doing', 8, '@doing Code Wiz: Every hamster has his day!')
/test put_array('git_doing', 9, '@doing Code Wiz: See battle Boo? Run, Boo, RUN!')
/test put_array('git_doing', 10, '@doing Code Wiz: You are as smart as Boo, sometimes!')
/test put_array('git_doing', 11, '@doing Code Wiz: TheBiggerTheyAre,TheHarderIHit!')

/test put_array('cm_doing', 0, '@doing Nice Shoes...')
/test put_array('cm_doing', 1, '@doing A clumsy sot, she is.')
/test put_array('cm_doing', 2, '@doing What does -this- button do? *REDALERT*')
/test put_array('cm_doing', 3, '@doing Let\'s get jiggy wit\' it')
/test put_array('cm_doing', 4, '@doing Now where\'d I leave me brains again?')
/test put_array('cm_doing', 5, '@doing SINGER: I\'m a freak - Touch me.')
/test put_array('cm_doing', 6, '@doing I once met a man from Nantucket...')
/test put_array('cm_doing', 7, '@doing WeAreTheThingsThatWereAndShallBeAgain')
/test put_array('cm_doing', 8, '@doing I\'ll swallow your soul.')
/test put_array('cm_doing', 9, '@doing SINGER: Come get some.')
/test put_array('cm_doing', 10, '@doing Hail to the King baby.')
/test put_array('cm_doing', 11, '@doing Gimme some sugar.')
/test put_array('cm_doing', 12, '@doing It rubs the lotion on its skin.')
/test put_array('cm_doing', 13, '@doing Yeah... Wait... What?')
/test put_array('cm_doing', 14, '@doing *KNOCKKNOCK* Dave?... Dave\'s not here')
/test put_array('cm_doing', 15, '@doing I\'m not even supposed to be here today!')
/test put_array('cm_doing', 16, '@doing ...And we will call it... This Land')
/test put_array('cm_doing', 17, '@doing This is my BOOM stick!')
/test put_array('cm_doing', 18, '@doing Pupils were fixed and dilapidated--')
/test put_array('cm_doing', 19, '@doing Obeying going on right under my nose!')
/test put_array('cm_doing', 20, '@doing Fuzzier on the subject of kneecaps')
/test put_array('cm_doing', 21, '@doing She has had congress with the beast')
/test put_array('cm_doing', 22, '@doing Shiny. Let\'s be bad guys.')
/test put_array('cm_doing', 23, '@doing BuddhaPLZBringMeAPonyAndAPlasticRocket-')
/test put_array('cm_doing', 24, '@doing The dreadpirate Steve be in no mans debt')
/test put_array('cm_doing', 25, '@doing Steve\'s gotta go drain the sea-monster')
/test put_array('cm_doing', 26, '@doing No one makes me bleed my own blood')

/help_add /help_redoing send a random @doing to the MUSH

/def -i help_redoing = \
  /echo -aB Memo help:%;\
  /echo /redoing               sets a random @doing on the active world MUSH

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; The number is in seconds so its (hours from your timezone to another) * 60 * 60
;;; This may be incorrect 2 weeks out of 52, as different regions treat DST differently.
;;;
;;; (Gwen Note: To NY from Australia +15 hrs=-54000, Australia +14 hours=-50400, Australia +16 hours=-57600)

; ftimez(format, time, timezone)
/def ftimez = \
    /if ({#} != 3) \
      /echo -e %0: found %# arguments, expected 3%; \
      /return%; \
    /endif%; \
    /let origTZ=%TZ%; \
    /set TZ=%3%; \
    /let result=%; \
    /test result := ftime({1}, {2})%; \
    /if (origTZ =~ "") \
      /unset TZ%; \
    /else \
      /set TZ=%origTZ%; \
    /endif %; \
    /return result

;/set status_int_clock strcat(ftime("%I:%M%p", time())," _ NY: ", ftimez("%I:%M%p", time(), "America/New_York"))

;;=======[status line]=====
;; status bar updates (based on code from Keith Howell)
;;-----
;; define custom status line flags
;;-----
/set warn_status 0
/set status_pad _
/set status_height 2
/if (BASEOS =~ "linux") \
  /set status_int_clock strcat(ftime("%I:%M%p", time()), " _ NY: ", ftimez("%I:%M%p", time(), "America/New_York")) %;\
/else \
  /set status_int_clock strcat(ftime("%I:%M%p", time()), " _ NY: ",ftime("%I:%M%p", time()-50400)) %;\
/endif

;; For Addison over at Maemo.org ==> remove the log setting entirely from the status bar
;; /set status_int_log=nlog() ? "" : ""

;; Slightly custom log setting
/set status_int_log=nlog() ? "(L)" : ""

;;-----
;; set some fillers for the status bar line prior to logon
;;-----

/set FLYING=[grounded]

;; first 10 spaces show more status and worldname
;; use -c option to remove all other status line fields
/status_add -c -r0 @more:10:r
/status_add -c -r1 FLYING:25:Cwhite

;; add the rest of the status fields to the first line
/status_add -s1 -r0 @read:6:r
/status_add -s1 -r0 @active:11:r
/status_add -s1 -r0 @log:3:r
/status_add -s1 -r0 insert:6:r
/status_add -s1 -r0 kbnum:4:r
/status_add -s1 -r0 @world:12:r
/status_add -s1 -r0 @clock:21:r

;; add more status fields to the second line
/status_add -s1 -r1 searchbar:12:Cgreen

;;/test op_search_bar(strip_attr({EXPECT_LZ_ROW2})) %; \
/def op_search_bar = \
  /eval /set FLYING=%{locsaved} _ALT: %{LZ_ALT} %;\
  /test op_search_bar(strip_attr({EXPECT_LZ_ROW2})) %; \
  /if ({1} =~ "9") /set searchbar=[++++++++++] %;\
  /elseif ({1} =~ "8") /set searchbar=[+++++++++.] %;\
  /elseif ({1} =~ "7") /set searchbar=[++++++++..] %;\
  /elseif ({1} =~ "6") /set searchbar=[+++++++...] %;\
  /elseif ({1} =~ "5") /set searchbar=[++++++....] %;\
  /elseif ({1} =~ "4") /set searchbar=[+++++.....] %;\
  /elseif ({1} =~ "3") /set searchbar=[++++......] %;\
  /elseif ({1} =~ "3") /set searchbar=[+++.......] %;\
  /elseif ({1} =~ "1") /set searchbar=[++........] %;\
  /elseif ({1} =~ "0") /set searchbar=[+.........] %;\
  /else /set searchbar=[..........]%;\
  /endif%;\

  
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;         CrystalMUSH stuff
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Minor handy triggers/highlites
;;;

;;; To exit from any shuttle when it arrives.
/def -T"tiny.mush.cm" -F -mregexp -t"^The shuttle opens its airlock and the pressure pops in your ears as the entry is unsealed\\.$" cm_shuttle_exit = \
  /repeat -w -0 1 /send unbuckle%;\
  /repeat -w -1 1 /send leave

/help_add /help_tub auto-move to Shankill Radiant tubs
/def -i help_tub=\
  /_echo %;\
  /echo -aB Tub help:%;\
  /echo /tub              to auto-move to Shankill Radiant tubs to de-rezz.%;\
  /_echo

/def -T"tiny.mush.cm.sing" -F -mregexp -t"^You step through the portal and onto the debarkation area on Shankill\\.$" cm_shankill_leaving = \
  /repeat -1 1 /tel tubs

/def -T"tiny.mush.cm" -F tub = \
  /repeat -w -0 1 /tel shankill

;;; To clean up the sled, simply type,

/def -T"tiny.mush.cm.recruit" -t'* pays the minimum for supplies.' cm_clean_cheap = \
  /send -w @pemit me=Time to write a cheap cleanup job!!!
/def -T"tiny.mush.cm.recruit" -p8 -aBCred -t'Time to write a cheap cleanup job!!!' hl_clean_cheap

/def -T"tiny.mush.cm.recruit" -p8 -t'* likes to be comfortable and pays for some extra touches.' cm_clean_moderate = \
  /send -w @pemit me=Time to write a moderate cleanup job!!!
/def -T"tiny.mush.cm.recruit" -p8 -aBCyellow -t'Time to write a moderate cleanup job!!!' hl_clean_moderate

/def -T"tiny.mush.cm.recruit" -p8 -t'* spends the credits to have their sled stocked with the finest things.' cm_clean_expensive = \
  /send -w @pemit me=Time to write an expensive cleanup job!!!
/def -T"tiny.mush.cm.recruit" -p8 -aBCgreen -t'Time to write an expensive cleanup job!!!' hl_clean_expensive
  
;;;; Sled Maintain Maintenance Partial highlights

/def -T"tiny.mush.cm" -F -p100 -abCyellow -t"*This sled is still in good shape, but it wouldn't hurt to some maintenance done." cm_maintain_middle


;;;; Scuba highlights

/def -T'tiny.mush.cm' -p1 -abBCyellow -t'A yellow light glows in the side of your face mask*' SCUBA_yellow
/def -T'tiny.mush.cm' -p1 -abBCred -t'A red light in the side of your face mask*' SCUBA_red
/def -T'tiny.mush.cm' -p1 -abBCblue -t'A warning alert tingles against your wrist as your air supply*' SCUBA_blue


;;; The vein is almost empty
/def -T"tiny.mush.cm.sing" -p10 -aBCyellow -t'You sense this vein is almost empty.' hl_claim


;;; Color code of remaining cartons in your sled
;;; added 10/24/2011 - left off the shared macros
/def -F -T"tiny.mush.cm.sing" -p100 -mregexp -t"There is room in this sled for 10 cartons, (\\d+) have been checked out\\." cm_sled_highlight_cart10 = \
  /set CARTONS=%P1%;\
    /if (CARTONS == "0") \
      /test substitute(decode_attr(strcat({PL}, "@{BCgreen}", {P0}, "@{n}", {PR})))%;\
    /elseif (CARTONS  >= "1" & CARTONS <= "9") \
      /test substitute(decode_attr(strcat({PL}, "@{BCyellow}", {P0}, "@{n}", {PR})))%;\
    /elseif (CARTONS = "10") \
      /test substitute(decode_attr(strcat({PL}, "@{BCred}", {P0}, "@{n}", {PR})))%;\
    /else \
      /echo TFRC: Broken match on the number of cartons in this sled.%;\
    /endif


;;; Color code of remaining cartons in your sled
;;; added 10/24/2011 - left off the shared macros
/def -F -T"tiny.mush.cm.sing" -p100 -mregexp -t"There is room in this sled for 8 cartons, (\\d+) have been checked out\\." cm_sled_highlight_cart8 = \
  /set CARTONS=%P1%;\
    /if (CARTONS == "0") \
      /test substitute(decode_attr(strcat({PL}, "@{BCgreen}", {P0}, "@{n}", {PR})))%;\
    /elseif (CARTONS  >= "1" & CARTONS <= "7") \
      /test substitute(decode_attr(strcat({PL}, "@{BCyellow}", {P0}, "@{n}", {PR})))%;\
    /elseif (CARTONS = "8") \
      /test substitute(decode_attr(strcat({PL}, "@{BCred}", {P0}, "@{n}", {PR})))%;\
    /else \
      /echo TFRC: Broken match on the number of cartons in this sled.%;\
    /endif


;;; added Mar 27 2014
/def -F -T"tiny.mush.cm.sing" -p100 -mregexp -t"^Carton (\\d+) - (.*) is unloaded from the airsled\\.$" cm_sled_carton_unload = \
  /set CARTONS=%P1

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Shepherd Macro
;;; '/shep <name>' <name=name of Sheep> :)

/def -T"tiny.mush.cm.sing" shep = \
/send -w @pemit me=Don't forget to +mail Lydander and Samira about the Shepherd contract. %;\
/send -w :says with only the slightest hint of the native Taal'en trill, "Rrecording on." After a slight pause, she continues "Ssudia Chok'toth. Entering shepherd contract with [name(num(*%*))] in accordance with Section 53, paragraphs 1 through 5. Singer [name(num(*%*))] is aware of the fact that [subj(num(*%*))] is entitled to nothing that may be cut under Singer Chok'toth's direction and guidance. Singer [name(num(*%*))] is entitled to remain at Singer Chok'toth's claim or claims for at least two working days. " %;\
/send -w :says "Singer [name(num(*%*))] will never attempt to return to said claims under Section 49, paragraphs 7, 9, and 14. I, Ssudia Chok'toth, affirm and avow to provide instruction for at least two days to this singer, as specified, above and beyond any bonus I may receive." She takes a breath and then motions %* to her side, "[name(num(*%*))], do you also affirm and avow, under the strict penalties imposed by the Heptite Guild that you will adhere to the strictures of the relevant sections and paragraphs cited herein?" %;\

; Start Autopilot flying
/def -F -T"tiny.mush.cm.s*" -mglob -t'Course set.  To invoke, do a \'autopilot on\'.' autopilot_on = \
  /send -w autopilot on

; recharge lamp (in Equipment room)
/def -T"tiny.mush.cm" recharge = \
    /send display lamps %;\
    /send +buy vendor=2 %;\
    /send @wait 1=recharge lamp
 
; repair broken climbing equipment (in Equipment room)
/def -T"tiny.mush.cm" repair_line = \
    /send display climbing %;\
    /send +buy vendor=2

; scanner quickies
; '/scanner on' or '/scanner off'
/def -T"tiny.mush.cm.sing" scanner = \
      /if ({*}=~"off")\
        /send -w stabilizer off %;\
        /send -w erase scan map %;\
        /send -w deactivate scan map %;\
      /elseif ({*}=~"on")\
        /send -w erase scan map %;\
        /send -w activate scan map %;\
      /else \
      /endif

/def -F -T"tiny.mush.cm.sing" -t'The fluid has become rather unpleasantly cold.*' cm_refill_bath = \
  /send -w refill bath%;\
  /send -w +resonance

; Fill Radiant Tub when you enter living quarters
/def -F -w'cm' -t'Kahlyla Suite -- White Level*' cm_fill_tub_kah = \
  /send -w fill bath with fluid

; Fill Radiant Tub when you enter living quarters
/def -F -w'ss' -t'Ssudia Suite -- Amethyst Level*' cm_fill_tub_ss = \
  /send -w fill bath with fluid

/def -F -T"tiny.mush.cm.sing" -t'You may enter the peach bath now.' cm_enter_peach = \
  /send -w enter peach bath

/def -F -T"tiny.mush.cm.sing" -t'You may enter the maple bath now.' cm_enter_maple = \
  /send -w enter maple bath

/def -F -T"tiny.mush.cm.sing" -t'You may enter the chocolate bath now.' cm_enter_chocolate = \
  /send -w enter chocolate bath

/def -F -T"tiny.mush.cm.sing" -t'You may enter the red bath now.' cm_enter_red = \
  /send -w enter bath

/def -F -T"tiny.mush.cm.sing" -t'You slide into the tub, forcing your sore muscles to move just a bit more.' cm_resonance_tub = \
  /send -w +resonance

/def -F -T"tiny.mush.cm.sing" -mregexp -t"^The Crystal Market has been updated by .*\\.$" cm_market_update = \
  /send -w crystal market

;;; Grab a special order chit as it comes out.
/def -F -T"tiny.mush.cm*" -t'You hear a low clattering in the terminal*' SO_chit = \
  /send -w take chit%;\
  /if (${world_type} =/ "tiny.mush.cm.sing") \
    /send -w give carton = chit%;\
  /endif

;;; CHIT SOMEONE ELSE ACCEPTED!!!
/def -F -T"tiny.mush.cm*" -t'You hear the clattering of the terminal*' SO_chit_filled = \
  /send -w take chit%;\
  /if (${world_type} =/ "tiny.mush.cm.sing") \
    /send -w give carton = chit%;\
  /endif

;;; Type '/pack <identifier >' where <identifier> is a way to identify the crystal
;;; (dbref, shape, size, color, etc), and you will manually "get" it and "pack" it
;;; (if you have a carton).
/def -F -T"tiny.mush.cm" pack = \
  /send -w get %* %;\
  /send -w give carton=%*

;;; Speeds up unpack commands
;;; usage: "/unpack <carton #>"
/def -T"tiny.mush.cm.sing" unpack = \
  /send -w drop carton %* - Ssudia %;\
  /send -w unpack carton %* - Ssudia

;;; Sled empty
;;; Fixed OCT 26 2011
;;; previously had typos from a global search/replace gone awry
/def -i -T"tiny.mush.cm.sing" empty = \
  /send -w out %;\
  /send -w processing %;\
  /send -w drop carton %;\
  /send -w unpack carton %;\
  /send -w out %;\
  /send -w enter ssudia's sled

;;; Handy little macro that sends <name> carton to Cargo storage while in front of a CS Conveyer.
;;; '/cargo <carton name>'
;;; '/shed <carton name>'
/def -T"tiny.mush.cm" cargo = \
/send -w send %* to cargo conveyor %;\
;;; The same as above except for the Shed.
/def -T"tiny.mush.cm" shed = \
/send -w send %* to shed conveyor %;\

;;; CrystalMUSH auto-remove carton
;;; By Gwen Morse (gwen dot morse at gmail dot com)
;;; This looks to see if you're dropping a carton into your sled. If so, it will remove the
;;; next carton by number and have you pick it up. Very handy when emptying claims. Less handy if
;;; you don't WANT another carton :).
;;; Get around it by exiting the sled and giving it the carton from outside.

/def -T"tiny.mush.cm.sing" -F -mregexp -t"^Carton ([0-9]) - Ssudia is loaded in to the sled." cm_carton_ss = \
  /set carton_count=$[{P1}+1] %;\
  /if (carton_count<=10) \
    /send -w remove carton %;\
    /send -w take carton %{carton_count} - Ssudia %;\
  /else \
  /endif

/def -T"tiny.mush.cm.sing" -F -mregexp -t"^Carton ([0-9]) - Kahlyla is loaded in to the sled." cm_carton_kah = \
  /set carton_count=$[{P1}+1] %;\
  /if (carton_count<=10) \
    /send -w remove carton %;\
    /send -w take carton %{carton_count} - Kahlyla %;\
  /else \
  /endif

; CrystalMUSH Cutter Overheat hilite
/def -F -T"tiny.mush.cm.sing" -p55 -aBCyellow -mregexp -t"^(You smell something beginning to overheat|The cutter abruptly powers down|The cutter housing feels warm to the touch|The cutter emits a low whine during the cut)" cm_overheat

; CrystalMUSH Cutter Powerdown hilite
/def -F -T"tiny.mush.cm.sing" -p55 -aBCyellow -mglob -t'The cutter\'s tone seems uncertain, like it\'s running low on power.' cm_powerdown

;; Climbing gear sticking
;; The line from your climbing equipment jerks tight, keeping you from entering the sled. You will
;;  have to 'retrieve line' before you can enter.
; Added 9/17/2011 - somehow got left off the macros shared with others.

/def -T"tiny.mush.cm.sing" -F -mglob -t'The line from your climbing equipment jerks tight*' climb_tight = \
  /send -w retrieve line %;\
  /repeat -1 1 /send -w enter \[name(me)\]'s sled

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; CrystalMUSH Singer Claims
;;;
;;; by Gwen Morse (gwen dot morse at gmail dot com)
;;;
;;; helper macros to get through auto-walking complicated claim sites
;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; The Ocean claim with the storm
/def -T"tiny.mush.cm.sing" -F -mregexp -t"^It's a hard swim against the currents, but in desperation, you manage to reach a rocky outcropping, and pull yourself out of the water. You find a small cave, and move in a little way, out of the storm\\.$" swim_currents = \
  /echo -w Out of the water

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; The claim with the limestone rocks (Ta'achia Do'inni's claim)
;;; '/knock'
 
/def -T"tiny.mush.cm.sing" -F -mregexp -t"^Nothing happened. Perhaps you'd better try a different one of these boulder-crates. This one must be too old\\.$" knock_nothing = \
  /if (KNOCKING =~ "yes") \
    /repeat -w -0 1 /knock%;\
  /endif

/def -T"tiny.mush.cm.sing" -F -mregexp -t"^The crate pops open with a low fsssst noise. You cautiously approach it and peek inside\\..*" knock_something = \
  /repeat -w -2 1 /do_eval_list back|insert crystal2|say Joseph|due west~~2

/def -T"tiny.mush.cm.sing" knock = \
  /set KNOCKING=yes%;\
  /let _HASH=knock knock knock count count count count count knock knock knock%;\
  /repeat -0 1 /knock_loop %{_HASH}

/def -T"tiny.mush.cm.sing" knock_loop = \
  /if (strlen(%{1})) \
    /repeat -0 1 /send -w %{1}%;\
    /shift%;\
    /repeat -0 1 /knock_loop %{*}%;\
  /else \
    /unset KNOCKING%;\
  /endif

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; For Vyana's yodeling claim
/def -T"tiny.mush.cm.*" yodel = \
  /if ({*}=~"start")\
    /echo -w TFRC: Starting the Yodel Loop.%;\
    /unset yodel_at%;\
    /unset yodel_found%;\
    /set yodelling=yes%;\
    /set yodel=109%;\
    /set end_yodel=881%;\
    /repeat -w -1 1 /yodel_loop%;\
  /elseif ({*}=~"stop")\
    /echo -w TFRC: Stopping the Yodel Loop.%;\
    /unset yodeling%;\
  /endif

/def -T"tiny.mush.cm.*" yodel_loop = \
  /if (yodel<=end_yodel)\
    /if (strlen(%{yodel_found}))\
      /send -w yodel at %{yodel_at}%;\
    /else \
      /send -w yodel at %{yodel}%;\
      /quote -w -1 `++yodel%;\
      /repeat -w -10 1 /yodel_loop%;\
    /endif%;\
  /elseif (yodel==end_yodel) \
    /echo -w TFRC: You have yodeled through your entire range of frequencies. There may be a problem.%;\
  /endif

/def -T"tiny.mush.cm*" -F -mregexp -t"^(.*) yodels a long tone which sets the loose rock on the side of the cliff to vibrating. (She|He|It) holds the note for a long moment\\.$" yodel_vibrating = \
  /if (!strlen(%{yodel_found}))\
    /set yodel_found=yes%;\
    /set yodel_at=%{yodel}%;\
    /send -w yodel at %{yodel_at}%;\
  /else \
    /send -w yodel at %{yodel_at}

/def -T"tiny.mush.cm.sing" -F -mregexp -t"^A couple of smallish pebbles roll down the side of the wall, followed by a few larger pebbles\\.$" yodel_pebbles = \
  /echo -w TFRC: Your yodel shakes the pebbles.

/def -T"tiny.mush.cm.sing" -F -mregexp -t"^(.*) doesn't seem to be yodeling with enough volume to cause much else to happen\\.$" yodel_volume = \
  /echo -w TFRC: Your yodel needs more volume.

/def -T"tiny.mush.cm.sing" -F -mregexp -t"^You yodel at about ([0-9]+) Hz, but the vibration from the rock makes you feel that your pitch is too (high|low)\\.$" yodel_highlow = \
  /echo -w TFRC: Your yodel was too %P2.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; CrystalMUSH Automated Cutting code (assembled by Gwen Morse)
;;;
;;; by Gwen Morse (gwen dot morse at gmail dot com)
;;; Based on a simple two-part cut loop by Christian Robinson (heptite at gmail dot com).
;;; Further help by Christian to add regexp checks for multiple parameters and randomness
;;;
;;;
;;; You look at the vein at least once to set the dominant note.
;;;
;;; Then, you type '/cut octave rectangle medium small' (for example) and it will cut out a
;;; full octave with 2 1/2 minute pauses between each cut.
;;;
;;; The size, shape, and grouping parameters can be in any order.
;;;
;;; To change the speed of cutting, adjust the /repeat -130 line to be -n
;;; where 'n' is the number of seconds to wait before the next cut.
;;;
;;; As per Wolfgang@CrystalMUSH:
;;; Taking it from first principles: The basics I'm sure you know - that 1 crystal adds
;;; 10 degrees; the actual cutter temperature starts and gets back down to -10
;;; degrees, although this is still represented as 0 - i.e. your first crystal will
;;; take you from -10 (shown as 0) to 0 (shown as 0), while the next will take you to
;;; 10; any temperature above 100 will lead to potential injury and cutter damage.
;;;
;;; Now - with NO COOLER, you should attain a cooling rate of approximately 0.05
;;; degrees per second, while with a cooler, you should attain a cooling rate of 0.07
;;; degrees per second. This translates to 2.38 minutes to cool 10 degrees with a
;;; cooler, but 3.33 minutes to cool 10 degrees with no cooler. This is based on the
;;; standard cutter.
;;;
;;; 130 seems to be close to the minimum to keep an elite cutter (formerly 135)
;;; from increasing in temperature and allow it to cool slightly if it had gained heat
;;;
;;; 150 seconds is 2 minutes, 30 seconds
;;; 210 seconds is 3 minutes, 30 seconds
;;;
;;; CrystalMUSH auto-pack crystals
;;; (after cutting a crystal, you automatically "get" it and "pack" it into a carton)
;;; Also learns crystal size and clarity
;;; Adds flawed notes to the recut list to try to get a perfect grouping
;;; Flawed crystals are recut at the end of the octave so that you have the best chance
;;; of maximizing your return from a vein.
;;;
;;; Autopack gives the crystal to your carton.
;;; Additionally it checks if the crystal is considered flawed enough to recut.
;;; Special Orders only recut if the flaw is worse than the minimal flaw for the order.
;;; Regular /cut flaw is recut if it's less than perfect.
;;;
;;; 10/30/2011 Fixed bug - SO recut losing the note
;;;
;;; 05/14/2012 Fixed logical error - Fixed another issue where SOs were having trouble matching flaw
;;; Fixed by assigning a number to the flaw level and the expected flaw level and comparing.
;;; The old way used regular expression matching.


/def -T"tiny.mush.cm.sing" -F -mregexp -t"^The crystal is ([A-Za-z ]+) in size and is ([A-Za-z ]+)" autopack = \
  /send -w get %{P1}%;\
  /send -w give carton=%{P1}%;\
  /set CUT_CLARITY=%{P2}%;\
  /if (%{CUT_CLARITY} =/ "perfect") \
    /set CUT_CLARITY2=0%;\
  /elseif (%{CUT_CLARITY} =/ "very slightly flawed") \
    /set CUT_CLARITY2=1%;\
  /elseif (%{CUT_CLARITY} =/ "slightly flawed") \
    /set CUT_CLARITY2=2%;\
  /elseif (%{CUT_CLARITY} =/ "flawed") \
    /set CUT_CLARITY2=3%;\
  /elseif (%{CUT_CLARITY} =/ "majorly flawed") \
    /set CUT_CLARITY2=4%;\
  /endif%;\
  /if (strlen(%{TEST_ORDERNUM})) \
    /if (%{CUT_CLARITY2} > %{FILLSO_CLARITY2}) \
      /set RECUT_LIST=%{RECUT_LIST} %{FILLSO_NOTE}%; \
      /set TEMP_RECUT=%{RECUT_LIST}%;\
      /echo -w -aBCcyan SPECIAL ORDER: Just added note "%{FILLSO_NOTE}" to the recut list.%; \
    /endif%;\
  /else \
    /if (%{CUT_CLARITY} !/ "perfect")\
      /set RECUT_LIST=%{RECUT_LIST} %{CUT_NOTE}%; \
      /set TEMP_RECUT=%{RECUT_LIST}%;\
      /echo -w -aBCcyan CUT: Just added note "%{CUT_NOTE}" to the recut list.%;\
    /endif%; \
  /endif

;;; Pause/Resume Cutting
;;; Recovery macros
;;; Gwen Morse
;;; Added OCT 27 2011
;;;
;;; With the ability to automate cutting more crystals than empty slots in
;;; a carton comes the need to 'pause' cutting to fetch a fresh carton.
;;; Tinyfugue does not allow a true pause, however a toggle (Boolean) can
;;; be used to determine if your carton is full or not.
;;;
;;; If the carton is full the toggle is automatically set. Then, instead
;;; of cutting the next crystal in the queue, the loop will send a message to
;;; you to fetch a new carton.
;;;
;;; When you have a fresh carton, type "/cut resume" and on the next
;;; completion of the loop the automated cutting will start up again.
;;; "/cut resume" also works with special orders.
;;;
;;; While I was already planning to write this update before he mentioned it,
;;; I was inspired to complete it when it was requested by Matthew Walker.
;;; He's also the one who suggested the term "resume".

/def -p50 -T"tiny.mush.cm.sing" -mregexp -t"^(The carton is now full|You do not think a crystal of that size will fit into this carton)" cm_full_carton = \
  /if (strlen(CUT_PID)) \
    /echo -aBCcyan -w CUT: Your carton is full, setting recovery toggle. Type '/cut resume' when ready.%;\
    /set CUT_CARTON=yes%;\
  /endif

;;; If you get this message, your cutter needs maintenance.
;;; Get thee to a cutter-tech!
;;; FIXED OCT 27 2011 to add the maintain your cutter message to non-SO cutting
/def -T"tiny.mush.cm.sing" -F -mglob -t'The poorly maintained cutter malfunctions. The crystal shatters and is destroyed.' shattered = \
  /if (strlen(TEST_ORDERNUM)) \
      /set RECUT_LIST=%{RECUT_LIST} %{CUT_NOTE}%; \
      /set TEMP_RECUT=%{RECUT_LIST}%;\
      /echo -w -aBCcyan SPECIAL ORDER: Just added note "%{CUT_NOTE}" to the recut list.%;\
      /echo -w -abBCred SPECIAL ORDER: If you get this message, maintain your cutter!!!%;\
  /else \
      /set RECUT_LIST=%{RECUT_LIST} %{CUT_NOTE}%; \
      /set TEMP_RECUT=%{RECUT_LIST}%;\
      /echo -w -aBCcyan CUT: Just added note "%{CUT_NOTE}" to the recut list.%; \
      /echo -w -abBCred CUT: If you get this message, maintain your cutter!!!%;\
  /endif


;;; OCT 27 Functionalized unsetting all the cut global variables
; Unset cutting global variables function
; didn't limit the unset to singers in case tuners ever want to use code.
; I wouldn't expect it but it could always happen in the future.
; Fixed 5/19/2012 edited typo so FILLSO_ variables actually clear.

/def -T"tiny.mush.cm" unset_cut = \
  /kill %{CUT_PID}%;\
  /quote -S /unset `/listvar -mglob -s FILLSO_* %;\
  /unset TEST_ORDERNUM %;\
  /unset RANDCUT %;\
  /unset RANDSHAPE %;\
  /unset RECUT_LIST %;\
  /unset TEMP_RECUT %;\
  /unset TEMP_CLARITY %;\
  /unset CUT_CLARITY %;\
  /unset CUT_GROUP %;\
  /unset CUT_LIST %;\
  /unset CUT_MARKET %;\
  /unset CUT_NOTE %;\
  /unset CUT_QUEUE %;\
  /unset CUT_SCALE %;\
  /unset CUT_SHAPE %;\
  /unset CUT_SIZE %;\
  /unset CUT_CARTON %;\
  /unset CUTTER_TEMP %;\
  /unset CUT_CLARITY2 %;\
  /unset SO_CLARITY3 %;\
  /unset SO_CLARITY2 %;\
  /repeat -0 1 /unset CUT_PID

; Halt cut
/def -T"tiny.mush.cm.sing" -abBCred -mregexp -t"^(The cutter groans and fails to hold the note|The cutter is in its six-hour recharge mode|You are in no shape to be cutting crystal|The cutter is not on|The cutter is drained of power|You must turn the 'cutter on' before using it|You begin to turn your cutter on but discover it is recharging)" cut_killpid = \
  /if (strlen(TEST_ORDERNUM)) \
    /echo -w -aBCcyan SPECIAL ORDER: You cannot complete Special Order %{TEST_ORDERNUM}.%; \
    /unset_cut%;\
  /elseif (strlen(CUT_PID))\
    /echo -w -aBCcyan CUT: You cannot complete this grouping.%; \
    /unset_cut%;\
  /endif

; To cut the last few crystals in the vein
/def -T"tiny.mush.cm.sing" -mglob -t'You don\'t think that you can get a crystal of that size out of the vein.' cut_tinies = \
  /if (!strlen(TEST_ORDERNUM) & (strlen(CUT_QUEUE) == "4")) \
    /kill %{CUT_PID} %;\
    /echo -w -aBCcyan CUT: Cutting the rest of the vein as tinies.%; \
    /repeat -1 -w 1 /cut tiny octave %{CUT_SHAPE}%;\
  /else \
    /echo -w -aBCcyan CUT: You cannot complete this grouping.%; \
    /unset_cut%;\
  /endif

; When the vein is empty clear all cutting settings and release the claim.
; Works just fine now. Fixed Oct 24 2011
/def -T"tiny.mush.cm.sing" -aBCred -mglob -t'That vein is empty.' cut_vein_empty = \
  /echo -w -aBCcyan CUT: You've emptied the vein - time to release the claim.%; \
  /if (PERSON =~ "Kahlyla") \
    /send -w cutter off%; \
    /repeat -w -0 1 /send take coin%;\
  /else \
    /repeat -w -0 1 /send take code%;\
  /endif%;\
  /repeat -w -1 1 /send leave%;\
  /repeat -w -3 1 /send release claim%;\
  /repeat -w -6 1 /unload %;\
  /if (strlen(%{TEST_ORDERNUM})) \
    /echo -w -aBCcyan SPECIAL ORDER: You cannot complete Special Order %{TEST_ORDERNUM}.%; \
    /unset_cut%;\
  /else \
    /echo -w -aBCcyan CUT: You cannot complete this grouping.%; \
    /unset_cut%;\
  /endif

;;; Dealing with cutter temperatures
;;; for faster cutting with temperature reactions/
;;; added 11/10/2011

/def -T"tiny.mush.cm.sing" cutter_temp = \
  /def -T"tiny.mush.cm.sing" -p100 -n1 -ag -mglob -t'^This is one of the elite high-performance infrasonic cutters which has been carefuly fitted for the distinguished Crystal Singer' cutter_body1 %;\
  /def -T"tiny.mush.cm.sing" -p100 -n1 -ag -mglob -t'^This cutter is a custom job, even by the standards of these elite variants' cutter_body2 %;\
  /def -T"tiny.mush.cm.sing" -p100 -n1 -mregexp -t"^Cutter Status: temperature is ([0-9.])\.$" cutter_status %;\
  /set CUTTER_TEMP=%P0%;\
  /repeat -1 0 /send -w look cutter %;\

;;;; To eventually cut to the biggest market size, use /cut bigmarket (strlen 9)
;;;; To eventually cut to the smallest market size, use /cut smallmarket (strlen 11)
;;;;
;;;; OCT 25 2011: cleaned up the echos to have the same hilights and prefixes.
;;;;
;;;; Add a feature that lets you delay cutting until the time of day change
;;;; (cut wait) check location, time of day, and boolean wait toggle
;;;; 
;;;; 03 March 2014: added "/cut finish" command.

;;; Actual cut command
/def -F -T"tiny.mush.cm.sing" cut = \
  /if (regmatch('help',%{*})) \
    /help_cut%;\
  /elseif (!regmatch('[1-9A-Za-z ]*',%{*})) \
    /_echo What do you want to cut? Your options are "/cut <size> <shape> <grouping>". %;\
    /_echo As an example "/cut medium large 3chord octagon". %;\
    /_echo The groupings are: single, 3row, 4row, 5row, 3chord, 4chord, 5chord, octave. %;\
  /elseif (regmatch('resume',%{*})) \
    /echo -w -aCcyan CUT: Resuming your cutting.%;\
    /unset CUT_CARTON %;\
  /elseif (regmatch('pause',%{*})) \
    /echo -w -aCcyan CUT: Pausing your cutting.%;\
    /set CUT_CARTON=yes%;\
  /elseif (regmatch('quick',%{*})) \
    /echo -w -aCcyan CUT: You will cut very quickly and your cutter may overheat.%;\
    /set CUT_QUICK=yes%;\
  /elseif (regmatch('slow',%{*})) \
    /echo -w -aCcyan CUT: You will cut at a slow rate that allows cooling.%;\
    /unset CUT_QUICK %;\
  /elseif (regmatch('finish',%{*})) \
    /echo -w -aCcyan CUT: You will finish this grouping and then stop cutting.%;\
    /unset CUT_QUEUE %;\
  /elseif (regmatch('5cut',%{*})) \
    /echo -w -aCcyan CUT: You will try to cut a very large 5-chord.%;\
    /set CUT_SIZE=very large%;\
    /set CUT_SHAPE=%{MARKET_SHAPE1}%;\
    /echo -w -aCcyan CUT: Cut shape set to the top market shape.%;\
  /else \
    /test regmatch('(market)',"%{*}")%;\
    /set CUT_MARKET=%{P1}%;\
    /if (strlen(%{CUT_MARKET}) == "6")\
      /set CUT_QUEUE=loop%;\
      /set CUT_SHAPE=%{MARKET_SHAPE1}%;\
      /echo -w -aCcyan CUT: Cut shape set to the top market shape.%;\
    /else \
      /test regmatch('(pyra?m?i?d?|cone?|cyli?n?d?e?r?|rect?a?n?g?l?e?|pent?a?g?o?n?|octago?n?|pris?m?|dode?c?a?h?e?d?r?o?n?|randshape)',"%{*}")%;\
        /set CUT_SHAPE=%{P1}%;\
      /test regmatch('(loop)',"%{*}")%;\
        /set CUT_QUEUE=%{P1}%;\
    /endif %;\
    /test regmatch('(tiny|very small|medium small|small|medium large|medium|very large|large|randsize)',"%{*}")%;\
      /set CUT_SIZE=%{P1}%;\
    /if (%{*} =/ "stop")\
      /echo -w -aBCred -p CUT: STOPing your crystal cutting!%; \
      /unset_cut%;\
    /elseif (%{*} =/ "check")\
      /echo%;\
      /echo -w -aCcyan CUT: CHECKing your cutting variables!%; \
      /set RANDCUT%;\
      /set RANDSHAPE%;\
      /set CUT_PID%; \
      /set CUT_NOTE%;\
      /set CUT_QUEUE%;\
      /set CUT_MARKET%;\
      /set RECUT_LIST%;\
      /set TEST_ORDERNUM%;\
      /set TEMP_RECUT%;\
      /set TEMP_CLARITY%;\
    /elseif (!strlen(%{CUT_SIZE})|!strlen(%{CUT_SHAPE})) \
      /help_cut%;\
    /else \
      /unset RANDCUT%;\
      /unset RANDSHAPE%;\
      /unset CUT_NOTE%;\
      /unset RECUT_LIST%;\
      /unset TEMP_RECUT%;\
      /test regmatch('(3chord|4chord|5chord|3row|4row|5row|octave|single|5cut)',"%{*}")%;\
      /let CUT_GROUP=%{P1}%;\
      /if (CUT_SIZE =/ "very large") \
        /set LABELSIZE=vl%;\
      /elseif (CUT_SIZE =/ "large") \
        /set LABELSIZE=lg%;\
      /eleseif (CUT_SIZE =/ "medium large") \
        /set LABELSIZE=ml%;\
      /eleseif (CUT_SIZE =/ "medium small") \
        /set LABELSIZE=ms%;\
      /eleseif (CUT_SIZE =/ "medium") \
        /set LABELSIZE=med%;\
      /eleseif (CUT_SIZE =/ "very small") \
        /set LABELSIZE=vs%;\
      /eleseif (CUT_SIZE =/ "small") \
        /set LABELSIZE=sm%;\
      /eleseif (CUT_SIZE =/ "tiny") \
        /set LABELSIZE=t%;\
      /endif%;\
      /if (CUT_GROUP =/ "octave") \
        /set CUT_LIST=do mi so dx ti re fa la%;\
      /elseif (CUT_GROUP =/ "3chord") \
        /set CUT_LIST=do mi so%;\
      /elseif (CUT_GROUP =/ "4chord") \
        /set CUT_LIST=do mi so dx%;\
      /elseif (CUT_GROUP =/ "5chord") \
        /set CUT_LIST=do mi so dx ti%;\
      /elseif (CUT_GROUP =/ "5cut") \
        /set CUT_LIST=do mi so dx ti%;\
      /elseif (CUT_GROUP =/ "3row") \
        /set CUT_LIST=do re mi%;\
      /elseif (CUT_GROUP =/ "4row") \
        /set CUT_LIST=do re mi fa%;\
      /elseif (CUT_GROUP =/ "5row") \
        /set CUT_LIST=do re mi fa so%;\
      /elseif (CUT_GROUP =/ "single") \
        /set CUT_LIST=do%;\
      /else \
        /echo -w -aCcyan CUT: Grouping defaulting to 'octave'.%;\
        /set CUT_LIST=do mi so dx ti re fa la%;\
      /endif %;\
      /if (PERSON =~ "Kahlyla") \
        /send -w cutter on%; \
      /endif%;\
        /repeat -2 -w 1 /cut_loop %{CUT_LIST} %; \
    /endif %;\
  /endif

/def cut_loop = \
  /if (CUT_CARTON =~ "yes") \
    /beep 1 %;\
    /echo -w -arBCred CUT: Cutting paused because you need a fresh carton. Type '/cut resume' when ready.%;\
    /if (CUT_QUICK =~ "yes") \
      /repeat -w -60 1 /cut_loop %{*} %;\
    /else \
      /repeat -w -130 1 /cut_loop %{*} %;\
    /endif%;\
    /set CUT_PID=%?%;\
  /elseif ({#}) \
    /note %{1} %; \
    /set CUT_NOTE=%{1}%; \
    /if (RANDSIZE =/ "yes") \
      /set CUT_SIZE=(/nth $[rand(1,8)] tiny vs s ms medium ml large vl)%;\
    /endif %;\
    /if (RANDSHAPE =/ "yes") \
      /set CUT_SHAPE=(/nth $[rand(1,8)] pyr cone cyl rec pent oct prism dod)%; \
    /endif %;\
    /set LABELSHAPE=%{CUT_SHAPE}%;\
    /set LABELSIZE=%{CUT_SIZE}%;\
    /send -w cut %{CUT_SHAPE} size=%{CUT_SIZE}%;\
    /shift %;\
    /if (CUT_QUICK =~ "yes") \
      /repeat -w -60 1 /cut_loop %{*} %;\
    /else \
      /repeat -w -130 1 /cut_loop %{*} %;\
    /endif%;\
    /set CUT_PID=%?%;\
  /else \
    /if (strlen(RECUT_LIST)) \
      /echo -w -aCcyan CUT: Recutting flawed crystals now.%;\
      /repeat -w -2 1 /cut_loop %{TEMP_RECUT}%;\
      /unset RECUT_LIST%;\
    /else \
      /if (strlen(CUT_QUEUE) == "4") \
        /echo -w -aCcyan CUT: Looping the cut command.%;\
        /cut %{CUT_SHAPE} %{CUT_SIZE} %{CUT_GROUP} loop%;\
      /else \
        /echo -w -aBCcyan CUT: The cut grouping is done.%;\
        /beep%;\
      /endif%;\
    /endif%;\
  /endif


/help_add /help_cut automate cutting out a vein

/def -i help_cut=\
  /_echo %;\
  /echo -aB Cut help:%;\
  /echo /cut <group> <size> <shape> will cut out a single grouping%;\
  /echo /cut stop            will interrupt the cutting process and end it instantly%;\
  /echo /cut pause           will pause the cutting process%;\
  /echo /cut resume          will resume the cutting process.%;\
  /echo /cut market <size>   will loop cutting the best market options of <size>%;\
  /echo '                    after that size is cut out it will automatically switch to tinies%;\
  /echo /cut finish          will stop a looped cut at the end of the grouping%;\
  /echo %;\
  /echo The groupings are: single, 3row, 4row, 5row, 3chord, 4chord, 5chord, octave %;\
  /echo Most shapes can be abbreviated to three or more characters (ex: prisms can be entered as 'pri', 'pris', or 'prism')%;\
  /echo Octagons are the only exception, they require at least 'octag' in order to differentiate from the 'octave' grouping.%;\
  /echo If you want to get really fancy you can try: "randsize" and/or "randshape" %;\
  /echo You can also include "loop" in the /cut command to keep looping the cutting with those settings until the claim runs out of crystals that size. It will then shift to tiny crystals.%;\
  /_echo
  
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Special Order Handling
;;;
;;; Samples of in-game special orders
;;;
;;; #    PATTERN      SIZE  color       SHAPE         CLARITY  MARKETER    VALUE
;;; 3188 5 chord      vs    vp yellow    cylinder      p        Nathaniel   166
;;; 3060 2 x octave   s     d amethyst   octagon       p        Darby       9196
;;; 3167 3 row        s     d rose       pentagon      p        Nathaniel   163
;;; 3195 2 x Single   t     l green      cylinder      f        Nathaniel   129
;;;
;;; %P1=order number // %P2=pattern // %P3=size // %P4=shade // %P5=color // %P6=shape
;;; %P7=clarity //%P8= Marketer (not needed) %P9=value (only for sorter +mail)
;;; %P10=SO_NUMGROUPS

/set warn_curly_re=off

;;;
;;; Special Order help
;;;

/help_add /help_orders CrystalMUSH Special Orders

/def -i help_orders=\
  /_echo%;\
  /echo -aB CrystalMUSH Special Order Help: %;\
  /_echo /orderfill <number>   to start cutting a Special Order by number%;\
  /_echo /orderlist <color>    to list all the Special Orders of a particular color%;\
  /_echo /ordermatch           find Special Orders that match vein color and shade%;\
  /_echo /orderdid             to list Special Orders that you completed%;\
  /_echo /orderflush           to empty the list of special orders%;\
  /_echo To learn the special orders, look at any Special Order terminal or type 'scan all list' in your sled with a special order uplink installed.%;\
  /_echo If you're carrying one or more Special Order chits, you can also learn the specifications of those orders by simply looking at each chit.%;\
  /_echo

/def -T"tiny.mush.cm" -F orderhelp = \
  /help_orders

/def print_so_list = \
  /eval /set TEMP_SIZE=$[get_2array("so",$[TEMP_NUM], 1)]%;\
  /eval /set TEMP_SHADE=$[get_2array("so",$[TEMP_NUM], 2)]%;\
  /eval /set TEMP_COLOR=$[get_2array("so",$[TEMP_NUM], 3)]%;\
  /eval /set TEMP_SHAPE=$[get_2array("so",$[TEMP_NUM], 4)]%;\
  /eval /set TEMP_CLARITY=$[get_2array("so",$[TEMP_NUM], 5)]%;\
  /eval /set TEMP_VALUE=$[get_2array("so",$[TEMP_NUM], 7)]%;\
  /eval /set TEMP_PATTERN=$[get_2array("so",$[TEMP_NUM], 0)]%;\
  /eval /set TEMP_NUMGROUPS=$[get_2array("so",$[TEMP_NUM], 8)]%;\
  /eval /set TEMP_MARKETER=$[get_2array("so",$[TEMP_NUM], 6)]%;\
  /eval /set TEMP_FILLED=$[isamember($[TEMP_NUM],_array_so_accepted,1)]%;\
  /if ({TEMP_COLOR} =/ {MATCH_COLOR} & (isamember(%{TEMP_NUM},%{_array_so_accepted},1) =/ "0")) \
    /echo -w %{TEMP_NUM} %{TEMP_NUMGROUPS} x %{TEMP_PATTERN} %{TEMP_SIZE} %{TEMP_SHADE} %{TEMP_COLOR} %{TEMP_SHAPE} %{TEMP_CLARITY} PAY: %{TEMP_VALUE} Listed: %{TEMP_MARKETER}%;\
  /elseif (!strlen(%{MATCH}) & (isamember(%{TEMP_NUM},%{_array_so_accepted},1) =/ "0")) \
    /echo -w %{TEMP_NUM} %{TEMP_NUMGROUPS} x %{TEMP_PATTERN} %{TEMP_SIZE} %{TEMP_SHADE} %{TEMP_COLOR} %{TEMP_SHAPE} %{TEMP_CLARITY} PAY: %{TEMP_VALUE} Listed: %{TEMP_MARKETER}%;\
  /endif

/def print_so_match = \
  /eval /set TEMP_SIZE=$[get_2array("so",$[TEMP_NUM], 1)]%;\
  /eval /set TEMP_SHADE=$[get_2array("so",$[TEMP_NUM], 2)]%;\
  /eval /set TEMP_COLOR=$[get_2array("so",$[TEMP_NUM], 3)]%;\
  /eval /set TEMP_SHAPE=$[get_2array("so",$[TEMP_NUM], 4)]%;\
  /eval /set TEMP_CLARITY=$[get_2array("so",$[TEMP_NUM], 5)]%;\
  /eval /set TEMP_VALUE=$[get_2array("so",$[TEMP_NUM], 7)]%;\
  /eval /set TEMP_PATTERN=$[get_2array("so",$[TEMP_NUM], 0)]%;\
  /eval /set TEMP_NUMGROUPS=$[get_2array("so",$[TEMP_NUM], 8)]%;\
  /eval /set TEMP_MARKETER=$[get_2array("so",$[TEMP_NUM], 6)]%;\
  /eval /set TEMP_FILLED=$[isamember($[TEMP_NUM],_array_so_accepted,1)]%;\
  /if ({TEMP_COLOR} =/ {VEIN_COLOR} & {TEMP_SHADE} =/ {VEIN_SHADE} & (isamember(%{TEMP_NUM},%{_array_so_accepted},1) =/ "0"))\
    /echo -w %{TEMP_NUM} %{TEMP_NUMGROUPS} x %{TEMP_PATTERN} %{TEMP_SIZE} %{TEMP_SHADE} %{TEMP_COLOR} %{TEMP_SHAPE} %{TEMP_CLARITY} PAY: %{TEMP_VALUE} Listed: %{TEMP_MARKETER}%;\
  /endif
  
/def print_so_did = \
  /eval /set TEMP_SIZE=$[get_2array("so",$[TEMP_NUM], 1)]%;\
  /eval /set TEMP_SHADE=$[get_2array("so",$[TEMP_NUM], 2)]%;\
  /eval /set TEMP_COLOR=$[get_2array("so",$[TEMP_NUM], 3)]%;\
  /eval /set TEMP_SHAPE=$[get_2array("so",$[TEMP_NUM], 4)]%;\
  /eval /set TEMP_CLARITY=$[get_2array("so",$[TEMP_NUM], 11)]%;\
  /eval /set TEMP_VALUE=$[get_2array("so",$[TEMP_NUM], 7)]%;\
  /eval /set TEMP_PATTERN=$[get_2array("so",$[TEMP_NUM], 0)]%;\
  /eval /set TEMP_NUMGROUPS=$[get_2array("so",$[TEMP_NUM], 8)]%;\
  /eval /set TEMP_MARKETER=$[get_2array("so",$[TEMP_NUM], 6)]%;\
  /eval /set TEMP_FILLED=$[isamember($[TEMP_NUM],_array_so_filled,1)]%;\
  /if (isamember(%{TEMP_NUM},%{_array_so_filled},1) != "0")\
    /echo -w %{TEMP_NUM} %{TEMP_NUMGROUPS} x %{TEMP_PATTERN} %{TEMP_SIZE} %{TEMP_SHADE} %{TEMP_COLOR} %{TEMP_SHAPE} %{TEMP_CLARITY} PAY: %{TEMP_VALUE} Listed: %{TEMP_MARKETER}%;\
  /endif

/def orderlist = \
  /let MATCH=%*%;\
  /if (regmatch((rose|blue|green|yellow|amethyst|black|white),{MATCH}) & (strlen({MATCH}))) \
    /set MATCH_COLOR=%{MATCH}%;\
  /endif %;\
  /_echo %;\ /echo -w -aBCcyan SPECIAL ORDER LIST%;\
  /foreach TEMP_NUM _array_so_list /print_so_list%;\
  /_echo %;\
  /unset MATCH%;\
  /unset MATCH_COLOR

/def ordermatch = \
  /_echo %;\ /echo -w -aBCcyan SPECIAL ORDER LIST (%{VEIN_SHADECOLOR})%;\
  /foreach TEMP_NUM _array_so_list /print_so_match %;\
  /_echo

/def orderdid = \
  /_echo %;\ /echo -w -aBCcyan SPECIAL ORDER LIST%;\
  /foreach TEMP_NUM _array_so_filled /print_so_did %;\
  /_echo

/def orderflush = \
  /_echo %;\ /echo -w -aBCcyan TFRC: Flushing the contents of the Special Order List%;\
  /purge_array so%;\
  /repeat -w -1 1 /unset _array_so_filled

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Learn the the special order(s) from the chit or terminal
;;;

/def -p100 -T"tiny.mush.cm.*" -mregexp -t"^([0-9]+) +([0-9a-zA-Z ]*[a-zA-Z]+) +(t|vs|s|ms|m|ml|l|vl) +(vp|p|l|m|d|rd) +([a-z]+) +([a-z]+) +(p|vsf|sf|f|mf) +([A-Za-z]+) +([0-9]+)" special_order_match = \
  /set SO_NUM=%P1%;\
  /set SO_PATTERN=%P2%;\
  /set SO_SIZE=%P3%;\
  /set SO_SHADE=%P4%;\
  /set SO_COLOR=%P5%;\
  /set SO_SHAPE=%P6%;\
  /set SO_CLARITY=%P7%;\
  /set SO_MARKETER=%P8%;\
  /set SO_VALUE=%P9%;\
  /set SO_LONGLINE=Special Order: %P1  %P2  %P4 %P5  %P6  %P7  %P8  %P9 %P3%;\
    /if (regmatch(' x ',%{P2})) \
        /set SO_NUMGROUPS=%PL%; \
        /set SO_PATTERN=%PR%; \
        /set SO_NUMPAT=%PL x %PR%; \
    /else \
        /set SO_NUMGROUPS=1%; \
        /set SO_NUMPAT=%{SO_PATTERN}%; \
    /endif%;\
    /if (%{SO_SHADE} =/ "vp") \
      /set SO_SHADE2=very pale%;\
    /elseif (%{SO_SHADE} =/ "l") \
      /set SO_SHADE2=light%;\
    /elseif (%{SO_SHADE} =/ "m") \
      /set SO_SHADE2=medium%;\
    /elseif (%{SO_SHADE} =/ "d") \
      /set SO_SHADE2=deep%;\
    /elseif (%{SO_SHADE} =/ "rd") \
      /set SO_SHADE2=rich deep%;\
      /set CUT_SCALE=do%;\
    /elseif (%{SO_SHADE} =/ "p") \
        /if (%{SO_COLOR} =/ "white") \
            /set SO_SHADE2=pure%;\
        /elseif (%{SO_COLOR} =/ "black") \
            /set SO_SHADE2=pure%;\
        /else \
            /set SO_SHADE2=pale%;\
        /endif%;\
    /endif%;\
    /if (%{SO_CLARITY} =/ "p") \
        /set SO_CLARITY2=perfect%;\
        /set SO_CLARITY3=0%;\
    /elseif (%{SO_CLARITY} =/ "vsf") \
        /set SO_CLARITY2=very slightly flawed%;\
        /set SO_CLARITY3=1%;\
    /elseif (%{SO_CLARITY} =/ "sf") \
        /set SO_CLARITY2=slightly flawed%;\
        /set SO_CLARITY3=2%;\
    /elseif (%{SO_CLARITY} =/ "f") \
        /set SO_CLARITY2=flawed%;\
        /set SO_CLARITY3=3%;\
    /elseif (%{SO_CLARITY} =/ "mf") \
        /set SO_CLARITY2=majorly flawed%;\
        /set SO_CLARITY3=4%;\
    /else \
        /echo -w -aBCcyan SPECIAL ORDER: Flaw match broken.%;\
    /endif%;\
    /if (%{SO_PATTERN} =/ "octave") \
        /set SO_CRYSTALS=8%;\
    /elseif (%{SO_PATTERN} =/ "5 chord") \
        /set SO_CRYSTALS=5%;\
    /elseif (%{SO_PATTERN} =/ "4 chord") \
        /set SO_CRYSTALS=4%;\
    /elseif (%{SO_PATTERN} =/ "3 chord") \
        /set SO_CRYSTALS=3%;\
    /elseif (%{SO_PATTERN} =/ "5 row") \
        /set SO_CRYSTALS=5%;\
    /elseif (%{SO_PATTERN} =/ "4 row") \
        /set SO_CRYSTALS=4%;\
    /elseif (%{SO_PATTERN} =/ "3 row") \
        /set SO_CRYSTALS=3%;\
    /elseif (%{SO_PATTERN} =/ "Single") \
        /set SO_CRYSTALS=1%;\
    /else \
        /echo -w -aBCcyan SPECIAL ORDER: Flaw match broken.%;\
    /endif %;\
    /test SO_NUMCRYSTALS := %{SO_CRYSTALS} * %{SO_NUMGROUPS}%;\
;@@%;\        
    /eval /set _array_so_$[SO_NUM]_0=$[SO_PATTERN]%;\
    /eval /set _array_so_$[SO_NUM]_1=$[SO_SIZE]%;\
    /eval /set _array_so_$[SO_NUM]_2=$[SO_SHADE2]%;\
    /eval /set _array_so_$[SO_NUM]_3=$[SO_COLOR]%;\
    /eval /set _array_so_$[SO_NUM]_4=$[SO_SHAPE]%;\
    /eval /set _array_so_$[SO_NUM]_5=$[SO_CLARITY2]%;\
    /eval /set _array_so_$[SO_NUM]_6=$[SO_MARKETER]%;\
    /eval /set _array_so_$[SO_NUM]_7=$[SO_VALUE]%;\
    /eval /set _array_so_$[SO_NUM]_8=$[SO_NUMGROUPS]%;\
    /eval /set _array_so_$[SO_NUM]_9=$[SO_CLARITY3]%;\
    /eval /set _array_so_$[SO_NUM]_10=$[SO_LONGLINE]%;\
    /eval /set _array_so_$[SO_NUM]_11=$[SO_CLARITY]%;\
    /eval /set _array_so_$[SO_NUM]_12=$[SO_SHADE]%;\
    /eval /set _array_so_$[SO_NUM]_13=$[SO_NUMPAT]%;\
    /eval /set _array_so_$[SO_NUM]_14=$[SO_NUMCRYSTALS]%;\
    /if (strlen({SO_ACCEPTFLAG})) \
      /addlist _array_so_accepted %{SO_NUM}%;\
    /else \
      /addlist _array_so_list %{SO_NUM}%;\
    /endif


;; check if scanning for Special Order that have already been accepted.

/set ACCEPTED_SCAN=yes

/def -F -p10 -T"tiny.mush.cm.*" -mglob -t'This terminal is totally dedicated to printing out work chits for specially ordered crystal.  At the touch of a button, the screen scrolls up to list the open orders*' so_trig_accept = \
  /if (%{ACCEPTED_SCAN} =/ "yes") \
    /repeat -1 1 /send -w scan accepted list %;\
  /endif

/def -F -p10 -T"tiny.mush.cm.*" -mglob -t'* Orders Under Competition *' so_accept = \
  /set SO_ACCEPTFLAG=yes%;\
  /repeat -2 1 /unset SO_ACCEPTFLAG

;;; 9/13/2011 Fixed orderfill so it no longer shares variable names with the
;;; SO chit code. This means SOs in the cut queue will not be mixed with
;;; SO chits being handled by an alternate Sorter character.

/def -T"tiny.mush.cm.sing" orderfill = \
  /unset TEST_ORDERNUM%;\
  /set TEST_ORDERNUM=%{*}%;\
  /set FILLSO_NUM=%{*}%;\
  /unset RECUT_LIST%;\
  /unset CUT_NOTE%;\
  /unset CUT_SCALE%;\
  /eval /set FILLSO_SIZE=$[get_2array("so",$[FILLSO_NUM], 1)]%;\
  /eval /set FILLSO_SHADE=$[get_2array("so",$[FILLSO_NUM], 2)]%;\
  /eval /set FILLSO_COLOR=$[get_2array("so",$[FILLSO_NUM], 3)]%;\
  /eval /set FILLSO_SHAPE=$[get_2array("so",$[FILLSO_NUM], 4)]%;\
  /eval /set FILLSO_PATTERN=$[get_2array("so",$[FILLSO_NUM], 0)]%;\
  /eval /set FILLSO_VALUE=$[get_2array("so",$[FILLSO_NUM], 7)]%;\
  /eval /set FILLSO_NUMGROUPS=$[get_2array("so",$[FILLSO_NUM], 8)]%;\
  /eval /set FILLSO_CLARITY2=$[get_2array("so",$[FILLSO_NUM], 9)]%;\
  /eval /set FILLSO_CLARITY=$[get_2array("so",$[FILLSO_NUM], 11)]%;\
  /if (!regmatch('[0-9]{4}',%{TEST_ORDERNUM})) \
    /_echo %;\
    /echo -w -aBCred SPECIAL ORDER: You didn't enter a proper special order number. The syntaxt is '/orderfill <SO Number>'. %;\
    /_echo %;\
  /elseif (%{FILLSO_SHADE}!/%{VEIN_SHADE})\
    /echo -w -aBCred SPECIAL ORDER: The "%{VEIN_SHADE}" vein shade does not match the shade on Special Order: %{FILLSO_SHADE}.%;\
  /elseif (%{FILLSO_COLOR}!/%{VEIN_COLOR})\
    /echo -w -aBCred SPECIAL ORDER: The "%{VEIN_COLOR}" vein color does not match the color on Special Order: %{FILLSO_COLOR}.%;\
  /else \
    /_echo %;\
    /echo -w -aBCcyan -p SPECIAL ORDER: The Special Order details match. If the vein is large enough, you can fill this order here. %{FILLSO_NUMGROUPS} x %{FILLSO_PATTERN} %{FILLSO_SIZE} %{FILLSO_SHAPE} %{FILLSO_CLARITY} for CREDITS: %{FILLSO_VALUE}%;\
    /test regmatch('(3 chord|4 chord|5 chord|3 row|4 row|5 row|octave|single)',"%{FILLSO_PATTERN}")%;\
    /addlist SO_QUEUE %{FILLSO_NUM}%;\
    /let CUT_GROUP=%{P1}%;\
    /if (%{CUT_GROUP} =/ "octave") \
      /set CUT_SCALE=do mi so dx ti re fa la%;\
    /elseif (%{CUT_GROUP} =/ "3 chord") \
      /set CUT_SCALE=do mi so%;\
    /elseif (%{CUT_GROUP} =/ "4 chord") \
      /set CUT_SCALE=do mi so dx%;\
    /elseif (%{CUT_GROUP} =/ "5 chord") \
      /set CUT_SCALE=do mi so dx ti%;\
    /elseif (%{CUT_GROUP} =/ "3 row") \
      /set CUT_SCALE=do re mi%;\
    /elseif (%{CUT_GROUP} =/ "4 row") \
      /set CUT_SCALE=do re mi fa%;\
    /elseif (%{CUT_GROUP} =/ "5 row") \
      /set CUT_SCALE=do re mi fa so%;\
    /elseif (%{CUT_GROUP} =/ "single") \
      /set CUT_SCALE=do%;\
    /endif %;\
    /if (%{FILLSO_NUMGROUPS} =/ "2") \
      /set CUT_SCALE=%{CUT_SCALE} %{CUT_SCALE}%;\
    /endif %;\
    /repeat -3 -w 1 /so_loop %{CUT_SCALE}%;\
  /endif

;;;; 9/17/2011 fixed so_loop to make unsetting TEST_ORDERNUM
;;;; slow enough that the order number is added to the
;;;; list of accepted special orders.
;;;; 10/27/2011 Added in check for pause/resume SO cutting

/def so_loop = \
  /if (CUT_CARTON =~ "yes") \
    /beep 1 %;\
    /echo -w -arBCred SPECIAL ORDER: Cutting paused because you need a fresh carton. Type '/cut resume' when ready.%;\
    /if (CUT_QUICK =~ "yes") \
      /repeat -w -60 1 /so_loop %{*} %;\
    /else \
      /repeat -w -130 1 /so_loop %{*} %;\
    /endif%;\
    /set CUT_PID=%?%;\
  /elseif ({#}) \
    /note %{1} %; \
    /set FILLSO_NOTE=%{1}%; \
    /set LABELSHAPE=%{FILLSO_SHAPE}%;\
    /set LABELSIZE=%{FILLSO_SIZE}%;\
    /send -w cut %{FILLSO_SHAPE} size=%{FILLSO_SIZE}%; \
    /shift %; \
    /if (CUT_QUICK =~ "yes") \
      /repeat -w -60 1 /so_loop %{*} %;\
    /else \
      /repeat -w -130 1 /so_loop %{*} %;\
    /endif%;\
    /set CUT_PID=%?%; \
  /else \
    /if (strlen(%{RECUT_LIST})) \
      /echo -w -aBCcyan SPECIAL ORDER: Recutting flawed crystals now.%;\
      /repeat -2 -w 1 /so_loop %{TEMP_RECUT}%; \
      /unset RECUT_LIST%; \
        /else \
          /echo -w -aBCcyan SPECIAL ORDER: Special order %{TEST_ORDERNUM} is done.%;\
          /beep%;\
      /addlist _array_so_accepted %{TEST_ORDERNUM}%;\
      /addlist _array_so_filled %{TEST_ORDERNUM}%;\
      /remlist SO_QUEUE %{FILLSO_NUM}%;\
      /quote -S /unset `/listvar -mglob -s FILLSO_* %;\
      /repeat -w -1 1 /unset TEST_ORDERNUM%;\
    /endif%;\
  /endif

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Automated Cutter Note package (assembled by Gwen Morse)
;;;
;;; How this works...
;;; Needs: the Array Lists of Octave Scales (below)
;;; Also Needs: the VEINSCALE global variable macro (below)
;;; Also Needs: The Virtual Array macro package by Galvin, 
;;; and Michael Hunger (above)

;;; Type '/note <note>' (where <note> is do, re, mi, fa, la, so, ti, dx).
;;; This will set the cutter to the appropriate note, based on the scale 
;;; of the vein you're presently in. This saves "book-keeping" in that 
;;; you don't have to keep track of these settings for each octave scale.
;;; If you want to set it manually to a specific note, /note will still 
;;; accept the standard A-G [sharp/flat] options as well.

;;; /note by Phil.Pennock (Phil Pennock at globnix dot org) and Gwen Morse
;;; (gwen dot morse at gmail dot com). Debugging help from David Moore.
;;; You can use the existing array macros unmodified if you use the scale 
;;; name as the name of the array.


/help_add /help_note set the cutter to the appropriate note
/def -i help_note= \
  /echo -aB Note help%;\
  /echo /note <note> This will set your cutter to <note> %;\
  /if (${world_type} =/ "*dream*") \
      /echo (where <note> is do, re, mi, fa, la, so, ti, dx, mx, fx)%;\
  /elseif (${world_type} =/ "*cm*") \
      /echo (where <note> is do, re, mi, fa, la, so, ti, dx)%;\
  /endif%;\
  /echo (or <note> is A B C D E F G sharp/flat)

/def -T"tiny.mush.cm" note = \
  /if ({*} =/ "{do|re|mi|fa|la|so|ti|dx}") \
      /get_array %{VEINSCALE} %1 %;\
      /let note=%? %;\
      /_echo %;/send -w pose tunes a "%1" note. %;\
      /send -w set cutter to %{note} %;\
      /send -w sing %{note} %;\
  /else \
      /send -w set cutter to %* %;\
      /send -w sing %* %;\
  /endif

;;; return the scale that the vein was in (when you forget if its major/minor cuts)

/def -T"tiny.mush.cm.sing" scale = \
/if ({*} =/ "{A|B|C|D|E|F|G|As|Bs|Cs|Ds|Es|Fs|Gs|Ab|Bb|Cb|Db|Eb|Fb|Gb}") \
      /get_array %1 scale %;\
      /let scale=%? %;\
      /_echo %;/send -w pose is using the "%{scale}" scale. %;\
/elseif ({*}=~"show") \
      /let scale=/test get_array_count('%{VEINSCALE}', 9) %;\
      /_echo %; /send -w pose is using the "$[get_array('%{VEINSCALE}', 9)]" scale. %;\
/else \
      /send -w think %{scale} is not a valid scale. %;\
/endif

;;; Please note that the 2nd echo with -p @{x} is just a haxxor to allow
;;; leading spaces, altho, if you wanted to you could use the @ feature to
;;; set attributes to the text.  Anyway, if I call this macro like such:
;;; /printnote do mi so dx ti re fa la

/DEF print = \
  /echo -w%;\
  /ECHO -w _ %{1} _ %{2} _ %{3} _ %{4} _ %{5} _ %; \
  /ECHO -w -p @{x}   _ %{6} _ %{7} _ %{8} _%;\
  /echo -w
;;; CrystalMUSH Vein emits
;;; Written by Gwen Morse (gwen dot morse at gmail dot com)
;;; matches based on specific leading strings and highlights to show there's a vein in the room.
;;; Also calls 'vein stats' so that you can know if you spotted the vein, or, found another Singer's discard.
;;; (I always want to know this because I keep track of all claims and whether I set the color)

;;; set AUTOSTAKE to something other than "true" if you don't want to automatically stake the claim.
;;;
;;; use "free claim" instead of stake/release when autostake is turned off

/set AUTOSTAKE=true

;; (!might bear|might be worth)

/def -p95 -T"tiny.mush.cm" -mregexp -t"(glint|Flickers|flicker|glimmer|flash|gleam) of (light|crystal) (that|catches|dance|momentarily|captures) .* (might bear|edged by forest)" cm_vein_ignore = \
  /set NULL=NULL

/def -p90 -F -T"tiny.mush.cm" -abCmagenta -mregexp -t"(glint|Flickers|flicker|glimmer|flash|gleam) of (light|crystal) (that|catches|dance|momentarily|captures)" cm_vein = \
  /send look vein%;\
  /send vein stats%;\
  /if ({AUTOSTAKE} =/ "true")\
    /send stake claim%;\
  /endif%;\
  /repeat -2 -w 1 /ordermatch

/def -F -T"tiny.mush.cm" -abCmagenta -mregexp -t"(this must be the place|there is a vein close by|the symbiont pinches right behind|sweet pull of crystal|hair on your arm stands straight up)" cm_vein2 = \
  /send look vein%;\
  /send vein stats%;\
  /if ({AUTOSTAKE} =/ "true")\
    /send stake claim%;\
  /endif%;\
  /repeat -2 -w 1 /ordermatch

/def -F -T"tiny.mush.cm" -abCmagenta -mregexp -t"(something about this spot|symbiont is telling you that crystal|Crystal must be near)" cm_vein3 = \
  /send look vein%;\
  /send vein stats%;\
  /if ({AUTOSTAKE} =/ "true")\
    /send stake claim%;\
  /endif%;\
  /repeat -2 -w 1 /ordermatch

/def -F -T"tiny.mush.cm" -abCmagenta -mregexp -t"(musical vibration rings with your footsteps|crystal song sings softly in your ear|Pleasant shivers go up and down your spine)" cm_vein4 = \
  /send look vein%;\
  /send vein stats%;\
  /if ({AUTOSTAKE} =/ "true")\
    /send stake claim%;\
  /endif%;\
  /repeat -2 -w 1 /ordermatch

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Array list of octave scales at CrystalMUSH
;;; Written by Gwen Morse (gwen dot morse at gmail dot com)

;;; As per Wolfgang@CrystalMUSH, it's always best to cut major scales. Then if you're left with a
;;; group of flawed crystals for the 'so', 'ti', and 'dx' notes, you can make a 3 chord.
;;; Minor scales do not allow that additional 3 chord grouping.

/put_array Amin do A
/put_array Amin re B
/put_array Amin mi C
/put_array Amin fa D
/put_array Amin so E
/put_array Amin la F
/put_array Amin ti G
/put_array Amin dx A
/put_array Amin mx C
/put_array Amin fx D
/put_array Amin scale Amin

/put_array A do A
/put_array A re B
/put_array A mi Cs
/put_array A fa D
/put_array A so E
/put_array A la Fs
/put_array A ti Gs
/put_array A dx A
/put_array A mx D
/put_array A fx Ds
/put_array A scale Amaj

/put_array Bmin do B
/put_array Bmin re Cs
/put_array Bmin mi D
/put_array Bmin fa E
/put_array Bmin so Fs
/put_array Bmin la G
/put_array Bmin ti A
/put_array Bmin dx B
/put_array Bmin mx D
/put_array Bmin fx E
/put_array Bmin scale Bmin

/put_array B do B
/put_array B re Cs
/put_array B mi Ds
/put_array B fa E
/put_array B so Fs
/put_array B la Gs
/put_array B ti As
/put_array B dx B
/put_array B mx Ds
/put_array B fx E
/put_array B scale Bmaj

/put_array C do C
/put_array C re D
/put_array C mi E
/put_array C fa F
/put_array C so G
/put_array C la A
/put_array C ti B
/put_array C dx C
/put_array C scale Cmaj

/put_array Cmin do C
/put_array Cmin re D
/put_array Cmin mi Ds
/put_array Cmin fa F
/put_array Cmin so G
/put_array Cmin la Gs
/put_array Cmin ti As
/put_array Cmin dx C
/put_array Cmin scale Cmin

/put_array Dmin do D
/put_array Dmin re E
/put_array Dmin mi F
/put_array Dmin fa G
/put_array Dmin so A
/put_array Dmin la As
/put_array Dmin ti C
/put_array Dmin dx D
/put_array Dmin mx F
/put_array Dmin fx G
/put_array Dmin scale Dmin

/put_array D do D
/put_array D re E
/put_array D mi Fs
/put_array D fa G
/put_array D so A
/put_array D la B
/put_array D ti Cs
/put_array D dx D
/put_array D mx Fs
/put_array D fx G
/put_array D scale Dmaj

/put_array Emin do E
/put_array Emin re Fs
/put_array Emin mi G
/put_array Emin fa A
/put_array Emin so B
/put_array Emin la C
/put_array Emin ti D
/put_array Emin dx E
/put_array Emin mx G
/put_array Emin fx A
/put_array Emin scale Emin

/put_array E do E
/put_array E re Fs
/put_array E mi Gs
/put_array E fa A
/put_array E so B
/put_array E la Cs
/put_array E ti Ds
/put_array E dx E
/put_array E mx Gs
/put_array E fx A
/put_array E scale Emaj

/put_array F do F
/put_array F re G
/put_array F mi A
/put_array F fa As
/put_array F so C
/put_array F la D
/put_array F ti E
/put_array F dx F
/put_array F mx A
/put_array F fx As
/put_array F scale Fmaj

/put_array Fmin do F
/put_array Fmin re G
/put_array Fmin mi Gs
/put_array Fmin fa As
/put_array Fmin so C
/put_array Fmin la Cs
/put_array Fmin ti Ds
/put_array Fmin dx F
/put_array Fmin mx Gs
/put_array Fmin fx As
/put_array Fmin scale Fmin

/put_array G do G
/put_array G re A
/put_array G mi B
/put_array G fa C
/put_array G so D
/put_array G la E
/put_array G ti Fs
/put_array G dx G
/put_array G mx B
/put_array G fx C
/put_array G scale Gmaj

/put_array Gmin do G
/put_array Gmin re A
/put_array Gmin mi As
/put_array Gmin fa C
/put_array Gmin so D
/put_array Gmin la Ds
/put_array Gmin ti F
/put_array Gmin dx G
/put_array Gmin mx As
/put_array Gmin fx C
/put_array Gmin scale Gmin

/put_array As do As
/put_array As re C
/put_array As mi D
/put_array As fa Ds
/put_array As so F
/put_array As la G
/put_array As ti A
/put_array As dx As
/put_array As mx D
/put_array As fx Ds
/put_array As scale Ashmaj

/put_array Asmin do As
/put_array Asmin re C
/put_array Asmin mi Cs
/put_array Asmin fa Ds
/put_array Asmin so F
/put_array Asmin la Fs
/put_array Asmin ti Gs
/put_array Asmin dx As
/put_array Asmin mx Cs
/put_array Asmin fx Ds
/put_array Asmin scale Ashmin

/put_array Bs do Bs
/put_array Bs re D
/put_array Bs mi E
/put_array Bs fa F
/put_array Bs so G
/put_array Bs la A
/put_array Bs ti B
/put_array Bs dx Bs
/put_array Bs mx E
/put_array Bs fx F
/put_array Bs scale Bshmaj

/put_array Bsmin do Bs
/put_array Bsmin re D
/put_array Bsmin mi Ds
/put_array Bsmin fa F
/put_array Bsmin so G
/put_array Bsmin la Gs
/put_array Bsmin ti As
/put_array Bsmin dx Bs
/put_array Bsmin mx Ds
/put_array Bsmin fx F
/put_array Bsmin scale Bshmin

/put_array Csmin do Cs
/put_array Csmin re Ds
/put_array Csmin mi E
/put_array Csmin fa Fs
/put_array Csmin so Gs
/put_array Csmin la A
/put_array Csmin ti B
/put_array Csmin dx Cs
/put_array Csmin mx E
/put_array Csmin fx Fs
/put_array Csmin scale Cshmin

/put_array Cs do Cs
/put_array Cs re Ds
/put_array Cs mi F
/put_array Cs fa Fs
/put_array Cs so Gs
/put_array Cs la As
/put_array Cs ti C
/put_array Cs dx Cs
/put_array Cs mx F
/put_array Cs fx Fs
/put_array Cs scale Cshmaj

/put_array Ds do Ds
/put_array Ds re F
/put_array Ds mi G
/put_array Ds fa Gs
/put_array Ds so As
/put_array Ds la C
/put_array Ds ti D
/put_array Ds dx Ds
/put_array Ds mx G
/put_array Ds fx Gs
/put_array Ds scale Dshmaj

/put_array Dsmin do Ds
/put_array Dsmin re F
/put_array Dsmin mi Fs
/put_array Dsmin fa Gs
/put_array Dsmin so As
/put_array Dsmin la B
/put_array Dsmin ti Cs
/put_array Dsmin dx Ds
/put_array Dsmin mx Fs
/put_array Dsmin fx Gs
/put_array Dsmin scale Dshmin

/put_array Es do Es
/put_array Es re G
/put_array Es mi A
/put_array Es fa As
/put_array Es so C
/put_array Es la D
/put_array Es ti E
/put_array Es dx Es
/put_array Es mx A
/put_array Es fx As
/put_array Es scale Eshmaj

/put_array Esmin do Es
/put_array Esmin re G
/put_array Esmin mi Gs
/put_array Esmin fa As
/put_array Esmin so C
/put_array Esmin la Cs
/put_array Esmin ti Ds
/put_array Esmin dx Es
/put_array Esmin mx Gs
/put_array Esmin fx As
/put_array Esmin scale Eshmin

/put_array Fsmin do Fs
/put_array Fsmin re Gs
/put_array Fsmin mi A
/put_array Fsmin fa B
/put_array Fsmin so Cs
/put_array Fsmin la D
/put_array Fsmin ti E
/put_array Fsmin dx Fs
/put_array Fsmin mx A
/put_array Fsmin fx B
/put_array Fsmin scale Fshmin

/put_array Fs do Fs
/put_array Fs re Gs
/put_array Fs mi As
/put_array Fs fa B
/put_array Fs so Cs
/put_array Fs la Ds
/put_array Fs ti F
/put_array Fs dx Fs
/put_array Fs mx As
/put_array Fs fx B
/put_array Fs scale Fshmaj

/put_array Gs do Gs
/put_array Gs re As
/put_array Gs mi C
/put_array Gs fa Cs
/put_array Gs so Ds
/put_array Gs la F
/put_array Gs ti G
/put_array Gs dx Gs
/put_array Gs mx C
/put_array Gs fx Cs
/put_array Gs scale Gshmaj

/put_array Gsmin do Gs
/put_array Gsmin re As
/put_array Gsmin mi B
/put_array Gsmin fa Cs
/put_array Gsmin so Ds
/put_array Gsmin la E
/put_array Gsmin ti Fs
/put_array Gsmin dx Gs
/put_array Gsmin mx B
/put_array Gsmin fx Cs
/put_array Gsmin scale Gshmin

/put_array Ab do Af
/put_array Ab re Bf
/put_array Ab mi C
/put_array Ab fa Df
/put_array Ab so Ef
/put_array Ab la F
/put_array Ab ti G
/put_array Ab dx Af
/put_array Ab mx C
/put_array Ab fx Df
/put_array Ab scale Abmaj

/put_array Abmin do Af
/put_array Abmin re Bf
/put_array Abmin mi B
/put_array Abmin fa Df
/put_array Abmin so Ef
/put_array Abmin la E
/put_array Abmin ti Gf
/put_array Abmin dx Af
/put_array Abmin mx B
/put_array Abmin fx Df
/put_array Abmin scale Abmin

/put_array Bbmin do Bf
/put_array Bbmin re C
/put_array Bbmin mi Df
/put_array Bbmin fa Ef
/put_array Bbmin so F
/put_array Bbmin la Gf
/put_array Bbmin ti Af
/put_array Bbmin dx Bf
/put_array Bbmin mx Df
/put_array Bbmin fx Ef
/put_array Bbmin scale Bbmin

/put_array Bb do Bf
/put_array Bb re C
/put_array Bb mi D
/put_array Bb fa Ef
/put_array Bb so F
/put_array Bb la G
/put_array Bb ti A
/put_array Bb dx Bf
/put_array Bb mx D
/put_array Bb fx Ef
/put_array Bb scale Bbmaj

/put_array Cb do Cf
/put_array Cb re Df
/put_array Cb mi Ef
/put_array Cb fa E
/put_array Cb so Gf
/put_array Cb la Af
/put_array Cb ti Bf
/put_array Cb dx Cf
/put_array Cb mx Ef
/put_array Cb fx E
/put_array Cb scale Cbmaj

/put_array Cbmin do Cf
/put_array Cbmin re Df
/put_array Cbmin mi D
/put_array Cbmin fa E
/put_array Cbmin so Gf
/put_array Cbmin la G
/put_array Cbmin ti A
/put_array Cbmin dx Cf
/put_array Cbmin mx D
/put_array Cbmin fx E
/put_array Cbmin scale Cbmin

/put_array Dbmin do Df
/put_array Dbmin re Ef
/put_array Dbmin mi E
/put_array Dbmin fa Gf
/put_array Dbmin so Af
/put_array Dbmin la A
/put_array Dbmin ti B
/put_array Dbmin dx Df
/put_array Dbmin mx E
/put_array Dbmin fx Gf
/put_array Dbmin scale Dbmin

/put_array Db do Df
/put_array Db re Ef
/put_array Db mi F
/put_array Db fa Gf
/put_array Db so Af
/put_array Db la Bf
/put_array Db ti C
/put_array Db dx Df
/put_array Db mx F
/put_array Db fx Gf
/put_array Db scale Dbmaj

/put_array Eb do Ef
/put_array Eb re F
/put_array Eb mi G
/put_array Eb fa Af
/put_array Eb so Bf
/put_array Eb la C
/put_array Eb ti D
/put_array Eb dx Ef
/put_array Eb mx G
/put_array Eb fx Af
/put_array Eb scale Ebmaj

/put_array Ebmin do Ef
/put_array Ebmin re F
/put_array Ebmin mi Gf
/put_array Ebmin fa Af
/put_array Ebmin so Bf
/put_array Ebmin la B
/put_array Ebmin ti Df
/put_array Ebmin dx Ef
/put_array Ebmin mx Gf
/put_array Ebmin fx Af
/put_array Ebmin scale Ebmin

/put_array Fbmin do Ff
/put_array Fbmin re Gf
/put_array Fbmin mi G
/put_array Fbmin fa A
/put_array Fbmin so B
/put_array Fbmin la C
/put_array Fbmin ti D
/put_array Fbmin dx Ff
/put_array Fbmin mx G
/put_array Fbmin fx A
/put_array Fbmin scale Fbmin

/put_array Fb do Ff
/put_array Fb re Gf
/put_array Fb mi Af
/put_array Fb fa A
/put_array Fb so B
/put_array Fb la Df
/put_array Fb ti Ef
/put_array Fb dx Ff
/put_array Fb mx Af
/put_array Fb fx A
/put_array Fb scale Fbmaj

/put_array Gbmin do Gf
/put_array Gbmin re Af
/put_array Gbmin mi A
/put_array Gbmin fa B
/put_array Gbmin so Df
/put_array Gbmin la D
/put_array Gbmin ti E
/put_array Gbmin dx Gf
/put_array Gbmin mx A
/put_array Gbmin fx B
/put_array Gbmin scale Gbmin

/put_array Gb do Gf
/put_array Gb re Af
/put_array Gb mi Bf
/put_array Gb fa B
/put_array Gb so Df
/put_array Gb la Ef
/put_array Gb ti F
/put_array Gb dx Gf
/put_array Gb mx Bf
/put_array Gb fx B
/put_array Gb scale Gbmaj

; VEINSCALE Global Variable Macro

;;; Written by Gwen Morse (gwen dot morse at gmail dot com)

;;; This works with the octave array code above. Grabs the scale of the vein that you've last 'looked' at.
;;; This sets the scale of the vein in the global {VEINSCALE} variable.

/def -T"tiny.mush.cm" -p50 -F -mregexp -t"The vein subtly sings to you in a scale of ([A-Za-z]+( [A-Za-z]+)?)." vein_scale = \
  /if ({P1}=~"A flat") \
    /set VEINSCALE=Ab %;\
  /elseif ({P1}=~"B flat") \
    /set VEINSCALE=Bb %;\
  /elseif ({P1}=~"C flat") \
    /set VEINSCALE=Cb %;\
  /elseif ({P1}=~"D flat") \
    /set VEINSCALE=Db %;\
  /elseif ({P1}=~"E flat") \
    /set VEINSCALE=Eb %;\
  /elseif ({P1}=~"F flat") \
    /set VEINSCALE=Fb %;\
  /elseif ({P1}=~"G flat") \
    /set VEINSCALE=Gb %;\
  /elseif ({P1}=~"A sharp") \
    /set VEINSCALE=As %;\
  /elseif ({P1}=~"B sharp") \
    /set VEINSCALE=Bs %;\
  /elseif ({P1}=~"C sharp") \
    /set VEINSCALE=Cs %;\
  /elseif ({P1}=~"D sharp") \
    /set VEINSCALE=Ds %;\
  /elseif ({P1}=~"E sharp") \
    /set VEINSCALE=Es %;\
  /elseif ({P1}=~"F sharp") \
    /set VEINSCALE=Fs %;\
  /elseif ({P1}=~"G sharp") \
    /set VEINSCALE=Gs %;\
  /else \
    /set VEINSCALE=%P1 %;\
/endif


;;; Set the color and shade of the vein and
;;; highlight the vein the color of the crystal found within.
;;;
;;; This was requested by Kahlyla@CM
;;;
;;; The "old" version of the code assigned a different color to each
;;; shade and color possible.
;;;
;;; This doesn't work well for visual cue-ing of "desirable" vs 
;;; "undesirable" veins because the variation in saturation is 
;;; different for each color. A 'pale' yellow color is less 
;;; saturated than a 'pale' pink color.
;;;
;; 17 Feb 2014 Changed to the newer version of the code.
;; Desirable claims get one highly saturated color
;; Undesirable claims get a less saturated color
;;
;; A claim is deemed desirable if it's Pure, Medium, Deep, or Rich Deep
;; The Pale and Light claims are undesirable.
;;

/def -T"tiny.mush.cm" -F -mregexp -t"You catch a sparkling glimmer of (very pale|pale|light|medium|deep|rich deep|pure) (rose|blue|green|yellow|black|white|amethyst)" vein_color = \
  /set VEIN_SHADE=%P1%;\
  /set VEIN_COLOR=%P2%;\
  /set VEIN_SHADECOLOR=%P1 %P2%;\
  /if ({VEIN_SHADE} =~ "pure") \
    /set VEIN_DBSHADE=p%;\
  /elseif ({VEIN_SHADE} =~ "very pale") \
    /set VEIN_DBSHADE=vp%;\
  /elseif ({VEIN_SHADE} =~ "pale") \
    /set VEIN_DBSHADE=p%;\
  /elseif ({VEIN_SHADE} =~ "light") \
    /set VEIN_DBSHADE=l%;\
  /elseif ({VEIN_SHADE} =~ "medium") \
    /set VEIN_DBSHADE=m%;\
  /elseif ({VEIN_SHADE} =~ "rich deep") \
    /set VEIN_DBSHADE=rd%;\
  /elseif ({VEIN_SHADE} =~ "deep") \
    /set VEIN_DBSHADE=d%;\
  /endif%;\
  /if ({COLORS} != "256") \
; @@ /echo 16 colors @@%;\
  /if ({VEIN_COLOR} =~ "rose") \
      /set VEIN_DBCOLOR=R%;\
      /test substitute(decode_attr(strcat("@{Cred}",{*})))%;\
    /elseif ({VEIN_COLOR} =~ "blue") \
      /set VEIN_DBCOLOR=Bl%;\
      /test substitute(decode_attr(strcat("@{Cblue}",{*})))%;\
    /elseif ({VEIN_COLOR} =~ "green") \
      /set VEIN_DBCOLOR=G%;\
      /test substitute(decode_attr(strcat("@{Cgreen}",{*})))%;\
    /elseif ({VEIN_COLOR} =~ "amethyst") \
      /set VEIN_DBCOLOR=A%;\
      /test substitute(decode_attr(strcat("@{Cmagenta}",{*})))%;\
    /elseif ({VEIN_COLOR} =~ "yellow") \
      /set VEIN_DBCOLOR=Y%;\
      /test substitute(decode_attr(strcat("@{Cyellow}",{*})))%;\
    /elseif ({VEIN_COLOR} =~ "white") \
      /set VEIN_DBCOLOR=W%;\
      /test substitute(decode_attr(strcat("@{BCwhite}",{*})))%;\
    /elseif ({VEIN_COLOR} =~ "black") \
      /set VEIN_DBCOLOR=Bk%;\
      /test substitute(decode_attr(strcat("@{rCblack}",{*})))%;\
    /endif%;\
  /set LABELCOLOR=%{VEIN_DBSHADE}%{VEIN_DBCOLOR}%;\
  /elseif ({COLORS} == "256")\
; @@ 256 colors @@ %;\
    /if ({VEIN_SHADECOLOR} =/ "pure black") \
      /set LABELCOLOR=%{VEIN_DBSHADE}Bk%;\
      /test substitute(decode_attr(strcat("@{BCblack}",{*})))%;\
    /elseif ({VEIN_SHADECOLOR} =/ "pure white") \
      /set LABELCOLOR=%{VEIN_DBSHADE}W%;\
      /test substitute(decode_attr(strcat("@{BCwhite}",{*})))%;\
;@@;%;\
    /elseif ({VEIN_SHADECOLOR} =/ "very pale rose") \
      /set LABELCOLOR=%{VEIN_DBSHADE}R%;\
      /test substitute(decode_attr(strcat("@{Crgb535}",{*})))%;\
     /elseif ({VEIN_SHADECOLOR} =/ "pale rose") \
      /set LABELCOLOR=%{VEIN_DBSHADE}R%;\
      /test substitute(decode_attr(strcat("@{Crgb535}",{*})))%;\
     /elseif ({VEIN_SHADECOLOR} =/ "light rose") \
      /set LABELCOLOR=%{VEIN_DBSHADE}R%;\
      /test substitute(decode_attr(strcat("@{Crgb535}",{*})))%;\
    /elseif ({VEIN_SHADECOLOR} =/ "medium rose") \
      /set LABELCOLOR=%{VEIN_DBSHADE}R%;\
      /test substitute(decode_attr(strcat("@{Crgb505}",{*})))%;\
    /elseif ({VEIN_SHADECOLOR} =/ "deep rose") \
      /set LABELCOLOR=%{VEIN_DBSHADE}R%;\
      /test substitute(decode_attr(strcat("@{Crgb505}",{*})))%;\
    /elseif ({VEIN_SHADECOLOR} =/ "rich deep rose") \
      /set LABELCOLOR=%{VEIN_DBSHADE}R%;\
      /test substitute(decode_attr(strcat("@{Crgb505}",{*})))%;\
;@@;%;\
    /elseif ({VEIN_SHADECOLOR} =/ "very pale amethyst") \
      /set LABELCOLOR=%{VEIN_DBSHADE}A%;\
      /test substitute(decode_attr(strcat("@{Crgb335}",{*})))%;\
     /elseif ({VEIN_SHADECOLOR} =/ "pale amethyst") \
      /set LABELCOLOR=%{VEIN_DBSHADE}A%;\
      /test substitute(decode_attr(strcat("@{Crgb335}",{*})))%;\
     /elseif ({VEIN_SHADECOLOR} =/ "light amethyst") \
      /set LABELCOLOR=%{VEIN_DBSHADE}A%;\
      /test substitute(decode_attr(strcat("@{Crgb335}",{*})))%;\
    /elseif ({VEIN_SHADECOLOR} =/ "medium amethyst") \
      /set LABELCOLOR=%{VEIN_DBSHADE}A%;\
      /test substitute(decode_attr(strcat("@{Crgb305}",{*})))%;\
    /elseif ({VEIN_SHADECOLOR} =/ "deep amethyst") \
      /set LABELCOLOR=%{VEIN_DBSHADE}A%;\
      /test substitute(decode_attr(strcat("@{Crgb305}",{*})))%;\
    /elseif ({VEIN_SHADECOLOR} =/ "rich deep amethyst") \
      /set LABELCOLOR=%{VEIN_DBSHADE}A%;\
      /test substitute(decode_attr(strcat("@{Crgb305}",{*})))%;\
;@@;%;\
    /elseif ({VEIN_SHADECOLOR} =/ "very pale green") \
      /set LABELCOLOR=%{VEIN_DBSHADE}G%;\
      /test substitute(decode_attr(strcat("@{Crgb140}",{*})))%;\
     /elseif ({VEIN_SHADECOLOR} =/ "pale green") \
      /set LABELCOLOR=%{VEIN_DBSHADE}G%;\
      /test substitute(decode_attr(strcat("@{Crgb140}",{*})))%;\
    /elseif ({VEIN_SHADECOLOR} =/ "light green") \
      /set LABELCOLOR=%{VEIN_DBSHADE}G%;\
      /test substitute(decode_attr(strcat("@{Crgb140}",{*})))%;\
    /elseif ({VEIN_SHADECOLOR} =/ "medium green") \
      /set LABELCOLOR=%{VEIN_DBSHADE}G%;\
      /test substitute(decode_attr(strcat("@{Crgb030}",{*})))%;\
    /elseif ({VEIN_SHADECOLOR} =/ "deep green") \
      /set LABELCOLOR=%{VEIN_DBSHADE}G%;\
      /test substitute(decode_attr(strcat("@{Crgb030}",{*})))%;\
    /elseif ({VEIN_SHADECOLOR} =/ "rich deep green") \
      /set LABELCOLOR=%{VEIN_DBSHADE}G%;\
      /test substitute(decode_attr(strcat("@{Crgb030}",{*})))%;\
;@@;%;\
    /elseif ({VEIN_SHADECOLOR} =/ "very pale blue") \
      /set LABELCOLOR=%{VEIN_DBSHADE}Bl%;\
      /test substitute(decode_attr(strcat("@{Crgb035}",{*})))%;\
     /elseif ({VEIN_SHADECOLOR} =/ "pale blue") \
      /set LABELCOLOR=%{VEIN_DBSHADE}Bl%;\
      /test substitute(decode_attr(strcat("@{Crgb035}",{*})))%;\
     /elseif ({VEIN_SHADECOLOR} =/ "light blue") \
      /set LABELCOLOR=%{VEIN_DBSHADE}Bl%;\
      /test substitute(decode_attr(strcat("@{Crgb035}",{*})))%;\
    /elseif ({VEIN_SHADECOLOR} =/ "medium blue") \
      /set LABELCOLOR=%{VEIN_DBSHADE}Bl%;\
      /test substitute(decode_attr(strcat("@{Crgb005}",{*})))%;\
    /elseif ({VEIN_SHADECOLOR} =/ "deep blue") \
      /set LABELCOLOR=%{VEIN_DBSHADE}Bl%;\
      /test substitute(decode_attr(strcat("@{Crgb005}",{*})))%;\
    /elseif ({VEIN_SHADECOLOR} =/ "rich deep blue") \
      /set LABELCOLOR=%{VEIN_DBSHADE}Bl%;\
      /test substitute(decode_attr(strcat("@{Crgb005}",{*})))%;\
;@@;%;\
    /elseif ({VEIN_SHADECOLOR} =/ "very pale yellow") \
      /set LABELCOLOR=%{VEIN_DBSHADE}Y%;\
      /test substitute(decode_attr(strcat("@{Crgb553}",{*})))%;\
     /elseif ({VEIN_SHADECOLOR} =/ "pale yellow") \
      /set LABELCOLOR=%{VEIN_DBSHADE}Y%;\
      /test substitute(decode_attr(strcat("@{Crgb553}",{*})))%;\
     /elseif ({VEIN_SHADECOLOR} =/ "light yellow") \
      /set LABELCOLOR=%{VEIN_DBSHADE}Y%;\
      /test substitute(decode_attr(strcat("@{Crgb553}",{*})))%;\
    /elseif ({VEIN_SHADECOLOR} =/ "medium yellow") \
      /set LABELCOLOR=%{VEIN_DBSHADE}Y%;\
      /test substitute(decode_attr(strcat("@{Crgb550}",{*})))%;\
    /elseif ({VEIN_SHADECOLOR} =/ "deep yellow") \
      /set LABELCOLOR=%{VEIN_DBSHADE}Y%;\
      /test substitute(decode_attr(strcat("@{Crgb550}",{*})))%;\
    /elseif ({VEIN_SHADECOLOR} =/ "rich deep yellow") \
      /set LABELCOLOR=%{VEIN_DBSHADE}Y%;\
      /test substitute(decode_attr(strcat("@{Crgb550}",{*})))%;\
    /endif%;\
  /endif

;; Feb 19 2014 - vein_size expanded to include a check and setting to determine
;; if the vein is small, medium, large, or empty
;;
;; April 8 2014 updated for UPLOAD_SIZE %;\


/def -T"tiny.mush.cm" -F -mregexp -t"You get a sense that this is (a|an) (very large|large|pretty large|medium|medium small|very small|empty) vein" vein_size = \
  /set VEIN_SIZE=%P2%;\
  /if (VEIN_SIZE =/ "very small" | VEIN_SIZE =/ "medium small") \
    /set VEIN_SIZE_STATUS=small%;\
  /elseif (VEIN_SIZE =/ "medium") \
    /set VEIN_SIZE_STATUS=medium%;\
  /elseif (VEIN_SIZE =/ "pretty large" | VEIN_SIZE =/ "very large" | VEIN_SIZE =/ "large") \
    /set VEIN_SIZE_STATUS=large%;\
  /elseif (VEIN_SIZE =/ "empty") \
    /set VEIN_SIZE_STATUS=empty%;\
  /else \
    /set VEIN_SIZE_STATUS=error%;\
  /endif%;\
  /if (VEIN_SIZE =/ "very small") \
    /set UPLOAD_SIZE=vs%;\
  /elseif (VEIN_SIZE =/ "medium small") \
    /set UPLOAD_SIZE=ms%;\
  /elseif (VEIN_SIZE =/ "medium") \
    /set UPLOAD_SIZE=med%;\
  /elseif (VEIN_SIZE =/ "pretty large") \
    /set UPLOAD_SIZE=ptl%;\
  /elseif (VEIN_SIZE =/ "large") \
    /set UPLOAD_SIZE=lg%;\
  /elseif (VEIN_SIZE =/ "very large") \
    /set UPLOAD_SIZE=vl%;\
  /elseif (VEIN_SIZE =/ "empty") \
    /set UPLOAD_SIZE=empty%;\
  /endif%;\
  /echo -w -aB VEIN: TFRC: The vein is: %{VEIN_SIZE_STATUS}.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;  Build the CM Market Pricing Array
;;;  crystal market price array and suggested best market
;;;  Calculate what a perfect octave at the best market size would be
;;;  ("best" being the best size out of size order).
;;;

;; size
/test put_2array('cmprices', 04, '0', 'size')
/test put_2array('cmprices', 04, '1', '25')
/test put_2array('cmprices', 04, '2', '18')
/test put_2array('cmprices', 04, '3', '13')
/test put_2array('cmprices', 04, '4', '10')
/test put_2array('cmprices', 04, '5', '9')
/test put_2array('cmprices', 04, '6', '7')
/test put_2array('cmprices', 04, '7', '5')
/test put_2array('cmprices', 04, '8', '3')

/set M_SIZE_ALL %{P1}, %{P2}, %{P3}, %{P4}, %{P5}, %{P6}, %{P7}, %{P8}
/set M_SIZE_TEST %{P1}|%{P2}|%{P3}|%{P4}|%{P5}|%{P6}|%{P7}|%{P8}
/set MARKET_SIZE_DEFAULT very large|large|medium large|medium|medium small|small|very small|tiny
/set MARKET_SIZE_NDEFAULT 25|18|13|10|9|7|5|3

;; I need to do a compare between the default size values and today's size values.
;; step through each item in the default size list.
;; Find it's place in today's size list.
;; Find it's value in today's value list.
;; write it's normal value in today's position as a number (NTEST). 
;; Compare NDEFAULT and NTEST. The best change wins.


/def do_market_place = \
  /eval /set test_place=$[isamember(%{TEMP_SIZE},%{MARKET_SIZE_TEST},1)]%;\
  /addlist MARKET_SIZE_NPOS %{test_place}

/def do_market_value = \
  /set TMP_VALUE%;\
  /eval /set temp_value=$[get_2array("cmprices",04,$[TMP_VALUE])]%;\
  /eval /set test_value=$[isamember(%{TMP_VALUE},%{MARKET_SIZE_NDEFAULT},1)]%;\
  /set test_value%;\
  /addlist MARKET_SIZE_NTEST %{test_value}


/def market-check = \
  /set clarity=perfect%;\
  /set group=octave%;\
  /set BEST_SIZE=medium large%;\
  /eval /set test_group=$[isamember(%{group},%{MARKET_GROUP_TEST},1)]%;\
  /eval /set test_clarity=$[isamember(%{clarity},%{MARKET_CLARITY_TEST},1)]%;\
  /eval /set test_color=$[isamember(%{VEIN_COLOR},%{MARKET_COLOR_TEST},1)]%;\
  /eval /set test_shade=$[isamember(%{VEIN_SHADE},%{MARKET_SHADE_TEST},1)]%;\
  /eval /set test_shape=$[isamember(%{MARKET_SHAPE1},%{MARKET_SHAPE_TEST},1)]%;\
  /eval /set test_size=$[isamember(%{BEST_SIZE},%{MARKET_SIZE_TEST},1)]%;\
  /eval /set TEST_GROUP=$[get_2array("cmprices",00,$[test_group])]%;\
  /eval /set TEST_SHADE=$[get_2array("cmprices",01,$[test_shade])]%;\
  /eval /set TEST_CLARITY=$[get_2array("cmprices",02,$[test_clarity])]%;\
  /eval /set TEST_SHAPE=$[get_2array("cmprices",03,$[test_shape])]%;\
  /eval /set TEST_SIZE=$[get_2array("cmprices",04,$[test_size])]%;\
  /eval /set TEST_COLOR=$[get_2array("cmprices",05,$[test_color])]%;\
  /test test_value :=(%{TEST_GROUP} * %{TEST_SHADE} * %{TEST_CLARITY} * %{TEST_SHAPE} * %{TEST_SIZE} * %{TEST_COLOR})/1000 %;\
  /set test_value%;\
  /quote -S /set `/listvar -mglob -s MARKET_* %;\
  /quote -S /set `/listvar -mglob -s test_* %;\
  /quote -S /set `/listvar -mglob -s TMP_* %;\
  /quote -S /set `/listvar -mglob -s TEST_*

  
;;; Grab the current crystal market

/def -F -p100 -T"tiny.mush.cm" -mregexp -t"^\\s+ Crystal Market values" cm_market_match_reset = \
  /quote -S /unset `/listvar -mglob -s MARKET_SIZE_NPOS* %;\
  /quote -S /unset `/listvar -mglob -s MARKET_SIZE_NTEST* %;\
  /repeat -w -1 1 /foreach TMP_SIZE MARKET_SIZE_DEFAULT /do_market_place%;\
  /repeat -w -2 1 /foreach TMP_VALUE MARKET_SIZE_NPOS /do_market_value


/def -qFp5 -T"tiny.mush.cm*" -mregexp -t"^\\s+\\s+(black|white|amethyst|yellow|blue|green|rose),\\s(black|white|amethyst|yellow|blue|green|rose),\\s(black|white|amethyst|yellow|blue|green|rose),\\s(black|white|amethyst|yellow|blue|green|rose),\\s(black|white|amethyst|yellow|blue|green|rose),\\s(black|white|amethyst|yellow|blue|green|rose), and (black|white|amethyst|yellow|blue|green|rose)" sort_get_market_color = \
  /set MARKET_COLOR1 %{P1} %;\
  /set MARKET_COLOR2 %{P2} %;\
  /set MARKET_COLOR3 %{P3} %;\
  /set MARKET_COLOR4 %{P4} %;\
  /set MARKET_COLOR5 %{P5} %;\
  /set MARKET_COLOR6 %{P6} %;\
  /set MARKET_COLOR7 %{P7} %;\
  /set MARKET_COLOR_TEST %{P1}|%{P2}|%{P3}|%{P4}|%{P5}|%{P6}|%{P7}%;\
  /set MARKET_COLOR_ALL Market Color: %{P1}, %{P2}, %{P3}, %{P4}, %{P5}, %{P6}, %{P7}

  
/def -qFp5 -T"tiny.mush.cm*" -mregexp -t"^\\s+\\s+(tiny|medium small|medium large|medium|very small|small|large|very large),\\s(tiny|medium small|medium large|medium|very small|small|large|very large),\\s(tiny|medium small|medium large|medium|very small|small|large|very large),\\s(tiny|medium small|medium large|medium|very small|small|large|very large),\\s(tiny|medium small|medium large|medium|very small|small|large|very large),\\s(tiny|medium small|medium large|medium|very small|small|large|very large),\\s(tiny|medium small|medium large|medium|very small|small|large|very large), and (tiny|medium small|medium large|medium|very small|small|large|very large)" sort_get_market_size = \
  /set MARKET_SIZE1 %{P1} %;\
  /set MARKET_SIZE2 %{P2} %;\
  /set MARKET_SIZE3 %{P3} %;\
  /set MARKET_SIZE4 %{P4} %;\
  /set MARKET_SIZE5 %{P5} %;\
  /set MARKET_SIZE6 %{P6} %;\
  /set MARKET_SIZE7 %{P7} %;\
  /set MARKET_SIZE8 %{P8} %;\
  /set MARKET_SIZE_ALL Market Size: %{P1}, %{P2}, %{P3}, %{P4}, %{P5}, %{P6}, %{P7}, %{P8}%;\
  /set MARKET_SIZE_TEST %{P1}|%{P2}|%{P3}|%{P4}|%{P5}|%{P6}|%{P7}|%{P8}%;\
  /set MARKET_SIZE_DEFAULT very large|large|medium large|medium|medium small|small|very small|tiny


/def -qFp5 -T"tiny.mush.cm*" -mregexp -t"^\\s+\\s+(pyramid|octagon|pentagon|rectangle|dodecahedron|cylinder|prism|cone),\\s(pyramid|octagon|pentagon|rectangle|dodecahedron|cylinder|prism|cone),\\s(pyramid|octagon|pentagon|rectangle|dodecahedron|cylinder|prism|cone),\\s(pyramid|octagon|pentagon|rectangle|dodecahedron|cylinder|prism|cone),\\s(pyramid|octagon|pentagon|rectangle|dodecahedron|cylinder|prism|cone),\\s(pyramid|octagon|pentagon|rectangle|dodecahedron|cylinder|prism|cone),\\s(pyramid|octagon|pentagon|rectangle|dodecahedron|cylinder|prism|cone), and (pyramid|octagon|pentagon|rectangle|dodecahedron|cylinder|prism|cone)" sort_get_market_shape = \
  /set MARKET_SHAPE1 %{P1} %;\
  /set MARKET_SHAPE2 %{P2} %;\
  /set MARKET_SHAPE3 %{P3} %;\
  /set MARKET_SHAPE4 %{P4} %;\
  /set MARKET_SHAPE5 %{P5} %;\
  /set MARKET_SHAPE6 %{P6} %;\
  /set MARKET_SHAPE7 %{P7} %;\
  /set MARKET_SHAPE8 %{P8} %;\
  /set MARKET_SHAPE_ALL Market Shape: %{P1}, %{P2}, %{P3}, %{P4}, %{P5}, %{P6}, %{P7}, %{P8}%;\
  /set MARKET_SHAPE_TEST %{P1}|%{P2}|%{P3}|%{P4}|%{P5}|%{P6}|%{P7}|%{P8}


;;; Set Practice Market (Practice Tables in Training)

/set MARKET_PRAC_SIZE Market Size:  very large, large, medium large, small, medium small, very small, medium, tiny
/set MARKET_PRAC_SHAPE Market Shape: pentagon, dodecahedron, octagon, pyramid, rectangle
/set MARKET_PRAC_COLOR Market Color: white, black, yellow, rose, green, blue

/set MARKET_SHADE_TEST pure|rich deep|deep|medium|light|pale|very pale
/set MARKET_CLARITY_TEST perfect|very slightly flawed|slightly flawed|flawed|majorly flawed

/set M_SIZE_ALL Market Size: %{P1}, %{P2}, %{P3}, %{P4}, %{P5}, %{P6}, %{P7}, %{P8}
/set M_SIZE_TEST %{P1}|%{P2}|%{P3}|%{P4}|%{P5}|%{P6}|%{P7}|%{P8}
/set MARKET_SIZE_DEFAULT very large|large|medium large|medium|medium small|small|very small|tiny
/set MARKET_SIZE_NDEFAULT 25|18|13|10|9|7|5|3

/set MARKET_GROUP_TEST octave

;; grouping (only octave for now)
/test put_2array('cmprices', 00, '0', 'group')
/test put_2array('cmprices', 00, '1', '24')

;; shade
/test put_2array('cmprices', 01, '0', 'shade')
/test put_2array('cmprices', 01, '1', '20')
/test put_2array('cmprices', 01, '2', '20')
/test put_2array('cmprices', 01, '3', '15')
/test put_2array('cmprices', 01, '4', '12')
/test put_2array('cmprices', 01, '5', '10')
/test put_2array('cmprices', 01, '6', '8')
/test put_2array('cmprices', 01, '7', '6')

;; clarity
/test put_2array('cmprices', 02, '0', 'clarity')
/test put_2array('cmprices', 02, '1', '18')
/test put_2array('cmprices', 02, '2', '13')
/test put_2array('cmprices', 02, '3', '10')
/test put_2array('cmprices', 02, '4', '7')
/test put_2array('cmprices', 02, '5', '2')

;; shape
/test put_2array('cmprices', 03, '0', 'shape')
/test put_2array('cmprices', 03, '1', '20')
/test put_2array('cmprices', 03, '2', '18')
/test put_2array('cmprices', 03, '3', '15')
/test put_2array('cmprices', 03, '4', '12')
/test put_2array('cmprices', 03, '5', '10')
/test put_2array('cmprices', 03, '6', '8')
/test put_2array('cmprices', 03, '7', '6')
/test put_2array('cmprices', 03, '8', '4')

;; size
/test put_2array('cmprices', 04, '0', 'size')
/test put_2array('cmprices', 04, '1', '25')
/test put_2array('cmprices', 04, '2', '18')
/test put_2array('cmprices', 04, '3', '13')
/test put_2array('cmprices', 04, '4', '10')
/test put_2array('cmprices', 04, '5', '9')
/test put_2array('cmprices', 04, '6', '7')
/test put_2array('cmprices', 04, '7', '5')
/test put_2array('cmprices', 04, '8', '3')

;; color
/test put_2array('cmprices', 05, '0', 'color')
/test put_2array('cmprices', 05, '1', '50')
/test put_2array('cmprices', 05, '2', '25')
/test put_2array('cmprices', 05, '3', '15')
/test put_2array('cmprices', 05, '4', '10')
/test put_2array('cmprices', 05, '5', '9')
/test put_2array('cmprices', 05, '6', '8')
/test put_2array('cmprices', 05, '7', '7')

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Features to add to the flyer over time
;;
;; deal with numeric differences greater than speed 40
;; start at the upper left corner of the flyover grid
;;
;; Check if you've entered a sled with unpacked crystal
;; and pemit to you (in red) 2 secs after entering the sled
;; This is going to be tricky -- maybe hook it off the @enter comment for sleds
;;
;; Better idea: match it to the sled name. Have it send the beep command (-ab),
;; go red, (underline), and repeat until you type some command to stop it.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Gwen's Flying Library (VERY VERY VERY useful)
;;;
;;; Based on a SimpleMU trigger written by Kahlyla at CM (turn the sled at every "F* *E" point).
;;; Adapted to tf by Gwen Morse using fall-thru triggers and reacting to configured options 
;;; via FLYSET.
;;;
;;; Start out on any row by flying the sled in an east or west direction.
;;; When it comes across the "F" row on the East side of the map, it will automatically shift 
;;; the sled down by 1 rank and start flying east.
;;;
;;; This automates overflying the entire flying grid once the sled has been started. It has
;;; different options based on what you actually want to do.
;;;
;;; If you fly over a claim that isn't staked, it will do one of the configured options,
;;; including stopping the sled or adding the LZ coordinates to the "location"
;;; list in the sled (if you have autopilot installed) and the date the coordinates were added
;;;
;;; This script should skip JPF/WWSF/Met station, as they're not proper claims.
;;;
;;; New update: You can also use /fly to set your autopilot to go to JPF or WWSF, or specific
;;; coordinates.
;;;
;;; I configure my CM worlds thusly:
;;; /addworld -T"tiny.mush.cm" cm crystalmush.kydance.net 6886
;;; /addworld -T"tiny.mush.cm.sing" singer NAME PASSWORD crystalmush.kydance.net 6886
;;;
;;; If things break really badly, you can stop your sled with the commands:
;;;  'speed 0' (set speed zero) and then '/fly undef' to clear all the flyer settings.
;;;
;;; The autofly macro (seaches the grid for an unstaked claim
;;; and shifts rows unsupervised)
;;;
;;;        ************** Fixes for "cheap" sleds ****************
;;; For the newbies (or perpetually poor folks), here are ways to use the
;;; flying macros without sled upgrades.
;;;
;;; You don't have to have the location database installed in your sled.
;;; The macro will also write to a text file. look for "claims.log" in your
;;; main tinyfugue directory. In it you will find a list of LZs and the
;;; date they were found.
;;;
;;; No need for a scan map.
;;;
;;; No need for a special order uplink. Just 'look' at the Special Order terminal
;;; in Sorting before you leave the Hangar.
;;;
;;; The lazy autoleveler will mostly compensate for not having a sled stabilizer.
;;; However, you could potentially drift down to altitude 5 which may be kind of scary.
;;; You shouldn't crash in clear weather. You could drift 'too high' to get claim messages.
;;;
;;; Flying Speed.
;;; Singers with basic sleds can only fly a max of 20. To only hit a claim once
;;; you need to be able to fly 26. Speed 20 will work, it's just slightly slower.
;;; edit this file (search/replace) and replace "speed 26" with "speed 20".
;;;

;;; BACK TO STANDARD configuration (no more cheap sled stuff)
;;; Set this to have it default to 'do nothing' so that you can fly around at will.
;;; You may want to choose your own default.

/set FLYSET=off

/def -Fp250 -T"tiny.mush.cm.sing" -t'Loc: F* * *E Heading: *' ss_autoflyer = \
  /if ({FLYSHIFT}=~"yes") \
      /send -w heading 24 %;\
      /send -w speed 10 %;\
      /def -Fp254 -n1 -T"tiny.mush.cm.sing" -t'Loc: F* * *E Heading: *' ss_autoflyer2 = \
          /send -w heading 0 %;\
      /def -p252 -n1 -T"tiny.mush.cm.sing" -t'Loc: F* * *E Heading: *' ss_autoflyer3 = \
          /send -w speed 26%;\
  /endif%;\

;; Debug sled flying
/def -F -p20 -T"tiny.mush.cm" debugflyer = \
  /set LZ_SEARCH%;\
  /set FLYSET%;\
  /set FLYSHIFT%;\
  /quote -S /set `/listvar -mglob -s LZ_* %;\
  /quote -S /set `/listvar -mglob -s EXPECT_LZ_* %;\
  /quote -S /set `/listvar -mglob -s CM_* %;\
  /set SLEDSPEED%;\
  /set locsaved%;\
  /set EXPECT_locsaved

; Landing messages

/def -F -T"tiny.mush.cm.sing" -p100 -aBCblue -mglob -t'(You perform a daredevil landing|You carefully land the sled)*' landing_blue = \
  /echo -w SLED LANDING!

;handy sled highlights (green/red/yellow)

; A yellow error indicator light appears on the console.

/def -F -T"tiny.mush.cm.sing" -p100 -aBCyellow -t'A yellow error indicator light appears on the console.' console_yellow = \
  /send -w sled status%;\
  /if (FLYSET =~ "file_tidy"|FLYSET =~ "lz_tidy") \
    /set FLYSET=off%;\
  /endif

/def -F -T"tiny.mush.cm.sing" -p100 -aBCgreen -t'*the autopilot light shows green*' autopilot_green = \
  /send -w sled status%;\
  /if (FLYSET =~ "file_tidy") \
    /repeat -w -3 1 /ftidy %;\
  /elseif (FLYSET =~ "lz_tidy") \
    /repeat -w -6 1 /tidy %;\
    /repeat -4 1 /send remove location here%;\
    /set TIDYDELPID=%?%;\
    /repeat -4 1 /echo -abBCred -w TFRC: Removing old LZ DB entry to tidy the list!%;\
    /set TIDYPID=%?%;\
  /endif

;;; Toggle for grabbing the SO Database (not all singers use it).
;;; set FLY_LEARNSO to anything other than 'true' to ignore Special Orders

/set FLY_LEARNSO=true

;;; FOUND THE LANDING ZONE
/def -F -T"tiny.mush.cm.sing" -p100 -aBCgreen -t'*the scanner light shows green*' scanner_green = \
  /if (!strlen({_array_so_list}) & {FLY_LEARNSO}=~"true") \
    /send -w scan all list %;\
    /send -w list locations %;\
  /endif%;\
  /if (FLYSET =~ "file_tidy") \
    /repeat -0 1 /send -w add location here=LZ Tidy $[ftime("%m/%d/%Y", time())]%;\
  /elseif (FLYSET =~ "lz_tidy") \
    /kill %{TIDYPID}%;\
    /kill %{TIDYDELPID}%;\
  /elseif (FLYSET =~ "add") \
    /fly redef%;\
    /if ({LZ_COL1}=~"F" & ({LZ_QUAD}=~"SW" | {LZ_QUAD}=~"NW")) \
      /send -w heading 24 %;\
      /send -w speed 10 %;\
      /def -p255 -n1 -T"tiny.mush.cm.sing" -t'Loc: F* * *E Heading: *' ss_fix_autoflyer2 = \
        /send -w heading 0 %;\
      /def -p253 -n1 -T"tiny.mush.cm.sing" -t'Loc: F* * *E Heading: *' ss_fix_autoflyer3 = \
        /send -w speed 26 %;\
    /else \
      /repeat -1 1 /send -w heading 0 %;\
      /repeat -1 1 /send -w speed 26%;\
    /endif %;\
    /repeat -1 1 /send -w add location here=LZ found $[ftime("%m/%d/%Y", time())] %{CM_VIEW_MATCH} %{CM_WALKIES}%;\
    /repeat -1 1 /send -w list locations%;\
    /set locsavedhandle=$[tfopen("claims.log","a")]%;\
    /test tfwrite({locsavedhandle}, strcat(ftime("%c", time()), " ", {locsaved}))%;\
    /unset LZ_SEARCH %;\
    /set FLYSHIFT=yes%;\
  /elseif ({FLYSET}=~"file_tidy") \
    /repeat -1 1 /send -w add location here=LZ cleanup $[ftime("%m/%d/%Y", time())]%;\
    /set loc_cleanup=$[tfopen("cleanup.log","a")]%;\
    /test tfwrite({loc_cleanup}, strcat(ftime("%c", time()), " ", {locsaved}))%;\
  /elseif ({FLYSET}=~"land") \
    /send -w speed 0 %;\
    /set EXPECT_LZ_COL1=%{LZ_COL1}%;\
    /set EXPECT_LZ_COL2=%{LZ_COL2}%;\
    /test LZ_ACOL2 := ascii("%{LZ_COL2}")%;\
    /test EXPECT_LZ_ACOL2 := ascii("%{LZ_COL2}")%;\
    /test EXPECT_LZ_ACOL1 := ascii("%{LZ_COL1}")%;\
    /set EXPECT_LZ_ROW1=%{LZ_ROW1}%;\
    /set EXPECT_LZ_ROW2=%{LZ_ROW2}%;\
    /if ((!strlen({LZ_LANDING})) & (!strlen({LZ_NOCRASH}))) \
      /send -w stabilizer off%;\
      /send -w nose down 1%;\
      /set LZ_LANDING=yes%;\
    /elseif (({LZ_LANDING}=~"yes") & ({LZ_ALT} <= "5")) \
      /send -w land sled %;\
      /unset LZ_SEARCH %;\
      /unset LZ_LANDING %;\
      /unset EXPECT_LZ_ROW2 %;\
      /set LZ_NOCRASH=yes%;\
    /endif%;\
    /set FLYSHIFT=yes%;\
  /elseif ({FLYSET}=~"stop") \
    /send -w speed 0 %;\
    /set FLYSHIFT=yes%;\
  /else \
    /unset LZ_SEARCH %;\
    /send -w speed 0 %;\
    /set FLYSHIFT=yes%;\
  /endif%;\
  /quote -S /unset `/listvar -mglob -s LZ_* %;\
  /quote -S /unset `/listvar -mglob -s EXPECT_LZ_* %;\
  /quote -S /unset `/listvar -mglob -s CM_*


/def -F -T"tiny.mush.cm.sing" -p100 -aBCred -t'A red light flashes on the console*' scanner_red = \
  /send -w level %;\

;;; Thanks to Hartato Sukagunas for suggesting using the ASCII() function to
;;; test for sled drift
;;; Thanks to Regan@Many MU's for logical and procedural assistance.
;; JPF: AA 00 NE // ZZ 00 NW // AA 999 SE // ZZ 999 SW

;;; 9/13/2011 Fixed a problem with the sled looping endlessly over a row with 
;;; a F* * *E zone with an unstaked claim.
;;; (I put that F E check inside the green LZ message).
;;; Utoxin crashed because alt 0 can trigger in a claim (only with /fly land which is deprecated)

;;; INSIDE THE UNSTAKED CLAIM
/def -F -T"tiny.mush.cm.sing" -p100 -aCyellow -t'*You see no traces of a paintmark.' ss_fly_notrace = \
/if (FLYSET =~ "file_tidy") /set NULL=NULL%;\
;@@%;\
/elseif ({LZ_COL1} =~ "L" & {LZ_ROW1} =~ "60" & {LZ_QUAD} =~ "SW") \
  /echo -w TFRC: Western White Sands Facility.%;\
/elseif ({LZ_COL1} =~ "B" & {LZ_ROW1} =~ "20" & {LZ_QUAD} =~ "NE") \
 /echo -w TFRC: JPF Met station.%;\
/elseif ({LZ_COL1} =~ "Z" & (!strlen({LZ_ROW1})) & {LZ_QUAD} =~ "NW") /set NULL=NULL %;\
/elseif ({LZ_COL1} =~ "A" & (!strlen({LZ_ROW1})) & {LZ_QUAD} =~ "NE") /set NULL=NULL %;\
/elseif ({LZ_COL1} =~ "Z" & {LZ_ROW1} =~ "99" & {LZ_QUAD} =~ "SW") /set NULL=NULL %;\
/elseif ({LZ_COL1} =~ "A" & {LZ_ROW1} =~ "99" & {LZ_QUAD} =~ "SE") /set NULL=NULL %;\
;@@%;\
/elseif ({FLYSET}=~"off") /set NULL=null %;\
/else \
/if (strlen({LZ_SEARCH})) \
  /if (({LZ_COL2}=~"Z") & (!strlen({LZ_CORRECT_Z})) & ({LZ_ROW1}=~{EXPECT_LZ_ROW1})) \
    /test LZ_ACOL2 := ascii("A")%;\
    /test EXPECT_LZ_ACOL2 := ascii("A")%;\
    /if (%{LZ_ROW2} == "0") \
      /set EXPECT_LZ_ROW2=9%;\
    /else \
      /set EXPECT_LZ_ROW2=$[%{LZ_ROW2} - 1]%;\
    /endif%;\
    /set LZ_ROW_DIFF=$[%{LZ_ROW2} - %{EXPECT_LZ_ROW2}]%;\
    /set LZ_COL_DIFF=$[%{LZ_ACOL2} - %{EXPECT_LZ_ACOL2}]%;\
    /set LZ_CORRECT_Z=yes%;\
    /if ({LZ_COL_DIFF} > 0) \
      /send heading 16%;\
      /send speed $[abs({LZ_COL_DIFF})]%;\
    /elseif ({LZ_COL_DIFF} < 0) \
      /send heading 0%;\
      /send speed $[abs({LZ_COL_DIFF})]%;\
    /elseif ({LZ_ROW_DIFF} > 0) \
      /send heading 24%;\
      /send speed $[abs({LZ_ROW_DIFF})]%;\
    /elseif ({LZ_ROW_DIFF} < 0) \
      /send heading 8%;\
      /send speed $[abs({LZ_ROW_DIFF})]%;\
    /endif%;\
;@%;\
  /elseif (({LZ_ACOL2}=={EXPECT_LZ_ACOL2}) & ({LZ_ROW2}=={EXPECT_LZ_ROW2})) \
    /set EXPECT_LZ_COL1=%{LZ_COL1}%;\
    /test EXPECT_LZ_COL2 := char(ascii("%{LZ_COL2}") + 1)%;\
    /test LZ_ACOL2 := ascii("%{LZ_COL2}")%;\
    /test EXPECT_LZ_ACOL2 := ascii("%{LZ_COL2}") + 1%;\
    /test EXPECT_LZ_ACOL1 := ascii("%{LZ_COL1}")%;\
    /set EXPECT_LZ_ROW1=%{LZ_ROW1}%;\
    /set EXPECT_LZ_ROW2=%{LZ_ROW2}%;\
    /set EXPECT_LZ_GRID=%{LZ_GRID}%;\
    /set EXPECT_LZ_QUAD=%{LZ_QUAD}%;\
    /set EXPECT_LZ_HEAD=%{LZ_HEAD}%;\
    /set EXPECT_LZ_ALT=%{LZ_ALT}%;\
    /set EXPECT_LZ_SPEED=%{LZ_SPEED}%;\
    /unset LZ_CORRECT_Z%;\
    /set EXPECT_locsaved=%{EXPECT_LZ_COL1}%{EXPECT_LZ_COL2} %{EXPECT_LZ_GRID} %{EXPECT_LZ_QUAD}%;\
    /if ({LZ_SPEED}!="1" | (strlen({LZ_SEARCH}) & strlen({LZ_CORRECT}))) \
      /send -w speed 1%;\
      /send -w heading 0%;\
      /unset LZ_CORRECT%;\
    /endif%;\
    /else \
      /set LZ_ROW_DIFF=$[%{LZ_ROW2} - %{EXPECT_LZ_ROW2}] %;\
      /set LZ_COL_DIFF=$[%{LZ_ACOL2} - %{EXPECT_LZ_ACOL2}] %;\
      /set LZ_CORRECT=yes%;\
    /if ({LZ_COL_DIFF} > 0) \
      /send heading 16%;\
      /send speed $[abs({LZ_COL_DIFF})]%;\
    /elseif ({LZ_COL_DIFF} < 0) \
      /send heading 0%;\
      /send speed $[abs({LZ_COL_DIFF})]%;\
    /elseif ({LZ_ROW_DIFF} > 0) \
      /send heading 24%;\
      /send speed $[abs({LZ_ROW_DIFF})]%;\
    /elseif ({LZ_ROW_DIFF} < 0) \
      /send heading 8%;\
      /send speed $[abs({LZ_ROW_DIFF})]%;\
    /endif%;\
  /endif%;\
  /else \
    /send -w view%;\
    /repeat -1 1 /send -w view%;\
    /repeat -4 1 /lzdb_namesearch%;\
    /repeat -8 1 /cm_skip_claim%;\
  /endif%;\
/endif

;;;
;;; All the reasons to potentially skip a claim
;;; 

/def -p100 -F -T"tiny.mush.cm" lzdb_namesearch = \
  /test LZ_MATCH_COL1 := searchstr_2array("lzdb", "1", "1", "%{LZDBC}","%{LZ_COL1}")%;\
  /echo LZ_MATCH_COL1=%{LZ_MATCH_COL1}%;\
  /if (LZ_MATCH_COL1 >= 1) \
    /echo -w -aBCred TFRC: This unstaked claim will be checked in the LZ DB.%;\
    /repeat -w -1 1 /lzdb_match_loop %{LZ_MATCH_COL1} %;\
    /repeat -w -2 1 /hate_match_loop %{SKIP_LIST} %;\
  /else \
    /echo -w -aBCgreen TFRC: This unstaked claim doesn't potentially match anything in the LZ DB.%;\
  /endif

/def -p100 lzdb_match_loop = \
  /if ({#}) \
    /let COORD_CHECK=%{LZ_COL1}-%{LZ_ROW1}-%{LZ_QUAD}%;\
    /set LZDB_NUM=%{1}%;\
    /test LZDB_CHECK := get_2array("lzdb", "%{LZDB_NUM}", "9")%;\
    /test LZDB_NUMBER := get_2array("lzdb", "%{LZDB_NUM}", "3")%;\
    /set LZDB_NUMBER%;\
    /if ({LZDB_CHECK} =~ {COORD_CHECK}) \
      /_echo This unstaked claim matches a claim in the LZ DB. Flyer will skip!%;\
      /set LZDB_SKIP=skip%;\
    /else \
      /shift %;\
      /repeat -w -0 1 /lzdb_match_loop %{*} %;\
    /endif%;\
  /endif

/def hate_match_loop = \
  /if ({#}) \
    /set LZDB_HNUM=%{1}%;\
    /test LZDB_HNUMBER := get_2array("lzdb", "%{LZDB_HNUM}", "3")%;\
    /set LZDB_NUMBER%;\
    /if (LZDB_HNUM =~ LZDB_HNUMBER) \
      /_echo This unstaked claim is hated enough to avoid. Flyer will skip!%;\
      /set LZDB_SKIP=skip%;\
    /else \
      /shift %;\
      /repeat -w -0 1 /hate_match_loop %{*} %;\
    /endif%;\
  /endif

;; Kahlyla wants to always skip some claims by number

/set SKIP_LIST=131 18

;; /if (CM_SKIP !~ "yes") \
;; /if (LZDB_SKIP !~ "skip") \
;; /if (isamember(%{CM_VIEW_MATCH},%{SKIP_LIST},1) =/ "0") \
;; /if ((LZDB_SKIP !~ "skip") | (isamember(%{CM_VIEW_MATCH},%{SKIP_LIST},1) =/ "0")) \

/def -Fp100 -T"tiny.mush.cm.sing" cm_skip_claim = \
  /test CM_VIEW_MATCH := searchstr_2array("claim", "1", "1", "163","%{CM_VIEW}")%;\
  /test CM_SKIP := get_2array("claim", "%{CM_VIEW_MATCH}", "8")%;\
  /test CM_INJURY := get_2array("claim", "%{CM_VIEW_MATCH}", "7")%;\
  /test CM_WALK := get_2array("claim", "%{CM_VIEW_MATCH}", "12")%;\
  /if (LZDB_SKIP !~ "skip") \
    /echo -w -aBCgreen TFRC: This claim has passed all checks, will search for LZ. %;\
    /unset LZDB_SKIP%;\
    /unset FLYSHIFT%;\
    /undef ss_autoflyer%;\
    /unset CM_SKIP%;\
    /unset CM_INJURY%;\
    /unset LZ_NOCRASH%;\
    /set LZ_SEARCH=yes%;\
    /send -w stop%;\
    /repeat -w -1 1 /send speed 1%;\
    /set EXPECT_LZ_COL1=%{LZ_COL1}%;\
    /test LZ_ACOL1 := ascii("%{LZ_COL1}")%;\
    /test LZ_ACOL2 := ascii("A")%;\
    /set EXPECT_LZ_COL2=A%;\
    /test EXPECT_LZ_ACOL2 := ascii("A")%;\
    /set EXPECT_LZ_ROW1=%{LZ_ROW1}%;\
    /set EXPECT_LZ_ROW2=9%;\
    /set EXPECT_LZ_GRID=%{LZ_GRID}%;\
    /set EXPECT_LZ_QUAD=%{LZ_QUAD}%;\
    /set EXPECT_LZ_HEAD=%{LZ_HEAD}%;\
    /set EXPECT_LZ_ALT=%{LZ_ALT}%;\
    /set EXPECT_LZ_SPEED=%{LZ_SPEED}%;\
  /else \
    /echo -w -aBCred TFRC: Skipping this claim! %;\
    /unset LZDB_SKIP%;\
    /unset CM_SKIP%;\
    /unset CM_INJURY%;\
    /unset CM_VIEW_MATCH%;\
    /unset CM_CLAIM_PATH%;\
    /unset CM_VIEW%;\
    /unset CM_VIEW_MATCH%;\
  /endif

;;;
;;; Toggle to skip identifying claim by view (some singers don't want the spam).
;;; to skip change LZ_VIEWSET to anything other than true.

/set LZ_VIEWSET=true

/def -p100 -t'Through the windscreen you see:' SLED_WINDSCREEN = \
  /def -p100 -1 -t'*' LZ_VIEW = \
      /set CM_VIEW %%{*}%;\
      /test CM_VIEW_MATCH := searchstr_2array("claim", "1", "1", "164","%{CM_VIEW}")%;\
      /repeat -2 1 /test CM_CLAIM_PATH := get_2array("claim", "%{CM_VIEW_MATCH}", "3")%;\
      /repeat -2 1 /echo Path to Vein: %{CM_CLAIM_PATH}%;\
      /repeat -2 1 /echo Claim Number: %{CM_VIEW_MATCH}%;\
      /repeat -2 1 /list2array claim %{CM_VIEW_MATCH}%;\
      /repeat -4 1 /UNSET_WINDSCREEN

/def UNSET_WINDSCREEN = \
  /unset CM_CLAIM_PATH%;\
  /quote -S /unset `/listvar -mglob -s CM_VEIW*

;;;
;;; Integrate flying into the status bar
;;; Landing stuff added 4/8/2014 by Gwen Morse

/def -F -T"tiny.mush.cm.sing" -mregexp -t"(You perform a daredevil landing, sliding the sled in at full speed|You carefully land the sled)" cm_groundsled = \
  /set FLYING=[grounded] %;\
  /if (PERSON =~ "Kahlyla") \
    /cm_landing_stuff_kah %;\
  /else \
    /cm_landing_stuff%;\
  /endif

/def -F -T"tiny.mush.cm.sing" cm_landing_stuff_kah = \
  /repeat -1 1 /send -w'cm' %;\
  /repeat -3 1 /send -w'cm' %;\
  /repeat -5 1 /send -w'cm' %;\
  /repeat -7 1 /send -w'cm' %;\
  /repeat -9 1 /UNSET_WINDSCREEN

/def -F -T"tiny.mush.cm.sing" cm_landing_stuff = \
  /repeat -1 1 /send -w'ss' %;\
  /repeat -3 1 /send -w'ss' %;\
  /repeat -5 1 /send -w'ss' %;\
  /repeat -7 1 /send -w'ss' %;\
  /repeat -9 1 /UNSET_WINDSCREEN

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Kahlyla's lazy auto-leveler and Gwen's Drift Correction
;;;
;;; Requested by Kahlyla@CM and based on zMUD macros she used.
;;; Written by Gwen Morse (gwen dot morse at gmail dot com)
;;;
;;; At altitude 8, it levels the sled and then noses down by 3.
;;; At altitude 7, it levels the sled and then noses down by 2.
;;; At altitude 6, it levels the sled and then noses down by 1.
;;; At altitude 5  it stays level.
;;; Further updated by Matthew Walker of Kydance to improve the
;;; autoleveling by altitude:
;;; At altitude 1-4 it rises up to altitude 5.
;;; At altitude 0 it sends a simple @@ command
;;;
;;; This partially automates the process of landing your sled and
;;; minimizes your chances of crashing.
;;;
;;; To escape, you have to keep setting the sled to nose up by 5/9 till
;;; you break out of the 0-8 altitude zone. This is admittedly annoying
;;; but less annoying than crashing.

;;  /set LZ_COL1=%P1%;\ = First letter of AA col coords
;;  /set LZ_COL2=%P2%;\ = Second letter of AA col coords
;;  /set LZ_ROW1=%P3%;\ = First or First+Second Digit of multi-digit row coords (left side)
;;  /set LZ_ROW2=%P4%;\ = Final digit of row coords (right side)
;;  /set LZ_COLS=%P1%P2%;\ = First and Second letter of col coords
;;  /set LZ_GRID=%P3%P4%;\ = All numbers of Row coords
;;  /set LZ_QUAD=%P5%;\ = Quadrant (NE/NW/SE/SW)
;;  /set LZ_HEAD=%P6%;\ = Heading
;;  /set LZ_ALT=%P7%;\ = Altitude
;;  /set LZ_SPEED=%P9%;\ = Speed

;; 9/12/2011 Fixed bug introduced with Matthew Walker's autoleveling update
;; changed alt 0 to send '@@' to break loop.
;; Descending (5)
/def -F -p200 -T"tiny.mush.cm.s*" -mregexp -t"^Loc: ([A-Z])([A-Z]) ([0-9]?[0-9]?)([0-9]) (NE|NW|SE|SW)+ Heading: (N|S|E|W|NE|NW|SE|SW|SSW|SSE|NNW|NNE)[(][0-9][0-9]?[)] Altitude: ([0-9][0-9]?[0-9]?)(S*), Speed: ([0-9][0-9]?)" loc_match = \
  /set LZ_COL1=%P1%;\
  /set LZ_COL2=%P2%;\
  /set LZ_ROW1=%P3%;\
  /set LZ_ROW2=%P4%;\
  /set LZ_COLS=%P1%P2%;\
  /set LZ_GRID=%P3%P4%;\
  /set LZ_QUAD=%P5%;\
  /set LZ_HEAD=%P6%;\
  /set LZ_ALT=%P7%;\
  /set LZ_SPEED=%P9%;\
  /test LZ_ACOL2 := ascii("%{LZ_COL2}")%;\
  /set locsaved=%{LZ_COLS} %{LZ_GRID} %{LZ_QUAD}%;\
;@@%;\
  /if (strlen({LZ_SEARCH}) & (({LZ_COL1}!~{EXPECT_LZ_COL1}) | ({LZ_COL2}!~{EXPECT_LZ_COL2}) | ({LZ_ROW1}!~{EXPECT_LZ_ROW1}) | ({LZ_ROW2}!~{EXPECT_LZ_ROW2}))) \
    /test LZ_ACOL1 := ascii("%{LZ_COL1}")%;\
    /test EXPECT_LZ_ACOL1 := ascii("%{EXPECT_LZ_COL1}")%;\
    /if ({LZ_COL1} =~ "A" & {EXPECT_LZ_COL1} =~ "Z") \
      /set LZ_ROW_DRIFT=$[%{LZ_ROW1} - %{EXPECT_LZ_ROW1}]%;\
      /set LZ_COL_DRIFT=1%;\
    /elseif ({LZ_GRID} =~ "0" & {EXPECT_LZ_GRID} =~ "999") \
      /set LZ_COL_DRIFT=$[%{LZ_COL1} - %{EXPECT_LZ_COL1}]%;\
      /set LZ_ROW_DRIFT=1%;\
    /elseif ({LZ_GRID} =~ "999" & {EXPECT_LZ_GRID} =~ "0") \
      /set LZ_COL_DRIFT=$[%{LZ_COL1} - %{EXPECT_LZ_COL1}]%;\
      /set LZ_ROW_DRIFT=1%;\
    /else \
      /set LZ_ROW_DRIFT=$[%{LZ_ROW1} - %{EXPECT_LZ_ROW1}]%;\
      /set LZ_COL_DRIFT=$[%{LZ_ACOL1} - %{EXPECT_LZ_ACOL1}]%;\
;     I think if LZ ROW DRIFT or LZ COL DRIFT is greater than one I can put a
;     another check if/else check here to multiply results by 26 or 10 depending 
;     on the direction. Maybe only do it if FLYTO Boolean is set?
      /if ((LZ_FLYTO =~ yes) & LZ_ROW_DRIFT >= 2) \
        /set LZ_ROW_DRIFT=$[%{LZ_ROW_DRIFT} * 26]%;\
      /elseif ((LZ_FLYTO =~ yes) & LZ_COL_DRIFT >= 2) \
        /set LZ_COL_DRIFT=$[%{LZ_COL_DRIFT} * 10]%;\
      /endif%;\
    /endif%;\
    /if ({LZ_ROW_DRIFT} > 0) \
      /send -w heading 24%;\
      /send -w speed $[abs({LZ_ROW_DRIFT})]%;\
    /elseif ({LZ_ROW_DRIFT} < 0) \
      /send -w heading 8%;\
      /send -w speed $[abs({LZ_ROW_DRIFT})]%;\
    /elseif ({LZ_COL_DRIFT} > 0) \
      /send -w heading 16%;\
      /send -w speed $[abs({LZ_COL_DRIFT})]%;\
    /elseif ({LZ_COL_DRIFT} < 0) \
      /send -w heading 0%;\
      /send -w speed $[abs({LZ_COL_DRIFT})]%;\
    /else \
    /endif%;\
  /endif%;\
  /if ({LZ_ALT}=~"8") \
    /send -w level %;\
    /send -w nose down 3%;\
  /elseif ({LZ_ALT}=~"7") \
    /send -w level %;\
    /send -w nose down 2%;\
  /elseif ({LZ_ALT}=~"6") \
    /send -w level %;\
    /send -w nose down 1%;\
  /elseif ({LZ_ALT}=~"5") \
    /send -w level %;\
  /elseif ({LZ_ALT}=~"4") \
    /send -w level %;\
    /send -w nose up 1%;\
  /elseif ({LZ_ALT}=~"3") \
    /send -w level %;\
    /send -w nose up 2%;\
  /elseif ({LZ_ALT}=~"2") \
    /send -w level %;\
    /send -w nose up 3%;\
  /elseif ({LZ_ALT}=~"1") \
    /send -w level %;\
    /send -w nose up 4%;\
  /elseif ({LZ_ALT}=~"0") \
    /send -w @@%;\
  /endif

;; Simple function to deal with distances larger than 40 klicks when flying a sled.
;; By Gwen Morse
;; Function for Lazy Auto-leveler

/def max_speed = \
  /let num=$[abs(%1)]%;\
  /echo num=%{num} %;\
  /if (num > 40) \
    /echo TFRC: Speed is over 40 klicks, resetting to 40.%;\
    /return 40%;\
  /elseif ((num < 41) & (num >= 1)) \
    /echo TFRC: Speed is within 40 klicks, using sent speed.%;\
    /return %{num}%;\
  /else \
    /echo TFRC: Max Speed function is broken, using speed 1%;\
    /return 1%;\
  /endif


;; Flyto command

;; Notes: Flies odd distances. Need to use Order of Operations to adjust calculations
;; Use a separate boolean toggle for this and then do subtraction based on
;; LZ_GRID and EXPECT_LZ_GRID instead of the COL2 values.
;; Also do something similar to get it to fly at max speed for rows.
;; Works for now for LZs in the same Quadrant (NE/NW/SE/SW)

/def -T"tiny.mush.cm.sing" flyto = \
  /if (regmatch("([A-Z])([A-Z])-([0-9]?[0-9]?)([0-9])-(NE|NW|SE|SW)",%{*})) \
    /unset FLYSHIFT%;\
    /set LZ_FLYTO=yes%;\
    /set LZ_SEARCH=yes%;\
    /set EXPECT_LZ_COL1=%P1%;\
    /set EXPECT_LZ_COL2=%P2%;\
    /test EXPECT_LZ_ACOL1 := ascii("%P1")%;\
    /test EXPECT_LZ_ACOL2 := ascii("%P2")%;\
    /set EXPECT_LZ_ROW1=%P3%;\
    /set EXPECT_LZ_ROW2=%P4%;\
    /set EXPECT_LZ_GRID=%P3%P4%;\
    /set EXPECT_LZ_QUAD=%P5%;\
    /quote -S /set `/listvar -mglob -s EXPECT_LZ_* %;\
    /echo TFRC: This is a proper landing zone. Commence flying.%;\
  /else \
    /echo TFRC: You did not input a proper landing zone.%;\
    /quote -S /unset `/listvar -mglob -s EXPECT_LZ_* %;\
  /endif

/def -T"tiny.mush.cm.sing" flyto_auto = \
  /if (regmatch("([A-Z])([A-Z])[-?//s?]([0-9]?[0-9]?)([0-9])[-?//s?](NE|NW|SE|SW)",%{*})) \
    /unset FLYSHIFT%;\
    /set LZ_FLYTO=yes%;\
    /set LZ_SEARCH=yes%;\
    /set EXPECT_LZ_COL1=%P1%;\
    /set EXPECT_LZ_COL2=%P2%;\
    /test EXPECT_LZ_ACOL1 := ascii("%P1")%;\
    /test EXPECT_LZ_ACOL2 := ascii("%P2")%;\
    /set EXPECT_LZ_ROW1=%P3%;\
    /set EXPECT_LZ_ROW2=%P4%;\
    /set EXPECT_LZ_GRID=%P3%P4%;\
    /set EXPECT_LZ_QUAD=%P5%;\
    /quote -S /set `/listvar -mglob -s EXPECT_LZ_* %;\
    /quote -1 `/send -w set destination %;\
    /echo TFRC: This is a proper landing zone. Commence flying.%;\
  /else \
    /echo TFRC: You did not input a proper landing zone.%;\
    /quote -S /unset `/listvar -mglob -s EXPECT_LZ_* %;\
  /endif

;;; Configuration macro for the autofly. ("/fly help" will list quick help)
;;;
;;; 9/12/2011 fixed bug where undef would not actually undefine the
;;; ss_autoflyer definitions - undef now works as described.

/def -Fp51 -T"tiny.mush.cm.*" fly = \
  /if ({*}=~"undef") \
    /undef ss_autoflyer %;\
    /undef ss_autoflyer_2 %;\
    /undef ss_autoflyer_3 %;\
    /unset FLYSHIFT%;\
    /unset EXPECT_locsaved %;\
    /unset LZ_SEARCH %;\
    /quote -S /unset `/listvar -mglob -s LZ_* %;\
    /quote -S /unset `/listvar -mglob -s EXPECT_LZ_* %;\
    /quote -S /unset `/listvar -mglob -s CM_* %;\
    /quote -S /unset `/listvar -mglob -s TIDY* %;\
    /unset LINES %;\
    /set FLYSET=off %;\
    /unset LZDB_SKIP %;\
    /_echo TFRC: /fly has forced the autofly macro to completely undefine (will not turn on the "F" East blocks). %;\
  /elseif ({*}=~"check") \
    /set FLYSHIFT %;\
    /set EXPECT_locsaved %;\
    /set LZ_SEARCH %;\
    /set LZDB_SKIP %;\
    /quote -S /set `/listvar -mglob -s LZ_* %;\
    /quote -S /set `/listvar -mglob -s EXPECT_LZ_* %;\
    /quote -S /set `/listvar -mglob -s CM_* %;\
    /quote -S /set `/listvar -mglob -s TIDY* %;\
    /set FTIDYCOUNT %;\
    /set LINES %;\
    /set SLEDSPEED %;\
    /set locsaved %;\
    /set EXPECT_locsaved %;\
  /elseif ({*}=~"flush") \
    /unset LZ_SEARCH %;\
    /quote -S /unset `/listvar -mglob -s LZ_* %;\
    /quote -S /unset `/listvar -mglob -s EXPECT_LZ_* %;\
    /quote -S /unset `/listvar -mglob -s CM_* %;\
    /quote -S /unset `/listvar -mglob -s TIDY* %;\
    /unset LINES %;\
    /unset FLYSHIFT %;\
    /unset LZDB_SKIP %;\
    /unset EXPECT_locsaved %;\
    /unset LZ_SEARCH %;\
    /_echo TFRC: /fly has forced the autofly macro to flush the variables for searching a claim for a LZ. %;\
  /elseif ({*}=~"off") \
    /unset LZ_SEARCH %;\
    /set FLYSET=off %;\
    /set FLYSHIFT=yes %;\
    /quote -S /unset `/listvar -mglob -s TIDY* %;\
    /unset LINES %;\
    /_echo TFRC: /fly has forced the autofly macro to stop watching for unstaked claims (but, it still turns on the "F" East rows). %;\
  /elseif ({*}=~"upload") \
    /quote -1 `/send -w remove location here%;\
    /quote -2 `/send -w add location here=LZ Staked $[ftime("%m/%d/%y", time())] Vein %{UPLOAD_SIZE} %{LABELCOLOR}%;\
    /repeat -3 1 /_echo TFRC: /fly has uploaded this staked vein information to the LZ DB.%;\
  /elseif ({*}=~"stop") \
    /send -w stabilizer on %;\
    /set FLYSET=stop %;\
    /set FLYSHIFT=yes %;\
    /_echo TFRC: /fly has forced the autofly macro to stop the sled at the landing zone of the unstaked claim.%;\
  /elseif ({*}=~"add") \
    /set FLYSET=add %;\
    /send -w stabilizer on %;\
    /set FLYSHIFT=yes %;\
    /_echo TFRC: /fly has forced the autofly macro to automatically try to find the Landing Zone and add it to the location database in the sled. %;\
    /set FLYSHIFT=yes %;\
  /elseif ({*}=~"redef") \
    /set FLYSHIFT=yes %;\
    /_echo TFRC: /fly has forced the autofly macro to redefine dropping a row each time the sled reaches the "F" coords in an Eastern Quadrant. %;\
    /_echo TFRC: Don't forget, if you want to claimhunt, use '/fly stop' or '/fly add' at this point. %;\
    /def -Fp250 -T"tiny.mush.cm.sing" -t'Loc: F* * *E Heading: *' ss_autoflyer =\
          /send -w heading 24 %%;\
          /send -w speed 10 %%;\
    /def -Fp254 -n1 -T"tiny.mush.cm.sing" -t'Loc: F* * *E Heading: *' ss_autoflyer_2 =\
          /send -w heading 0 %%;\
    /def -p252 -n1 -T"tiny.mush.cm.sing" -t'Loc: F* * *E Heading: *' ss_autoflyer_3 =\
          /send -w speed 26%%;\
    /_echo %;\
  /elseif ({*}=~"land") \
    /set FLYSHIFT=yes %;\
    /set FLYSET=land %;\
    /send -w stabilizer on %;\
    /_echo TFRC: /fly has forced the autofly macro to automatically try to find the Landing Zone and then try to land the sled in the claim.%;\
  /elseif ({*}=~"help")\
    /_echo %;\
    /set FLYSET %;\
    /help_fly %;\
  /elseif ({*}=~"list")\
    /let count=0 %;\
    /_echo%;\
    /echo -aBCwhite -w *   LZDB: LZ Database List %;\
    /while (++count < LZDBC) \
      /eval /set LZDB_NUM=$[get_2array("lzdb",$[count], 0)]%;\
      /eval /set LZDB_DCOORDS=$[get_2array("lzdb",$[count], 1)]%;\
      /eval /set LZDB_DATE=$[get_2array("lzdb",$[count], 2)]%;\
      /eval /set LZDB_CLAIM=$[get_2array("lzdb",$[count], 3)]%;\
      /eval /set LZDB_VEIN=$[get_2array("lzdb",$[count], 4)]%;\
      /eval /set LZDB_NAME=$[get_2array("claim",$[LZDB_CLAIM], 0)]%;\
      /eval /set LZDB_WALKIES=$[get_2array("claim",$[LZDB_CLAIM], 12)]%;\
      /if (LZDB_CLAIM =~ "Tidy") \
        /echo -aCcyan -w * %{LZDB_NUM} %{LZDB_DCOORDS} Tidy Found: %{LZDB_DATE} %;\
      /elseif (LZDB_CLAIM =~ "Staked") \
        /echo -aCmagenta -w * %{LZDB_NUM} %{LZDB_DCOORDS} Paintmarked: %{LZDB_DATE} Vein: %{LZDB_VEIN}%;\
      /elseif (LZDB_WALKIES =~ "yes")\
        /echo -aCgreen -w * %{LZDB_NUM} %{LZDB_DCOORDS} Number: %{LZDB_CLAIM} Name: %{LZDB_NAME} Found: %{LZDB_DATE} Walkies: %{LZDB_WALKIES}%;\
      /elseif (LZDB_WALKIES =~ "no")\
        /echo -aCred -w * %{LZDB_NUM} %{LZDB_DCOORDS} Number: %{LZDB_CLAIM} Name: %{LZDB_NAME} Found: %{LZDB_DATE} Walkies: %{LZDB_WALKIES}%;\
      /else \
        /echo -aBCyellow -w * %{LZDB_NUM} %{LZDB_DCOORDS} Number: %{LZDB_CLAIM} Name: %{LZDB_NAME} Found: %{LZDB_DATE} Walkies: %{LZDB_WALKIES}%;\
      /endif %;\
    /done%;\
    /_echo %;\
  /elseif ({*}=~"jpf")\
    /send -w set course ZZ-00-NW%;\
  /elseif ({*}=~"north")\
    /send -w set course AJ-995-NW%;\
  /elseif ({*}=~"south")\
    /send -w set course AJ-985-SW%;\
  /elseif ({*}=~"wwsf")\
    /send -w set course LZ-600-SW%;\
  /elseif ({*}=~"met")\
    /send -w set course BC-200-NE%;\
  /elseif ({*}=~"tidy")\
;   /send list locations%;\
    /_echo TFRC: /fly will check the claim addresses in the LZ DB for old claims to be tidied.%;\
    /unset FLYSHIFT%;\
    /undef ss_autoflyer %;\
    /undef ss_autoflyer_2 %;\
    /undef ss_autoflyer_3 %;\
    /set FLYSET=lz_tidy%;\
    /test TIDYCOUNT := %{LZDBC} - 1%;\
    /set TIDYCOUNT%;\
    /repeat -w -1 1 /tidy %;\
;@@%;\
  /elseif ({*} =/ "0") \
    /echo -w TFRC: 0 is not a valid landing zone. %;\
  /elseif (regmatch("^[0-9]+",{*}) & ({*} <= LZDBC)) \
    /let num=%{*}%;\
    /echo -w TFRC: Flying to Landing Zone %{*}. %;\
    /eval /set target=$[get_2array("lzdb",$[num], 1)]%;\
    /send -w set course %{target}%;\
    /unset target%;\
  /elseif (regmatch("^[0-9]+",{*})) \
    /echo -w TFRC: %{*} is not a valid landing zone. %;\
  /else \
    /if (regmatch("^([A-Z][A-Z])\\s([0-9]+)\\s(NE|NW|SE|SW)$",{*})) \
      /send -w set course %{P1}-%{P2}-%{P3}%;\
    /elseif (regmatch('\\s',{*})) \
      /let cmd %PL%;\
      /let var %PR%;\
      /if (cmd =~ "remove") \
        /if (var =/ "0") \
          /echo -w TFRC: 0 is not a valid landing zone. %;\
        /elseif (regmatch("^[0-9]+",var) & (var <= LZDBC)) \
          /let num=%{var}%;\
          /echo TFRC: Removing landing zone %{var}. %;\
          /eval /set target=$[get_2array("lzdb",$[num], 1)]%;\
          /send -w remove location %{target}%;\
          /unset target%;\
        /elseif (regmatch("^[0-9]+",var)) \
          /echo -w TFRC: %{var} is not a valid landing zone. %;\
        /else \
          /echo -w TFRC: ERROR MESSAGE. %;\
        /endif %;\
      /elseif (cmd =~ "ftidy") \
        /_echo TFRC: /fly will check the claim addresses in %{var} for old claims to be tidied.%;\
        /undef ss_autoflyer %;\
        /undef ss_autoflyer_2 %;\
        /undef ss_autoflyer_3 %;\
        /set FLYSET=file_tidy%;\
        /set TIDYFILE=%{var}%;\
        /countlines %{var}%;\
        /set FTIDYCOUNT=%{LINES}%;\
        /repeat -w -1 1 /ftidy %;\
        /unset FLYSHIFT%;\
      /endif %;\
    /else \
      /send -w set course %*%;\
    /endif %;\
  /endif


;;; Sample Helplist config for other macros

/help_add /help_fly the autoflyer, LZ DB, and fly list commands

/def -i help_fly=\
  /echo -aB Fly help:%;\
  /echo /fly undef         to completely undefine the autofly macro. %;\
  /echo /fly redef         to redefine after undefining the autofly macro. %;\
  /echo /fly flush         to clear the LZ variables (in case of search glitches). %;\
  /echo /fly off           to shut off searching (still turns on "F" East rows). %;\
  /echo /fly add           to add landing zones from unstaked claims to location list. %;\
  /echo /fly land          to stop the sled at unstaked claims and land. (BROKEN!!!)%;\
  /echo /fly stop          to stop the sled at unstaked claims and wait. %;\
  /echo /fly jpf           to set your autopilot to ZZ-00-NW%;\
  /echo /fly wwsf          to set your autopilot to LZ-600-SW%;\
  /echo /fly met           to set your autopilot to BC-200-NE%;\
  /echo /fly north         to autopilot to the upper NW corner of the map.%;\
  /echo /fly south         to autopilot to the upper SW corner of the map.%;\
  /echo /fly list          to list the landing zone's in the LZ DB list.%;\
  /echo /fly upload        to update the LZ DB list to inlcude the staked vein info.%;\
  /echo /fly <#>           to fly to <#> in the LZ DB list.%;\
  /echo /fly tidy          to check the LZ DB for old claims to be tidied.%;\
  /echo /fly ftidy <file>  to check <file> for old claims to be tidied.%;\
  /echo /fly remove <#>    to remove the landing zone from the LZ DB list by <#>.%;\
  /echo /fly <coords>      to fly to any coordinates on the grid.%;\
  /echo /fly check         to show all flier variables for debugging.%;\
  /echo /fly help          to list this help.%;\
  /echo

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Tidy
; Written by Gwen Morse with assistance from the Tinyfugue Mailing list
; Added 17 Mar 2014

;; Written by Brian Rice @ the Tinyfugue Mailing list
;; altered slightly by Gwen Morse
;; reads a particular line in a specific file.
;; syntax: /lineread <filename> <line #>
;; Global variable: LINEVALUE

/def lineread = \
  /let _doc=%1%;\
  /let _val=%2%;\
  /let _file $[ tfopen( %{_doc} , "r" ) ] %; \
  /let _line 0 %; \
  /while ( _line != _val ) \
    /test tfread( _file , LINEVALUE ) %; \
    /test ++_line %; \
  /done %; \
  /test tfclose ( _file )


;; By Gwen Morse
;; Fixed by Jacob Finn @ the Tinyfugue Mailing list
;; Counts the number of lines in a particular file
;; syntax: /countlines <filename>
;; Global variable: LINES

/def countlines = \
  /let _doc=%*%;\
  /let _file $[ tfopen( %{_doc} , "r" ) ] %;\
  /set LINES $(/wc -l %{_file}) %;\
  /test tfclose ( _file )

;; To find missing unwanted claim landing zones to tidy up.
;; syntax: /fly ftidy

/def -p100 -T"tiny.mush.cm.sing" ftidy = \
  /if (FTIDYCOUNT == "0") \
    /echo -abCblue -w TFRC: You've finished tidying the Landing Zones.%;\
    /quote -S /unset `/listvar -mglob -s TIDY* %;\
    /unset FTIDYCOUNT%;\
    /unset LINES%;\
    /fly redef%;\
    /repeat -1 1 /set FLYSET=off%;\
    /repeat -1 1 /send -w list locations%;\
  /else \
    /lineread fix.tf %{FTIDYCOUNT}%;\
    /repeat -1 1 /fly %{LINEVALUE} %;\
    /repeat -1 1 /echo -abCmagenta -w TFRC: Flying to %{LINEVALUE}. You have %{FTIDYCOUNT} claim(s) remaining.%;\
    /test --FTIDYCOUNT%;\
  /endif

/def -p100 -T"tiny.mush.cm.sing" tidy = \
  /if (TIDYCOUNT == "0") \
    /echo -abCblue -w TFRC: You've finished tidying the Landing Zones.%;\
    /quote -S /unset `/listvar -mglob -s TIDY* %;\
    /fly redef%;\
    /repeat -1 1 /set FLYSET=off%;\
    /send list locations%;\
  /else \
    /test TIDYTARGET := get_2array('lzdb',%{TIDYCOUNT},1)%;\
    /repeat -5 1 /fly %{TIDYTARGET} %;\
    /repeat -5 1 /echo -abCmagenta -w TFRC: Flying to %{TIDYTARGET}. %{TIDYCOUNT} claim(s) remain.%;\
    /test --TIDYCOUNT%;\
  /endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; LZ Landing Zone Database Array
;;;
;;; Gwen Morse
;;; Started October 11 2012
;;; Re-started 23 February 2014 - This was left for two years with
;;; nothing but a broken regexp match. Nearly all the work was done
;;; on or after Feb 23 2014.
;;; 

;;; set LZDB_COUNT to 1
/def -F -p100 -T"tiny.mush.cm" -mregexp -t"^\\s\\sLocation\\s\\sText$" lzdb_set_count = \
  /set LZDBC=1

/def -p100 -T"tiny.mush.cm" -mregexp -t"^No locations registered\\.$" lzdb_clear = \
  /echo -w NO LZ MATCHES!%;\
  /unset LZDBC

/def -p100 -T"tiny.mush.cm.sing" -mregexp -t"^Location removed\\.$" lzdb_removed = \
  /send -w list locations

/def -F -p100 -T"tiny.mush.cm" -mregexp -t"^\\s+([A-Z])([A-Z])-([0-9]?[0-9]?)([0-9])-(NW|NE|SE|SW)\\s+LZ found\\s([0-9]+/[0-9]+/[1-2][0-9][0-9][0-9])\\s?(.*)" lzdb_found_learn = \
  /let TLZDB_NAME=%P1%P2%P3%P4%P5%;\
  /let TLZDB_COORDS=%P1%P2 %P3%P4 %P5%;\
  /let TLZDB_DCOORDS=%P1%P2\-%P3%P4\-%P5%;\
  /let TLZDB_NUM=%P7%;\
  /let TLZDB_COL1=%P1%;\
  /let TLZDB_ROW1=%P3%;\
  /let TLZDB_QUAD=%P5%;\
  /let TLZDB_DATE=%P6%;\
  /let TLZDB_COMPARE=%P1\-%P3\-%P5%;\
  /let TLZDB_COMMENT=%P9%;\
;@@ Check if the claim has a number, if not set to 0 @@;%\
  /if (%P7 >= 1) \
    /let TLZDB_CLAIM=%P7%;\
  /else \
    /let TLZDB_CLAIM=NULL%;\
  /endif%;\
  /if (%P3>=0) \
    /let _NULL=NULL%;\
  /else \
    /echo TFRC: TLZDB_ROW1 = Set to 0%;\
    /set TLZDB_ROW1=0%;\
  /endif%;\
  /eval /set _array_lzdb_$[LZDBC]_0=$[LZDBC]%;\
  /eval /set _array_lzdb_$[LZDBC]_1=$[TLZDB_DCOORDS]%;\
  /eval /set _array_lzdb_$[LZDBC]_2=$[TLZDB_DATE]%;\
  /eval /set _array_lzdb_$[LZDBC]_3=$[TLZDB_CLAIM]%;\
  /eval /set _array_lzdb_$[LZDBC]_4=$[TLZDB_NAME]%;\
  /eval /set _array_lzdb_$[LZDBC]_5=$[TLZDB_COL1]%;\
  /eval /set _array_lzdb_$[LZDBC]_6=$[TLZDB_ROW1]%;\
  /eval /set _array_lzdb_$[LZDBC]_7=$[TLZDB_QUAD]%;\
  /eval /set _array_lzdb_$[LZDBC]_8=$[TLZDB_COMMENT]%;\
  /eval /set _array_lzdb_$[LZDBC]_9=$[TLZDB_COMPARE]%;\
  /test ++LZDBC

/def -F -p100 -T"tiny.mush.cm" -mregexp -t"^\\s([A-Z])([A-Z])-([0-9]?[0-9]?)([0-9])-(NW|NE|SE|SW)\\s+LZ Tidy\\s([0-9]+/[0-9]+/[1-2][0-9][0-9][0-9])\\s?(.*)" lzdb_tidy_learn = \
  /let TLZDB_NAME=%P1%P2%P3%P4%P5%;\
  /let TLZDB_COORDS=%P1%P2 %P3%P4 %P5%;\
  /let TLZDB_DCOORDS=%P1%P2\-%P3%P4\-%P5%;\
  /let TLZDB_NUM=%P7%;\
  /let TLZDB_COL1=%P1%;\
  /let TLZDB_ROW1=%P3%;\
  /let TLZDB_QUAD=%P5%;\
  /let TLZDB_DATE=%P6%;\
  /let TLZDB_COMPARE=%P1\-%P3\-%P5%;\
  /eval /set _array_lzdb_$[LZDBC]_0=$[LZDBC]%;\
  /eval /set _array_lzdb_$[LZDBC]_1=$[TLZDB_DCOORDS]%;\
  /eval /set _array_lzdb_$[LZDBC]_2=$[TLZDB_DATE]%;\
  /eval /set _array_lzdb_$[LZDBC]_3=Tidy%;\
  /test ++LZDBC

/def -F -p100 -T"tiny.mush.cm" -mregexp -t"^\\s([A-Z])([A-Z])-([0-9]?[0-9]?)([0-9])-(NW|NE|SE|SW)\\s+LZ Staked\\s([0-9]+/[0-9]+/[1-2][0-9][0-9][0-9]) Vein\\s(.*)" lzdb_staked_learn = \
  /let TLZDB_NAME=%P1%P2%P3%P4%P5%;\
  /let TLZDB_COORDS=%P1%P2 %P3%P4 %P5%;\
  /let TLZDB_DATE=%P6%;\
  /let TLZDB_VEIN=%P7%;\
  /eval /set _array_lzdb_$[LZDBC]_0=$[LZDBC]%;\
  /eval /set _array_lzdb_$[LZDBC]_1=$[TLZDB_COORDS]%;\
  /eval /set _array_lzdb_$[LZDBC]_2=$[TLZDB_DATE]%;\
  /eval /set _array_lzdb_$[LZDBC]_3=Staked%;\
  /eval /set _array_lzdb_$[LZDBC]_4=$[TLZDB_VEIN]%;\
  /test ++LZDBC

;   /test CLAIM_ROOM_LIST := searchstr_2array("claim", "0", "1", "164","%{CLAIM_FIRST_ROOM}")%;\

/def -F -T"tiny.mush.cm" lzdb_num_search = \
  /if ({#} >= 1) = \
    /echo -w P0={P0}%;\
    /test LZ_MATCH_NUM := searchstr_2array("lzdb", "1", "1", "%{LZDBC}","%{#}")%;\
    /echo LZ_MATCH_NUM=%{LZ_MATCH_NUM}%;\
    /if (LZ_MATCH_NUM >= 1) \
      /echo -w -aBCgreen TFRC: Found the claim number in the LZ DB.%;\
    /else \
      /echo -w -aBCred TFRC: This claim number doesn't match anything in the LZ DB.%;\
    /endif%;\
  /else \
    /echo -w TFRC: Broken Claim Num Search.%;\
  /endif

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Headings (to fly in a particular direction)
;;;
;;; Using Keypad for directions (type keypad # and then 'enter')
;;;
;;; Original author lost, but, grabbed off a site with Battletech or
;;; other 'mech-type' macros.

;;;;;;;;;;;;;;;;;;;;;
;;  Keypad macros  ;;
;;  NW    N     NE ;;
;;   \    |    /   ;;
;;    7---8---9    ;;
;;    |   |   |    ;;
;;W-- 4---5---6 --E;;
;;    |   |   |    ;;
;;    1---2---3    ;;
;;   /    |    \   ;;
;;  SW    S     SE ;;
;;                 ;;
;;    5 to stop    ;;
;;;;;;;;;;;;;;;;;;;;;

/def -T"tiny.mush.cm" -i -mregexp -h'SEND ^1$' cm_head_sw = heading 20
/def -T"tiny.mush.cm" -i -mregexp -h'SEND ^2$' cm_head_s  = heading 24
/def -T"tiny.mush.cm" -i -mregexp -h'SEND ^3$' cm_head_se = heading 28
/def -T"tiny.mush.cm" -i -mregexp -h'SEND ^4$' cm_head_w  = heading 16
/def -T"tiny.mush.cm" -i -mregexp -h'SEND ^5$' cm_head_5  = stop
/def -T"tiny.mush.cm" -i -mregexp -h'SEND ^6$' cm_head_e  = heading 0
/def -T"tiny.mush.cm" -i -mregexp -h'SEND ^7$' cm_head_nw = heading 12
/def -T"tiny.mush.cm" -i -mregexp -h'SEND ^8$' cm_head_n  = heading 8
/def -T"tiny.mush.cm" -i -mregexp -h'SEND ^9$' cm_head_ne = heading 4

;;; Peter's directions (CM)
/def -T"tiny.mush.cm" -i key_nkp5 = /stop
/def -T"tiny.mush.cm" -i key_nkp1 = /sw
/def -T"tiny.mush.cm" -i key_nkp2 = /s
/def -T"tiny.mush.cm" -i key_nkp3 = /se
/def -T"tiny.mush.cm" -i key_nkp4 = /w
/def -T"tiny.mush.cm" -i key_nkp6 = /e
/def -T"tiny.mush.cm" -i key_nkp7 = /nw
/def -T"tiny.mush.cm" -i key_nkp8 = /n
/def -T"tiny.mush.cm" -i key_nkp9 = /ne

;;; Peter's directions (DIKU/MUD)
/def -Tdiku -i key_nkp5 = stop
/def -Tdiku -i key_nkp1 = sw
/def -Tdiku -i key_nkp2 = s
/def -Tdiku -i key_nkp3 = se
/def -Tdiku -i key_nkp4 = w
/def -Tdiku -i key_nkp6 = e
/def -Tdiku -i key_nkp7 = nw
/def -Tdiku -i key_nkp8 = n
/def -Tdiku -i key_nkp9 = ne


;;; The remaining flight macros are mine (Gwen Morse)

/def -F -T"tiny.mush.cm" -p7 e = \
  /send heading 0

/def -F -T"tiny.mush.cm" -p7 n = \
  /send heading 8

/def -F -T"tiny.mush.cm" -p7 w = \
  /send heading 16

/def -F -T"tiny.mush.cm" -p7 s = \
  /send heading 24

/def -F -T"tiny.mush.cm" -p7 ne = \
  /send heading 4

/def -F -T"tiny.mush.cm" -p7 nw = \
  /send heading 12

/def -F -T"tiny.mush.cm" -p7 sw = \
  /send heading 20

/def -F -T"tiny.mush.cm" -p7 se = \
  /send heading 28

;;; Stop (to stop the sled)

/def -F -T"tiny.mush.cm" -p7 stop = \
  /send stop

;;; Move (to start flying again)

/def -F -T"tiny.mush.cm" -p7 speed = \
  /if ({#} > 0) \
      /send speed %* %;\
  /else \
      /send speed 1 %;\
  /endif

;;; Level (to level the nose of the sled)

/def -F -T"tiny.mush.cm" -p7 level = \
  /send level

;;; To eventually avoid stupidly claimjumping!
;;; "You can barely make out the traces of"
;;; All about you can see freshly painted
;;; Here and there, a little faded, you can see

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Claims array (Claims database)
;;;
;;; This needs Galvin's array code
;;; Originally collected by Wolfgang@CM with updates from assorted players on the game
;;; The claim array was truly a community effort!

;;; What claim am I checking?
;;; Increase ({*} <= 163)) if the number of claims in the database increases

/def -T"tiny.mush.cm.sing" checkclaim = \
  /if (({*} >= 0) & ({*} <= 164)) \
    /_echo %;\
    /list2array claim %1 %;\
  /else \
    /echo TFRC: You need to enter a number between 0 and 164. %;\
  /endif

;;;
;;; What Claim am I in?
;;; type /whatclaim when standing in the FIRST ROOM of the claim
;;; needs Galvin's array as well as the claim array database.

/def -F -p20 -T"tiny.mush.cm" whatclaim = \
  /send -w @pemit me=The first room of the claim I'm in is: [name(loc(me))]%;\

/def -F -T"tiny.mush.cm" -mregexp -t"^The first room of the claim I'm in is: ([A-Za-z0-9- ]+)" claim_namesearch = \
  /let CLAIM_FIRST_ROOM=%P1%;\
  /_echo Claim room: %{CLAIM_FIRST_ROOM}%;\
  /test CLAIM_ROOM_LIST := searchstr_2array("claim", "0", "1", "164","%{CLAIM_FIRST_ROOM}")%;\
  /send -w credits%;\
  /let _claim $(/length %{CLAIM_ROOM_LIST}) %;\
  /repeat -w -1 1 /builder_loop %{CLAIM_ROOM_LIST}

/def -F -T"tiny.mush.cm" -mregexp -t"^The first room of the claim I'm in is: ([A-Za-z0-9- ]+)" claim_namesearch = \
  /let CLAIM_FIRST_ROOM=%P1%;\
  /_echo Claim room: %{CLAIM_FIRST_ROOM}%;\
  /test CLAIM_ROOM_LIST := searchstr_2array("claim", "0", "1", "164","%{CLAIM_FIRST_ROOM}")%;\
  /send -w credits%;\
  /let _claim $(/length %{CLAIM_ROOM_LIST}) %;\
  /if (_claim >= 2) \
    /repeat -w -1 1 /builder_loop %{CLAIM_ROOM_LIST}%;\
  /elseif (_claim == 1) \
    /set CLAIM_NUM=%{CLAIM_ROOM_LIST}%;\
    /test CLAIM_ARRAY_BUILDER := get_2array("claim", "%{CLAIM_NUM}", "2")%;\
    /test CLAIM_PATH := get_2array("claim", "%{CLAIM_NUM}", "3")%;\
    /list2array claim %{CLAIM_NUM}%;\
    /_echo Path: %{CLAIM_PATH}%;\
  /else \
    /echo -aBCred -w TFRC: Claim Room search broken.%;\
  /endif

/def builder_loop = \
  /if ({#}) \
    /set CLAIM_NUM=%{1}%;\
    /test CLAIM_ARRAY_BUILDER := get_2array("claim", "%{CLAIM_NUM}", "2")%;\
    /if ({CLAIM_ARRAY_BUILDER} =~ {CLAIM_BUILDER}) \
      /test CLAIM_PATH := get_2array("claim", "%{CLAIM_NUM}", "3")%;\
      /list2array claim %{CLAIM_NUM}%;\
      /_echo Path: %{CLAIM_PATH}%;\
    /else \
      /shift %;\
      /repeat -w -1 1 /builder_loop %{*} %;\
    /endif%;\
  /endif

;;; Regexp match fixed by Tommy (hair at vnet dot net)
/def -F -p100 -T"tiny.mush.cm" -mregexp -t'^This claim was built by ([A-Za-z-,& \(\)\;\:.]+)(\.|\.\.)$' claim_builder = \
  /set CLAIM_BUILDER=%P1

;;;
;;; Type /path after you've used /whatclaim to see the path and the LZ (if known).
;;; Path does not (yet) work with multi-path claims.

/def -F -p20 -T"tiny.mush.cm" path = \
  /send -w @pemit me=%{CLAIM_PATH}%;\
  /send -w @pemit me=%{locsaved}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; entry 0: The name of the claim
;;; entry 1: The 'veiw' outside the windscreen
;;; entry 2: The 'credits' (who desced and coded the claim)
;;; entry 3: Directions to the vein
;;; entry 4: Alternate directions once the vein is found
;;; entry 5: Notes about the claim
;;; entry 6: the 'hints' on the claim (if any)
;;; entry 7: if injuries are confirmed on this claim "yes" otherwise "none"
;;; entry 8: Whether you will to skip this claim when using the autofly code.
;;; Most of entry 8 are set to 'no' by default, some are set 'yes'
;;; entry 9: Autowalkies from first room to find vein
;;; entry 10: Autowalkies from sled to staked vein
;;; entry 11: Autowalkies from staked vein to sled
;;; entry 12: if full autowalkies paths are functional "yes" otherwise "no"
;;; entry 13: delay in seconds for auto-walking
;;;
;;; Edit entry 8 to 'yes' or 'no' as you like for each. Each user of 
;;; this code should update entry 8 of the assorted array entries 
;;; below to have a "yes" or "no" based on whether they want to skip 
;;; each claim ('yes' skips, 'no' doesn't). Please don't count on 
;;; the defaults in here, they were set up solely for testing purposes.
;;;
;;;
;;; A very few of the 'credits' entries do not exactly match the 
;;; ones in the claims. This is due to Wolfgang originally 
;;; abbreviating them. Please replace the array entries
;;; with the exact text when you find one like this. 
;;; Additionally, some special characters break the match 
;;; code ("smileys" are one of the issues). I'm still working on a fix 
;;; for the unmatched credits entries. 
;;; When you type credits, 
;;; if you see two periods (..) at the end, only put one in the array.
;;; If you see one period (.), don't put any in the array.
;;;


;; 000 Claim put in for LZ Database ;;
/test put_2array('claim', 000, '0', 'NULL Claim')
/test put_2array('claim', 000, '1', 'NULL Claim')
/test put_2array('claim', 000, '2', 'NULL Claim')
/test put_2array('claim', 000, '3', 'NULL Claim')
/test put_2array('claim', 000, '4', 'NULL Claim')
/test put_2array('claim', 000, '5', 'NULL Claim')
/test put_2array('claim', 000, '6', 'NULL Claim')
/test put_2array('claim', 000, '7', 'none')
/test put_2array('claim', 000, '8', 'no')


/test put_2array('claim', 001, '0', 'Abandoned Campsite')
/test put_2array('claim', 001, '1', 'As you spot the plateau far below, and decide to see if there is a place to land. ')
/test put_2array('claim', 001, '2', 'Seliantha')
/test put_2array('claim', 001, '3', 'East South South --> VEIN!')
/test put_2array('claim', 001, '4', 'none')
/test put_2array('claim', 001, '5', 'none')
/test put_2array('claim', 001, '6', 'none')
/test put_2array('claim', 001, '7', 'none')
/test put_2array('claim', 001, '8', 'no')


/test put_2array('claim', 002, '0', 'Aged Forest - Clearing')
/test put_2array('claim', 002, '1', 'Below your sled runs a ridge of limestone, an aged cliff that borders a substantial forest.')
/test put_2array('claim', 002, '2', 'Tirla, based on an area desc by Radhiya')
/test put_2array('claim', 002, '3', 'e d n enter vein')
/test put_2array('claim', 002, '4', 'none')
/test put_2array('claim', 002, '5', 'none')
/test put_2array('claim', 002, '6', 'The red plant tinting has nothing to do with finding crystal. It\'s just for descriptive effect. Honest.')
/test put_2array('claim', 002, '7', 'none')
/test put_2array('claim', 002, '8', 'no')
/test put_2array('claim', 002, '9', 'e|d|n')
/test put_2array('claim', 002, '10', 'leave sled|e|d|n|enter vein')
/test put_2array('claim', 002, '11', 'leave vein|o|o|o|enter sled')
/test put_2array('claim', 002, '12', 'yes')


/test put_2array('claim', 003, '0', 'Angled Shelf')
/test put_2array('claim', 003, '1', 'A slashing cut runs in a northeast/southwest slice deep into the range below. There seems to be a level spot to the east of the slice, just large enough for a sled to land if one is extremely skillful about it. A quick flash of light catches your eye, possibly from an elusive vein of crystal.')
/test put_2array('claim', 003, '2', 'Nikama')
/test put_2array('claim', 003, '3', 'Path Southeast (injury?) Into the Shadows --> VEIN!')
/test put_2array('claim', 003, '4', 'none')
/test put_2array('claim', 003, '5', 'minor injury confirmed')
/test put_2array('claim', 003, '6', 'none')
/test put_2array('claim', 003, '7', 'yes')
/test put_2array('claim', 003, '8', 'no')
/test put_2array('claim', 003, '9', 'path|southeast|lamp on|into the shadows')
/test put_2array('claim', 003, '10', 'leave sled|path|southeast|lamp on|into the shadows|enter vein|lamp off')
/test put_2array('claim', 003, '11', 'lamp on|leave vein|out|out|out|lamp off|enter sled')
/test put_2array('claim', 003, '12', 'yes')


/test put_2array('claim', 004, '0', 'Arroyo')
/test put_2array('claim', 004, '1', 'The ground below you is a honeycomb of narrow canyons and gullies, almost all too treacherous-looking to land in.')
/test put_2array('claim', 004, '2', 'Inanna')
/test put_2array('claim', 004, '3', 'East Push Rock (east) North --> VEIN!')
/test put_2array('claim', 004, '4', 'none')
/test put_2array('claim', 004, '5', 'none')
/test put_2array('claim', 004, '6', 'Don\'t be afraid of a little hard work.')
/test put_2array('claim', 004, '7', 'none')
/test put_2array('claim', 004, '8', 'no')
/test put_2array('claim', 004, '9', 'east|push rock|north')
/test put_2array('claim', 004, '10', 'leave sled|east|push rock|north|enter vein')
/test put_2array('claim', 004, '11', 'leave vein|south|west|out|enter sled')
/test put_2array('claim', 004, '12', 'yes')


/test put_2array('claim', 005, '0', 'Barren Canyon')
/test put_2array('claim', 005, '1', 'A long narrow canyon stretches out east to west. It looks like there might be a place at the bottom to land.')
/test put_2array('claim', 005, '2', 'Deserai')
/test put_2array('claim', 005, '3', 'East East north lamp on north --> VEIN!')
/test put_2array('claim', 005, '4', 'none')
/test put_2array('claim', 005, '5', 'none')
/test put_2array('claim', 005, '6', 'none')
/test put_2array('claim', 005, '7', 'none')
/test put_2array('claim', 005, '8', 'no')
/test put_2array('claim', 005, '9', 'east|east|north|lamp on|north')
/test put_2array('claim', 005, '10', 'leave sled|east|east|north|lamp on|north|enter vein|lamp off')
/test put_2array('claim', 005, '11', 'lamp on|leave vein|out|out|out|out|lamp off|enter sled')
/test put_2array('claim', 005, '12', 'yes')


/test put_2array('claim', 006, '0', 'Base of Slope')
/test put_2array('claim', 006, '1', 'A dry area, with multiple rockfalls and many shifts in the water table.')
/test put_2array('claim', 006, '2', 'Edwin')
/test put_2array('claim', 006, '3', 'Up Secure Line Up (injury?) --> VEIN!')
/test put_2array('claim', 006, '4', 'none')
/test put_2array('claim', 006, '5', 'none')
/test put_2array('claim', 006, '6', 'none')
/test put_2array('claim', 006, '7', 'yes')
/test put_2array('claim', 006, '8', 'no')
/test put_2array('claim', 006, '9', 'up|secure line|up')
/test put_2array('claim', 006, '10', 'leave sled|up|secure line|up|enter vein|retrieve line')
/test put_2array('claim', 006, '11', 'leave vein|secure line|out|out|retrieve line|enter sled')
/test put_2array('claim', 006, '12', 'yes')


/test put_2array('claim', 007, '0', 'Basin')
/test put_2array('claim', 007, '1', 'An irregular rock formation draws your attention. On closer inspection, you see that a tall rock spire rises from the planet\'s surface.')
/test put_2array('claim', 007, '2', 'Dalyc')
/test put_2array('claim', 007, '3', 'Trench Northwest East --> VEIN!')
/test put_2array('claim', 007, '4', 'none')
/test put_2array('claim', 007, '5', 'none')
/test put_2array('claim', 007, '6', 'none')
/test put_2array('claim', 007, '7', 'none')
/test put_2array('claim', 007, '8', 'no')
/test put_2array('claim', 007, '9', 'trench|northwest|east')
/test put_2array('claim', 007, '10', 'leave sled|trench|northwest|east|enter vein')
/test put_2array('claim', 007, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 007, '12', 'yes')


/test put_2array('claim', 008, '0', 'Beach')
/test put_2array('claim', 008, '1', 'Along the coastline, rocky cliffs rise out of turbulent surf and sand. Wind and ocean combine to wear away rock to fine sand in a half-moon shaped bay. This area is only slightly sheltered from the elements.')
/test put_2array('claim', 008, '2', 'Samira')
/test put_2array('claim', 008, '3', 'Dunes Cliff Crack --> VEIN!')
/test put_2array('claim', 008, '4', 'none')
/test put_2array('claim', 008, '5', 'TIDE-LOCK!! must be LOW!')
/test put_2array('claim', 008, '6', 'Keep close track of the tide. You don\'t want to get trapped. It\'s also probably not a good idea to carry your cutter into the sea, but I suspect that\'s obvious. A lamp may prove useful.')
/test put_2array('claim', 008, '7', 'none')
/test put_2array('claim', 008, '8', 'yes')
/test put_2array('claim', 008, '9', 'dunes|cliff|crack')
/test put_2array('claim', 008, '10', 'leave sled|dunes|cliff|crack|enter vein')
/test put_2array('claim', 008, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 008, '12', '')


/test put_2array('claim', 009, '0', 'Beach Hillside')
/test put_2array('claim', 009, '1', 'The wrinkled landscape beneath your sled is a mass of sandy hills that end at the shoreline. A ledge, roughly carved out of the side of one of the taller hills appears flat enough to land on.')
/test put_2array('claim', 009, '2', 'Edana')
/test put_2array('claim', 009, '3', 'Down Down Northeast --> VEIN!')
/test put_2array('claim', 009, '4', 'none')
/test put_2array('claim', 009, '5', 'none')
/test put_2array('claim', 009, '6', 'Be observant-- use your senses.')
/test put_2array('claim', 009, '7', 'none')
/test put_2array('claim', 009, '8', 'no')
/test put_2array('claim', 009, '9', 'down|down|northeast')
/test put_2array('claim', 009, '10', 'leave sled|down|down|northeast|enter vein')
/test put_2array('claim', 009, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 009, '12', 'yes')


/test put_2array('claim', 010, '0', 'Bog - Broad Expanse')
/test put_2array('claim', 010, '1', 'The ground below seems to stretch flat in all directions, bounded only by a long, steep cliff to the west.')
/test put_2array('claim', 010, '2', 'Zynthce')
/test put_2array('claim', 010, '3', 'Darker Horizon Gap Further In Glow --> VEIN!')
/test put_2array('claim', 010, '4', 'none')
/test put_2array('claim', 010, '5', 'none')
/test put_2array('claim', 010, '6', 'none')
/test put_2array('claim', 010, '7', 'none')
/test put_2array('claim', 010, '8', 'no')
/test put_2array('claim', 010, '9', 'darker horizon|gap|further in|glow')
/test put_2array('claim', 010, '10', 'leave sled|darker horizon|gap|further in|glow|enter vein')
/test put_2array('claim', 010, '11', 'leave|out|out|out|out|enter sled')
/test put_2array('claim', 010, '12', 'yes')


/test put_2array('claim', 011, '0', 'Bottomlands')
/test put_2array('claim', 011, '1', 'A predictable panorama of rocky mountains and valleys stretches out below you. But wait a second -- what\'s that glint, down there in that river valley?')
/test put_2array('claim', 011, '2', 'Inanna')
/test put_2array('claim', 011, '3', 'Enter wreck +view supplies get rope out west +view rope get grapnel tie rope to grapnel o u toss grapnel u --> VEIN!')
/test put_2array('claim', 011, '4', 'none')
/test put_2array('claim', 011, '5', 'Possibility of getting sled stuck!')
/test put_2array('claim', 011, '6', '+view everything')
/test put_2array('claim', 011, '7', 'none')
/test put_2array('claim', 011, '8', 'yes')
/test put_2array('claim', 011, '9', 'enter wreck|+view supplies|get rope|out|west|+view rope|get grapnel|tie rope to grapnel|o|u|toss grapnel|u')
/test put_2array('claim', 011, '10', 'leave sled|up|up|enter vein')
/test put_2array('claim', 011, '11', 'leave vein|down|down|enter [name(me)]\'s sled')
/test put_2array('claim', 011, '12', 'yes')
/test put_2array('claim', 011, '13', '5')


/test put_2array('claim', 012, '0', 'Broken Tooth - ')
/test put_2array('claim', 012, '1', 'You see a mountain, apparently sheared off during some ancient cataclysm, to look almost exactly like a colossal molar.  Surrounding the mountain is what looks like a sheer drop off, hundreds of feet high.')
/test put_2array('claim', 012, '2', 'Remy')
/test put_2array('claim', 012, '3', 'East North Up -->VEIN!')
/test put_2array('claim', 012, '4', 'none')
/test put_2array('claim', 012, '5', 'none')
/test put_2array('claim', 012, '6', 'none')
/test put_2array('claim', 012, '7', 'none')
/test put_2array('claim', 012, '8', 'no')
/test put_2array('claim', 012, '9', 'east|north|up')
/test put_2array('claim', 012, '10', 'leave sled|east|north|up|enter vein')
/test put_2array('claim', 012, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 012, '12', 'yes')


/test put_2array('claim', 013, '0', 'Canyon Top')
/test put_2array('claim', 013, '1', 'A large canyon cuts into a mountaintop below.')
/test put_2array('claim', 013, '2', 'Connor')
/test put_2array('claim', 013, '3', 'Down Down Down Narrow Ledge (injury?) -->VEIN!')
/test put_2array('claim', 013, '4', 'none')
/test put_2array('claim', 013, '5', 'none')
/test put_2array('claim', 013, '6', 'Take a good look around.')
/test put_2array('claim', 013, '7', 'yes')
/test put_2array('claim', 013, '8', 'no')
/test put_2array('claim', 013, '9', 'down|down|down|narrow ledge')
/test put_2array('claim', 013, '10', 'leave sled|down|down|down|narrow ledge|enter vein')
/test put_2array('claim', 013, '11', 'leave vein|out|out|out|out|enter sled')
/test put_2array('claim', 013, '12', 'yes')


/test put_2array('claim', 014, '0', 'Center of Narrow Canyon')
/test put_2array('claim', 014, '1', 'A narrow, twisting canyon lies below, full of interesting possibilities.')
/test put_2array('claim', 014, '2', 'Elenna')
/test put_2array('claim', 014, '3', 'Northeast --> VEIN!')
/test put_2array('claim', 014, '4', 'none')
/test put_2array('claim', 014, '5', 'none')
/test put_2array('claim', 014, '6', 'none')
/test put_2array('claim', 014, '7', 'none')
/test put_2array('claim', 014, '8', 'no')
/test put_2array('claim', 014, '9', 'ne')
/test put_2array('claim', 014, '10', 'leave sled|ne|enter vein')
/test put_2array('claim', 014, '11', 'leave vein|sw|enter sled')
/test put_2array('claim', 014, '12', 'yes')


/test put_2array('claim', 015, '0', 'Central Bowl')
/test put_2array('claim', 015, '1', 'A large lake lies below, the area around it may potentially hide crystal veins.')
/test put_2array('claim', 015, '2', 'Laicyn')
/test put_2array('claim', 015, '3', 'Western Rim --> VEIN!!!')
/test put_2array('claim', 015, '4', 'none')
/test put_2array('claim', 015, '5', 'none')
/test put_2array('claim', 015, '6', 'none')
/test put_2array('claim', 015, '7', 'none')
/test put_2array('claim', 015, '8', 'no')
/test put_2array('claim', 015, '9', 'western rim')
/test put_2array('claim', 015, '10', 'leave sled|western rim|enter vein')
/test put_2array('claim', 015, '11', 'leave vein|out|enter sled')
/test put_2array('claim', 015, '12', 'yes')


/test put_2array('claim', 016, '0', 'Clearing')
/test put_2array('claim', 016, '1', 'Endless rocky plains have been monotonous in their sameness, but the blurry line you pass by looks interesting. A closer looks shows that the land opens into a small lake, and along the southern end dips into a black line that runs a short distance before vanishing into the monotony again. Perhaps you should investigate this more closely.')
/test put_2array('claim', 016, '2', 'Richard')
/test put_2array('claim', 016, '3', 'Faded Trail Down --> VEIN!')
/test put_2array('claim', 016, '4', 'none')
/test put_2array('claim', 016, '5', 'none')
/test put_2array('claim', 016, '6', 'none')
/test put_2array('claim', 016, '7', 'none')
/test put_2array('claim', 016, '8', 'no')
/test put_2array('claim', 016, '9', 'faded trail|down')
/test put_2array('claim', 016, '10', 'leave sled|faded trail|down|enter vein')
/test put_2array('claim', 016, '11', 'leave vein|out|out|enter sled')
/test put_2array('claim', 016, '12', 'yes')


/test put_2array('claim', 017, '0', 'Cliff Ledge')
/test put_2array('claim', 017, '1', 'A blank cliff stretches down into a gulley, with a few ledges on, but only one looks landable.')
/test put_2array('claim', 017, '2', 'Jasper')
/test put_2array('claim', 017, '3', 'Up East --> VEIN!')
/test put_2array('claim', 017, '4', 'none')
/test put_2array('claim', 017, '5', 'none')
/test put_2array('claim', 017, '6', 'Climbing equipment may prove useful.')
/test put_2array('claim', 017, '7', 'none')
/test put_2array('claim', 017, '8', 'no')


/test put_2array('claim', 018, '0', 'Cliffs of Insanity')
/test put_2array('claim', 018, '1', 'Down below, you see a soft blanket of thick fog covering the ground. You catch glimpses of sheer rock cliffs as the fog swirls and thins in spots. Dark shadows mask the bottom of the cliffs, forming the illusion of endless walls going nowhere.')
/test put_2array('claim', 018, '2', 'Kierani and Kes')
/test put_2array('claim', 018, '3', 'secure line,Climb, Swing Left, Swing Left, Lamp on!, Up --> VEIN!')
/test put_2array('claim', 018, '4', 'none')
/test put_2array('claim', 018, '5', 'Sled gets stuck!!')
/test put_2array('claim', 018, '6', 'When on dangerous cliffs climbing gear is useful.')
/test put_2array('claim', 018, '7', 'none')
/test put_2array('claim', 018, '8', 'yes')
/test put_2array('claim', 018, '9', 'secure line|climb|swing left|swing left|lamp on|up|swing left|swing left|up')
/test put_2array('claim', 018, '10', 'leave sled|secure line|climb|swing left|swing left|up|enter vein')
/test put_2array('claim', 018, '11', 'lamp on|leave vein|secure line|walls|out|out|retrieve line|enter sled|lamp off')
/test put_2array('claim', 018, '12', 'no')


/test put_2array('claim', 019, '0', 'Coastal Bluffs')
/test put_2array('claim', 019, '1', 'Eerie and cold black sand beaches stretch out below you.')
/test put_2array('claim', 019, '2', 'Lhovrik')
/test put_2array('claim', 019, '3', 'North North North --> VEIN!')
/test put_2array('claim', 019, '4', 'none')
/test put_2array('claim', 019, '5', 'none')
/test put_2array('claim', 019, '6', 'none')
/test put_2array('claim', 019, '7', 'none')
/test put_2array('claim', 019, '8', 'no')
/test put_2array('claim', 019, '9', 'north|north|north')
/test put_2array('claim', 019, '10', 'leave sled|north|north|north|enter vein')
/test put_2array('claim', 019, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 019, '12', 'yes')


/test put_2array('claim', 020, '0', 'Collapsed Volcano')
/test put_2array('claim', 020, '1', 'What strikes you the most as you overfly this area is the collapsed volcano, the slide of debris slumping to a gentle halt near a fault that runs perpendicular to the volcano. Perhaps the fault has some potential?')
/test put_2array('claim', 020, '2', 'Himiko')
/test put_2array('claim', 020, '3', 'Down Fault Trench --> VEIN!')
/test put_2array('claim', 020, '4', 'none')
/test put_2array('claim', 020, '5', 'none')
/test put_2array('claim', 020, '6', 'none')
/test put_2array('claim', 020, '7', 'none')
/test put_2array('claim', 020, '8', 'no')
/test put_2array('claim', 020, '9', 'down|fault|trench')
/test put_2array('claim', 020, '10', 'leave sled|down|fault|trench|enter vein')
/test put_2array('claim', 020, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 020, '12', 'yes')


/test put_2array('claim', 021, '0', 'Coral Canyon')
/test put_2array('claim', 021, '1', 'Many klicks below, you see a number of winding canyons. One in particular catches your eye. Perhaps you should take a closer look...')
/test put_2array('claim', 021, '2', 'Bernadette Marshall')
/test put_2array('claim', 021, '3', 'South Up (dark) --> VEIN!')
/test put_2array('claim', 021, '4', 'none')
/test put_2array('claim', 021, '5', 'north injury falling in a hole')
/test put_2array('claim', 021, '6', 'none')
/test put_2array('claim', 021, '7', 'yes')
/test put_2array('claim', 021, '8', 'no')
/test put_2array('claim', 021, '9', 'south|up')
/test put_2array('claim', 021, '10', 'leave sled|south|up|enter vein')
/test put_2array('claim', 021, '11', 'leave vein|down|north|enter sled')
/test put_2array('claim', 021, '12', 'yes')


/test put_2array('claim', 022, '0', 'Cove of Peace - Main Beach')
/test put_2array('claim', 022, '1', 'The sea is below you crashing against tall cliffs. And where there\'s water and land, there might be a beach you could land on.')
/test put_2array('claim', 022, '2', 'Remyra, finished by Jasen')
/test put_2array('claim', 022, '3', 'North Rockslide (lamp on) Crevice --> VEIN!')
/test put_2array('claim', 022, '4', 'none')
/test put_2array('claim', 022, '5', 'Leaving results in possible injury')
/test put_2array('claim', 022, '6', 'none')
/test put_2array('claim', 022, '7', 'yes')
/test put_2array('claim', 022, '8', 'no')


/test put_2array('claim', 023, '0', 'Creek Valley')
/test put_2array('claim', 023, '1', 'You look down and see a narrow valley with a small creek running through it. Not far from this valley is a small slash in the ground that seems quite unaccessible.')
/test put_2array('claim', 023, '2', 'Tsia')
/test put_2array('claim', 023, '3', 'Cavern Hidden Gully --> VEIN!')
/test put_2array('claim', 023, '4', 'none')
/test put_2array('claim', 023, '5', 'sled can get stuck when trying to leave')
/test put_2array('claim', 023, '6', 'none')
/test put_2array('claim', 023, '7', 'none')
/test put_2array('claim', 023, '8', 'yes')
/test put_2array('claim', 023, '9', 'cavern|hidden gully')
/test put_2array('claim', 023, '10', 'leave sled|cavern|hidden gully|enter vein')
/test put_2array('claim', 023, '11', 'leave vein|cavern|out|enter sled')
/test put_2array('claim', 023, '12', 'yes')


/test put_2array('claim', 024, '0', 'Dank Marsh')
/test put_2array('claim', 024, '1', 'A semi-circle rising of rock encloses a deep, brown area of water. There is little green to be found below, merely the brackish water and the craggy rocks.')
/test put_2array('claim', 024, '2', 'Martelle, Andreshella')
/test put_2array('claim', 024, '3', 'north north lamp on crevice -> vein')
/test put_2array('claim', 024, '4', 'Investigate easier route')
/test put_2array('claim', 024, '5', 'none')
/test put_2array('claim', 024, '6', 'Obviously dangerous choices usually have alternatives. You may have to wait for those alternatives to become clear.')
/test put_2array('claim', 024, '7', 'none')
/test put_2array('claim', 024, '8', 'no')
/test put_2array('claim', 024, '9', 'north|north|lamp on|crevice')
/test put_2array('claim', 024, '10', 'leave sled|north|north|lamp on|crevice|enter vein|lamp off')
/test put_2array('claim', 024, '11', 'leave vein|up|out|south|lamp off|south|south|enter sled')
/test put_2array('claim', 024, '12', 'yes')


/test put_2array('claim', 025, '0', 'Deep Bowl - Underhang')
/test put_2array('claim', 025, '1', 'Scoria glitters on a deep bowl valley, water standing amidst swampy hummocks of ground. ')
/test put_2array('claim', 025, '2', 'Linanna, finished by Edwin.')
/test put_2array('claim', 025, '3', 'Muddy Levee Cleft Cave Cleft +view ceiling Wide Crack VEIN!')
/test put_2array('claim', 025, '4', 'none')
/test put_2array('claim', 025, '5', 'sled can get stuck in mud')
/test put_2array('claim', 025, '6', 'none')
/test put_2array('claim', 025, '7', 'none')
/test put_2array('claim', 025, '8', 'yes')
/test put_2array('claim', 025, '9', 'muddy levee|cleft cave|cleft|+view ceiling|wide crack')
/test put_2array('claim', 025, '10', 'leave sled|muddy levee|cleft cave|cleft|wide crack|enter vein')
/test put_2array('claim', 025, '11', 'leave vein|out|out|out|out|enter sled')
/test put_2array('claim', 025, '12', 'yes')


/test put_2array('claim', 026, '0', 'Desert Flats')
/test put_2array('claim', 026, '1', 'From up here, all of Ballybran seems to be one large sandbox, with pink and yellow flashes clearly visible to symbiont-enhanced vision. The uniform landscape is marred by a large protrusion, however - not a toy left by some giant child, but rather an impressive butte of volcanic rock.')
/test put_2array('claim', 026, '2', 'Emara')
/test put_2array('claim', 026, '3', 'East East Up South --> VEIN!')
/test put_2array('claim', 026, '4', 'none')
/test put_2array('claim', 026, '5', 'none')
/test put_2array('claim', 026, '6', 'none')
/test put_2array('claim', 026, '7', 'none')
/test put_2array('claim', 026, '8', 'no')
/test put_2array('claim', 026, '9', 'east|east|up|south')
/test put_2array('claim', 026, '10', 'leave sled|east|east|up|south|enter vein')
/test put_2array('claim', 026, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 026, '12', 'yes')


/test put_2array('claim', 027, '0', 'Devil\'s Cauldron - Landing Site')
/test put_2array('claim', 027, '1', 'A sheer cliff right on the edge of the coast looks down over a spectacular formation of rock. There may be a landing site on the rim of the cliff.')
/test put_2array('claim', 027, '2', 'Linanna')
/test put_2array('claim', 027, '3', 'Narrow Trail Dirt Track Low Tunnel Rocky Beach Narrow Gap --> VEIN!')
/test put_2array('claim', 027, '4', 'Secure Line Cliff Face Dirt Track Low Tunnel Rocky Beach Narrow Gap --> VEIN!')
/test put_2array('claim', 027, '5', 'none')
/test put_2array('claim', 027, '6', 'none')
/test put_2array('claim', 027, '7', 'none')
/test put_2array('claim', 027, '8', 'no')
/test put_2array('claim', 027, '9', 'nt|dt|lt|rb|ng')
/test put_2array('claim', 027, '10', 'leave sled|nt|dt|lt|rb|ng|enter vein')
/test put_2array('claim', 027, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 027, '12', 'no')


/test put_2array('claim', 028, '0', 'Diamond Point Canyon')
/test put_2array('claim', 028, '1', 'You see below you a long narrow canyon with a slight swell in the middle. It appears to narrow to nothing at the eastern end and drop off into a cliff at the western end.')
/test put_2array('claim', 028, '2', 'Lauren')
/test put_2array('claim', 028, '3', 'East East East --> VEIN!')
/test put_2array('claim', 028, '4', 'none')
/test put_2array('claim', 028, '5', 'none')
/test put_2array('claim', 028, '6', 'none')
/test put_2array('claim', 028, '7', 'none')
/test put_2array('claim', 028, '8', 'no')


/test put_2array('claim', 029, '0', 'Dragon\'s Lair')
/test put_2array('claim', 029, '1', 'A perfectly circular patch of green, surrounded by high cliffs, catches your eye.')
/test put_2array('claim', 029, '2', 'Zaylii')
/test put_2array('claim', 029, '3', 'Sinkhole Down Narrow Crevice --> VEIN!')
/test put_2array('claim', 029, '4', 'none')
/test put_2array('claim', 029, '5', 'climbing gear can break leaving you stuck in the sinkhole')
/test put_2array('claim', 029, '6', 'none')
/test put_2array('claim', 029, '7', 'none')
/test put_2array('claim', 029, '8', 'no')
/test put_2array('claim', 029, '9', 'secure line|sinkhole|down|narrow crevice')
/test put_2array('claim', 029, '10', 'leave sled|secure line|sinkhole|down|narrow crevice|retrieve line|enter vein')
/test put_2array('claim', 029, '11', 'leave vein|secure line|out|out|out|retrieve line|enter sled')
/test put_2array('claim', 029, '12', 'yes')


/test put_2array('claim', 030, '0', 'Dunes')
/test put_2array('claim', 030, '1', 'The majestic panorama of the ocean floods the view. Gazing around you see an extensive rocky reef lying parallel to the coastline, a large sandy beach and an impressive array of limestone cliffs.')
/test put_2array('claim', 030, '2', 'Kakuru')
/test put_2array('claim', 030, '3', 'west, sandy beach, +view debris, get crowbar Limestone Cliffs Lift wreck with crowbar Down --> VEIN!')
/test put_2array('claim', 030, '4', 'none')
/test put_2array('claim', 030, '5', 'You have to look around for the crowbar.. it might be in the sled.')
/test put_2array('claim', 030, '6', 'none')
/test put_2array('claim', 030, '7', 'none')
/test put_2array('claim', 030, '8', 'no')
/test put_2array('claim', 030, '9', 'west|sandy beach|+view debris|get crowbar|limestone cliffs|lift wreck with crowbar|down')
/test put_2array('claim', 030, '10', 'leave|limestone cliffs|down|enter vein')
/test put_2array('claim', 030, '11', 'out|up|out|enter sled')
/test put_2array('claim', 030, '12', 'yes')
/test put_2array('claim', 030, '13', '5')


/test put_2array('claim', 031, '0', 'Dusty Heights')
/test put_2array('claim', 031, '1', 'Rugged terrain lies below, but shadows hint as some interesting caves.')
/test put_2array('claim', 031, '2', 'Elissa')
/test put_2array('claim', 031, '3', 'Down North Down --> VEIN!')
/test put_2array('claim', 031, '4', 'S, W, N, NE, N, D --> VEIN')
/test put_2array('claim', 031, '5', 'none')
/test put_2array('claim', 031, '6', 'none')
/test put_2array('claim', 031, '7', 'none')
/test put_2array('claim', 031, '8', 'no')
/test put_2array('claim', 031, '12', 'no')


/test put_2array('claim', 032, '0', 'Dusty Plains')
/test put_2array('claim', 032, '1', 'Below you, the plains and smooth hills of the high desert have given way to craggy small peaks. In the ravine directly beneath you, you think you see a winding creek. Beyond these small crags lie huge mountains, covered in conifers.')
/test put_2array('claim', 032, '2', 'Callista')
/test put_2array('claim', 032, '3', 'Small Trail Up the Trail South Rocky Path --> VEIN!')
/test put_2array('claim', 032, '4', 'none')
/test put_2array('claim', 032, '5', 'none')
/test put_2array('claim', 032, '6', 'none')
/test put_2array('claim', 032, '7', 'none')
/test put_2array('claim', 032, '8', 'no')
/test put_2array('claim', 032, '9', 'st|ut|s|rp')
/test put_2array('claim', 032, '10', 'leave|bushy path|bush|enter vein')
/test put_2array('claim', 032, '11', 'out|out|landing site|enter sled')
/test put_2array('claim', 032, '12', 'yes')


/test put_2array('claim', 033, '0', 'Edge of a Rough Canyon')
/test put_2array('claim', 033, '1', 'A fault lies below holding promise of crystal.')
/test put_2array('claim', 033, '2', 'Jade')
/test put_2array('claim', 033, '3', 'East North --> VEIN!')
/test put_2array('claim', 033, '4', 'none')
/test put_2array('claim', 033, '5', 'none')
/test put_2array('claim', 033, '6', 'none')
/test put_2array('claim', 033, '7', 'none')
/test put_2array('claim', 033, '8', 'no')
/test put_2array('claim', 033, '9', 'east|north')
/test put_2array('claim', 033, '10', 'leave sled|east|north|enter vein')
/test put_2array('claim', 033, '11', 'leave vein|out|out|enter sled')
/test put_2array('claim', 033, '12', 'yes')


/test put_2array('claim', 034, '0', 'End of Gully')
/test put_2array('claim', 034, '1', 'A gully lies far below, rock walls eroded by centuries of weather. Perhaps this would be a good spot to try searching for crystal.')
/test put_2array('claim', 034, '2', 'Kyrae Syree')
/test put_2array('claim', 034, '3', 'West Small Crack Large Cleft --> VEIN!')
/test put_2array('claim', 034, '4', 'none')
/test put_2array('claim', 034, '5', 'none')
/test put_2array('claim', 034, '6', 'none')
/test put_2array('claim', 034, '7', 'none')
/test put_2array('claim', 034, '8', 'no')
/test put_2array('claim', 034, '9', 'west|small crack|large cleft')
/test put_2array('claim', 034, '10', 'leave sled|west|small crack|large cleft|enter vein')
/test put_2array('claim', 034, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 034, '12', 'yes')


/test put_2array('claim', 035, '0', 'Endless Desert Plain')
/test put_2array('claim', 035, '1', 'An endless desert plain stretches out below, dunes washing across it likes waves upon the ocean. The only spot that looks flat enough to land is a formerly muddy wash that\'s now cracked and dried.')
/test put_2array('claim', 035, '2', 'Svetlana Vona Slovskaya')
/test put_2array('claim', 035, '3', 'Ne,nt --> VEIN!')
/test put_2array('claim', 035, '4', 'none')
/test put_2array('claim', 035, '5', 'none')
/test put_2array('claim', 035, '6', 'It\'s not where you think it is.')
/test put_2array('claim', 035, '7', 'none')
/test put_2array('claim', 035, '8', 'no')


/test put_2array('claim', 036, '0', 'Erosion Canyon')
/test put_2array('claim', 036, '1', 'An eroded canyon lake and stream.')
/test put_2array('claim', 036, '2', 'Gyles Lee')
/test put_2array('claim', 036, '3', 'Requires Saw! Trim Log Drag Northeast Northeast Drag Northeast Northeast Saw Steps Down --> VEIN!')
/test put_2array('claim', 036, '4', 'Northeast Swim Lamp on! Dive --> VEIN!')
/test put_2array('claim', 036, '5', 'This claim has 2 possible answers... so check it out first! ----- The first version requires the saw be rented from the equipment room at JPF.. The second one has the \'out\' exit from the vein chamber as possible injury.')
/test put_2array('claim', 036, '6', 'Perhaps a saw would be good if you want to cut some wood.')
/test put_2array('claim', 036, '7', 'none')
/test put_2array('claim', 036, '8', 'no')
/test put_2array('claim', 036, '9', 'Northeast|Swim|Lamp on|Dive')
/test put_2array('claim', 036, '10', 'leave sled|ne|swim|lamp on|dive|enter vein')
/test put_2array('claim', 036, '11', 'leave|surface|out|out|enter sled')
/test put_2array('claim', 036, '12', 'no')


/test put_2array('claim', 037, '0', 'Fallen Crest--Ravine Slope')
/test put_2array('claim', 037, '1', 'Below you you see a mass of ravines, including one very deep one with a fallen cliff next to it, boulders scattered into the ravine\'s opening.')
/test put_2array('claim', 037, '2', 'Edwin')
/test put_2array('claim', 037, '3', 'In (injury?) Cave Right --> VEIN!')
/test put_2array('claim', 037, '4', 'In (injury?) Cave Left --> VEIN!')
/test put_2array('claim', 037, '5', 'none')
/test put_2array('claim', 037, '6', 'none')
/test put_2array('claim', 037, '7', 'yes')
/test put_2array('claim', 037, '8', 'no')
/test put_2array('claim', 037, '9', 'in|cave|right')
/test put_2array('claim', 037, '10', 'leave sled|in|cave|right|enter vein')
/test put_2array('claim', 037, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 037, '12', 'no')


/test put_2array('claim', 038, '0', 'Fjord')
/test put_2array('claim', 038, '1', 'A narrow fjord sprawls out below, the towering walls on either side might be worth a closer look.')
/test put_2array('claim', 038, '2', 'Talia')
/test put_2array('claim', 038, '3', 'Southwest South Crack Up (injury?) --> VEIN!')
/test put_2array('claim', 038, '4', 'none')
/test put_2array('claim', 038, '5', 'none')
/test put_2array('claim', 038, '6', 'none')
/test put_2array('claim', 038, '7', 'yes')
/test put_2array('claim', 038, '8', 'no')
/test put_2array('claim', 038, '9', 'southwest|south|crack|up')
/test put_2array('claim', 038, '10', 'leave sled|southwest|south|crack|up|enter vein')
/test put_2array('claim', 038, '11', 'leave vein|out|out|out|out|enter sled')
/test put_2array('claim', 038, '12', 'yes')


/test put_2array('claim', 039, '0', 'Flat Area of Scrub')
/test put_2array('claim', 039, '1', 'Jagged peaks reach vainly for the sky. The barren rocks may potentially hide a crystal vein below.')
/test put_2array('claim', 039, '2', 'Sindra')
/test put_2array('claim', 039, '3', 'Ranges North --> VEIN!')
/test put_2array('claim', 039, '4', 'none')
/test put_2array('claim', 039, '5', 'none')
/test put_2array('claim', 039, '6', 'none')
/test put_2array('claim', 039, '7', 'none')
/test put_2array('claim', 039, '8', 'no')
/test put_2array('claim', 039, '9', 'ranges|north')
/test put_2array('claim', 039, '10', 'leave sled|ranges|north|enter vein')
/test put_2array('claim', 039, '11', 'leave vein|out|out|enter sled')
/test put_2array('claim', 039, '12', 'yes')


/test put_2array('claim', 040, '0', 'Flat Desert')
/test put_2array('claim', 040, '1', 'The vast desert below is broken by what appears to be a giant hole in the middle of some palm trees. There appears to be a good landing spot just east of the area.')
/test put_2array('claim', 040, '2', 'Dendrite')
/test put_2array('claim', 040, '3', 'Outcroppings Secure Line Lamp on! Climb down (injury?) Small Tunnel South --> VEIN!')
/test put_2array('claim', 040, '4', 'none')
/test put_2array('claim', 040, '5', 'none')
/test put_2array('claim', 040, '6', 'You may have to look fairly deep on this patch of land to find anything of value.')
/test put_2array('claim', 040, '7', 'yes')
/test put_2array('claim', 040, '8', 'no')


/test put_2array('claim', 041, '0', 'Flat Ledge')
/test put_2array('claim', 041, '1', 'A flash of green vegetation in the surrounding rugged bleakness catches your attention. As you take a closer look at the cliffs, you think there might be a ledge that\'s large enough for your sled.')
/test put_2array('claim', 041, '2', 'Hannah')
/test put_2array('claim', 041, '3', 'Path Down Water\'s Edge Push Vines Dim Cave Lamp on! Tunnel (injury?) --> VEIN!')
/test put_2array('claim', 041, '4', 'none')
/test put_2array('claim', 041, '5', 'none')
/test put_2array('claim', 041, '6', 'Relax, enjoy yourself, and take time to smell the flowers.')
/test put_2array('claim', 041, '7', 'yes')
/test put_2array('claim', 041, '8', 'no')


/test put_2array('claim', 042, '0', 'Flat Ledge')
/test put_2array('claim', 042, '1', 'Below, you spot a small flat ledge perched at the top of a narrow gully. There seems room enough to land.')
/test put_2array('claim', 042, '2', 'Deirdra')
/test put_2array('claim', 042, '3', 'Gully Hole --> VEIN!')
/test put_2array('claim', 042, '4', 'none')
/test put_2array('claim', 042, '5', 'none')
/test put_2array('claim', 042, '6', 'Things are not always obvious.')
/test put_2array('claim', 042, '7', 'none')
/test put_2array('claim', 042, '8', 'no')
/test put_2array('claim', 042, '9', 'gully|hole')
/test put_2array('claim', 042, '10', 'leave sled|gully|hole|enter vein')
/test put_2array('claim', 042, '11', 'leave vein|out|out|enter sled')
/test put_2array('claim', 042, '12', 'yes')


/test put_2array('claim', 043, '0', 'Flat Overgrown Meadow')
/test put_2array('claim', 043, '1', 'Below you notice rolling hills and high weeds, and what looks like a path that leads towards a thin ribbon of water.')
/test put_2array('claim', 043, '2', 'Estara')
/test put_2array('claim', 043, '3', 'Dirt Path West Ledge --> VEIN!')
/test put_2array('claim', 043, '4', 'none')
/test put_2array('claim', 043, '5', 'none')
/test put_2array('claim', 043, '6', 'none')
/test put_2array('claim', 043, '7', 'none')
/test put_2array('claim', 043, '8', 'no') 
/test put_2array('claim', 043, '9', 'dirt path|west|ledge')
/test put_2array('claim', 043, '10', 'leave sled|dirt path|west|ledge|enter vein')
/test put_2array('claim', 043, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 043, '12', 'yes')


/test put_2array('claim', 044, '0', 'Flat Rock')
/test put_2array('claim', 044, '1', 'Below, there appears to be a small box canyon near the edge of the ocean.')
/test put_2array('claim', 044, '2', 'Kilanjth')
/test put_2array('claim', 044, '3', 'Beach Down Cave --> VEIN!')
/test put_2array('claim', 044, '4', 'none')
/test put_2array('claim', 044, '5', 'TIDE-LOCK!! must be Low Out')
/test put_2array('claim', 044, '6', 'none')
/test put_2array('claim', 044, '7', 'none')
/test put_2array('claim', 044, '8', 'yes')
/test put_2array('claim', 044, '9', 'beach|down|cave')
/test put_2array('claim', 044, '10', 'leave sled|beach|down|cave|enter vein')
/test put_2array('claim', 044, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 044, '12', '')


/test put_2array('claim', 045, '0', 'Flood Gully')
/test put_2array('claim', 045, '1', 'Below you is a flood plain, cut with gullies and washes where mach storms have deposited their rain.')
/test put_2array('claim', 045, '2', 'Edwin')
/test put_2array('claim', 045, '3', 'Lamp on! Narrow Cave Large Cavern Southwest --> VEIN!')
/test put_2array('claim', 045, '4', 'none')
/test put_2array('claim', 045, '5', 'injury if you don\'t immediately turn your lamp on before moving.')
/test put_2array('claim', 045, '6', 'none')
/test put_2array('claim', 045, '7', 'yes')
/test put_2array('claim', 045, '8', 'no')
/test put_2array('claim', 045, '9', 'lamp on|nc|lc|sw')
/test put_2array('claim', 045, '10', 'leave sled|lamp on|nc|lc|sw|enter vein|lamp off')
/test put_2array('claim', 045, '11', 'lamp on|leave vein|out|out|out|enter sled|lamp off')
/test put_2array('claim', 045, '12', 'yes')


/test put_2array('claim', 046, '0', 'Floor of the Hidden Valley')
/test put_2array('claim', 046, '1', 'A hidden valley is spied below, potentially holding an accessible crystal vein.')
/test put_2array('claim', 046, '2', 'Samira')
/test put_2array('claim', 046, '3', 'Eroded Area --> VEIN!')
/test put_2array('claim', 046, '4', 'none')
/test put_2array('claim', 046, '5', 'There are boulders on the upslope rooms, but I don\'t know if they will have anything to do with possible alternate vein locations. ')
/test put_2array('claim', 046, '6', 'Boulders can hide so many treasures within them. Careful does it.')
/test put_2array('claim', 046, '7', 'none')
/test put_2array('claim', 046, '8', 'no')
/test put_2array('claim', 046, '9', 'eroded area')
/test put_2array('claim', 046, '10', 'leave sled|ea|enter vein')
/test put_2array('claim', 046, '11', 'leave vein|out|enter sled')
/test put_2array('claim', 046, '12', 'yes')


/test put_2array('claim', 047, '0', 'Forest Clearing')
/test put_2array('claim', 047, '1', 'As you hover over the vast greenness of the forest, you notice a little stream, which terminates where several large rock formations are. There is a clearing large enough to land in not far away from there.')
/test put_2array('claim', 047, '2', 'Callista')
/test put_2array('claim', 047, '3', 'East East Rocks --> VEIN!')
/test put_2array('claim', 047, '4', 'none')
/test put_2array('claim', 047, '5', 'none')
/test put_2array('claim', 047, '6', 'none')
/test put_2array('claim', 047, '7', 'none')
/test put_2array('claim', 047, '8', 'no')


/test put_2array('claim', 048, '0', 'Forked Canyon')
/test put_2array('claim', 048, '1', 'Peering down at a vast expanse of blood red and black sandstone you spot a forked canyon that looks very promising.')
/test put_2array('claim', 048, '2', 'Daron')
/test put_2array('claim', 048, '3', 'Right Fork --> VEIN!')
/test put_2array('claim', 048, '4', 'none')
/test put_2array('claim', 048, '5', 'none')
/test put_2array('claim', 048, '6', 'none')
/test put_2array('claim', 048, '7', 'none')
/test put_2array('claim', 048, '8', 'no')
/test put_2array('claim', 048, '9', 'right fork')
/test put_2array('claim', 048, '10', 'leave sled|right fork|enter vein')
/test put_2array('claim', 048, '11', 'leave vein|out|enter sled')
/test put_2array('claim', 048, '12', 'yes')


/test put_2array('claim', 049, '0', 'Frozen Plain')
/test put_2array('claim', 049, '1', 'A great glacier stretches across the landscape here, a mass of silver and white. Gullies and crevasses section its imposing mass.')
/test put_2array('claim', 049, '2', 'Paia')
/test put_2array('claim', 049, '3', 'Glacier Base Dark Fissure Lamp on! Down (injury?) Shift Boulder Down --> VEIN!')
/test put_2array('claim', 049, '4', 'none')
/test put_2array('claim', 049, '5', 'Sled gets stuck!! Out from \'Fissure\' is injury')
/test put_2array('claim', 049, '6', 'none')
/test put_2array('claim', 049, '7', 'yes')
/test put_2array('claim', 049, '8', 'no')
/test put_2array('claim', 049, '9', 'glacier base|dark fissure|lamp oon|down|shift boulder|down')
/test put_2array('claim', 049, '10', 'leave sled|glacier base|dark fissure|lamp on|down|shift boulder|down|enter vein|lamp off')
/test put_2array('claim', 049, '11', 'lamp on|leave vein|out|out|out|out|lamp off|enter sled')
/test put_2array('claim', 049, '12', 'yes')


/test put_2array('claim', 050, '0', 'Grassy Hillside')
/test put_2array('claim', 050, '1', 'A wide stretch of green rolling hills lies below, not very promising, but certainly worth a closer look.')
/test put_2array('claim', 050, '2', 'Elisarra')
/test put_2array('claim', 050, '3', 'North East Crevice --> VEIN!')
/test put_2array('claim', 050, '4', 'none')
/test put_2array('claim', 050, '5', 'none')
/test put_2array('claim', 050, '6', 'Nothing tricky about this claim.')
/test put_2array('claim', 050, '7', 'none')
/test put_2array('claim', 050, '8', 'no')
/test put_2array('claim', 050, '9', 'north|east|crevice')
/test put_2array('claim', 050, '10', 'leave|north|east|crevice|enter vein')
/test put_2array('claim', 050, '11', 'leave|out|out|out|enter sled')
/test put_2array('claim', 050, '12', 'yes')


;; Still need to test sled path
/test put_2array('claim', 051, '0', 'Grassy Hillside')
/test put_2array('claim', 051, '1', 'Your sled passes over a region of gently rolling hills, green with grass and the occasional tree.')
/test put_2array('claim', 051, '2', 'Alex')
/test put_2array('claim', 051, '3', 'North North (injury?) Cave Lamp on! Deep Cave --> VEIN!')
/test put_2array('claim', 051, '4', 'none')
/test put_2array('claim', 051, '5', 'none')
/test put_2array('claim', 051, '6', 'none')
/test put_2array('claim', 051, '7', 'yes')
/test put_2array('claim', 051, '8', 'no')
/test put_2array('claim', 051, '9', 'north|north|cave|lamp on|deep cave')
/test put_2array('claim', 051, '10', 'leave sled|north|north|cave|lamp on|deep cave|enter vein|lamp off')
/test put_2array('claim', 051, '11', 'lamp on|leave vein|out|out|out|lamp off|enter sled')
/test put_2array('claim', 051, '12', '')


/test put_2array('claim', 052, '0', 'Grassy Swath')
/test put_2array('claim', 052, '1', 'Amidst the typical jumble of rocky outcroppings and nearly impassable canyons, you suddenly spot a splash of green beside a rather boxy freestanding block of stone.')
/test put_2array('claim', 052, '2', 'Denassa')
/test put_2array('claim', 052, '3', 'Stream Small Opening --> VEIN!')
/test put_2array('claim', 052, '4', 'none')
/test put_2array('claim', 052, '5', 'If you can\'t bring cartons you have to find the rope (use +views in the vein room) to find the rope, then go out all the way to sled, up, and east, use view\'s to find the ring to tie the rope to. then hook carton, and lower rope. then go to the vein room, \'unhook carton\' and now you can use your carton... you\'ll have to send it back out the way it came in though.')
/test put_2array('claim', 052, '6', 'none')
/test put_2array('claim', 052, '7', 'none')
/test put_2array('claim', 052, '8', 'yes')

/test put_2array('claim', 052, '9', 'stream|small opening|+view depression')
/test put_2array('claim', 052, '10', 'leave sled||enter vein')
/test put_2array('claim', 052, '11', 'leave vein||enter sled')
/test put_2array('claim', 052, '12', '')


/test put_2array('claim', 053, '0', 'Gravel Field')
/test put_2array('claim', 053, '1', 'As you travel along the southernmost area of this range, you see a bluff that towers over the landscape. This rampart looks like some giant ruddy block dropped from the sky. Part of the eastern wall has eroded more than the rest and mars the symmetry of the rock. To the south of the rampart is a wide field of gravel that has fallen from the craggy rock face over the centuries. Close to the rampart seems to be a slightly flatter area than the rest, and looks like a good place to land.')
/test put_2array('claim', 053, '2', 'Rhianna')
/test put_2array('claim', 053, '3', 'Cave Entrance Lamp on! Inner Cave (injury?) Up Up --> VEIN!')
/test put_2array('claim', 053, '4', 'none')
/test put_2array('claim', 053, '5', 'none')
/test put_2array('claim', 053, '6', 'none')
/test put_2array('claim', 053, '7', 'yes')
/test put_2array('claim', 053, '8', 'no')


/test put_2array('claim', 054, '0', 'Hanging Rock')
/test put_2array('claim', 054, '1', 'This is a wide valley in the mountains. Many volcanic rocks are jumbled together, leaning on each other, forming a maze of cavelets.')
/test put_2array('claim', 054, '2', 'Linanna')
/test put_2array('claim', 054, '3', 'Nook High Window --> VEIN!')
/test put_2array('claim', 054, '4', 'none')
/test put_2array('claim', 054, '5', 'It\'s very dark, and your lights striking the rocks just casts further shadows. Landing here in the dark would be insane. - Message at night')
/test put_2array('claim', 054, '6', 'none')
/test put_2array('claim', 054, '7', 'none')
/test put_2array('claim', 054, '8', 'no')
/test put_2array('claim', 054, '9', 'nook|high window')
/test put_2array('claim', 054, '10', 'leave sled|nook|high window|enter vein')
/test put_2array('claim', 054, '11', 'leave vein|out|out|enter sled')
/test put_2array('claim', 054, '12', 'yes')


/test put_2array('claim', 055, '0', 'Haunted Cliffs')
/test put_2array('claim', 055, '1', 'You can see a tall cliff. It has a look about it that shouts stay away. The surrounding area looks dead.')
/test put_2array('claim', 055, '2', 'Issa and Psiosis')
/test put_2array('claim', 055, '3', 'Cliff Path Northeast Secret Cave --> VEIN!')
/test put_2array('claim', 055, '4', 'none')
/test put_2array('claim', 055, '5', 'Sled gets stuck!!')
/test put_2array('claim', 055, '6', 'none')
/test put_2array('claim', 055, '7', 'none')
/test put_2array('claim', 055, '8', 'yes')
/test put_2array('claim', 055, '9', 'cliff path|ne|secret cave')
/test put_2array('claim', 055, '10', 'leave sled|cliff path|ne|secret cave|enter vein')
/test put_2array('claim', 055, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 055, '12', 'yes')


/test put_2array('claim', 056, '0', 'Heaven\'s Gate')
/test put_2array('claim', 056, '1', 'Below the sled is a valley that is surrounded by high jutting mountains. It is definiately worth taking a closer look as the draw of crystal tugs at the mind.')
/test put_2array('claim', 056, '2', 'Malorie')
/test put_2array('claim', 056, '3', 'Base Clear bushes (slight inj?) (pause) Up +view dark spot crevice --> VEIN!')
/test put_2array('claim', 056, '4', 'Perhaps vein in east;cave?')
/test put_2array('claim', 056, '5', 'none')
/test put_2array('claim', 056, '6', 'none')
/test put_2array('claim', 056, '7', 'none')
/test put_2array('claim', 056, '8', 'no')
/test put_2array('claim', 056, '12', 'no')


/test put_2array('claim', 057, '0', 'Hemlock Ravine - Ledge')
/test put_2array('claim', 057, '1', 'Far below, you see a deep ravine with cliffs to either side. A river flows through at the bottom until the land drops away, and the river becomes a magnificent waterfall.')
/test put_2array('claim', 057, '2', 'Coralia')
/test put_2array('claim', 057, '3', 'Down (injury?) Southern Slope Up (equip) --> VEIN!')
/test put_2array('claim', 057, '4', 'none')
/test put_2array('claim', 057, '5', 'none')
/test put_2array('claim', 057, '6', 'Pay attention to what\'s said in the desc, and look for hidden exits. You will need equipment to find what you seek.')
/test put_2array('claim', 057, '7', 'yes')
/test put_2array('claim', 057, '8', 'no')
/test put_2array('claim', 057, '9', 'down|southern slope|secure line|up')
/test put_2array('claim', 057, '10', 'leave sled|down|southern slope|secure line|up|enter vein')
/test put_2array('claim', 057, '11', 'leave vein|down|out|retrieve line|out|enter sled')
/test put_2array('claim', 057, '12', 'yes')


;;; Doesn't match view, no idea why
;;; A high sierra stretches below you, with sawtooth peaks both beautiful and treacherous. Some of the pikes have flat areas that might be large enough to land on.
/test put_2array('claim', 058, '0', 'High Plateau')
/test put_2array('claim', 058, '1', 'A high sierra stretches below you, with sawtooth peaks both beautiful and treacherous. Some of the pikes have flat areas that might be large enough to land on.')
/test put_2array('claim', 058, '2', 'Ariel')
/test put_2array('claim', 058, '3', 'Down Shift Boulder Narrow Crack --> VEIN!')
/test put_2array('claim', 058, '4', 'none')
/test put_2array('claim', 058, '5', 'none')
/test put_2array('claim', 058, '6', 'Sometimes you need a bit of muscle.')
/test put_2array('claim', 058, '7', 'none')
/test put_2array('claim', 058, '8', 'no')
/test put_2array('claim', 058, '9', 'down|shift boulder|narrow crack')
/test put_2array('claim', 058, '10', 'leave sled|down|shift boulder|crack|enter vein')
/test put_2array('claim', 058, '11', 'leave vein|out|out|enter sled')
/test put_2array('claim', 058, '12', 'yes')
/test put_2array('claim', 058, '13', '5')


/test put_2array('claim', 059, '0', 'High Valley')
/test put_2array('claim', 059, '1', 'You see a valley cut out of the high mountainside, above the glitter of a waterfall.')
/test put_2array('claim', 059, '2', 'Calantha')
/test put_2array('claim', 059, '3', 'West Down --> VEIN!')
/test put_2array('claim', 059, '4', 'none')
/test put_2array('claim', 059, '5', 'none')
/test put_2array('claim', 059, '6', 'none')
/test put_2array('claim', 059, '7', 'none')
/test put_2array('claim', 059, '8', 'no')
/test put_2array('claim', 059, '9', 'west|down')
/test put_2array('claim', 059, '10', 'leave sled|west|down|enter vein')
/test put_2array('claim', 059, '11', 'leave vein|out|out|enter sled')
/test put_2array('claim', 059, '12', 'yes')


/test put_2array('claim', 060, '0', 'Hills')
/test put_2array('claim', 060, '1', 'A large green expanse catches you attention, gently rolling hills turning into darker stands of trees, you wonder if it is worth investigating?')
/test put_2array('claim', 060, '2', 'Delvan')
/test put_2array('claim', 060, '3', 'South, Cave --> VEIN!')
/test put_2array('claim', 060, '4', 'none')
/test put_2array('claim', 060, '5', 'none')
/test put_2array('claim', 060, '6', 'none')
/test put_2array('claim', 060, '7', 'none')
/test put_2array('claim', 060, '8', 'no')
/test put_2array('claim', 060, '9', 'south|cave')
/test put_2array('claim', 060, '10', 'leave sled|south|cave|enter vein')
/test put_2array('claim', 060, '11', 'leave vein|out|out|enter sled')
/test put_2array('claim', 060, '12', 'yes')


/test put_2array('claim', 061, '0', 'Hot Springs')
/test put_2array('claim', 061, '1', 'Far below you there seems to be a very small trench of sorts. A sort of mist rises from the closest end.')
/test put_2array('claim', 061, '2', 'Talath')
/test put_2array('claim', 061, '3', 'River Bed Rocky Path (injury?) Hole Fissure --> VEIN!')
/test put_2array('claim', 061, '4', 'none')
/test put_2array('claim', 061, '5', 'none')
/test put_2array('claim', 061, '6', 'none')
/test put_2array('claim', 061, '7', 'yes')
/test put_2array('claim', 061, '8', 'no')
/test put_2array('claim', 061, '9', 'dried river bed|rocky path|hole|fissure')
/test put_2array('claim', 061, '10', 'leave sled|dried river bed|rocky path|hole|fissure|enter vein')
/test put_2array('claim', 061, '11', 'leave vein|out|out|out|out|enter sled')
/test put_2array('claim', 061, '12', 'yes')


/test put_2array('claim', 062, '0', 'In the Shadow of a Granite Shelf')
/test put_2array('claim', 062, '1', 'Below sprawls a lush carpet of vivid greenery, broken in places by slashes of rich earth brown. After another look, a large gash between two separated hillsides, belonging to the same hill at that, can be seen, its length forming a short valley which extends a little way beyond the two halves.')
/test put_2array('claim', 062, '2', 'Reena')
/test put_2array('claim', 062, '3', 'North North Western Face HillSide --> VEIN!')
/test put_2array('claim', 062, '4', 'none')
/test put_2array('claim', 062, '5', 'none')
/test put_2array('claim', 062, '6', 'none')
/test put_2array('claim', 062, '7', 'none')
/test put_2array('claim', 062, '8', 'no')
/test put_2array('claim', 062, '9', 'north|north|western face|hillside')
/test put_2array('claim', 062, '10', 'leave sled|north|north|western face|hillside|enter vein')
/test put_2array('claim', 062, '11', 'leave vein|out|out|out|out|enter sled')
/test put_2array('claim', 062, '12', 'yes')


/test put_2array('claim', 063, '0', 'Island Cliff')
/test put_2array('claim', 063, '1', 'Rising tall from the surrounding forests this expense of rock is gently sloped on all but one side. On the last side the cliff falls away sharply but there appears to be a small shadow of an opening in it, and light reflects from what may well be water.')
/test put_2array('claim', 063, '2', 'Kaine')
/test put_2array('claim', 063, '3', 'Cliff Edge Narrow Path Descend Ledge --> VEIN!')
/test put_2array('claim', 063, '4', 'none')
/test put_2array('claim', 063, '5', 'Sled gets stuck by \'Loose piles of rocks and shale\' at Landing site. \'shift rocks\' will clear them.')
/test put_2array('claim', 063, '6', 'none')
/test put_2array('claim', 063, '7', 'none')
/test put_2array('claim', 063, '8', 'no')
/test put_2array('claim', 063, '9', 'cliff edge|narrow path|descend ledge')
/test put_2array('claim', 063, '10', 'leave sled|cliff edge|narrow path|descend ledge|enter vein')
/test put_2array('claim', 063, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 063, '12', 'yes')


/test put_2array('claim', 064, '0', 'Island Mesa')
/test put_2array('claim', 064, '1', 'Two small islands -- little more than rocks -- break the foaming sea\'s surface far below you. They might be worth a closer look.')
/test put_2array('claim', 064, '2', 'Nathan')
/test put_2array('claim', 064, '3', 'Down Jump (injury?) Narrow Path Crevasse Forward --> VEIN!')
/test put_2array('claim', 064, '4', 'none')
/test put_2array('claim', 064, '5', 'none')
/test put_2array('claim', 064, '6', 'none')
/test put_2array('claim', 064, '7', 'yes')
/test put_2array('claim', 064, '8', 'no')
/test put_2array('claim', 064, '9', 'down|jump|narrow path|crevasse|forward')
/test put_2array('claim', 064, '10', 'leave sled|down|jump|narrow path|crevasse|forward|enter vein')
/test put_2array('claim', 064, '11', 'leave vein|out|out|out|out|out|enter sled')
/test put_2array('claim', 064, '12', 'yes')


/test put_2array('claim', 065, '0', 'Island Top')
/test put_2array('claim', 065, '1', 'Jumbled surf bounces around you, a small atoll rises from it.')
/test put_2array('claim', 065, '2', 'Telandra')
/test put_2array('claim', 065, '3', 'Secure Line! Slimy Hole Fault Crack Cleft Crack --> VEIN!')
/test put_2array('claim', 065, '4', 'none')
/test put_2array('claim', 065, '5', 'TIDE-LOCK??')
/test put_2array('claim', 065, '6', 'none')
/test put_2array('claim', 065, '7', 'none')
/test put_2array('claim', 065, '8', 'yes')
/test put_2array('claim', 065, '9', 'secure line|slimy hole|lamp on|fault crack|cleft|crack')
/test put_2array('claim', 065, '10', 'leave sled|secure line|slimy hole|lamp on|fault crack|cleft|crack|enter vein|lamp off|retrieve line')
/test put_2array('claim', 065, '11', 'lamp on|secure line|leave vein|out|out|out|out|retrieve line|lamp off|enter sled')
/test put_2array('claim', 065, '12', 'yes')


/test put_2array('claim', 066, '0', 'Jagged Fissure')
/test put_2array('claim', 066, '1', 'Below you, the surface of Ballybran is crazed and completely inhospitable. The fissures vary in size, but a closer search might reveal one large enough to be interesting.')
/test put_2array('claim', 066, '2', 'Ehlla, finished by Kumiko')
/test put_2array('claim', 066, '3', 'Lamp on! Narrow Crack South East (injury?) --> VEIN!')
/test put_2array('claim', 066, '4', 'Lamp on! Narrow Crack West ---> VEIN!')
/test put_2array('claim', 066, '5', 'none')
/test put_2array('claim', 066, '6', 'none')
/test put_2array('claim', 066, '7', 'yes')
/test put_2array('claim', 066, '8', 'no')
/test put_2array('claim', 066, '12', 'now')


/test put_2array('claim', 067, '0', 'Lake of Stars')
/test put_2array('claim', 067, '1', 'Flashes of light catch your eye. A small lake glistens from between a sheer rock wall and a gently sloping meadow.')
/test put_2array('claim', 067, '2', 'Astaris')
/test put_2array('claim', 067, '3', 'Lake Dive Shadow forward --> VEIN!')
/test put_2array('claim', 067, '4', 'none')
/test put_2array('claim', 067, '5', 'none')
/test put_2array('claim', 067, '6', 'How about a swim?')
/test put_2array('claim', 067, '7', 'none')
/test put_2array('claim', 067, '8', 'no')

/test put_2array('claim', 067, '9', 'lake|dive|shadow|forward')
/test put_2array('claim', 067, '10', 'leave sled|lake|dive|shadow|forward|enter vein')
/test put_2array('claim', 067, '11', 'leave vein|out|out|out|out|enter sled')
/test put_2array('claim', 067, '12', 'yes')


/test put_2array('claim', 068, '0', 'Landing Pad')
/test put_2array('claim', 068, '1', 'You see what looks like an old shell of a Meterological station below, but for some reason it\'s not on your map. What would cause the Guild to forget this station?')
/test put_2array('claim', 068, '2', '... well, started by Telandra, who had the wonderful met station idea, and was passed off to Kesya, (muahaha) who added lots of puzzles and desced some stuff. :)')
/test put_2array('claim', 068, '3', 'Met Station Secure Line! Clean Rubble Crack Down --> VEIN!')
/test put_2array('claim', 068, '4', 'none')
/test put_2array('claim', 068, '5', 'none')
/test put_2array('claim', 068, '6', '+views will tell you all you need to know, if you fiddle with likely commands and poke around a bit.')
/test put_2array('claim', 068, '7', 'none')
/test put_2array('claim', 068, '8', 'no')


/test put_2array('claim', 069, '0', 'Landing Site')
/test put_2array('claim', 069, '1', 'There is a glint of light reflected from down below, and your eye is drawn to a small waterway that winds around the base of a large, jagged hill.')
/test put_2array('claim', 069, '2', 'Ceara')
/test put_2array('claim', 069, '3', 'Bushy Path Bush --> VEIN!')
/test put_2array('claim', 069, '4', 'none')
/test put_2array('claim', 069, '5', 'none')
/test put_2array('claim', 069, '6', 'If you just can\'t find your way, try again at a different time of day.')
/test put_2array('claim', 069, '7', 'none')
/test put_2array('claim', 069, '8', 'no')
/test put_2array('claim', 069, '9', 'bushy path|bush')
/test put_2array('claim', 069, '10', 'leave sled|bushy path|bush|enter vein')
/test put_2array('claim', 069, '11', 'leave vein|out|out|enter sled')
/test put_2array('claim', 069, '12', 'yes')


/test put_2array('claim', 070, '0', 'Large Clearing')
/test put_2array('claim', 070, '1', 'Looking below, you see a small crater, a small creek trickles down into it. Nearby is a small forest. Perhaps it is worth a closer look.')
/test put_2array('claim', 070, '2', 'Kyrae Syree')
/test put_2array('claim', 070, '3', 'Southeast South (injury?) --> VEIN!')
/test put_2array('claim', 070, '4', 'none')
/test put_2array('claim', 070, '5', 'none')
/test put_2array('claim', 070, '6', 'none')
/test put_2array('claim', 070, '7', 'yes')
/test put_2array('claim', 070, '8', 'no')
/test put_2array('claim', 070, '9', 'southeast|south')
/test put_2array('claim', 070, '10', 'leave sled|southeast|south|enter vein')
/test put_2array('claim', 070, '11', 'leave vein|out|out|enter sled')
/test put_2array('claim', 070, '12', 'yes')


/test put_2array('claim', 071, '0', 'Large Natural Well')
/test put_2array('claim', 071, '1', 'Far below lies an enormous rock formation. It appears to be a large slab of stone that fell down the side of the ridge to the floor, covering over a natural well at the valley floor. Certainly worth a closer look.')
/test put_2array('claim', 071, '2', 'Kilanjth')
/test put_2array('claim', 071, '3', 'Lamp on! Dark Hole (injury?) Alcove Passage --> VEIN!')
/test put_2array('claim', 071, '4', 'none')
/test put_2array('claim', 071, '5', 'none')
/test put_2array('claim', 071, '6', 'none')
/test put_2array('claim', 071, '7', 'yes')
/test put_2array('claim', 071, '8', 'no')


/test put_2array('claim', 072, '0', 'Ledge')
/test put_2array('claim', 072, '1', 'You fly along what appears to be a mountainous region. Perhaps if you fly lower you\'ll find a place to land your sled.')
/test put_2array('claim', 072, '2', 'Miriann')
/test put_2array('claim', 072, '3', 'Push Boulder Sparkling Cave Clear Rubble Down --> VEIN!')
/test put_2array('claim', 072, '4', 'none')
/test put_2array('claim', 072, '5', 'none')
/test put_2array('claim', 072, '6', 'none')
/test put_2array('claim', 072, '7', 'none')
/test put_2array('claim', 072, '8', 'no')
/test put_2array('claim', 072, '9', 'push boulder|sparkling cave|clear rubble|down')
/test put_2array('claim', 072, '10', 'leave sled|sparkling cave|down|enter vein')
/test put_2array('claim', 072, '11', 'leave vein|out|out|enter sled')
/test put_2array('claim', 072, '12', 'yes')


/test put_2array('claim', 073, '0', 'Ledge')
/test put_2array('claim', 073, '1', 'You see a dark stripe on the surface of the ranges. It is a deep gorge. This should provide a good chance of finding crystal, if only you can find something large enough to land on.')
/test put_2array('claim', 073, '2', 'Started by Sasryn, finished by Bayr.')
/test put_2array('claim', 073, '3', 'Secure Line! Over the Edge Lamp on! Tunnel (injury?) North --> VEIN!')
/test put_2array('claim', 073, '4', 'none')
/test put_2array('claim', 073, '5', 'none')
/test put_2array('claim', 073, '6', 'Lots of fairly minor injury potential, need shovel, somewhat convoluted cave area.')
/test put_2array('claim', 073, '7', 'yes')
/test put_2array('claim', 073, '8', 'no')
/test put_2array('claim', 073, '9', 'take shovel|secure line|over the edge|lamp on|tunnel|north')
/test put_2array('claim', 073, '10', 'leave sled|secure line|over the edge|lamp on|tunnel|north|retrieve line|lamp off|enter vein')
/test put_2array('claim', 073, '11', 'leave vein|secure line|lamp on|south|out|out|retrieve line|lamp off|drop shovel|enter sled')
/test put_2array('claim', 073, '12', 'yes')


/test put_2array('claim', 074, '0', 'Ledge')
/test put_2array('claim', 074, '1', 'Down below you is a narrow canyon that runs north-south. Glints from the floor look promising. ')
/test put_2array('claim', 074, '2', 'Alasha, finished by Kieren.')
/test put_2array('claim', 074, '3', 'Path Canyon floor (injury?) Alcove (lamp on) --> VEIN!')
/test put_2array('claim', 074, '4', 'none')
/test put_2array('claim', 074, '5', 'none')
/test put_2array('claim', 074, '6', 'Watch your step')
/test put_2array('claim', 074, '7', 'yes')
/test put_2array('claim', 074, '8', 'no')
/test put_2array('claim', 074, '9', 'path|canyon floor|lamp on|alcove')
/test put_2array('claim', 074, '10', 'leave sled|path|canyon floor|lamp on|alcove|enter vein|lamp off')
/test put_2array('claim', 074, '11', 'lamp on|leave vein|out|out|out|lamp off|enter sled')
/test put_2array('claim', 074, '12', 'yes')


/test put_2array('claim', 075, '0', 'Ledge - Lonely Peak')
/test put_2array('claim', 075, '1', 'A sharp, imposing peak seemingly framed in shadow lies beneath you, laid out as if with a painters\' brush and canvas. Reds, yellows and brown swirls color the otherwise dull grey, storm-roughened stone, in patterns too complex to see from this altitude.')
/test put_2array('claim', 075, '2', 'Cherin')
/test put_2array('claim', 075, '3', 'Narrow Path Secure Line! Crack (injury?) --> VEIN!')
/test put_2array('claim', 075, '4', 'none')
/test put_2array('claim', 075, '5', 'none')
/test put_2array('claim', 075, '6', 'none')
/test put_2array('claim', 075, '7', 'yes')
/test put_2array('claim', 075, '8', 'no')
/test put_2array('claim', 075, '9', 'np|secure line|crack')
/test put_2array('claim', 075, '10', 'leave sled|np|secure line|crack|enter vein|retrieve line')
/test put_2array('claim', 075, '11', 'leave vein|secure line|out|out|retrieve line|enter sled')
/test put_2array('claim', 075, '12', 'yes')


/test put_2array('claim', 076, '0', 'Long Crevice')
/test put_2array('claim', 076, '1', 'Far below you seems to be a long crevice, which extends for several hundred yards. It almost looks like a fissure in the ground.')
/test put_2array('claim', 076, '2', 'Talath')
/test put_2array('claim', 076, '3', 'w (injury?) w (injury?) d (injury?) --> VEIN!')
/test put_2array('claim', 076, '4', 'none')
/test put_2array('claim', 076, '5', 'none')
/test put_2array('claim', 076, '6', 'none')
/test put_2array('claim', 076, '7', 'yes')
/test put_2array('claim', 076, '8', 'no')
/test put_2array('claim', 076, '9', 'w|w|d')
/test put_2array('claim', 076, '10', 'leave sled|w|w|d|enter vein')
/test put_2array('claim', 076, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 076, '12', 'yes')


/test put_2array('claim', 077, '0', 'Marshy Ground')
/test put_2array('claim', 077, '1', 'Purplish-green hills undulate below. The color is nauseating, but you are tempted to fly lower to investigate anyway.')
/test put_2array('claim', 077, '2', 'Shiora')
/test put_2array('claim', 077, '3', 'stream Outcropping --> VEIN')
/test put_2array('claim', 077, '4', 'none')
/test put_2array('claim', 077, '5', 'none')
/test put_2array('claim', 077, '6', 'none')
/test put_2array('claim', 077, '7', 'none')
/test put_2array('claim', 077, '8', 'no')
/test put_2array('claim', 077, '9', 'stream|outcropping')
/test put_2array('claim', 077, '10', 'leave sled|stream|outcropping|enter vein')
/test put_2array('claim', 077, '11', 'leave vein|marshes|out|enter sled')
/test put_2array('claim', 077, '12', 'yes')


/test put_2array('claim', 078, '0', 'Middle of the Desert')
/test put_2array('claim', 078, '1', 'Pale tan, almost white, sand below reflects light back up to you.')
/test put_2array('claim', 078, '2', 'Cybil Raleigh')
/test put_2array('claim', 078, '3', 'Search Pick Up Shovel Dig Down Down East Up --> VEIN!')
/test put_2array('claim', 078, '4', 'none')
/test put_2array('claim', 078, '5', 'none')
/test put_2array('claim', 078, '6', 'none')
/test put_2array('claim', 078, '7', 'none')
/test put_2array('claim', 078, '8', 'no')


/test put_2array('claim', 079, '0', 'Misty Valley')
/test put_2array('claim', 079, '1', 'From the air, you can see a cleared valley. The valley is wide, and a sled can land comfortably. The area is covered in mist.')
/test put_2array('claim', 079, '2', 'Katlyn')
/test put_2array('claim', 079, '3', 'North East Rocks South --> VEIN!')
/test put_2array('claim', 079, '4', 'none')
/test put_2array('claim', 079, '5', 'Sled gets stuck!! Morning Lock - can\'t take off in morning.')
/test put_2array('claim', 079, '6', 'none')
/test put_2array('claim', 079, '7', 'none')
/test put_2array('claim', 079, '8', 'no')
/test put_2array('claim', 079, '9', 'north|east|rocks|south')
/test put_2array('claim', 079, '10', 'leave sled|north|east|rocks|south|enter vein')
/test put_2array('claim', 079, '11', 'leave vein|out|out|out|out|enter sled')
/test put_2array('claim', 079, '12', 'yes')


/test put_2array('claim', 080, '0', 'Mountain Ledge')
/test put_2array('claim', 080, '1', 'Below, you spot a mountain ledge that is just wide and flat enough for you to land your sled.')
/test put_2array('claim', 080, '2', 'Summer')
/test put_2array('claim', 080, '3', 'Lamp on, Narrow Cave Waterfall Secure Line! Up (injury?) --> VEIN!')
/test put_2array('claim', 080, '4', 'none')
/test put_2array('claim', 080, '5', 'Morning lock!')
/test put_2array('claim', 080, '6', 'Things always look better in the morning light.')
/test put_2array('claim', 080, '7', 'yes')
/test put_2array('claim', 080, '8', 'no')
/test put_2array('claim', 080, '9', 'lamp on|narrow cave|waterfall|secure line|up')
/test put_2array('claim', 080, '10', 'leave sled|lamp on|narrow cave|waterfall|secure line|up|enter vein')
/test put_2array('claim', 080, '11', 'lamp on|leave vein|out|out|out|lamp off|enter sled')
/test put_2array('claim', 080, '12', 'yes')


/test put_2array('claim', 081, '0', 'Mountain Valley')
/test put_2array('claim', 081, '1', 'Flying near the mountain ranges, you see nothing more than the expanse of deep green of the trees, and the rocks below, when a small open patch catches your eye.')
/test put_2array('claim', 081, '2', 'Rhys')
/test put_2array('claim', 081, '3', 'Path Up Secure Line! Descend (injury?) Cave Lamp on! Up (injury?) Overhang --> VEIN!')
/test put_2array('claim', 081, '4', 'Path Up Lamp on! In (injury?) Hole Overhang --> VEIN!')
/test put_2array('claim', 081, '5', 'none')
/test put_2array('claim', 081, '6', 'none')
/test put_2array('claim', 081, '7', 'yes')
/test put_2array('claim', 081, '8', 'no')

/test put_2array('claim', 081, '9', 'path|up|lamp on|in|hole|overhang')
/test put_2array('claim', 081, '10', 'leave sled|path|up|lamp on|in|hole|overhang|enter vein|lamp off')
/test put_2array('claim', 081, '11', 'lamp on|out|out|out|enter sled')
/test put_2array('claim', 081, '12', 'no')


/test put_2array('claim', 082, '0', 'Mythrane Meadows')
/test put_2array('claim', 082, '1', 'You see a startling burst of color beneath you, greens and wild reds and pinks. You could land there, perhaps, and check this hollow out.')
/test put_2array('claim', 082, '2', 'Started by Kit, finished by Bayr.')
/test put_2array('claim', 082, '3', 'Lamp on! Secure Line! South (injury?) Down --> VEIN!')
/test put_2array('claim', 082, '4', 'none')
/test put_2array('claim', 082, '5', 'none')
/test put_2array('claim', 082, '6', 'Chance of injury, dark exits, and a lamp may prove useful.')
/test put_2array('claim', 082, '7', 'yes')
/test put_2array('claim', 082, '8', 'no')
/test put_2array('claim', 082, '9', 'lamp on|secure line|south|down')
/test put_2array('claim', 082, '10', 'leave sled|lamp on|secure line|south|down|enter vein|lamp off')
/test put_2array('claim', 082, '11', 'lamp on|leave|out|west|retrieve line|lamp off|enter sled')
/test put_2array('claim', 082, '12', 'yes')


/test put_2array('claim', 083, '0', 'Narrow Beach')
/test put_2array('claim', 083, '1', 'Craggy cliffs stand as lonely sentinels along the barren coast. The tops of the cliffs are too broken to make a decent landing site, but a subtle curve in one area has created a narrow beach between cliff and surging ocean.')
/test put_2array('claim', 083, '2', 'Kumiko')
/test put_2array('claim', 083, '3', 'Secure Line! Rocky Slope (injury?) Up --> VEIN!')
/test put_2array('claim', 083, '4', 'none')
/test put_2array('claim', 083, '5', 'none')
/test put_2array('claim', 083, '6', 'none')
/test put_2array('claim', 083, '7', 'yes')
/test put_2array('claim', 083, '8', 'no')


/test put_2array('claim', 084, '0', 'Narrow Ledge')
/test put_2array('claim', 084, '1', 'A deep cut slashes across the land below, the jagged edges of the cut look like a fang filled mouth.')
/test put_2array('claim', 084, '2', 'Aderyn and finished by Taisan')
/test put_2array('claim', 084, '3', 'Western Ledge Upper Ledge +view Stream +view Large Rock Remove Rock Down Down (lamp on) Crevice --> VEIN!')
/test put_2array('claim', 084, '4', 'none')
/test put_2array('claim', 084, '5', '\'Out\' from second \'Down\' is an injury exit.')
/test put_2array('claim', 084, '6', 'none')
/test put_2array('claim', 084, '7', 'none')
/test put_2array('claim', 084, '8', 'no')
/test put_2array('claim', 084, '9', 'western ledge|upper ledge|+view stream|stream|+view rock|rock|remove rock|down|down|lamp on|crevice')
/test put_2array('claim', 084, '10', 'leave sled|western ledge|upper ledge|+view stream|stream|down|down|lamp on|crevice|enter vein|lamp off')
/test put_2array('claim', 084, '11', 'lamp on|leave vein|out|out|lamp off|nl|enter sled')
/test put_2array('claim', 084, '12', 'yes')


/test put_2array('claim', 085, '0', 'Narrow Valley')
/test put_2array('claim', 085, '1', 'You spot a series of twisting canyons and valleys winding through the landscape below. One valley in particular looks promising.')
/test put_2array('claim', 085, '2', 'Colwin')
/test put_2array('claim', 085, '3', 'Small Cave Lamp on! Down (injury?) Cavern Small Alcove --> VEIN!')
/test put_2array('claim', 085, '4', 'none')
/test put_2array('claim', 085, '5', 'this claim will smash your cutter and require a full repair if you go the wrong way. Stow cutter in sled.')
/test put_2array('claim', 085, '6', 'It\'s safer to get a good night\'s sleep, and hunt with a clear head in the morning.')
/test put_2array('claim', 085, '7', 'yes')
/test put_2array('claim', 085, '8', 'no')
/test put_2array('claim', 085, '9', 'small cave|lamp on|down|cavern|small alcove')
/test put_2array('claim', 085, '10', 'leave sled|small cave|lamp on|down|cavern|small alcove|lamp off|enter vein')
/test put_2array('claim', 085, '11', 'leave vein|lamp on|cavern|small cave|out|lamp off|enter sled')
/test put_2array('claim', 085, '12', 'yes')


/test put_2array('claim', 086, '0', 'North End of Cliff Base')
/test put_2array('claim', 086, '1', 'The land below is ragged, rocky and harsh looking. Perfect for concealing crystal.')
/test put_2array('claim', 086, '2', 'Laicyn')
/test put_2array('claim', 086, '3', 'Stream --> VEIN!')
/test put_2array('claim', 086, '4', 'none')
/test put_2array('claim', 086, '5', 'none')
/test put_2array('claim', 086, '6', 'Sing a happy tune and smell the roses...Life isn\'t so bad.')
/test put_2array('claim', 086, '7', 'none')
/test put_2array('claim', 086, '8', 'no')


/test put_2array('claim', 087, '0', 'Northeast Cliff')
/test put_2array('claim', 087, '1', 'You see the a deep ravine below you, with a river bubbling through it.')
/test put_2array('claim', 087, '2', 'Zyander')
/test put_2array('claim', 087, '3', 'South Fix Bridge South Bushes --> VEIN!')
/test put_2array('claim', 087, '4', 'none')
/test put_2array('claim', 087, '5', 'none')
/test put_2array('claim', 087, '6', 'none')
/test put_2array('claim', 087, '7', 'none')
/test put_2array('claim', 087, '8', 'no')
/test put_2array('claim', 087, '9', 'south|fix bridge|south|bushes')
/test put_2array('claim', 087, '10', 'leave sled|south|south|bushes|enter vein')
/test put_2array('claim', 087, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 087, '12', 'yes')


/test put_2array('claim', 088, '0', 'Northeast End')
/test put_2array('claim', 088, '1', 'The monotony of the boring landscape below suddenly captures your interest. A niggling sensation in your gut beckons you lower.')
/test put_2array('claim', 088, '2', 'Elissa')
/test put_2array('claim', 088, '3', 'Southwest Southwest South East --> VEIN!')
/test put_2array('claim', 088, '4', 'none')
/test put_2array('claim', 088, '5', 'none')
/test put_2array('claim', 088, '6', 'Nothing to stress you here.')
/test put_2array('claim', 088, '7', 'none')
/test put_2array('claim', 088, '8', 'no')
/test put_2array('claim', 088, '9', 'southwest|southwest|south|east')
/test put_2array('claim', 088, '10', 'leave sled|southwest|southwest|south|east|enter vein')
/test put_2array('claim', 088, '11', 'leave vein|out|out|out|out|enter sled')
/test put_2array('claim', 088, '12', 'yes')


/test put_2array('claim', 089, '0', 'Northern End')
/test put_2array('claim', 089, '1', 'From this height, the ragged crevice looks like a huge maw. It is worth a closer look.')
/test put_2array('claim', 089, '2', 'Rikart')
/test put_2array('claim', 089, '3', 's s se e')
/test put_2array('claim', 089, '4', 'none')
/test put_2array('claim', 089, '5', 'none')
/test put_2array('claim', 089, '6', 'none')
/test put_2array('claim', 089, '7', 'none')
/test put_2array('claim', 089, '8', 'no')
/test put_2array('claim', 089, '9', 'south|south|se|east')
/test put_2array('claim', 089, '10', 'leave sled|south|south|se|east|enter vein')
/test put_2array('claim', 089, '11', 'leave vein|out|out|out|out|enter sled')
/test put_2array('claim', 089, '12', 'yes')


/test put_2array('claim', 090, '0', 'Northern Ledge')
/test put_2array('claim', 090, '1', 'Below you lies a large impact crater, a deep scar left upon the surface by a meteor ages ago. Sheltered by the steep walls from the full force of Ballybran\'s furious winds, a forest has grown and filled the bowl. Perhaps a search will reveal a clear place to land.')
/test put_2array('claim', 090, '2', 'Jayce')
/test put_2array('claim', 090, '3', 'climbing equip and lamp! Down, south, west, west, cave, lamp on, west, west, +veiw jut, +view shadow, crevice, enter vein')
/test put_2array('claim', 090, '4', 'none')
/test put_2array('claim', 090, '5', 'none')
/test put_2array('claim', 090, '6', 'none')
/test put_2array('claim', 090, '7', 'yes')
/test put_2array('claim', 090, '8', 'yes')
/test put_2array('claim', 090, '9', 'secure line|down|south|south|west|west|cave|lamp on|west|west|+view jut|+view shadow|crevice')
/test put_2array('claim', 090, '10', 'leave sled|secure line|down|south|south|west|west|cave|lamp on|west|west|cave|lamp on|west|west|+view jut|+view shadow|crevice|lamp off|retrieve line|enter vein')
/test put_2array('claim', 090, '11', 'lamp on|leave vein|secure line|out|out|out|out|out|out|enter sled')
/test put_2array('claim', 090, '12', 'no')


; Ta'achia Do'inni's claim
/test put_2array('claim', 091, '0', 'Old Campsite')
/test put_2array('claim', 091, '1', 'A great limestone burren stretches over the hills below you. It looks desolate, barren and hopeless.')
/test put_2array('claim', 091, '2', 'Vyana, who would like to thank Aria, Andreshella, Rosa, Inanna and Tate')
/test put_2array('claim', 091, '3', 'View Rock, +view Hearth, +view Datapad, +view Burren, Burren, +view Boulder, around the boulders, +view limestone, +view shadows, (wait till emits reveal rusty box), +view rusty box, pry box open, back, insert crystal, around the boulders, knock 3 times, count to 5, knock 3 more times, back to boulders, insert crystal2, say joseph, then due west')
/test put_2array('claim', 091, '4', 'Burren Due West --> VEIN!')
/test put_2array('claim', 091, '5', 'The complicated way is very frustrating.. however I don\'t know if you can bypass it when you visit to stake the claim. Once you have staked the claim the second is all that is needed. You don\'t need all the other stuff to get to the vein once you\'ve found the vein.')
/test put_2array('claim', 091, '6', 'none')
/test put_2array('claim', 091, '7', 'none')
/test put_2array('claim', 091, '8', 'yes')
/test put_2array('claim', 091, '9', '+view rock|+view hearth|+view datapad|+view burren|burren|+view boulder|around the boulders|+view limestone|+view shadows|+view rusty box|pry box open|back|insert crystal|ta\'achia2|around the boulders|/knock')
/test put_2array('claim', 091, '10', 'leave sled|burren|due west|enter vein')
/test put_2array('claim', 091, '11', 'leave vein|out|out|enter sled')
/test put_2array('claim', 091, '12', 'yes')
/test put_2array('claim', 091, '13', '15')


/test put_2array('claim', 092, '0', 'On a Wide Cliff Ledge')
/test put_2array('claim', 092, '1', 'Mountainous rocky cliffs can be seen below, with very little open space for landing a sled. You see one wide ledge at the edge of a sharp drop off that looks like the only possible spot.')
/test put_2array('claim', 092, '2', 'Fianna')
/test put_2array('claim', 092, '3', 'Up Rock Outcrop Crevice (injury?) --> VEIN!')
/test put_2array('claim', 092, '4', 'none')
/test put_2array('claim', 092, '5', 'none')
/test put_2array('claim', 092, '6', 'none')
/test put_2array('claim', 092, '7', 'yes')
/test put_2array('claim', 092, '8', 'no')


/test put_2array('claim', 093, '0', 'On the Hillside')
/test put_2array('claim', 093, '1', 'A winding gully lies far below, tempting you to fly lower.')
/test put_2array('claim', 093, '2', 'Kevlan Sharr')
/test put_2array('claim', 093, '3', 'Secure Line! Gully Southeast East --> VEIN!')
/test put_2array('claim', 093, '4', 'none')
/test put_2array('claim', 093, '5', 'none')
/test put_2array('claim', 093, '6', 'none')
/test put_2array('claim', 093, '7', 'none')
/test put_2array('claim', 093, '8', 'no')
/test put_2array('claim', 093, '9', 'secure line|gully|southeast|east')
/test put_2array('claim', 093, '10', 'leave sled|secure line|gully|southeast|east|enter vein')
/test put_2array('claim', 093, '11', 'leave vein|out|out|out|retrieve line|enter sled')
/test put_2array('claim', 093, '12', 'yes')


/test put_2array('claim', 094, '0', 'Open Meadow - ')
/test put_2array('claim', 094, '1', 'You spot a large open meadow below. Cover looks rather scarce, but you might be able to find something once you get down there.')
/test put_2array('claim', 094, '2', 'Sellen')
/test put_2array('claim', 094, '3', 'Cliff Small Lake +view Rock (note #) Out Secure Line! Up +view Boulder (note #) Out North Canyon +view Small Hole (note #) Out Out Rocky Outcrop (enter numbers) Button Alcove --> VEIN!')
/test put_2array('claim', 094, '4', 'none')
/test put_2array('claim', 094, '5', 'Order changes! +view Log at the outcrop BEFORE entering the numbers')
/test put_2array('claim', 094, '6', 'Be careful and don\'t guess.')
/test put_2array('claim', 094, '7', 'none')
/test put_2array('claim', 094, '8', 'yes')


/test put_2array('claim', 095, '0', 'Open Ranges')
/test put_2array('claim', 095, '1', 'Below your sled stretches an expanse of rocky rubble, which seems as promising as any other place in the ranges. You\'ll have to find a reasonably clear spot to land, though. ')
/test put_2array('claim', 095, '2', 'Vyana')
/test put_2array('claim', 095, '3', '+View Hoodoos Jump Crevice --> VEIN!')
/test put_2array('claim', 095, '4', 'Climb')
/test put_2array('claim', 095, '5', 'There are several different possibilities on this claim, including an alcove, a mesa, a boulder, and more. You have to try each of the terms in single quotes as the vein location moves around.')
/test put_2array('claim', 095, '6', 'No tricks here, just some straight forward searching. Look at descs and +views (expect +views to add themselves as you see more things, so keep checking), watch for items in single quotes, try them out.')
/test put_2array('claim', 095, '7', 'none')
/test put_2array('claim', 095, '8', 'yes')
/test put_2array('claim', 095, '12', 'no')


/test put_2array('claim', 096, '0', 'Outside of Blue Mountain')
/test put_2array('claim', 096, '1', 'A Blue Mountain appears in the distance.')
/test put_2array('claim', 096, '2', 'Liralye')
/test put_2array('claim', 096, '3', 'Lamp on! North Northeast West (injury?) South --> VEIN!')
/test put_2array('claim', 096, '4', 'none')
/test put_2array('claim', 096, '5', 'none')
/test put_2array('claim', 096, '6', 'In the dark, what do you need?')
/test put_2array('claim', 096, '7', 'yes')
/test put_2array('claim', 096, '8', 'no')
/test put_2array('claim', 096, '9', 'lamp on|north|northeast|west|south')
/test put_2array('claim', 096, '10', 'leave sled|lamp on|north|northeast|west|south|enter vein')
/test put_2array('claim', 096, '11', 'lamp on|leave vein|north|east|sw|s|lamp off|enter sled')
/test put_2array('claim', 096, '12', 'yes')


/test put_2array('claim', 097, '0', 'Overhang')
/test put_2array('claim', 097, '1', 'Numerous ravines scar the land below, potentially hiding crystal.')
/test put_2array('claim', 097, '2', 'Kyah')
/test put_2array('claim', 097, '3', 'East Down East --> VEIN!')
/test put_2array('claim', 097, '4', 'none')
/test put_2array('claim', 097, '5', 'none')
/test put_2array('claim', 097, '6', 'none')
/test put_2array('claim', 097, '7', 'none')
/test put_2array('claim', 097, '8', 'no')
/test put_2array('claim', 097, '9', 'east|down|east')
/test put_2array('claim', 097, '10', 'leave sled|east|down|east|enter vein')
/test put_2array('claim', 097, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 097, '12', 'yes')


/test put_2array('claim', 098, '0', 'Pale beach below some cliffs')
/test put_2array('claim', 098, '1', 'Below you, the sea presses against a sandy shore, from which rises a steep set of cliffs. Cracked with narrow crevices and eroded pock-marks, some of them are little more than dark holes, though there are others that offer brighter hopes.')
/test put_2array('claim', 098, '2', 'Shane')
/test put_2array('claim', 098, '3', 'Opening --> VEIN!')
/test put_2array('claim', 098, '4', 'none')
/test put_2array('claim', 098, '5', 'TIDE-LOCK!! ----------------- Chimney for tidelocked escape is carton destruction/cutter damage')
/test put_2array('claim', 098, '6', 'Repeat your searches enough, and eventually, the odds will bend to your favor. Watch the corners of your eyes, and if you get frustrated, pause, take a breath, and enjoy the view.')
/test put_2array('claim', 098, '7', 'none')
/test put_2array('claim', 098, '8', 'yes')
/test put_2array('claim', 098, '9', 'opening')
/test put_2array('claim', 098, '10', 'leave sled|opening|enter vein')
/test put_2array('claim', 098, '11', 'leave vein|out|enter sled')
/test put_2array('claim', 098, '12', 'yes')


/test put_2array('claim', 099, '0', 'Pebbled Beach')
/test put_2array('claim', 099, '1', 'A pebbled beach lies below, hard up against some cave-pocked cliffs.')
/test put_2array('claim', 099, '2', 'Feyr')
/test put_2array('claim', 099, '3', '(Lamp on?) Cave Deeper Up --> VEIN!')
/test put_2array('claim', 099, '4', 'none')
/test put_2array('claim', 099, '5', 'minor injury possible (getting wet and coughing up water)')
/test put_2array('claim', 099, '6', 'none')
/test put_2array('claim', 099, '7', 'yes')
/test put_2array('claim', 099, '8', 'no')


/test put_2array('claim', 100, '0', 'Peaceful Shores')
/test put_2array('claim', 100, '1', 'From the sled, you can see a shore, with white capped waves rushing to kiss the sand, like a lovers touch. There are also high cliffs, and a cove.')
/test put_2array('claim', 100, '2', 'Katlyn and Psiosis')
/test put_2array('claim', 100, '3', 'Path Unknown Quiet Place Secure line Going Down (injury?) Lamp on Tunnel --> VEIN!')
/test put_2array('claim', 100, '4', 'none')
/test put_2array('claim', 100, '5', 'none')
/test put_2array('claim', 100, '6', 'none')
/test put_2array('claim', 100, '7', 'yes')
/test put_2array('claim', 100, '8', 'no')
/test put_2array('claim', 100, '9', 'path unknown|quiet place|secure line|going down?|lamp on|tunnel')
/test put_2array('claim', 100, '10', 'leave sled|path unknown|quiet place|secure line|going down?|lamp on|tunnel|enter vein')
/test put_2array('claim', 100, '11', 'lamp on|leave vein|secure line|out|out|out|out|lamp off|retrieve line|enter sled')
/test put_2array('claim', 100, '12', 'yes')


/test put_2array('claim', 101, '0', 'Plains')
/test put_2array('claim', 101, '1', 'You see below you a small wandering stream.')
/test put_2array('claim', 101, '2', 'Hanna')
/test put_2array('claim', 101, '3', 'North East North Down --> VEIN!')
/test put_2array('claim', 101, '4', 'none')
/test put_2array('claim', 101, '5', 'none')
/test put_2array('claim', 101, '6', 'none')
/test put_2array('claim', 101, '7', 'none')
/test put_2array('claim', 101, '8', 'no')
/test put_2array('claim', 101, '9', 'north|east|north|down')
/test put_2array('claim', 101, '10', 'leave sled|north|east|north|down|enter vein')
/test put_2array('claim', 101, '11', 'leave vein|out|out|out|out|enter sled')
/test put_2array('claim', 101, '12', 'yes')


/test put_2array('claim', 102, '0', 'Plateau')
/test put_2array('claim', 102, '1', 'A huge plateau opens below you, but the jagged rocks dispersed along it may make a landing spot hard to find. A long crevasse winds its way north to south, looking like a huge tear in the rock.')
/test put_2array('claim', 102, '2', 'Bernadette Marshall')
/test put_2array('claim', 102, '3', 'Secure Line! Down (!injury!) Northern Crevasse Cave --> VEIN!')
/test put_2array('claim', 102, '4', 'get rope, tie rope, down, down, south')
/test put_2array('claim', 102, '5', 'secure line, down, south, vein. The injury is VERY VERY injury!')
/test put_2array('claim', 102, '6', 'none')
/test put_2array('claim', 102, '7', 'yes')
/test put_2array('claim', 102, '8', 'yes')
/test put_2array('claim', 102, '9', 'secure line|down|nc|cave')
/test put_2array('claim', 102, '10', 'leave sled|secure line|down|dc|cave|enter vein|retrieve line')
/test put_2array('claim', 102, '11', 'leave vein|secure line|out|out|out|out|retrieve line|enter sled')
/test put_2array('claim', 102, '12', 'no')


/test put_2array('claim', 103, '0', 'Plateau')
/test put_2array('claim', 103, '1', 'Below you lies a rocky mountain, with a peculiarly flat, dusty plateau, which is covered with dead bushes. It looks like is would be possible to land a sled there if you were lower.')
/test put_2array('claim', 103, '2', 'This claim was started by Gentric, who was idle-dested, and was completed and spiffied up by Kesya. :)')
/test put_2array('claim', 103, '3', 'Down, Down, Northern Crevasse, Cave,  --> VEIN!')
/test put_2array('claim', 103, '4', 'none')
/test put_2array('claim', 103, '5', 'none')
/test put_2array('claim', 103, '6', 'none')
/test put_2array('claim', 103, '7', 'none')
/test put_2array('claim', 103, '8', 'no')
/test put_2array('claim', 103, '9', 'down|nc|cave')
/test put_2array('claim', 103, '10', 'leave sled|down|nc|cave|enter vein')
/test put_2array('claim', 103, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 103, '12', 'yes')


/test put_2array('claim', 104, '0', 'Purple Meadow')
/test put_2array('claim', 104, '1', 'As you look down, you see a sloping meadow leading up to a rockier hill and a rushing stream. It looks small in the distance, and very calm.')
/test put_2array('claim', 104, '2', 'Helen, then Kes')
/test put_2array('claim', 104, '3', 'Southwest --> VEIN!')
/test put_2array('claim', 104, '4', 'none')
/test put_2array('claim', 104, '5', 'none')
/test put_2array('claim', 104, '6', 'none')
/test put_2array('claim', 104, '7', 'none')
/test put_2array('claim', 104, '8', 'no')
/test put_2array('claim', 104, '9', 'sw')
/test put_2array('claim', 104, '10', 'leave sled|sw|enter vein')
/test put_2array('claim', 104, '11', 'leave vein|ne|enter sled')
/test put_2array('claim', 104, '12', 'yes')


/test put_2array('claim', 105, '0', 'Ragged Ditches - Edge')
/test put_2array('claim', 105, '1', 'Ragged ditches trace across the land below, hiding many potential places for crystal veins.')
/test put_2array('claim', 105, '2', 'Rikart')
/test put_2array('claim', 105, '3', 'Down --> VEIN!')
/test put_2array('claim', 105, '4', 'none')
/test put_2array('claim', 105, '5', 'might need to wander just a bit')
/test put_2array('claim', 105, '6', 'Not too bad but mind your footing.')
/test put_2array('claim', 105, '7', 'none')
/test put_2array('claim', 105, '8', 'no')
/test put_2array('claim', 105, '9', 'down')
/test put_2array('claim', 105, '10', 'leave sled|down|enter vein')
/test put_2array('claim', 105, '11', 'leave vein|up|enter sled')
/test put_2array('claim', 105, '12', 'yes')


;;; Since this is tidelocked it needs testing during a time when the tide is in.
/test put_2array('claim', 106, '0', 'Raised Plateau')
/test put_2array('claim', 106, '1', 'A large forest stretches far along the coastline of a large body of water... short of landing in a tree, the only flat spot you can see anywhere nearby is a large plateau jutting up out of the green canopy.')
/test put_2array('claim', 106, '2', 'Kesya')
/test put_2array('claim', 106, '3', 'Path Down Water Dive Crevice Get Rock for vein ')
/test put_2array('claim', 106, '4', 'none')
/test put_2array('claim', 106, '5', 'TIDE-LOCK!! Alcove Pool for soaking Res! ------------ \'Dig up\' for out.. INJURY!')
/test put_2array('claim', 106, '6', 'none')
/test put_2array('claim', 106, '7', 'none')
/test put_2array('claim', 106, '8', 'yes')
/test put_2array('claim', 106, '9', 'path down|water|dive|crevice|get rock')
/test put_2array('claim', 106, '10', 'leave sled|path down|water|dive|crevice|get rock|enter vein')
/test put_2array('claim', 106, '11', 'leave vein|out|out|out|out|enter sled')
/test put_2array('claim', 106, '12', 'no')
/test put_2array('claim', 106, '13', '5')


/test put_2array('claim', 107, '0', 'Raised Plateau')
/test put_2array('claim', 107, '1', 'The arid land of a desert plain spreads in all directions, networked by craggy faults that plow deep into the earth. A raised plateau of rock catches your eye, nearly perfectly square with plenty of room for a sled to land. A forked cut runs from the plateau off to the east and then branches northeast and southeast.')
/test put_2array('claim', 107, '2', 'Nikama')
/test put_2array('claim', 107, '3', 'Path Sharp Cut Left Fork --> VEIN!')
/test put_2array('claim', 107, '4', 'none')
/test put_2array('claim', 107, '5', 'none')
/test put_2array('claim', 107, '6', 'none')
/test put_2array('claim', 107, '7', 'none')
/test put_2array('claim', 107, '8', 'no')
/test put_2array('claim', 107, '9', 'path|sharp cut|left fork')
/test put_2array('claim', 107, '10', 'leave sled|path|sharp cut|left fork|enter vein')
/test put_2array('claim', 107, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 107, '12', 'yes')


/test put_2array('claim', 108, '0', 'Rift Landing')
/test put_2array('claim', 108, '1', 'Only the width of 3 sled lengths, a rift runs to the southwest along the side of a mountain. There is a flattish rock near the edge of the rift on which you might be able to land.')
/test put_2array('claim', 108, '2', 'Tsuri (finished by Bayr)')
/test put_2array('claim', 108, '3', 'Northwest Secure Line Down (injury?) down Southwest --> VEIN!')
/test put_2array('claim', 108, '4', 'none')
/test put_2array('claim', 108, '5', 'At night trying to take off gives \'The force of the wind would crush the sled against the mountain if you lifted.\' Retrieval necessary at night.')
/test put_2array('claim', 108, '6', 'none')
/test put_2array('claim', 108, '7', 'yes')
/test put_2array('claim', 108, '8', 'yes')
/test put_2array('claim', 108, '9', 'secure line|northwest|down|southwest')
/test put_2array('claim', 108, '10', 'leave sled|secure line|northwest|down|southwest|retrieve line|enter vein')
/test put_2array('claim', 108, '11', 'leave vein|secure line|out|out|out|retrieve line|enter sled')
/test put_2array('claim', 108, '12', 'yes')


/test put_2array('claim', 109, '0', 'Rocky Valley')
/test put_2array('claim', 109, '1', 'You see a long, rocky valley. The valley is long with a slight curve in the middle. Upon first glance, it doesn\'t look fit for a sled, but then you notice a small plateau at the south end.')
/test put_2array('claim', 109, '2', 'Siantha')
/test put_2array('claim', 109, '3', 'Middle Fissure Deep --> VEIN!')
/test put_2array('claim', 109, '4', 'none')
/test put_2array('claim', 109, '5', 'lamp needed')
/test put_2array('claim', 109, '6', 'none')
/test put_2array('claim', 109, '7', 'none')
/test put_2array('claim', 109, '8', 'no')
/test put_2array('claim', 109, '9', 'lamp on|middle|fissure|deep')
/test put_2array('claim', 109, '10', 'leave sled|lamp on|middle|fissure|deep|lamp off|enter vein')
/test put_2array('claim', 109, '11', 'lamp on|leave vein|out|out|out|lamp off|enter sled')
/test put_2array('claim', 109, '12', 'yes')


/test put_2array('claim', 110, '0', 'Rocky Cliffside')
/test put_2array('claim', 110, '1', 'You see a large ledge that looks like it is big enough for a sled to land on. The area is wide and sturdy. You see the opening of a cave.')
/test put_2array('claim', 110, '2', 'Katlyn')
/test put_2array('claim', 110, '3', 'Cave West North Lost --> VEIN!')
/test put_2array('claim', 110, '4', 'none')
/test put_2array('claim', 110, '5', 'none')
/test put_2array('claim', 110, '6', 'none')
/test put_2array('claim', 110, '7', 'none')
/test put_2array('claim', 110, '8', 'no')
/test put_2array('claim', 110, '9', 'cave|west|north|lost')
/test put_2array('claim', 110, '10', 'leave sled|cave|west|north|lost|enter vein')
/test put_2array('claim', 110, '11', 'leave vein|out|out|out|out|enter sled')
/test put_2array('claim', 110, '12', 'yes')


/test put_2array('claim', 111, '0', 'Rocky Floor')
/test put_2array('claim', 111, '1', 'Below is an odd formation of four peaks. Three of them seem to be connected at the bottom and the fourth lies a little below the others...alone.')
/test put_2array('claim', 111, '2', 'Brandon')
/test put_2array('claim', 111, '3', 'Two Crevice -- VEIN!')
/test put_2array('claim', 111, '4', 'none')
/test put_2array('claim', 111, '5', 'none')
/test put_2array('claim', 111, '6', 'none')
/test put_2array('claim', 111, '7', 'none')
/test put_2array('claim', 111, '8', 'no')
/test put_2array('claim', 111, '9', 'two|crevice')
/test put_2array('claim', 111, '10', 'leave sled|two|crevice|enter vein')
/test put_2array('claim', 111, '11', 'leave vein|out|out|enter sled')
/test put_2array('claim', 111, '12', 'yes')


/test put_2array('claim', 112, '0', 'Rocky Plateau')
/test put_2array('claim', 112, '1', 'A rocky plateau rises sharply from below, surrounded by the forest to the east and rocky hills to the west.')
/test put_2array('claim', 112, '2', 'Corinna Crosley (Cori)')
/test put_2array('claim', 112, '3', 'Tunnel Down East --> VEIN!')
/test put_2array('claim', 112, '4', 'none')
/test put_2array('claim', 112, '5', 'none')
/test put_2array('claim', 112, '6', 'none')
/test put_2array('claim', 112, '7', 'none')
/test put_2array('claim', 112, '8', 'no')
/test put_2array('claim', 112, '9', 'tunnel|down|east|up')
/test put_2array('claim', 112, '10', 'leave sled|tunnel|down|east|up|enter vein')
/test put_2array('claim', 112, '11', 'leave vein|out|out|out|out|enter sled')
/test put_2array('claim', 112, '12', 'yes')


/test put_2array('claim', 113, '0', 'Rocky Shore')
/test put_2array('claim', 113, '1', 'To one end of a mountain chain you see a huge volcano. The western side was blown out from some long ago eruption, and you think you see a sparkle of light reflecting off water inside its mouth.')
/test put_2array('claim', 113, '2', 'Antonya')
/test put_2array('claim', 113, '3', 'North Northeast -- VEIN!')
/test put_2array('claim', 113, '4', 'none')
/test put_2array('claim', 113, '5', 'none')
/test put_2array('claim', 113, '6', 'none')
/test put_2array('claim', 113, '7', 'none')
/test put_2array('claim', 113, '8', 'no')
/test put_2array('claim', 113, '9', 'north|northeast')
/test put_2array('claim', 113, '10', 'leave sled|north|northeast|enter vein')
/test put_2array('claim', 113, '11', 'leave vein|out|out|enter sled')
/test put_2array('claim', 113, '12', 'yes')


/test put_2array('claim', 114, '0', 'Rocky Slope')
/test put_2array('claim', 114, '1', 'A vast, barren landscape, but the dark openings of caves make it look worth investigating.')
/test put_2array('claim', 114, '2', 'Amberle (Deceased)')
/test put_2array('claim', 114, '3', 'East North West Forward --> VEIN!')
/test put_2array('claim', 114, '4', 'none')
/test put_2array('claim', 114, '5', 'none')
/test put_2array('claim', 114, '6', 'none')
/test put_2array('claim', 114, '7', 'none')
/test put_2array('claim', 114, '8', 'no')
/test put_2array('claim', 114, '9', 'east|north|west|forward')
/test put_2array('claim', 114, '10', 'leave sled|east|north|west|forward|enter vein')
/test put_2array('claim', 114, '11', 'leave vein|out|out|out|out|enter sled')
/test put_2array('claim', 114, '12', 'yes')


/test put_2array('claim', 115, '0', 'Rocky Timberline - ')
/test put_2array('claim', 115, '1', 'Flying overhead, you look down and see a sharp line where the forest abruptly stops near the top of the mountain. The trees thicken farther down the side of the mountain, but above the timberline is barren, an easy landing site.')
/test put_2array('claim', 115, '2', 'Lirra, finished by Kes')
/test put_2array('claim', 115, '3', 'East Waterfall Lamp on! Dank Cave (injury?) --> VEIN!')
/test put_2array('claim', 115, '4', 'none')
/test put_2array('claim', 115, '5', 'none')
/test put_2array('claim', 115, '6', 'Doesn\'t that sound like a big waterfall.')
/test put_2array('claim', 115, '7', 'yes')
/test put_2array('claim', 115, '8', 'no')
/test put_2array('claim', 115, '9', 'east|waterfall|lamp on|dank cave')
/test put_2array('claim', 115, '10', 'leave sled|east|waterfall|lamp on|dank cave|enter vein|lamp off')
/test put_2array('claim', 115, '11', 'lamp on|leave vein|out|out|out|lamp off|enter sled')
/test put_2array('claim', 115, '12', 'yes')


/test put_2array('claim', 116, '0', 'Rolling Hills - Clearing')
/test put_2array('claim', 116, '1', 'Huge trees cover the land below you. They\'re too dense for you to land but maybe you can find a clearing.')
/test put_2array('claim', 116, '2', 'Jasen')
/test put_2array('claim', 116, '3', 'Push Tree Get Branches Down Lamp on! Cave Hole Drop Branches Lay Branches Over Fissure Bridge Crevice --> VEIN!')
/test put_2array('claim', 116, '4', 'none')
/test put_2array('claim', 116, '5', 'need a lamp, multiple breaks/inactive medstate possible in this claim.')
/test put_2array('claim', 116, '6', 'Timber!')
/test put_2array('claim', 116, '7', 'yes')
/test put_2array('claim', 116, '8', 'yes')
/test put_2array('claim', 116, '9', 'push tree|get branches|down|lamp on|cave|hole|drop branches|lay branches over fissure|bridge|crevice')
/test put_2array('claim', 116, '10', 'leave sled|lamp on|down|cave|hole|bridge|crevice|enter vein|lamp off')
/test put_2array('claim', 116, '11', 'lamp on|leave vein|out|out|out|out|out|lamp off|enter sled')
/test put_2array('claim', 116, '12', 'yes')


/test put_2array('claim', 117, '0', 'Roof of the World')
/test put_2array('claim', 117, '1', 'An enormous mountain range stretches out beneath you. Looking down on it, you get the impression that Ballybran\'s crust is nothing but a piece of paper that has been crumpled into these peaks by some giant, cosmic hand.')
/test put_2array('claim', 117, '2', 'Vyana')
/test put_2array('claim', 117, '3', 'Secure Line Down Plucked Wall +view Rock Yodle at ??? Climb up --> VEIN!')
/test put_2array('claim', 117, '4', 'none')
/test put_2array('claim', 117, '5', 'Need to secure line or will go too far! Find the hz to yodel at.. continue to yodel until \'+comming\' message appears and then \'Finally, the tide of rocks begins to subside\'.. then vein path is open!')
/test put_2array('claim', 117, '6', 'Hint at landing zone: You could /try/ before asking.;Hint at \'down\': You could /try/ before asking.;Hint at plucked wall: You\'ll need to test your perfect pitch to the limit ICly. Type \'hint1\' for another hint.;Hint1: Every object has a fundamental frequency -- a frequency at which it will resonate. This is how opera singers break glasses. They sing at the right fundamental frequency. Could you do something similar here? Type \'hint2\' for a final hint.;Hint2: ; **; ** ** **; ** ** ** ** **; ** ** ** ** ** ** **; ** ** ** ** ** ** ** **; ** ** ** ** ** ** ** **; ** ** ** ** ** ** ** **;************************************************************************;440 Hz 880 Hz 1320 Hz 1760 Hz 2200 Hz 2640 Hz 3080 Hz 3520 Hz; (A4) (A5) (A6) (A7); H: 0 H: 1 H: 2 H: 3 H: 4 H: 5 H: 6 H: 7;; A SAMPLE HARMONIC CHART; (H=HARMONIC);;Notice that each harmonic is a multiple of the fundamental frequency (H: 0).;If you sense a note is too high or too low, this is relative to the nearest harmonic.')
/test put_2array('claim', 117, '7', 'none')
/test put_2array('claim', 117, '8', 'no')


/test put_2array('claim', 118, '0', 'Rugged Canyons')
/test put_2array('claim', 118, '1', 'As you look below, you see what appears to be a dry scrubland valley that eventually narrows to a pair of sandstone gorges.')
/test put_2array('claim', 118, '2', 'Rinnae')
/test put_2array('claim', 118, '3', 'Down Lake Pool Down --> VEIN!')
/test put_2array('claim', 118, '4', 'none')
/test put_2array('claim', 118, '5', 'none')
/test put_2array('claim', 118, '6', 'none')
/test put_2array('claim', 118, '7', 'none')
/test put_2array('claim', 118, '8', 'no')
/test put_2array('claim', 118, '9', 'down|lake|pool|down')
/test put_2array('claim', 118, '10', 'leave sled|down|lake|pool|down|enter vein')
/test put_2array('claim', 118, '11', 'leave vein|out|out|out|landing ledge|enter sled')
/test put_2array('claim', 118, '12', 'yes')


/test put_2array('claim', 119, '0', 'Sand Dunes')
/test put_2array('claim', 119, '1', 'Hovering over the ragged shoreline, you notice a large enough patch of soft dune to land, near some huge cliffs.')
/test put_2array('claim', 119, '2', 'Katlyn & Callista')
/test put_2array('claim', 119, '3', 'north, east, up')
/test put_2array('claim', 119, '4', 'none')
/test put_2array('claim', 119, '5', 'none')
/test put_2array('claim', 119, '6', 'none')
/test put_2array('claim', 119, '7', 'none')
/test put_2array('claim', 119, '8', 'no')
/test put_2array('claim', 119, '9', 'north|east|up')
/test put_2array('claim', 119, '10', 'leave sled|north|east|up|enter vein')
/test put_2array('claim', 119, '11', 'leave vein|out|out|enter sled')
/test put_2array('claim', 119, '12', 'yes')


/test put_2array('claim', 120, '0', 'Sandy Beach')
/test put_2array('claim', 120, '1', 'Below you stretches a long, crooked line of black cliffs, constantly pounded by angry white surf. The sea beyond is a deep azure blue.')
/test put_2array('claim', 120, '2', 'Inanna')
/test put_2array('claim', 120, '3', 'Narrow Ledge Lamp on! Cave (injury?) Southwest --> VEIN!')
/test put_2array('claim', 120, '4', 'none')
/test put_2array('claim', 120, '5', 'none')
/test put_2array('claim', 120, '6', 'That cliff looks dangerous...maybe you should get some climbing gear.')
/test put_2array('claim', 120, '7', 'yes')
/test put_2array('claim', 120, '8', 'no')
/test put_2array('claim', 120, '9', 'narrow ledge|lamp on|cave|southwest')
/test put_2array('claim', 120, '10', 'leave sled|narrow ledge|lamp on|cave|southwest|enter vein|lamp off')
/test put_2array('claim', 120, '11', 'lamp on|leave vein|out|out|out|lamp off|enter sled')
/test put_2array('claim', 120, '12', 'yes')


/test put_2array('claim', 121, '0', 'Seaside Cliff')
/test put_2array('claim', 121, '1', 'Huge waves crash high up on a cliff wall below the sled, as Ballybran\'s three moons fight each other for control of the tides. The steep cliff side is worth a further look.')
/test put_2array('claim', 121, '2', 'Vyanna & Bernedette')
/test put_2array('claim', 121, '3', 'Narrow Path Secure line! Down (injury?) Dark Cave Jump --> VEIN!')
/test put_2array('claim', 121, '4', 'none')
/test put_2array('claim', 121, '5', 'none')
/test put_2array('claim', 121, '6', 'none')
/test put_2array('claim', 121, '7', 'yes')
/test put_2array('claim', 121, '8', 'no')


/test put_2array('claim', 122, '0', 'Seaside Shadows')
/test put_2array('claim', 122, '1', 'Light reflects from below, the surface of a smooth limestone upthrust situated at the edge of the sea shining brightly.')
/test put_2array('claim', 122, '2', 'Adrian Eva Cossanti')
/test put_2array('claim', 122, '3', 'Pit --> VEIN!')
/test put_2array('claim', 122, '4', 'none')
/test put_2array('claim', 122, '5', 'Sled gets stuck!! try to \'dig\' out')
/test put_2array('claim', 122, '6', 'none')
/test put_2array('claim', 122, '7', 'none')
/test put_2array('claim', 122, '8', 'no')
/test put_2array('claim', 122, '9', 'pit')
/test put_2array('claim', 122, '10', 'leave sled|pit|enter vein')
/test put_2array('claim', 122, '11', 'leave vein|out|enter sled')
/test put_2array('claim', 122, '12', 'yes')


/test put_2array('claim', 123, '0', 'Sheer Face Ledge')
/test put_2array('claim', 123, '1', 'Down close to the sheer mountain face might hide a likely spot for a crystal vein.')
/test put_2array('claim', 123, '2', 'Michel')
/test put_2array('claim', 123, '3', 'Up West Search here Groove --> VEIN!')
/test put_2array('claim', 123, '4', 'none')
/test put_2array('claim', 123, '5', 'none')
/test put_2array('claim', 123, '6', 'Check for arbitrary commands ($commands).')
/test put_2array('claim', 123, '7', 'none')
/test put_2array('claim', 123, '8', 'no')
/test put_2array('claim', 123, '9', 'up|west|search here|groove')
/test put_2array('claim', 123, '10', 'leave sled|up|west|groove|enter vein')
/test put_2array('claim', 123, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 123, '12', 'yes')


/test put_2array('claim', 124, '0', 'Shoreline')
/test put_2array('claim', 124, '1', 'Down below, whitecaps crash along a boulder-edged shoreline; small peninsula jutting out as well as a tiny island that barely pushes through the surface.')
/test put_2array('claim', 124, '2', 'Tavva')
/test put_2array('claim', 124, '3', 'Southeast North (injury?) North --> VEIN!')
/test put_2array('claim', 124, '4', 'Try E at low out instead of Southeast')
/test put_2array('claim', 124, '5', 'none')
/test put_2array('claim', 124, '6', 'none')
/test put_2array('claim', 124, '7', 'yes')
/test put_2array('claim', 124, '8', 'no')
/test put_2array('claim', 124, '9', 'se|n|n')
/test put_2array('claim', 124, '10', 'leave sled|se|n|n|enter vein')
/test put_2array('claim', 124, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 124, '12', 'no')


/test put_2array('claim', 125, '0', 'Sinkhole')
/test put_2array('claim', 125, '1', 'Far below there seems to be a dark circle. As you look closer you can see a hole descending into the earth and a ledge upon which you could land.')
/test put_2array('claim', 125, '2', 'Rykos')
/test put_2array('claim', 125, '3', 'Down Dark Passage (lamp on) Wet Passage Down --> VEIN!')
/test put_2array('claim', 125, '4', 'none')
/test put_2array('claim', 125, '5', 'none')
/test put_2array('claim', 125, '6', 'none')
/test put_2array('claim', 125, '7', 'none')
/test put_2array('claim', 125, '8', 'no')
/test put_2array('claim', 125, '9', 'down|lamp on|dark passage|wet passage|down')
/test put_2array('claim', 125, '10', 'leave sled|down|lamp on|dark passage|wet passage|down|enter vein|lamp off')
/test put_2array('claim', 125, '11', 'lamp on|leave vein|out|out|out|out|enter sled|lamp off')
/test put_2array('claim', 125, '12', 'yes')


/test put_2array('claim', 126, '0', 'Sinkhole')
/test put_2array('claim', 126, '1', 'Looking at first like nothing but a big hole in the ground, on your second pass something about this place catches your eye.')
/test put_2array('claim', 126, '2', 'Sean')
/test put_2array('claim', 126, '3', 'Crack Chamber --> VEIN!')
/test put_2array('claim', 126, '4', 'none')
/test put_2array('claim', 126, '5', 'none')
/test put_2array('claim', 126, '6', 'none')
/test put_2array('claim', 126, '7', 'none')
/test put_2array('claim', 126, '8', 'no')


/test put_2array('claim', 127, '0', 'Slope of Boulders and Arches')
/test put_2array('claim', 127, '1', 'A basin covered in limestone and surrounded by a cliff face running clockwise from west to southeast. A river loops around the remainder.')
/test put_2array('claim', 127, '2', 'Sofie')
/test put_2array('claim', 127, '3', 'North In --> VEIN!')
/test put_2array('claim', 127, '4', 'none')
/test put_2array('claim', 127, '5', 'none')
/test put_2array('claim', 127, '6', 'none')
/test put_2array('claim', 127, '7', 'none')
/test put_2array('claim', 127, '8', 'no')
/test put_2array('claim', 127, '9', 'north|in')
/test put_2array('claim', 127, '10', 'leave sled|north|in|enter vein')
/test put_2array('claim', 127, '11', 'leave|out|out|enter sled')
/test put_2array('claim', 127, '12', 'yes')


/test put_2array('claim', 128, '0', 'Small Covered Ledge')
/test put_2array('claim', 128, '1', 'You see a very small ledge below you. It appears to be just large enough for your sled to land on. You can also see a dark patch on the rock face by the ledge. It looks almost like it is a crack in the rock face.')
/test put_2array('claim', 128, '2', 'Davor')
/test put_2array('claim', 128, '3', 'Crack Cave Pass Pit (!injury?) --> VEIN!')
/test put_2array('claim', 128, '4', 'none')
/test put_2array('claim', 128, '5', 'none')
/test put_2array('claim', 128, '6', 'none')
/test put_2array('claim', 128, '7', 'yes')
/test put_2array('claim', 128, '8', 'no')
/test put_2array('claim', 128, '9', 'crack|cave|pass|pit')
/test put_2array('claim', 128, '10', 'leave sled|crack|cave|pass|pit|enter vein')
/test put_2array('claim', 128, '11', 'leave vein|out|out|out|out|enter sled')
/test put_2array('claim', 128, '12', 'yes')


/test put_2array('claim', 129, '0', 'Small inlet')
/test put_2array('claim', 129, '1', 'The glittering waters of the main ocean sparkle and shine out as far as the eye can see to the east. Below there is a small inlet, surrounded by huge rocky cliffs that might look like a pleasant spot to land in.')
/test put_2array('claim', 129, '2', 'Xyvarra')
/test put_2array('claim', 129, '3', 'Narrow Cave Dim-Lit Opening Box Canyon --> VEIN!')
/test put_2array('claim', 129, '4', 'NC DLO Natural Steps behind waterfall --> VEIN!')
/test put_2array('claim', 129, '5', 'Possible TIDE-LOCK .. Low? Multiple vein locations. Behind waterfall ok at medium going out.')
/test put_2array('claim', 129, '6', 'Somewhere, over the rainbow, (Look around very carefully, at things, and have some fun.)')
/test put_2array('claim', 129, '7', 'none')
/test put_2array('claim', 129, '8', 'yes')


/test put_2array('claim', 130, '0', 'Small Valley Near a Steep Cliff-Face')
/test put_2array('claim', 130, '1', 'A long, wooded grotto of treacherous cliffs lie below, potentially hiding a crystal vein.')
/test put_2array('claim', 130, '2', 'Kyrae')
/test put_2array('claim', 130, '3', 'Up Up Up --> VEIN!')
/test put_2array('claim', 130, '4', 'none')
/test put_2array('claim', 130, '5', 'none')
/test put_2array('claim', 130, '6', 'none')
/test put_2array('claim', 130, '7', 'none')
/test put_2array('claim', 130, '8', 'no')
/test put_2array('claim', 130, '9', 'up|up|up')
/test put_2array('claim', 130, '10', 'leave sled|up|up|up|enter vein')
/test put_2array('claim', 130, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 130, '12', 'yes')


/test put_2array('claim', 131, '0', 'Sorta Flat Narrow Cleft')
/test put_2array('claim', 131, '1', 'The tangled jumble of rock and dirt gives way to what looks like a narrow ledge. Surrounded by clinging scrub, the surface doesn\'t look completely level, but with a display of your impressive flying skills you might be able to land your sled on the ledge without sliding off onto the uneven jags of rock around it.')
/test put_2array('claim', 131, '2', 'Ceara')
/test put_2array('claim', 131, '3', 'Crawl Lamp on! Low (See note!) Passage --> VEIN!')
/test put_2array('claim', 131, '4', 'none')
/test put_2array('claim', 131, '5', 'WARNING! You\'ll get tattered hands and knees crawling around in here! ------------ You MUST MAP!! If you don\'t you\'ll get lost! Mark DBREF#s of rooms!')
/test put_2array('claim', 131, '6', 'HINT: If you\'re really having trouble, go to the landing site and type \'hint 1\' to get help. HINT 1: It\'s such a nice claim, don\'t you think you should \'explore\' a little more before you cheat? Type \'hint 2\' if you really want more help. EXPLORE: As you explore a particularly interesting slanted boulder, your foot dislodges a few small stones and they rattle across the shale and disappear down,...is that an opening between the rocks??? HINT 2: Okay, you\'ve \'explored\' the landing site and found the low opening to the tunnels. The little spider has inspired you to \'crawl\' in and now you\'re roaming endlessly through the tunnels and have -no- idea where you are supposed to go. Think a map would help you figure it out? You could scrawl a line drawing on your datapad or the leg of your coverall or something. Type \'hint 3\' for more help. HINT 3: You\'ve mapped all the rooms and still can\'t find the vein room. Are you sure you have all -8- rooms on your map? Type \'hint 4\' for more help. HINT 4: Yes, there are 8 underground rooms on your diagram, but which one has the durned vein already?! Check them all -one- more time. By now, you should be able to feel the call of crystal if you\'re in the right place.')
/test put_2array('claim', 131, '7', 'yes')
/test put_2array('claim', 131, '8', 'yes')
/test put_2array('claim', 131, '12', 'no')


/test put_2array('claim', 132, '0', 'South Beach')
/test put_2array('claim', 132, '1', "The reflection of sun off water somewhere beneath you catches your eye...")
/test put_2array('claim', 132, '2', 'Yanuk')
/test put_2array('claim', 132, '3', 'Northwest and then Fissure --> VEIN!')
/test put_2array('claim', 132, '4', 'none')
/test put_2array('claim', 132, '5', 'none')
/test put_2array('claim', 132, '6', 'Things are not always obvious, but persistance will see you heading in the right direction.')
/test put_2array('claim', 132, '7', 'none')
/test put_2array('claim', 132, '8', 'no')
/test put_2array('claim', 132, '9', 'northwest|fissure')
/test put_2array('claim', 132, '10', 'leave sled|northwest|fissure|enter vein')
/test put_2array('claim', 132, '11', 'leave vein|out|out|enter sled')
/test put_2array('claim', 132, '12', 'yes')


/test put_2array('claim', 133, '0', 'South Saddle')
/test put_2array('claim', 133, '1', 'Far below you see a geologically recent canyon formed in the bottom of a larger older canyon.')
/test put_2array('claim', 133, '2', 'Gordon Ginzratan (Gorginz)')
/test put_2array('claim', 133, '3', 'Northeast North --> VEIN!')
/test put_2array('claim', 133, '4', 'none')
/test put_2array('claim', 133, '5', 'none')
/test put_2array('claim', 133, '6', 'none')
/test put_2array('claim', 133, '7', 'none')
/test put_2array('claim', 133, '8', 'no')
/test put_2array('claim', 133, '9', 'northeast|north')
/test put_2array('claim', 133, '10', 'leave sled|northeast|north|enter vein')
/test put_2array('claim', 133, '11', 'leave vein|south|southwest|enter sled')
/test put_2array('claim', 133, '12', 'yes')


/test put_2array('claim', 134, '0', 'Southern Ledge')
/test put_2array('claim', 134, '1', 'Below you you can see a deep jagged gap in the ground, an old legacy from an earthquake, it runs north and closes over itself to the south.')
/test put_2array('claim', 134, '2', 'Miriann (concept) finished by Aria')
/test put_2array('claim', 134, '3', 'Northeast --> VEIN!')
/test put_2array('claim', 134, '4', 'none')
/test put_2array('claim', 134, '5', 'none')
/test put_2array('claim', 134, '6', 'none')
/test put_2array('claim', 134, '7', 'none')
/test put_2array('claim', 134, '8', 'no')
/test put_2array('claim', 134, '9', 'ne')
/test put_2array('claim', 134, '10', 'leave sled|ne|enter vein')
/test put_2array('claim', 134, '11', 'leave vein|sw|enter sled')
/test put_2array('claim', 134, '12', 'yes')


/test put_2array('claim', 135, '0', 'Southern Rim')
/test put_2array('claim', 135, '1', 'On the plains below, you see a deep pit in the ground.')
/test put_2array('claim', 135, '2', 'Connor')
/test put_2array('claim', 135, '3', 'WR NR Sinkhole --> VEIN!')
/test put_2array('claim', 135, '4', 'none')
/test put_2array('claim', 135, '5', 'none')
/test put_2array('claim', 135, '6', 'none')
/test put_2array('claim', 135, '7', 'none')
/test put_2array('claim', 135, '8', 'no')
/test put_2array('claim', 135, '9', 'wr|nr|sinkhole')
/test put_2array('claim', 135, '10', 'leave sled|wr|nr|sinkhole|enter vein')
/test put_2array('claim', 135, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 135, '12', 'yes')


/test put_2array('claim', 136, '0', 'Southern Stretch of a Narrow Canyon')
/test put_2array('claim', 136, '1', 'The ground far below is treacherous, but perhaps there is a landing site if you search lower.')
/test put_2array('claim', 136, '2', 'Elsiarra')
/test put_2array('claim', 136, '3', 'North Northeast Northeast --> VEIN!')
/test put_2array('claim', 136, '4', 'none')
/test put_2array('claim', 136, '5', 'none')
/test put_2array('claim', 136, '6', 'none')
/test put_2array('claim', 136, '7', 'none')
/test put_2array('claim', 136, '8', 'no')
/test put_2array('claim', 136, '9', 'north|northeast|northeast')
/test put_2array('claim', 136, '10', 'leave sled|north|northeast|northeast|enter vein')
/test put_2array('claim', 136, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 136, '12', 'yes')


/test put_2array('claim', 137, '0', 'The Steep Banks of a Riverbed')
/test put_2array('claim', 137, '1', 'A dried river bed lies below. Potentially some crystal may be found in the area, although it looks like a flash flood area.')
/test put_2array('claim', 137, '2', 'Shiora')
/test put_2array('claim', 137, '3', 'Out Downstream --> VEIN!')
/test put_2array('claim', 137, '4', 'none')
/test put_2array('claim', 137, '5', 'none')
/test put_2array('claim', 137, '6', 'Observation and a keen eye will help.')
/test put_2array('claim', 137, '7', 'none')
/test put_2array('claim', 137, '8', 'no')
/test put_2array('claim', 137, '9', 'out|downstream')
/test put_2array('claim', 137, '10', 'leave sled|out|downstream|enter vein')
/test put_2array('claim', 137, '11', 'leave vein|upstream|out|enter sled')
/test put_2array('claim', 137, '12', 'yes')


/test put_2array('claim', 138, '0', 'Straight Canyon - South End')
/test put_2array('claim', 138, '1', 'An unusually straight canyon lies below, running south to north. It looks interesting.')
/test put_2array('claim', 138, '2', 'Tavril')
/test put_2array('claim', 138, '3', 'North North North North --> VEIN!')
/test put_2array('claim', 138, '4', 'none')
/test put_2array('claim', 138, '5', 'none')
/test put_2array('claim', 138, '6', 'No stresses here.')
/test put_2array('claim', 138, '7', 'none')
/test put_2array('claim', 138, '8', 'no')
/test put_2array('claim', 138, '9', 'north|north|north|north')
/test put_2array('claim', 138, '10', 'leave sled|north|north|north|north|enter vein')
/test put_2array('claim', 138, '11', 'leave vein|out|out|out|out|enter sled')
/test put_2array('claim', 138, '12', 'yes')


/test put_2array('claim', 139, '0', 'Streamside Cliffs')
/test put_2array('claim', 139, '1', 'A flash of light catches your eye amongst the jumbled terrain below, but it isn\'t crystal... a second glance shows a ribbon of blue meandering amongst some cliffs, edged by forest. Still, it looks as though it might be worth a closer look.')
/test put_2array('claim', 139, '2', 'Kesya As\'shoriah')
/test put_2array('claim', 139, '3', 'Push Tree Cross North (see note!) Right (see note!) Push Moss --> VEIN!')
/test put_2array('claim', 139, '4', 'none')
/test put_2array('claim', 139, '5', 'Once you go north you may have to go south again and just keep repeating until you fall. You HAVE to fall. This is a guarenteed injury claim! Just keep going right until you see \'A slight change in the air\'!! This and only this is the message you watch for. Anything else means you have to start over!! Now you have the vein! \'Dig\' to get out! At this point once you \'cross\' you can go \'cave\'.')
/test put_2array('claim', 139, '6', 'none')
/test put_2array('claim', 139, '7', 'yes')
/test put_2array('claim', 139, '8', 'no')
/test put_2array('claim', 139, '12', 'no')


/test put_2array('claim', 140, '0', 'Stone Ledge')
/test put_2array('claim', 140, '1', 'The twisted peaks and valleys of a large mountain range pass beneath. There is no apparent spot either large or flat enough to contemplate a landing, but it looks like it\'s worth a closer look.')
/test put_2array('claim', 140, '2', 'Dreatha, finished by Renata')
/test put_2array('claim', 140, '3', 'Secure Line! Climb Down (injury?) Stream Swim Crack --> VEIN!!')
/test put_2array('claim', 140, '4', 'none')
/test put_2array('claim', 140, '5', '\'Chimney\' is the way out!')
/test put_2array('claim', 140, '6', 'The way out is not always the way in.')
/test put_2array('claim', 140, '7', 'yes')
/test put_2array('claim', 140, '8', 'no')
/test put_2array('claim', 140, '9', 'secure line|climb down|stream|swim|crack')
/test put_2array('claim', 140, '10', 'leave sled|secure line|climb down|stream|swim|crack|enter vein|retrieve line')
/test put_2array('claim', 140, '11', 'leave vein|chimney|out|out|out|enter sled')
/test put_2array('claim', 140, '12', 'yes')


/test put_2array('claim', 141, '0', 'Sunburnt Desert')
/test put_2array('claim', 141, '1', 'A huge expanse of desert spreads out beneath you, heat waves buffeting the sled.')
/test put_2array('claim', 141, '2', 'Sindra')
/test put_2array('claim', 141, '3', 'Sandy Gully Broken Slopes Shallow Alcove Deeper Cave --> VEIN!')
/test put_2array('claim', 141, '4', 'none')
/test put_2array('claim', 141, '5', 'none')
/test put_2array('claim', 141, '6', 'none')
/test put_2array('claim', 141, '7', 'none')
/test put_2array('claim', 141, '8', 'no')
/test put_2array('claim', 141, '9', 'sandy gully|broken slopes|shallow alcove|deeper cave')
/test put_2array('claim', 141, '10', 'leave sled|sandy gully|broken slopes|shallow alcove|deeper cave|enter vein')
/test put_2array('claim', 141, '11', 'leave vein|out|out|out|out|enter sled')
/test put_2array('claim', 141, '12', 'yes')


/test put_2array('claim', 142, '0', 'Toothy Edge')
/test put_2array('claim', 142, '1', 'Jagged fingers of stone reach high into the sky. While the landscape is bleak, it might be worth a closer look.')
/test put_2array('claim', 142, '2', 'Lhovrik')
/test put_2array('claim', 142, '3', 'Down Cave Dry Cave --> VEIN!')
/test put_2array('claim', 142, '4', 'none')
/test put_2array('claim', 142, '5', 'none')
/test put_2array('claim', 142, '6', 'none')
/test put_2array('claim', 142, '7', 'none')
/test put_2array('claim', 142, '8', 'no')
/test put_2array('claim', 142, '9', 'down|cave|dry cave')
/test put_2array('claim', 142, '10', 'leave sled|down|cave|dry cave|enter vein')
/test put_2array('claim', 142, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 142, '12', 'yes')


/test put_2array('claim', 143, '0', 'Top of Cliff')
/test put_2array('claim', 143, '1', 'As you fly over the broad plain, you see a steep cliff below you. Looking closely, there appears to be a ledge about halfway down it.')
/test put_2array('claim', 143, '2', 'Jadenell')
/test put_2array('claim', 143, '3', 'Down Ledge Cliff Face --> VEIN!')
/test put_2array('claim', 143, '4', 'none')
/test put_2array('claim', 143, '5', 'Exiting the vein room could cause injury.')
/test put_2array('claim', 143, '6', 'none')
/test put_2array('claim', 143, '7', 'none')
/test put_2array('claim', 143, '8', 'no')
/test put_2array('claim', 143, '9', 'down|ledge|cliff face')
/test put_2array('claim', 143, '10', 'leave sled|down|ledge|cliff face|enter vein')
/test put_2array('claim', 143, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 143, '12', 'yes')


/test put_2array('claim', 144, '0', 'Top of the Cliff')
/test put_2array('claim', 144, '1', 'The ocean coast lies below, the rocky crags nearby hold promise of crystal.')
/test put_2array('claim', 144, '2', 'Mirelle')
/test put_2array('claim', 144, '3', 'Rocky Gorge Lamp on! Down East North --> VEIN!')
/test put_2array('claim', 144, '4', 'none')
/test put_2array('claim', 144, '5', 'none')
/test put_2array('claim', 144, '6', 'none')
/test put_2array('claim', 144, '7', 'none')
/test put_2array('claim', 144, '8', 'no')
/test put_2array('claim', 144, '9', 'rocky gorge|lamp on|down|east|north')
/test put_2array('claim', 144, '10', 'leave sled|rocky gorge|lamp on|down|east|north|enter vein|lamp off')
/test put_2array('claim', 144, '11', 'lamp on|leave vein|out|out|out|out|lamp off|enter sled')
/test put_2array('claim', 144, '12', 'yes')

; 
/test put_2array('claim', 145, '0', 'Top of Waterfall')
/test put_2array('claim', 145, '1', 'Far below, a gash of relative greenery in a rocky plateau catches your eye. Further down in the vegetated crevice, it looks like there might be a flat space to land.')
/test put_2array('claim', 145, '2', 'This claim was built by Initial design/concept by Corzaon; further building by Andreshella; final code by Bayr. Thanks to Aria and others for help.')
/test put_2array('claim', 145, '3', 'Secure Line Down (injury?) Pool Dive Tunnel Ledge --> VEIN!')
/test put_2array('claim', 145, '4', 'none')
/test put_2array('claim', 145, '5', 'There is a cutter damage/carton destruction exit on this claim.. be VERY VERY careful!')
/test put_2array('claim', 145, '6', 'none')
/test put_2array('claim', 145, '7', 'yes')
/test put_2array('claim', 145, '8', 'yes')
/test put_2array('claim', 145, '9', 'secure line|down|pool|dive|tunnel|ledge')
/test put_2array('claim', 145, '10', 'leave sled|secure line|down|pool|dive|tunnel|ledge|enter vein')
/test put_2array('claim', 145, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 145, '12', 'yes')


/test put_2array('claim', 146, '0', 'Top of the Hill')
/test put_2array('claim', 146, '1', 'Below are sprawling mudflats, broken only by one lone, jagged hill.')
/test put_2array('claim', 146, '2', 'Brightstar')
/test put_2array('claim', 146, '3', 'East Down --> VEIN!')
/test put_2array('claim', 146, '4', 'none')
/test put_2array('claim', 146, '5', 'none')
/test put_2array('claim', 146, '6', 'This claim is fairly straight forward. There is one dark exit that isn\'t indicated in any descriptions unless it is evening or night time.')
/test put_2array('claim', 146, '7', 'none')
/test put_2array('claim', 146, '8', 'no')
/test put_2array('claim', 146, '9', 'east|down')
/test put_2array('claim', 146, '10', 'leave sled|east|down|enter vein')
/test put_2array('claim', 146, '11', 'leave vein|out|out|enter sled')
/test put_2array('claim', 146, '12', 'yes')


/test put_2array('claim', 147, '0', 'Under the Erratic')
/test put_2array('claim', 147, '1', 'Snow covered tundra seems to stretch out endlessly.')
/test put_2array('claim', 147, '2', 'Ferren')
/test put_2array('claim', 147, '3', 'Open Tundra Pingo Crack --> VEIN!')
/test put_2array('claim', 147, '4', 'none')
/test put_2array('claim', 147, '5', 'none')
/test put_2array('claim', 147, '6', 'Try to get an angle on things. Everything looks the same when you\'re standing still.')
/test put_2array('claim', 147, '7', 'none')
/test put_2array('claim', 147, '8', 'no')
/test put_2array('claim', 147, '9', 'open tundra|pingo|crack')
/test put_2array('claim', 147, '10', 'leave sled|open tundra|pingo|crack|enter vein')
/test put_2array('claim', 147, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 147, '12', 'yes')


/test put_2array('claim', 148, '0', 'Undercut Ledge')
/test put_2array('claim', 148, '1', 'From up here you see a place where a stream has eaten away at the rock over the centuries.')
/test put_2array('claim', 148, '2', 'Alpin')
/test put_2array('claim', 148, '3', 'Lamp on! Muddy Hole Watery Cave Dive in --> VEIN!')
/test put_2array('claim', 148, '4', 'none')
/test put_2array('claim', 148, '5', 'Sled Stuck!! Night Lock Watch for rubble that buries sled! cutter damage possible!! Crevice exits INJURY!!')
/test put_2array('claim', 148, '6', 'Light is your friend')
/test put_2array('claim', 148, '7', 'none')
/test put_2array('claim', 148, '8', 'yes')
/test put_2array('claim', 148, '9', 'lamp on|muddy hole|watery cave|dive in')
/test put_2array('claim', 148, '10', 'leave sled|lamp on|muddy hole|watery cave|dive in|enter vein|lamp off')
/test put_2array('claim', 148, '11', 'lamp on|leave vein|out|out|out|lamp off|enter sled')
/test put_2array('claim', 148, '12', 'yes')


/test put_2array('claim', 149, '0', 'Uneven Gully')
/test put_2array('claim', 149, '1', 'A long eroded gully is laid out below, showing promising hiding places for crystal.')
/test put_2array('claim', 149, '2', 'Elisarra')
/test put_2array('claim', 149, '3', 'South Around Curve --> VEIN!')
/test put_2array('claim', 149, '4', 'none')
/test put_2array('claim', 149, '5', 'none')
/test put_2array('claim', 149, '6', 'none')
/test put_2array('claim', 149, '7', 'none')
/test put_2array('claim', 149, '8', 'no')
/test put_2array('claim', 149, '9', 'south|around the curve')
/test put_2array('claim', 149, '10', 'leave sled|south|around the curve|enter vein')
/test put_2array('claim', 149, '11', 'leave vein|out|out|enter sled')
/test put_2array('claim', 149, '12', 'yes')


/test put_2array('claim', 150, '0', 'Waterfall Valley')
/test put_2array('claim', 150, '1', 'Below, a large stream crosses the rocky terrain, spilling over the edge of a tiny canyon, and down into a tiny valley that one would easily miss if not following the stream\'s course.')
/test put_2array('claim', 150, '2', 'Astaris')
/test put_2array('claim', 150, '3', 'Yawning Cavern Up --> VEIN!')
/test put_2array('claim', 150, '4', 'none')
/test put_2array('claim', 150, '5', 'Exit from vein room has potential for injury.')
/test put_2array('claim', 150, '6', 'Watch your step in places!')
/test put_2array('claim', 150, '7', 'yes')
/test put_2array('claim', 150, '8', 'no') 
/test put_2array('claim', 150, '9', 'yc|up')
/test put_2array('claim', 150, '10', 'leave sled|yc|up|enter vein')
/test put_2array('claim', 150, '11', 'leave vein|out|out|enter sled')
/test put_2array('claim', 150, '12', 'yes')


/test put_2array('claim', 151, '0', 'Wide Ledge')
/test put_2array('claim', 151, '1', 'A dark, narrow ravine lies below. Very promising location for a vein of crystal to lurk.')
/test put_2array('claim', 151, '2', 'Aria')
/test put_2array('claim', 151, '3', 'Rocky Path North Take Water Out Ravine Use Water Crevice!')
/test put_2array('claim', 151, '4', 'none')
/test put_2array('claim', 151, '5', 'none')
/test put_2array('claim', 151, '6', 'You wonder how long that mudslide has been there for. What could have caused it, and what might it have buried.')
/test put_2array('claim', 151, '7', 'none')
/test put_2array('claim', 151, '8', 'no')
/test put_2array('claim', 151, '9', 'rocky path|north|take water|out|ravine|use water|crevice')
/test put_2array('claim', 151, '10', 'leave sled|rocky path|north|out|ravine|crevice|enter vein')
/test put_2array('claim', 151, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 151, '12', 'yes')
/test put_2array('claim', 152, '13', '5')


/test put_2array('claim', 152, '0', 'Wide Ledge')
/test put_2array('claim', 152, '1', 'Below, three huge mountains nearly obscure a tiny valley. If you circle a while, you might find a place to land.')
/test put_2array('claim', 152, '2', 'Sea_Keesna & Elissa')
/test put_2array('claim', 152, '3', 'Tree (injury!) River Dive/Falls --> VEIN! ')
/test put_2array('claim', 152, '4', 'none')
/test put_2array('claim', 152, '5', 'Cartons help you \'float\' out.')
/test put_2array('claim', 152, '6', 'none')
/test put_2array('claim', 152, '7', 'yes')
/test put_2array('claim', 152, '8', 'no')
/test put_2array('claim', 152, '9', 'tree|river|dive|falls')
/test put_2array('claim', 152, '10', 'leave sled|tree|river|dive|falls|enter vein')
/test put_2array('claim', 152, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 152, '12', 'no')



/test put_2array('claim', 153, '0', 'Wide Ledge')
/test put_2array('claim', 153, '1', 'Below you is a small valley wedged tightly between a tall, almost vertical cliff and part a rocky outcropping of mountain. From the looks of it this little valley was formed by some ancient waterway. The outcropping seems to have been the result the slow disintigration of a mountain top. It looks like it slid down and blocked the waterway. Large boulders are strewn about and towards the northern end of the little valley you see a flash of green. There is a wide ledge about halfway up the outcropping that looks sturdy enough to land a sled on.')
/test put_2array('claim', 153, '2', 'Rhianna')
/test put_2array('claim', 153, '3', 'Small Spring Dry Creek --> VEIN!')
/test put_2array('claim', 153, '4', 'none')
/test put_2array('claim', 153, '5', 'none')
/test put_2array('claim', 153, '6', 'none')
/test put_2array('claim', 153, '7', 'none')
/test put_2array('claim', 153, '8', 'no')
/test put_2array('claim', 153, '9', 'small spring|dry creek')
/test put_2array('claim', 153, '10', 'leave sled|small spring|dry creek|enter vein')
/test put_2array('claim', 153, '11', 'none')
/test put_2array('claim', 153, '12', 'no')


/test put_2array('claim', 154, '0', 'Wide ledge')
/test put_2array('claim', 154, '1', 'You see a possible landing site on the side of a sheer cliff. The area looks rough but promising.')
/test put_2array('claim', 154, '2', 'Emma')
/test put_2array('claim', 154, '3', 'Path Cliff Wall North --> VEIN!')
/test put_2array('claim', 154, '4', 'none')
/test put_2array('claim', 154, '5', 'Sled sticks with message \'The sled begins to slide precariously into the little valley as the ledge below you begins to crumble.\'')
/test put_2array('claim', 154, '6', 'none')
/test put_2array('claim', 154, '7', 'none')
/test put_2array('claim', 154, '8', 'yes')
/test put_2array('claim', 154, '9', 'path|cliff wall|north')
/test put_2array('claim', 154, '10', 'leave sled|path|cliff wall|north|enter vein')
/test put_2array('claim', 154, '11', 'leave vein|out|out|out|enter sled')
/test put_2array('claim', 154, '12', 'yes')


/test put_2array('claim', 155, '0', 'Windswept Ledge')
/test put_2array('claim', 155, '1', 'The mountain\'s top is buffeted by heavy gusts of wind, making landing difficult at best. But there does appear to be a ledge wide enough for a sled to land.')
/test put_2array('claim', 155, '2', 'Dariz')
/test put_2array('claim', 155, '3', 'se - wait! Sw - wait! Enter vein')
/test put_2array('claim', 155, '4', 'none')
/test put_2array('claim', 155, '5', 'Shortcut can result in injury')
/test put_2array('claim', 155, '6', 'Sometimes the shortest way is not the best way.')
/test put_2array('claim', 155, '7', 'none')
/test put_2array('claim', 155, '8', 'no')
/test put_2array('claim', 155, '9', 'se|sw')
/test put_2array('claim', 155, '10', 'leave sled|se|sw|enter vein')
/test put_2array('claim', 155, '11', 'leave vein|ne|nw|enter sled')
/test put_2array('claim', 155, '12', 'yes')
/test put_2array('claim', 155, '13', '16')


/test put_2array('claim', 156, '0', 'Valley Floor')
/test put_2array('claim', 156, '1', 'The cliff walls rise on either side as you pilot the sled to the floor of the valley.')
/test put_2array('claim', 156, '2', 'Emma')
/test put_2array('claim', 156, '3', 'Cave Entrance Large Chamber --> VEIN!')
/test put_2array('claim', 156, '4', 'none')
/test put_2array('claim', 156, '5', 'none')
/test put_2array('claim', 156, '6', 'none')
/test put_2array('claim', 156, '7', 'none')
/test put_2array('claim', 156, '8', 'no')
/test put_2array('claim', 156, '9', 'cave entrance|large chamber')
/test put_2array('claim', 156, '10', 'leave sled|cave entrance|large chamber|enter vein')
/test put_2array('claim', 156, '11', 'leave vein|ce|vf|enter sled')
/test put_2array('claim', 156, '12', 'yes')


/test put_2array('claim', 157, '0', 'Vile Swamp')
/test put_2array('claim', 157, '1', 'A river winds its way below, from this height, it looks promising. It\'s worth a lower look.')
/test put_2array('claim', 157, '2', 'Elissa')
/test put_2array('claim', 157, '3', 'Shore Cave --> VEIN!')
/test put_2array('claim', 157, '4', 'none')
/test put_2array('claim', 157, '5', 'none')
/test put_2array('claim', 157, '6', 'none')
/test put_2array('claim', 157, '7', 'none')
/test put_2array('claim', 157, '8', 'no')
/test put_2array('claim', 157, '9', 'shore|cave')
/test put_2array('claim', 157, '10', 'leave sled|shore|cave|enter vein')
/test put_2array('claim', 157, '11', 'leave vein|out|out|enter sled')
/test put_2array('claim', 157, '12', 'yes')


/test put_2array('claim', 158, '0', 'Seaside Cliff')
/test put_2array('claim', 158, '1', 'none')
/test put_2array('claim', 158, '2', 'Vyana Stewart and Bernadette Marshall')
/test put_2array('claim', 158, '3', 'view cliff // down // +view hole // +view cave // dark cave// +view hole //jump (keep jumping until you get it)')
/test put_2array('claim', 158, '4', 'none')
/test put_2array('claim', 158, '5', '?')
/test put_2array('claim', 158, '6', 'none')
/test put_2array('claim', 158, '7', 'none')
/test put_2array('claim', 158, '8', 'no')


/test put_2array('claim', 159, '0', 'Eastern Bowl')
/test put_2array('claim', 159, '1', 'Below you lies a large impact crater, a deep scar left upon the surface by a meteor ages ago. Sheltered by the steep walls from the full force of Ballybran\'s furious winds, a forest has grown and filled the bowl. Perhaps a search will reveal a clear place to land.')
/test put_2array('claim', 159, '2', 'Jayce')
/test put_2array('claim', 159, '3', 'light needed (injury without) in the cave. I found the vein at: 2xe,pool, down, crack (hidden) => vein')
/test put_2array('claim', 159, '4', 'none')
/test put_2array('claim', 159, '5', 'This is a very complex claim, the vein _may_ move around. Possible alternate path: Westx7 (end up in Sloping Tunnel). +view. +view jut. +view shadow. crevice. A second route: straight west towards the cave. From the Cave Entrance, east once and then south. Dark south exit into the forest which can lead to the vein.')
/test put_2array('claim', 159, '6', 'none')
/test put_2array('claim', 159, '7', 'yes')
/test put_2array('claim', 159, '8', 'yes')
/test put_2array('claim', 159, '12', 'no')


;;; The match for the vein needs to be confirmed
/test put_2array('claim', 160, '0', 'Ocean Shoreline')
/test put_2array('claim', 160, '1', 'A small beach lies between the ocean and the Brerrerton range.')
/test put_2array('claim', 160, '2', 'Vyana')
/test put_2array('claim', 160, '3', ' E, D, look ship, enter ship, +view, +view resin, apply resin, grab a jar, out, look dyke, dyke, apply resin, sail toward islands, leave sailboat, enter sailboat, sail toward ocean, wait for the boat to smash up in storm, go to dark sw exit. => vein')
/test put_2array('claim', 160, '4', 'none')
/test put_2array('claim', 160, '5', 'Take climbing gear off to go swimming')
/test put_2array('claim', 160, '6', 'Explore. Look at everything. Look for clues in the text. Be nice and put the boat back in the dry cavern if you can\'t find the claim. If someone hasn\'t been nice, and there\'s no boat in the dry cavern, do a \'return\' there. If the alternate route to the claim has not yet been opened, the boat will be blown back in by the wind.')
/test put_2array('claim', 160, '7', 'none')
/test put_2array('claim', 160, '8', 'no')
/test put_2array('claim', 160, '9', 'enter sled|drop climb|out|east|down|look ship|enter ship|+view|+view resin|apply resin|grab a jar|out|look dyke|dyke|apply resin|enter sailboat|sail toward islands|leave sailboat|enter sailboat|sail toward ocean|sail toward islands|sail toward ocean')
/test put_2array('claim', 160, '10', 'leave sled|narrow tunnel|enter vein')
/test put_2array('claim', 160, '11', 'leave vein|out|enter sled')
/test put_2array('claim', 160, '12', 'yes')
/test put_2array('claim', 160, '13', '5')


/test put_2array('claim', 161, '0', 'Caldera\'s Rim')
/test put_2array('claim', 161, '1', 'Far below, a cobalt blue lake and a tiny island are centered in the caldera of an extinct volcano.')
/test put_2array('claim', 161, '2', 'Hannah and Bremen')
/test put_2array('claim', 161, '3', 'ne, se, +view dead trees, +view vines, build raft, float raft, +view summit, summit => vein')
/test put_2array('claim', 161, '4', 'none')
/test put_2array('claim', 161, '5', 'none')
/test put_2array('claim', 161, '6', 'Yes, there are dark exits around. And watch your step!')
/test put_2array('claim', 161, '7', 'none')
/test put_2array('claim', 161, '8', 'no')
/test put_2array('claim', 161, '9', 'ne|se|+view dead trees|+view vines|build raft|float raft|+view summit|summit')
/test put_2array('claim', 161, '10', 'no')
/test put_2array('claim', 161, '11', 'none')
/test put_2array('claim', 161, '12', 'no')
/test put_2array('claim', 161, '13', '10')


/test put_2array('claim', 162, '0', 'Eroded Desert Canyon')
/test put_2array('claim', 162, '1', 'The flat and featureless desert stretches below your sled in all directions. But wait, there seems to be a large crack in the ground. Might be worth investigating.')
/test put_2array('claim', 162, '2', 'Kedra')
/test put_2array('claim', 162, '3', 'W, secure line, D, E => vein')
/test put_2array('claim', 162, '4', 'none')
/test put_2array('claim', 162, '5', 'none')
/test put_2array('claim', 162, '6', 'Gather information as you go. It might be useful later.')
/test put_2array('claim', 162, '7', 'none')
/test put_2array('claim', 162, '8', 'no')
/test put_2array('claim', 162, '9', 'west|secure line|down|east')
/test put_2array('claim', 162, '10', 'leave sled|west|secure line|down|east|enter vein')
/test put_2array('claim', 162, '11', 'leave vein|west|secure line|up|east|enter sled')
/test put_2array('claim', 162, '12', 'yes')


/test put_2array('claim', 163, '0', 'Mouth of the valley')
/test put_2array('claim', 163, '1', 'Looking below into the rocky valley, you think that although the landscape is harsh, there might possibly be a crystal vein hidden below.')
/test put_2array('claim', 163, '2', 'Prospero')
/test put_2array('claim', 163, '3', 'N, W => vein')
/test put_2array('claim', 163, '4', 'none')
/test put_2array('claim', 163, '5', 'none')
/test put_2array('claim', 163, '6', 'Nothing tricky about this claim')
/test put_2array('claim', 163, '7', 'none')
/test put_2array('claim', 163, '8', 'no')
/test put_2array('claim', 163, '9', 'north|west')
/test put_2array('claim', 163, '10', 'leave sled|north|west|enter vein')
/test put_2array('claim', 163, '11', 'leave vein|out|out|enter sled')
/test put_2array('claim', 163, '12', '')


;;; This claim by Jayce has multiple starting rooms. It's the same claim but needs different entries in the array for the macros to work.
/test put_2array('claim', 164, '0', 'Open Meadow')
/test put_2array('claim', 164, '1', 'Below you lies a large impact crater, a deep scar left upon the surface by a meteor ages ago. Sheltered by the steep walls from the full force of Ballybran\'s furious winds, a forest has grown and filled the bowl. Perhaps a search will reveal a clear place to land.')
/test put_2array('claim', 164, '2', 'Jayce')
/test put_2array('claim', 164, '3', 'light needed (injury without) in the cave. I found the vein at: 2xe,pool, down, crack (hidden) => vein')
/test put_2array('claim', 164, '4', 'none')
/test put_2array('claim', 164, '5', 'This is a very complex claim, the vein _may_ move around. Possible alternate path: Westx6 (end up in Sloping Tunnel). +view. +view jut. +view shadow. crevice. A second route: straight west towards the cave. From the Cave Entrance, east once and then south. Dark south exit into the forest which can lead to the vein.')
/test put_2array('claim', 164, '6', 'none')
/test put_2array('claim', 164, '7', 'yes')
/test put_2array('claim', 164, '8', 'yes')


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Peter's Emote Match for MUDs
;;;

/def -F -p10 -mregexp -t"^:(.*)$" emote_match = \
    /send -w emote {P1}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Original by Andrew C.M. McClintock <andrewm at tiger dot hsc dot edu>
;;; corrections by Ken Keys <hawkeye at commercewave dot com>
;;; Modifications from Gwen Morse to remove alias calls.
;;;
;;; Base do_eval_list written by Andrew McClintock
;;; Re-written by Brian Rice @ Tinyfugue Mailing list
;;; to pause and step through in 3 second increments.
;;; Modified by Gwen Morse to work on CrystalMUSH, use a pipe | as delimiter
;;; and to have a configurable time pause
;;;
;;
;; For CrystalMUSH auto-walkies to and from veins

/def do_eval_list = \
  /let i 0 %; \
  /if (regmatch('~~',{*})) \
    /let var %PR%; \
    /let args %PL%; \
  /else \
    /let var 2%; \
    /let args %{*}%; \
  /endif%;\
  /if ((i:= strchr( args,"|")) >= 0 ) \
    /eval $[ substr( args , 0 , i ) ] %; \
    /let args $[ substr( args , i + 1 ) ] %; \
    /repeat -w -%{var} 1 /do_eval_list %{args}~~%{var}%; \
  /else \
    /eval %{args} %; \
  /endif

;;; To use:
;;; Type "/walkies stake" to get to the vein from the first room.
;;;   Many claims have a different path before and after the vein is staked.
;;; Type "/walkies sled" to walk from the staked vein to the sled
;;; Type "/walkies vein" to walk from the sled to the staked vein

; to alias 'walkies' to the more mature 'walker'
;/def -i walker = /walkies

/def walkies = \
  /unset WALKER_STRING%;\
  /unset DELAY%;\
;@@ to get to the vein from the first room @@;%;\
  /if (regmatch('stake',%{*})) \
    /test WALKER_STRING := get_2array("claim", "%{CLAIM_NUM}", "9")%;\
    /test DELAY := get_2array("claim", "%{CLAIM_NUM}", "13")%;\
;@@ to walk from the sled to the staked vein @@;%;\
  /elseif (regmatch('vein',%{*})) \
    /test WALKER_STRING := get_2array("claim", "%{CLAIM_NUM}", "10")%;\
    /test DELAY := get_2array("claim", "%{CLAIM_NUM}", "13")%;\
;@@ to walk from the staked vein to the sled @@;%;\
  /elseif (regmatch('sled',%{*})) \
    /test WALKER_STRING := get_2array("claim", "%{CLAIM_NUM}", "11")%;\
    /test DELAY := get_2array("claim", "%{CLAIM_NUM}", "13")%;\
  /else \
    /echo -w TFRC: Auto_Walkies function not sent valid information. %{*}%;\
  /endif%;\
  /if (strlen(DELAY) >= "1") \
    /repeat -w -2 1 /do_eval_list %{WALKER_STRING}~~%{DELAY}%;\
  /else \
    /repeat -w -2 1 /do_eval_list %{WALKER_STRING}%;\
  /endif

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Spammy spammy Stuff
;;;

/def lecture = \
    /quote -w${world_name} pose `/%{1}

;;; Sorting lecture for recruits (sorting_recruit)
/def sr1 = /echo smiles at the recruits, "I am [u(me/full_name)], and I will be taking you through the techniques of packing and sorting. This information will be useful to any of those of you who end up adapting as Singers and Sorters."%;\
/def sr2 = /echo continues, "Crystals are, as you know, cut in the ranges and then transported back to the center. To do this the Singer must 'get' the crystal and put it carefully in a carton ('give <carton>=crystal'). It's vitally important to remember to pack each crystal immediately to prevent crystal thrall. Only five crystals will fit in the cartons in the sleds, more can be stored in storage cartons available here at the center. (OOC note: when a new singer is being shepherded the old singer must be the one to get the cartons from the sled and put the first crystal in, otherwise ownership problems arise.)"%;\
/def sr3 = /echo glance's flicks from the recruits to their ubiquitous datapads, waiting until %s sees some industrious data-entry before %s continues.
/def sr4 = /echo smiles, "The crystal is then brought back here to the center and placed in the Cargo Storage area for sorting. Crystal not ready for sorting is stored in the Crystal Shed. Once a singer is happy with his or her cut they either notify the sorters, or try to catch one on duty. The crystal is then brought to one of the sorting tables."%;\
/def sr5 = /echo looks round at the recruits, "Frequently there will be more than one carton of crystals to be brought in to sorting. There is a sorting equipment vendor in Main Sorting which you can rent carts from, by the hour. This allows you to move more than one carton at a time. Once the cartons have been brought here, they are unpacked and the Sorter takes a first look at the crystals. The first consideration is to find the scale they were cut in and set the table accordingly."%;\
/def sr6 = /echo looks at the table and continues, "The next step is to sort the crystals into groups. All crystals in a group must have the same shape, shade and color. Size and clarity are variable but the other factors must be constant. The relative values of colors, shapes and sizes depend on the market." %S shows the recruits how to access the 'crystal market' on a nearby terminal. "Shade and Clarity values are independent of the market since a good shade and a good clarity are always valuable, poor shades or flawed crystals are always priced cheaply."%;\
/def sr7 = /echo looks up from her lecture notes, "The groups of crystals must be one of these groupings:\%r\%rSingle Crystal\%r3 in Sequence: do mi so\%r4 in sequence: do mi so do\%r5 in Sequence: do mi so ti do\%rFull Octave.\%r\%rThe value of the grouping is evaluated at the level of the worst attributes of the group, so if in a grouping there is a majorly flawed crystal and a bottom-market tiny crystal for example, the group will be evaluated as if all the crystals were tiny with major flaws. This can lead to a grouping of 3 crystals being worth more than if you add another. It does pay to keep this in mind."%;\
/def sr8 = /echo turns back to the table, "So the sorter has to look at all the crystals ('list all') and determine and select the best crystals to group. Once the sorter has found a grouping they can evaluate it."%;\
/def sr9 = /echo smiles, "Once the group has been evaluated and the grouping meets with the singer's and sorter's approval it is committed. This process continues until all the crystal on the table has been sorted into groups. Any remaining crystals are either sold separately or repacked so that the singer may fill in the gaps. All the assigned groups are then sold."%;\
/def sr10 = /echo continues, "Another point of interest is special orders, there is a market terminal on level 5 and here in Main Sorting, which tells you what orders have come in....If a singer manages to bring in that order they get a chit from the machine which they take to the sorter along with the grouping. These groupings must be equal to or better than the specified clarity for the order. A bonus is then paid to that Singer on top of what the crystal is worth....the standard tithe does not apply to any special order bonus."%;\
/def sr11 = /echo looks at you seriously, "Now...a last warning, do not under any circumstances sing, hum, whistle, sigh or otherwise make a musical sound around raw crystal...Never! Doing this can cause crystal to sour and that will cause the temper of the singer to sour. If crystals get damaged this way the culprit is liable to attract fines or suspension."%;\
/def sr12 = /echo smiles, "Are there any questions?"

;;; /def sorting_adapt = \
/def sa1 = /echo glances around at the newly adapted sorters, "I am [u(me/full_name)], a fully qualified Senior Sorter, and I'm here to teach you some of the practicalities of packing and sorting crystal."%;\
/def sa2 = /echo smiles, "There are the training tables you can practice on in level 8, to give you experience before attempting a sort of live crystal."%;\
/def sa3 = /echo adds, "You may wish to consider purchasing a sorting calculator from the equipment vendor in Main Sorting. These devices aid in working out the relative values of various groupings, and are useful to both Singers and Sorters. There are also sorting carts for rental by the hour which allow you to move more than one carton at a time."%;\
/def sa4 = /echo settles into %p lecture, "It is possible to use a different scale than what the crystals were cut in, to make a chord or sequence which would otherwise not be possible, and the ability to spot those alternate groupings is  highly prized in the most competent Sorters."%;\
/def sa5 = /echo glances around "There are two holding areas for cartons. First is Cargo Storage, where cartons containing crystals ready to be sorted are placed. The second is The Shed, where cartons containing incomplete cuts, or cuts waiting for the right market, are placed. Every carton in the shed carries with it a storage fee. Unless carton notes state otherwise, crystal in the Shed may be sorted when the market is right."%;\
/def sa6 = /echo motions to a nearby terminal, "Please be aware of Singer preferences." %S grimaces faintly, "Often Singers can be picky over who deals with their crystal, and in what manner. <OOC: +lhelp in the sorting area will give you the commands for this> Notes are also sometimes left on the cartons detailing what the Singer wants done with their crystal."%;\
/def sa7 = /echo smiles, "Now, to write notes on a carton you have just repacked, just 'write carton notes <carton name>=<notes>'. Please also be considerate to your fellow sorters: if someone else has presorted the crystal, leave it to them to do the final sort for sale unless they've indicated they don't mind others doing their sale for them. (OOC: 'list free stamps')%;\
/def sa8 = /echo adds, "A few last things: make sure you notify the Singer (via +mail) of the results of your sort if they are not present at the time. Cartons in the Shed should not be touched without the Singer's permission, though it is often a good idea to check which cartons are ripe for market, and ask the Singer if you can sort them. And you may find it easier to control your new-found enhanced vision if you widen your eyes like so...." %S demonstrates, widening %p eyes as the red film comes down over them. %S then blinks them away.%;\
/def sa9 = /echo looks at you seriously, "Now...a last warning, do not under any circumstances sing, hum, whistle, sigh or otherwise make a musical sound around raw crystal...Never! Doing this can cause crystal to sour and that will cause the temper of the singer to sour. If crystals get damaged this way the culprit is liable to attract fines or suspension."
/def sa10 = /echo smiles, "Are there any questions?"

;;; Survival lecture for recruits
/def sur1 = /echo smiles at the recruits, "I am [u(me/full_name)], and today's lecture is on a topic most of you will find of interest, how to stay alive out in the Ranges. While this lecture is intended to provide information for would-be Singers, parts of it are useful to anyone who travels from this facility."%;\
/def sur2 = /echo says, "The first and most important point is to heed the storm warnings from Weather Control and from your symbiont. The largest single cause of death here on Ballybran is Singers playing fast and loose with an approaching mach storm, trying to cut that last crystal to finish a grouping."%;\
/def sur3 = /echo continues, "The sleds are equipped with a wide array of warning devices, ranging from a powerful external klaxon up to nerve ticklers connected to the pilot's chair. These devices are activated by weather alert transmissions broadcast from the orbiting satellites."%;\
/def sur4 = /echo looks at the class and says, "Remember that weather forecasting on Ballybran is an inexact science. Although Meteorology constantly analyzes global weather patterns and tries to predict the movements and severity of storms, the storms themselves do not always cooperate."%;\
/def sur5 = /echo says, "Weather sensitivity is a common adaptation among Singers, and there have been many recorded instances where the Singer's weather sense alerted them of an approaching storm that was both more powerful and faster than the forecast by Meteorology at the time."%;\
/def sur6 = /echo takes a sip of water before introducing the next topic, "There are other dangers on Ballybran beside its famous storms. While much of the ranges are geologically stable, the storms can and do wear away at mountainsides, ledges, and valleys."%;\
/def sur7 = /echo says, "Select sled landing sites with care, and proceed cautiously when scampering about in the ranges. If you're injured while exploring, you'll have to return to your sled to summon medical help. It's also a good idea to camouflage your sled so it's not visible from an aerial view. It's not technically claimjumping if another Singer lands on a claim site before you've staked it with your paintmark."%;\
/def sur8 = /echo looks intently at the class and says, "Pack crystal as soon as it is cut, otherwise you risk going into crystal thrall. Singers have perished in storms that overran them because they ignored storm warnings while locked in thrall."%;\
/def sur9 = /echo continues. "Practice on the sled simulators until you can practically fly in your sleep. Staying on course and landing the sim-sled in bad weather may be difficult, but it's nothing compared to landing a real sled in an onrushing mach storm when you're dead tired from cutting too long."%;\
/def sur10 = /echo looks out across the room, and says forcefully, "Perhaps the most effective survival 'technique' is right inside you: your symbiont. While it isn't sentient it can give you subconscious warnings about things you'd ignore otherwise."%;\
/def sur11 = /echo straightens up and says, "That brings us to the end of this lecture. Are there any final questions?"

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; TF PYTHON
;;;
;;; Load python modules
;;;

;;; This space reserved for later.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;  Marketing CM Macros
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; CrystalMUSH Marketing loop to fill SOs
/def -i -F -T"tiny.mush.cm.market" -p55 -mglob -t'You tap a few keys, accessing the most recent special orders.' cm_SOcreate = \
  /send -w new singer order


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; Put a semi-colon (;) in front of this /set if you don't want to see
;;; the last time this tfrc file was modified each time you run tf.
/set LASTMOD

;;; Run help-list once each sessions
/helplist

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                            END OF FILE                            ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                            END OF FILE                            ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;