Wyrel's ToriMUD Stuff

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

;; Wyrel @ ToriMUD forums
;; http://www.torilmud.org/phpBB3/viewtopic.php?f=4&t=6031&view=previous

;;AFK Proc

/def -p1 -mglob -F -t'*tells you*' tell_page = \
/if /test "%tell_page"=~"on"%; \
/then \
tell %1 %playername is afk, I'm paging him now.%; \
/beep%; \
/endif
/def -p1 -mglob -h'SEND {afk}*' afk_alias = \
/set afk=on%; \
/set tell_page=on%; \
tog afk
/def -p1 -mglob -h'SEND {back}*' back_alias = \
/set afk=off%; \
/set tell_page=off%; \
tog afk%;
/def -p1 -mglob -t'*AFK toggled on*' afk_proc = \
/if /test "%afk" =~ "on"%; \
/then sc%; \
/repeat -30 1 /afk_proc%; \
/endif


;;;Food Macros (seperate listing in case of future auto eat/drink setup)

/def -p1 -mglob -h'SEND {food}' food_alias = drink%; eat
/def -p1 -mglob -h'SEND {drink}' drink_alias = \
/if /test "%pack"=~"on"%; \
/then \
rem sack%; get flagon sack%; drink flagon%; !%; \
put flagon sack%; wear sack%; /else get flagon sack%; \
drink flagon%; drink flagon%; put flagon sack%; \
/endif
/def -p1 -mglob -h'SEND {eat}' eat_alias = \
/if /test "%pack"=~"on"%; \
/then \
rem sack%; get bbq sack%; eat bbq%; \
put partial sack%; wear sack%; \
/else \
get bbq sack%; eat bbq%; put partial sack%; \
/endif


;;;Spell Out Alerts

/def -p1 -mglob -t'*You feel less wooden*' bark_out = \
/beep%; \
/echo -aCbgyellow Bark out!%; emote has lost his wooden feeling.
/def -p1 -mglob -t'*Evil things appear more threatening*' protevil_out = \
/beep%; \
/echo -aCbgyellow Protection from evil is out!
/def -p1 -mglob -t'*Your magic armor fades away*' armor_out = \
/beep%; \
/echo -aCbgyellow Armor is out!
/def -p1 -mglob -t'*You feel less blessed*' bless_out = \
/beep%; \
/echo -aCbgyellow Bless is out!


;;;Spellcast Macros

/def -p1 -mglob -h'SEND {cc} *' curecritic_alias = cas 'cure c' %2
/def -p1 -mglob -h'SEND {bless} *' bless_alias = cas 'bless' %2
/def -p1 -mglob -h'SEND {armor} *' armor_alias = cas 'armor' %2
/def -p1 -mglob -h'SEND {prot} *' protevil_alias = cas 'prot' %2


;;;Weapon Macros

/def -p1 -mglob -t'*You swing _really_ badly, sending your*' fumble_trig = \
get %current_weapon%; save%; wield %current_weapon
/def set1h = /set oneh_weapon=%1
/def set2h = /set twoh_weapon=%1
/def set2h2 = /set twohtwo_weapon=%1
/def setwater = /set water_weapon=%1
/def -p1 -mglob -h'SEND {1h}' 1h_alias = \
/if /test "%pack"=~"on"%; \
/then packoff%; \
/endif%; \
/if /test "%weapon_type"=~"2h"%; \
/then /2h_remove%; \
/endif%; \
/if /test "%weapon_type"=~"2h2"%; \
/then /2h2_remove%; \
/endif%; \
/if /test "%weapon_type"=~"water"%; \
/then /water_remove%; \
/endif%; \
/1h_wield
/def -p1 -mglob -h'SEND {2h}' 2h_alias = \
/if /test "%pack"=~"on"%; \
/then packoff%; \
/endif%; \
/if /test "%weapon_type"=~"1h"%; \
/then /1h_remove%; \
/endif%; \
/if /test "%weapon_type"=~"2h2"%; \
/then /2h2_remove%; \
/endif%; \
/if /test "%weapon_type"=~"water"%; \
/then /water_remove%; \
/endif%; \
/2h_wield
/def -p1 -mglob -h'SEND {2h2}' 2h2_alias = \
/if /test "%pack"=~"on"%; \
/then packoff%; \
/endif%; \
/if /test "%weapon_type"=~"1h"%; \
/then /1h_remove%; \
/endif%; \
/if /test "%weapon_type"=~"2h"%; \
/then /2h_remove%; \
/endif%; \
/if /test "%weapon_type"=~"water"%; \
/then /water_remove%; \
/endif%; \
/2h2_wield
/def -p1 -mglob -h'SEND {water}' water_alias = \
/if /test "%pack"=~"on"%; \
/then packoff%; \
/endif%; \
/if /test "%weapon_type"=~"1h"%; \
/then /1h_remove%; \
/endif%; \
/if /test "%weapon_type"=~"2h"%; \
/then /2h_remove%; \
/endif%; \
/if /test "%weapon_type"=~"2h2"%; \
/then /2h2_remove%; \
/endif%; \
/water_wield
/def 1h_wield = \
/if /test "%pack"=~"on"%; \
/then packoff%; \
/endif%; \
/set current_weapon=%oneh_weapon%; \
/set weapon_type=1h%; \
get %current_weapon sack%; \
wield %current_weapon%; \
get shield sack%; \
wear shield
/def 2h_wield = \
/if /test "%pack"=~"on"%; \
/then packoff%; \
/endif%; \
/set current_weapon=%twoh_weapon%; \
/set weapon_type=2h%; \
get %current_weapon sack%; \
wield %current_weapon
/def 2h2_wield = \
/if /test "%pack"=~"on"%; \
/then packoff%; \
/endif%; \
/set current_weapon=%twohtwo_weapon%; \
/set weapon_type=2h2%; \
get %current_weapon sack%; \
wield %current_weapon
/def water_wield = \
/if /test "%pack"=~"on"%; \
/then packoff%; \
/endif%; \
/set current_weapon=%water_weapon%; \
/set weapon_type=water%; \
get %current_weapon sack%; \
wield %current_weapon%; \
get shield sack%; \
wear shield
/def 1h_remove = \
/if /test "%pack"=~"on"%; \
/then packoff%; \
/endif%; \
remove %current_weapon%; \
put %current_weapon sack%; \
remove shield%; \
put shield sack
/def 2h_remove = \
/if /test "%pack"=~"on"%; \
/then packoff%; \
/endif%; \
remove %current_weapon%; \
put %current_weapon sack
/def 2h2_remove = \
/if /test "%pack"=~"on"%; \
/then packoff%; \
/endif%; \
remove %current_weapon%; \
put %current_weapon sack
/def water_remove = \
/if /test "%pack"=~"on"%; \
/then packoff%; \
/endif%; \
remove %current_weapon%; \
put %current_weapon sack%; \
remove shield%; \
put shield sack


;;;In-Combat Triggers (auto-stand, auto-bash, auto re-assist, etc..)

/def -p1 -mglob -t'*avoids your bash, you topple over*' = st
/def -p1 -mglob -t'*sends you sprawling*' = st
/def bashon = /set bash=on
/def bashoff = /set bash=off
/def -p1 -mglob -t'*You*to your feet*' auto_bash = \
/if /test "%bash"=~"on"%; \
/then /repeat -1 1 bash%; \
/endif
/def -p1 -mglob -h'SEND {reassist}*' re-assist_toggle = \
/if /test "%rescue_assist"=~"on"%; \
/then \
/set rescue_assist=off%; \
/echo Automatic Re-Assist Disabled!%; \
/else \
/set rescue_assist=on%; \
/echo Automatic Re-Assist Enabled!%; \
/endif
/def -p1 -mregexp -t'You are rescued by (.*), you' rescue_re-assist = \
/if /test "%rescue_assist"=~"on"%; \
/then ass %P1%; \
/endif


;;;Convenience Macros (Order Followers, Re-edit tool, packon/packoff, etc..)

/def reeditd = /grab $(/cddr $(/list -i - %{L-@}))%; /undef %1
/def -p1 -mglob -h'SEND {of}*' of_alias = o followers %-1
/def -p1 -mglob -h'SEND {packon}*' wear_pack = \
/set pack=on%; \
rem cloak%; put cloak pack%; wear pack
/def -p1 -mglob -h'SEND {packoff}*' remove_pack = \
/set pack=off%; \
rem pack%; get cloak pack%; wear cloak
/def ettercap = \
/load speedwalk.tf%; /speedwalk%; 6ds2w4s3w3sesd6se%; \
open door east%; e%; open door east%; e2s
/def pracall = \
prac bash%; prac bash%; \
prac rescue%; prac rescue%; \
prac double%; prac double%; \
prac dodge%; prac dodge%; \
prac hitall%; prac hitall%; \
prac disarm%; prac disarm%; \
prac parry%; prac parry%; \
prac medi%; prac medi%; \
prac mount%; prac mount%; \
prac switch%; prac switch%; \
prac offense%; prac offense%; \
prac riposte%; prac riposte%; \
prac quick%; prac quick%; \
prac spellcast generic%; prac spellcast generic%; \
prac spellcast heal%; prac spellcast heal%; \
prac spellcast prot%; prac spellcast prot%; \
prac 1h slash%; prac 1h slash%; \
prac 1h blud%; prac 1h blud%; \
prac 2h slash%; prac 2h slash%; \
prac 2h misc%; prac 2h misc%; \
prac blindfighting%; prac blindfighting%;
/def -p1 -mglob -h'SEND {settings}' settings_alias = /set rescue_assist%; \
/set bash%; \
/set autocoin%; \
/set autoloot%; \
/set autosplit%; \
/set copperdrop%; \
/set coppergive%; \
/set copperchannel%; \
/set coppertarget%; \
/set weapon_type%; \
/set current_weapon%; \
/set oneh_weapon%; \
/set twoh_weapon%; \
/set twohtwo_weapon%; \
/set water_weapon%; \
/set pack


;;;Toggleable Autoloot/split

/def -p1 -mregexp -F -t' ([^ ]+) silver coins*' silver_split = \
/if /test "%autosplit"=~"on"%; \
/then \
/if /test "%1"=~"There"%; \
/then split %P1 s%; \
/endif%; \
/endif
/def -p1 -mregexp -F -t' ([^ ]+) gold coins*' gold_split = \
/if /test "%autosplit"=~"on"%; \
/then \
/if /test "%1"=~"There"%; \
/then split %P1 g%; \
/endif%; \
/endif
/def -p1 -mregexp -F -t' ([^ ]+) copper coins*' copper_drop = \
/if /test "%copperdrop"=~"on"%; \
/then \
/if /test "%1"=~"There"%; \
/then \
%copperchannel %P1 c %coppertarget%; \
/endif%; \
/endif
/def -p1 -mregexp -F -t' ([^ ]+) platinum coins*' platinum_split = \
/if /test "%autosplit"=~"on"%; \
/then \
/if /test "%1"=~"There"%; \
/then split %P1 p%; \
/endif%; \
/endif
/def -p1 -mglob -h'SEND {as}*' autosplit_toggle = \
/if /test "%autosplit"=~"on"%; \
/then /set autosplit=off%; /echo Autosplit Disabled!%; \
/else /set autosplit=on%; /echo Autosplit Enabled!%; \
/endif
/def -p1 -mglob -h'SEND {al}*' autoloot_toggle = \
/if /test "%autoloot"=~"on"%; \
/then /set autoloot=off%; /echo Autoloot Disabled!%; \
/else \
/set autoloot=on%; \
/set autocoin=off%; \
/echo Autoloot Enabled!%; \
/endif
/def -p1 -mglob -h'SEND {ac}*' autocoin_toggle = \
/if /test "%autocoin"=~"on"%; \
/then /set autocoin=off%; /echo Auto Coin Loot Disabled!%; \
/else \
/set autocoin=on%; \
/set autoloot=off%; \
/echo AutoCoin Loot Enabled!%; \
/endif
/def -p1 -mglob -h'SEND {cd}*' copperdrop_toggle = \
/if /test "%copperdrop"=~"on"%; \
/then /set copperdrop=off%; /echo Copperdrop Disabled!%; \
/else \
/set copperdrop=on%; \
/set coppergive=off%; \
/set copperchannel=drop%; \
/echo Copperdrop Enabled!%; \
/endif
/def -p1 -mglob -h'SEND {cg} *' coppergive_toggle = \
/if /test "%coppergive"=~"on"%; \
/then /set coppergive=off%; /echo Coppergive Disabled!%; \
/else \
/set coppergive=on%; \
/set copperdrop=off%; \
/set copperchannel=give%; \
/set coppertarget=%2%; \
/echo Coppergive Enabled!%; \
/echo Copper will be routed to %2!%; \
/endif
/def -p1 -mglob -F -t'*You receive your share of exp*' autoloot_trig = \
/if /test "%autoloot"=~"on"%; \
/then get all corpse%; save%; \
/endif%; \
/if /test "%autocoin"=~"on"%; \
/then get coins corpse%; save%; \
/endif


;;;Hilites

/def -p1 -ahCbggreen -mglob -F -t'*tells you*'
/def -p1 -ahCbgblue -mglob -F -t'*clambers*feet*'
/def -p1 -ahCbgblue -mglob -F -t'*rises*feet*'
/def -p1 -ahCbgred -mglob -F -t'*starts casting an offensive spell*'
/def -p1 -ahCbgred -mglob -F -t'*sends you sprawling*'
/def -p1 -ahCbgred -mglob -F -t'*OUCH*'


;;;Commands Executed Upon Loading

/set playername=Wyrel
/set bash=off
/set bash
/set autoloot=on
/set autoloot
/set autocoin=off
/set autocoin
/set autosplit=off
/set autosplit
/set copperdrop=on
/set copperdrop
/set coppergive=off
/set coppergive
/set copperchannel=drop
/set copperchannel
/set coppertarget=none
/set coppertarget
/set rescue_assist=on
/set rescue_assist
/set1h giantbane
/set oneh_weapon
/set2h holy
/set twoh_weapon
/set2h2 broadsword
/set twohtwo_weapon
/setwater scimitar
/set water_weapon
/set current_weapon=holy
/set current_weapon
/set weapon_type=2h
/set weapon_type
/set pack=off
/set pack




;************************* STANDARD TF MACROS *********************************
;
; cherzra@ ToriMUD Forum
;
;; There are many good standard macro's, let's use those!
;; Screw the non-load and polishing policies...
/load at.tf
/load replace.tf
/load tr.tf
/load kbstack.tf
;;volgende twee regels zijn voor tab completion
/load complete.tf

/set completion_list=ezzallixxell syssok lissrissnak mazzilldorden draakchadra ssnyss thuraneer ssiwwiratu ssolsinorr dromgringita vsrrinaek azzxarrum ossisna nissimmek

;/~loaded alias.tf
;; /alias <name> <command>
/def -i alias = /def -i -ag -h"SEND ^%1( |$$)" alias_%1 = %-1 %%PR

;; My own echo...
/def -i mesg = \
/if (${world_name}=~"") /echo -ah - %0%;/else /echo -w -ah - %0%;/endif

;; For one-world-only macros (macro followed by world name)
/def -i iswmacro = \
/test ismacro(strcat("%0", "$(/escape \(\) ${world_name})"))

;; Ignore colour sequences
/def -i esc = \
/let tmp=%0%;\
/while (regmatch("^[\[[0-9]*m",tmp)) \
/let tmp=$[strcat(PL,PR)]%;\
/done%;\
/echo %tmp

;; Capitalize
/def -i capitalize = \
/echo $[strcat(toupper(substr({*}, 0, 1)), tolower(substr({*}, 1)))]

;****************************** TRIGGERS **************************************

;; Automatic revive-from-link-dead
/def -i -F -ag -h"PROMPT ^Throw the other copy out" auto_revive = y%;l

;; Automatic display mail like other echos
/def -i -F -ah -hMAIL mailincolour

;************************* SEQUENTIAL ACTIONS *********************************

;; The respective commands will call
;; /finished aloot, asell, packsell, hunt, akill or aboard when finished
;; You can use this function like:
;; /seq /aloot%;/walk n 3e%;/akill orc%;/wait akill%;/return
/def -i seq = \
/undef finished%;\
/mesg *CONTINUING WITH %**%;\
/if (regmatch('(%;)?/wait ([a-z]*)(%;)?',%*))%;\
/if (%P2 =~ "") \
/def -i finished = /seq '%PR'%;\
/else \
/def -i finished = \
/if (%%* =~ "%P2") /test $$[seq('%PR')]%%;/endif%;\
/endif%;\
/eval %PL%;\
/else \
/def -i finished = /test 1%;\
/eval %*%;\
/endif

;; /finished is used in combination with /seq, don't remove!
/def -i finished = /test 1

/def -i search = \
/if ({#} > 1) \
/def -i -n1 -t"(nothing special|You don't find)" searching = \
/search %-1%;\
exa %1%;\
search %1%;\
/else \
exa %1%;\
search %*%;\
/endif

;**************************** KEY BINDINGS ************************************

/def -i -b^L Ctrl_L = /cls
;;voor tab completion
/def -i -b^I Tab = /if (moresize()) /dokey page%;/else /complete%;/endif

;; Based on common Linux keycodes
;/def -i -b^[[A Up = /dokey searchb
;/def -i -b^[[B Down = /dokey searchf
;/def -i -b^[[A Up = /dokey recallb
/def -i -b^[[B Down = /dokey recallf
/def -i -b^[[D Left = /if (moresize()) /dokey line%;/else /dokey left%;/endif
/def -i -b^[[[A F1 = /listsockets
/def -i -b^[[[B F2 = /tfshelp
/def -i -b^[[[C F3 = /time
/def -i -b^[[[D F4 = /recall -g 40
/def -i -b^[[1~ Home = /dokey home
/def -i -b^[[2~ Ins = /test insert := !insert
/def -i -b^[[3~ Del = /dokey dch
/def -i -b^[[4~ End = /dokey end
/def -i -b^[[5~ PgUp = /dokey socketb
/def -i -b^[[6~ PgDn = /dokey socketf
/def -i -b^[[23~ Shift-F1 = /dokey flush
/def -i -b^[[24~ Shift-F2 = /myhelp
/def -i -b^[[25~ Shift-F3 = /test more := !more
/def -i -b^[[26~ Shift-F4 = /recall -w 40
;; note; on DOS these are Shift-F2, ..., Shift-5

;; For FreeBSD
/def -i -b^[[F = /End
/def -i -b^[[G = /PgDn
/def -i -b^[[H = /Home
/def -i -b^[[I = /PgUp
/def -i -b^[[M = /F1
/def -i -b^[[N = /F2
/def -i -b^[[O = /F3
/def -i -b^[[P = /F4
/def -i -b^[[Y = /Shift-F1
/def -i -b^[[Z = /Shift-F2
/def -i -b^[[a = /Shift-F3
/def -i -b^[[b = /Shift-F4

;; For SunOS (I think)
;/def -i -b^[OA = /Up
/def -i -b^[OB = /Down
/def -i -b^[OP = /F1
/def -i -b^[OQ = /F2
/def -i -b^[OR = /F3
/def -i -b^[OS = /F4

;; For Indy (M-11/16/88f-beta4)
/def -i -b^[[001q = /F1
/def -i -b^[[002q = /F2
/def -i -b^[[003q = /F3
/def -i -b^[[004q = /F4

;; For DOS (I think) & DEC-2100
/def -i -b^[[11~ = /F1
/def -i -b^[[12~ = /F2
/def -i -b^[[13~ = /F3
/def -i -b^[[14~ = /F4

;; For the Macintosh - will probably conflict somewhere

;; removed, due to too many conficts :( Sorry Mac users!

;******************************* TIMERS ***************************************

;; Somewhere during the next hour (but not in the first 10 minutes)...
;; Some people think this is annoying, so let's just turn it off :(
;/eval /set HOST=%{HOST-$[regmatch("\.",%HOSTNAME),%PL]}
;/eval /repeat -$[rand(3000)+600] 1 /test prompt("%%HOST:~> ")%%;\
; /echo -ab Insufficient user intelligence error.

;; /schedule turns on/off the notification of my schedule
/def -i schedule = \
/set day=$[tolower($(/time %%a))]%;\
/if (!sched_pid) \
/if (day =~ "mon") \
/at 5:00 /mesg *IT'S MONDAY, 5.00 am*%;\
/elseif (day =~ "tue") \
/at 5:00 /mesg *IT'S TUESDAY, 5.00 am*%;\
/elseif (day =~ "wed") \
/at 5:00 /mesg *IT'S WEDNESDAY, 5.00 am*%;\
/elseif (day =~ "thu") \
/at 5:00 /mesg *IT'S THURSDAY, 5.00 am*%;\
/elseif (day =~ "fri") \
/at 5:00 /mesg *IT'S FRIDAY, 5.00 am*%;\
/endif%;\
/mesg *SCHEDULER ON*%;\
/at 4:00 /mesg *TIME TO GET SOME SLEEP*%;\
/at 8:40 /mesg *FIRST HOUR LECTURE*%;\
/at 9:40 /mesg *SECOND HOUR LECTURE*%;\
/at 10:40 /mesg *THIRD HOUR LECTURE*%;\
/at 11:40 /mesg *FOURTH HOUR LECTURE*%;\
/at 12:00 /mesg *CHECK FOR KROKETTEN*%;\
/at 13:25 /mesg *TIME FOR INSTRUCTION*%;\
/at 17:55 /mesg *STACK DUMP ABOUT TO CLOSE*%;\
/at 21:55 /mesg *RUN FOR YOUR TRAIN?*%;\
/at 22:25 /mesg *HG ABOUT TO CLOSE*%;\
/set sched_pid %?%;\
/else \
/mesg *SCHEDULER OFF*%;\
/for i 0 9 /kill $$[%sched_pid - i]%;\
/unset sched_pid%;\
/endif
/schedule

;; /idle turns on/off global idle prevention (uses /chkidle)
/def -i idle = \
/if (!idle_pid) \
/mesg *IDLE MODE ON*%;\
/repeat -0:15 100 /chkidle%;\
/set idle_pid %?%;\
/else \
/mesg *IDLE MODE OFF*%;\
/kill %idle_pid%;\
/unset idle_pid%;\
/endif
/idle

;************************** INTERNET PROTOCOL *********************************

;; /tcp <host> <port> <message>
;; Where message will be exploded on '#' (not on ' '!)
/def -i tcp = \
/let current=${world_name}%;\
/def -i -F -ag -n1 -hCONNECT #tcp1 = \
/def -i -ah -F -t"." #tcp0%%;\
/let str=%-2%%;\
/while ($$(/let i $$[strstr(%%str,"#")]) , i >= 0) \
/send -w%%1 -- $$[substr(str,0,i)]%%;\
/let str=$$[substr(str,i+1)]%%;\
/done%%;/send -w%%1 -- %%str%;\
/def -i -F -ag -hWORLD|REDEF|ACTIVITY \
-t"(22|Hello|Verbose|POP3|PASS)" #tcp2%;\
/def -i -F -n1 -hCONFAIL #tcp3 = /purge -i #tcp.+%;\
/def -i -F -ag -hDISCONNECT #tcp4 = /purge -i #tcp.+%%;\
/def -n1 -F -ag -hWORLD%%;/fg -s %current%;\
/connect %1 %2

;; /expn <user>[@machine]
/def -i expn = \
/test $[regmatch("@([^@]*)$$",%*)]%;\
/tcp %{P1-localhost} smtp helo %{HOSTNAME-%HOST}#verb#expn %{PL-%*}#quit

;; /day <host>
/def -i day = /tcp %{1-zen.stack.nl} daytime

;; /time gets the local time
/def -i time = /mesg $[ftime(%{*-%time_format},time())]

;; /cso <name>[@machine]
/def -i cso = \
/test $[regmatch("@",%*)]%;\
/tcp %{PR-cso.tue.nl} csnet-ns query %{PL-%*}#quit

;; /finger [user][@machine]
;/def -i finger = \
; /test $[regmatch("@",%*)]%;\
; /tcp %{PR-localhost} finger -m %{PL-%*}

;; /whois <name>[@machine]
/def -i whois = \
/test $[regmatch("@",%*)]%;\
/tcp %{PR-rs.internic.net} whois %{PL-%*}

;; /gopher <machine> [port] [file]
/def -i gopher = \
/def -ag -F -hCONNECT #tcp.gopher = \
/set gopherc=1%%;\
/purge -i gopher-[0-9]*%%;\
/set wrap off%%;\
/def -ag -F -p5 -w"%%*" -t"^(.)(.+) +([^ ]+) +([^ ]+) +([0-9]+)" \
#tcp.gopher1 = \
/def -i gopher-%%%gopherc = /gopher %%%P4 %%%P5 %%%P3%%%%;\
/def -i gopher-b = /gopher %1 %2 %3%%%;\
/mesg %%%gopherc [%%%P1] %%%P2%%%;\
/set gopherc=$$$[gopherc+1]%%;\
/def -ag -F -t"^.$$$"%;\
/def -ag -F -h"DISCONNECT %%*" #tcp.gopher2 = /unset gopherc%;\
/tcp %{1-localhost} %{2-gopher} %{3}

;; /www <url>
/def -i www = \
/test $[regmatch("^http://([a-zA-Z0-9\.-]+)(:([a-z0-9]+))?/",%*) \
| regmatch("^([a-zA-Z0-9\.-]+)?(:([a-z0-9]+))?/",%*)]%;\
/tcp %{P1-localhost} %{P3-www} GET /%{PR-/} HTTP/1.0#From: \
root@%{P1-localhost}#User-Agent: Koresh.TFSH/%major_version \
TinyFugue/%minor_version#

;; /auth <localport>
/def -i auth = \
/let port=%{1-23}%;\
/set tmp=0%;\
/let netstat=$(/quote -decho -S !netstat -tn)%;\
/while (regmatch(strcat(":",port," +([^ ]+):([^ ]+)"),netstat)) \
/def -ag -n1 -hCONFAIL %P1.%P2a = \
/purge %P1.%P2%;\
/def -ag -n1 -hCONNECT %P1.%P2b = \
/def -ag -n1 -w%%1 -t":.*:.*: (.*)" = \
/echo -e -ah $$${world_host} %%%P1%%;\
/def -ag -F -n1 -h"DISCONNECT %%1" = %%;\
/purge %P1.%P2%;\
/tcp %P1 auth %P2,%port%;\
/let netstat=%PR%;\
/list #tcp.auth%;\
/done%;\
/set tmp=

;; /nntp [-m] [newsgroup] [machine]
/def -i nntp = \
/if (!getopts("m", 0)) /break%;/endif%;\
/def -ag -F -hCONNECT #tcp.nntp = \
/def -ag -F -w%%1 -t"." #tcp.nntp1%%;\
/def -ag -F -w%%1 -t"^411" #tcp.nntp2 = \
/send -w%%1 quit%%%;/mesg *NO SUCH NEWS GROUP*%%;\
/if (!opt_m) \
/def -ah -p2 -w%%1 -t"(^From:|^Date:|^Subject)" #tcp.nntp3%%;\
/def -ag -w%%1 -t"211 ([0-9]+) ([0-9]+) ([0-9]+) %{1-stack.flame}" \
#tcp.nntp4 = \
/mesg Information about most recent message \
(total %%%P1 in %{1-stack.flame}):%%%;\
/send -w%%1 head %%%P3%%%;\
/send -w%%1 quit%%;\
/else \
/def -ah -F -p0 -w%%1 -t"." #tcp.nntp3%%;\
/def -ag -w%%1 -t"211 ([0-9]+) ([0-9]+) ([0-9]+) %{1-stack.flame}" \
#tcp.nntp4 = \
/mesg Most recent message in %{1-stack.flame} \
(%%%P1 total):%%%;/undef #tcp.nntp1%%%;\
/send -w%%1 article %%%P3%%%;\
/send -w%%1 quit%%;\
/endif%;\
/tcp %{NNTPSERVER-tuegate.tue.nl} nntp group %{1-stack.flame}

;; /pop3 <user>[@machine]
/def -i pop3 = \
/test prompt("Enter Password: ")%;\
/let passwd=$[read()]%;\
/send -w%;\
/def -ah -p2 -t"^From:" #tcp.pop3a%;\
/def -ah -p2 -t"^-ERR" #tcp.pop3b = /send -w quit%;\
/def -ag -p2 -t"^\\+OK ([0-9]+) [0-9]+$$" #tcp.pop3c = \
/mesg %%P1 messages available in remote mailbox%%;\
/for i 1 %%P1 /send -w retr %%%i%%;/send -w quit%;\
/def -ag -t"." #tcp.pop3d%;\
/test $[regmatch("@",%*)]%;\
/tcp %{PR-localhost} pop3 user %{PL-%USER}#pass %passwd#stat

;; /portchk <host> [minport] [maxport]
/def -i portchk = \
/let host=%{1-localhost}%;\
/let i=%{2-1}%;\
/let maxport=%{3-1024}%;\
/set max_iter=0%;\
/unset portlist%;\
/def -i -F -ag -hCONNECT #port1 = \
/set portlist=%%portlist $${world_port}%%;\
/dc %%1%;\
/def -i -F -ag -hCONFAIL|DISCONNECT|ACTIVITY|PENDING|WORLD|SHADOW #port2%;\
/while (i<maxport) \
/let i=$[i+1]%;\
/connect %host %i%;\
/done%;\
/repeat -10 1 /purge -i #port.*%%;/mesg Ports used by %host:%%portlist


;**************************** SIMPLE ALIASES **********************************

/def -i moron = /set more on
/def -i more = /set more %*

/def -i bank = test change platinum and gold and silver and copper for copper
/def -i new = Destruct %*%;load %*%;update %*%;clone %*


;************************** ADVANCED ALIASES **********************************

/def -i compare = \
/def -i comp = /while (%%#) compare %%1 with $[tolower(%*)]%%;\
/shift%%;/done%%;/undef comp%;\
/comp str dex con int wis dis

/def -i stest = \
/def -i cest = /while (%%#) estimate %%1%%;/shift%%;/done%%;/undef cest%;\
meditate%;/cest str dex con int wis dis%;rise

/def -i stset = \
/if (%# != 6) /mesg *USAGE: stset <str> <dex> <con> <int> <wis> <dex>*%;\
/else meditate%; set%; %1%; %2%; %3%; %4%; %5%; %6%; rise%;\
/endif

/def -i ip = \
/def -F -n1 -t"(What?|there is no skill|learn a skill before|\
fail to adopt|don't have enough money)" ip_end = /undef ip_go%;\
/def -F -t"You improve " ip_go = improve %0%;\
improve %0

/def -i akill = \
/if (!getopts("h", 0)) /break%;/endif%;\
/if (opt_h) \
/def -i -F -w -t" died.$$" next_kill${world_name} = \
; The repeat is for possible alooting ;-)
/repeat -3 1 /hunt -r%%%;/hunt %*%%%;/akill %*%;\
/hunt %*%;\
/else \
/def -i -F -w -t" died.$$" next_kill${world_name} = kill %*%;\
/endif%;\
/def -i -F -n1 -w -t"You find no" end_next_kill${world_name} = \
/repeat -1 1 /undef next_kill${world_name}%%;\
/mesg *ALL %*s KILLED*%%;\
/if (%opt_h) /hunt -r%%;/endif%%;\
/finished akill%;\
kill %*
/def -i k = /akill -h %0

/def -i go = !wiz afk %* - brb%;!say afk %* - brb%;\
/if (%TERM =~ "xterm") /sys xlock -remote -info "Bugger Off, Loser!" \
-password "\\"I love OuterSpace!\\"" -username "Locked For " \
-nice 0 -mode random%;\
/else /def -i -ag -n4 -hSHELL|RESUME susp%;\
/sh stty susp ^@ ; lock -p%;\
/sys ps -ux | grep 'lock -p' | cut -f'2-5' -d' ' | xargs kill -9%;\
/sh stty susp ^Z%;\
/endif

;; ~/bin/crypt does practically the same as crypt() (3)
/def -i crypt = /quote -S -decho !~/bin/crypt %1 %{2-$(/salt)}
/def -i salt = \
/let i=$[rand(54)]%;\
/let j=$[rand(54)]%;\
/echo $[char(i>=28 ? i-28+97 : (i>=2 ? i-2+65 : i+46))]\
$[char(j>=28 ? j-28+97 : (j>=2 ? j-2+65 : j+46))]

/def -i tcsh = /@sh exec tcsh -l

/def -i listm = /list -i \^%*\$

;; This macro depends on the way ed works in the MUD...
;; However it _DOES_ work for very long files like /secure/master.c
;; w/o reason 1,$p aborts on empty files - making this alias useless :(
/def -i vi = \
/if (!getopts("r", 0)) /break%;/endif%;\
/let file %HOME/tmp_$[getpid()]_${world_name}.tf%;\
ed %1%;set nonumber%;\
/def -i -F -n1 -ag -t"::" gagcolon = /echo %%PR%;\
/if (opt_r) \
; Read only
/def -i -F -n1 -t"ed version" endget = \
/log off%%;/sh %{2-%{VISUAL-vim}} %file%%;Q%%;\
/sys rm %file%;\
/else \
; Modify file
/def -i -F -n1 -t"ed version" endget = \
/log off%%;/sh %{2-%{VISUAL-vim}} %file%%;1,$$$d%%;i%%;\
/quote -S '%file%%;.%%;x%%;/sys rm %file%;\
/endif%;\
/sys rm %file 2> /dev/null%;\
/log %file%;\
1,$$p%;set

;; For people who don't use a decent editor
/def -i joe = /vi %* %{EDITOR-joe}
/def -i jed = /vi %* jed
/def -i emacs = /vi %* emacs

;; /get and /put are based on the /vi macro
;; /get <mudfile> [<localfile>]
/def -i get = \
ed %1%;set nonumber%;\
/def -i -F -n1 -ag -t"::" gagcolon = /echo %%PR%;\
/def -i -F -n1 -t"ed version" endget = \
/log off%%;Q%;\
/sys rm %{2-%1} 2> /dev/null%;\
/log %{2-%1}%;\
1,$$p%;set

;; /put <localfile> [<mudfile>]
/def -i put = ed %{2-%1}%;1,$$d%;i%;/quote -S '%1%;.%;x

;; ncftp -h<host> -p<port> -a -P -r<remdir> -l<locdir> <files>
;; Requires ncftp version 2.3.0 or compatible
/def -i ncftp = \
/if ({#} == 0) /quote -S -decho !ncftp -H --version%;/break%;/endif%;\
/let opt_h=${world_host}%;\
/let opt_p=ftp%;\
/let opt_a=%;\
/let opt_P=%;\
/let opt_r=\/%;\
/let opt_l=~%;\
/if (!getopts("h:p:aPr:l:")) /break%;/endif%;\
/let ftpcmd=$[opt_P ? "put" : "get -CfR"]%;\
/sys mv ~/.ncftp/macros ~/.ncftp/tmp_$[getpid()]_macros%;\
/log -l ~/.ncftp/macros%;\
/echo -ag macro .open.any%;\
/echo -ag cd %opt_r%;\
/echo -ag lcd %opt_l%;\
/while ({#}) /echo -ag %ftpcmd %1%;/shift%;/done%;\
/echo -ag bye%;\
/echo -ag end%;\
/log off%;\
/sh ncftp -$[opt_a?"a":"u"] %{opt_h-localhost} %opt_p%;\
/sys mv ~/.ncftp/tmp_$[getpid()]_macros ~/.ncftp/macros

/def -i cls = \
/if (%visual=~"on") /dokey redraw%;/else /echo -r \033[H\033[J%;/endif

/def -i xtitle = /if (TERM =~ "xterm") /echo -r \033]2;%*\07%;/endif

/def -i idea = \
/sys echo '%*' | elm -s"tfsh suggestion" %{authormail} \
> /dev/null%;\
/mesg *THANK YOU FOR SHARING YOUR IDEAS*

/def -i host = /quote -S /mesg !host %*

/def -i redo = /input $[regmatch(": ",$(/list -i - ^%{L-@}$$)),%PR]

;; And does an idle check as well :)
/def -i chkidle = \
/let worlds=$(/listsockets -s)%;\
/let i=1%;\
/let world=%;\
/while (world:=$(/nth %i %worlds)) \
/if (idle(%world)>10*60) /send -w%world%;/endif%;\
/let i=$[i+1]%;\
/done

;; Refresh _ALL_ defines, running processes and worlds
/def -i purge_all = \
/kill *%;\
/unset *%;\
/purgeworld .*%;\
/purge -i%;\
/def -i -F -ag -hLOAD tfshgag%;\
/load %{TFLIBRARY-stdlib.tf}%;\
/load ~/.tfrc%;\
/dokey flush%;\
/mesg *ALL PURGED*

/def -i kill = \
/if (%* =~ "*") \
/quote -S /kill `/ps -s%;\
/else \
/@kill %*%;\
/endif

/def -i unset = \
/let keepthose=$(/help special variables)%;\
/test regmatch("/",'$(/set)')%;\
/if (%* =~ "*") \
/while (regmatch("set ([^=]+)=",PR)) \
/if (strstr(keepthose,strcat(" ",P1))==-1) \
/@unset %P1%;\
/endif%;\
/done%;\
/else \
/@unset %*%;\
/endif

/def -i debug = \
/if (%1 =~ "on") /set mecho all%;/set emulation debug%;/set telopt on%;\
/elseif (%1 =~ "off") \
/set mecho off%;/set emulation ansi_attr%;/set telopt off%;\
/else /echo Debug mode is %telopt.%;\
/endif

;; /enter turns on/off automatic resending of last line
/def -i enter = \
/if (!ismacro("autoenter")) \
/mesg *AUTOMAGIC ENTER ENABLED*%;\
/def -i -F -h"SEND ^$$" autoenter = $(/recall -i - -2)%;\
/else \
/mesg *AUTOMAGIC ENTER DISABLED*%;\
/undef autoenter%;\
/endif

;; /resize turns on/off automatic mud notification of screen resize
/def -i resize = \
/if (!ismacro("autoresize")) \
/mesg *AUTOMATIC RESIZE ENABLED*%;\
/def -i -F -ah -T"lp" -hRESIZE autoresize = !screenwidth %%wrapsize%;\
/else \
/mesg *AUTOMATIC RESIZE DISABLED*%;\
/undef autoresize%;\
/endif
/resize

;; /wpropt <prompt> uses user defined prompt
;; in which #w will be interpreted as world name, #t time, #p orig prompt
/def -i wprompt = \
/if (%* !~ "" | !ismacro("autowprompt")) \
/set prompt_mode 1%;\
/let myprompt=%{*-#t #w #p}%;\
/let myprompt=$(/replace #t %%{prompt_time} %myprompt)%;\
/let myprompt=$(/replace #w $${world_name} %myprompt)%;\
/let myprompt=$(/replace #p %%{0} %myprompt)%;\
/mesg *WORLD PROMPTING ENABLED*%;\
/def -i -F -h"PROMPT .*> " autowprompt = \
/let prompt_time=$$[ftime("%%I:%%M",time())]%%;\
/test prompt("%myprompt ")%;\
/else \
/mesg *WORLD PROMPTING DISABLED*%;\
/undef autowprompt%;\
/endif

;******************************* WALKING **************************************

;; /walk <path>
/def -i walk = \
/let args=%*%;\
/while ($[regmatch("^([0-9]*)([a-z]+)( |$)",%args)],%P2!~"") \
/for i 1 %{P1-1} %P2%;\
/let args=%PR%;\
/done%;/set back=$(/rev_path %*)

;; /return will return on last walked path
/def -i return = /walk %back

;; used by walk
/def -i rev_path = \
/let rev_p=%;\
/while (%#) /let rev_p=%1 %rev_p%;/shift%;/done%;\
/echo $(/tr nsewud snwedu $(/short_path %rev_p))

;; used by walk
/def -i short_path = \
/let path=%;\
/while (%#) \
/let i=1%;\
/while (%1 =~ %2) /let i=$[i+1]%;/shift%;/done%;\
/let path=%path $[i>1 ? i : ""]%1%;\
/shift%;\
/done%;\
/echo %path

;; /trace [leader] will turn on/off logging all steps
/def -i trace = \
/if (!ismacro("trace_leader")) \
/if (%1 =~ "") \
/mesg *TRACING ROUTE*%;\
/def -i -F -w -h'send ^(n|s|e|w|ne|sw|nw|se|u|d)$$' trace_leader = \
/set traced=%%traced %%*%%;/send -w %%*%;\
/def -i -F -w -h'send ^-(n|s|e|w|ne|sw|nw|se|u|d)$$' trace_err = \
/set traced=$$[regmatch(" ([a-z]+)$$$", traced), %%PL]%%;\
/mesg *TRACE: %%P1 verwijderd*%;\
/def -i -F -w -t'There is no obvious exit [a-z]+.$$' trace_aerr = \
/trace_err%;\
/else \
/mesg *TRACING ROUTE $[toupper(%1)]*%;\
/def -i -F -w -t"^$[toupper(substr(%1,0,1))]\
$[tolower(substr(%1,1))] (hops|sneaks|leaves|climbs) ([a-z]+)\.\$" \
trace_leader = \
/let dir=%%P1%%;\
/test regmatch("th([we])[ea]st","%%dir")%%;\
/set traced=%%traced $$[substr(%%dir,0,1)]\
$$[substr(%%P1,0,1)]%;\
/endif%;\
/set traced=%;\
/else \
/mesg *NO LONGER TRACING ROUTE*%;\
/set traced=$(/short_path %traced)%;\
/mesg /walk %traced%;\
/mesg Use /eval /map \%traced to get a map%;\
/purge -i trace_%;\
/test prompt("Save this path as: ")%;\
/let name=$[read()]%;\
/send -w%;\
/if (%name =~ "") /mesg *PATH NOT SAVED*%;\
/elseif /ismacro %name%;/then /mesg *MACRO EXISTS: NOT SAVED*%;\
/else \
/test prompt("Give comment for this path: ")%;\
/let comment=$[read()]%;\
/send -w%;\
/if (%comment !~ "") \
/test fwrite(PATHFILE, strcat(";; %comment"))%;\
/endif%;\
/test fwrite(PATHFILE, "/def -i %name = /walk %traced")%;\
/def -i %name = /walk %traced%;\
/mesg *PATH SAVED AS /%{name} IN %{PATHFILE}*%;\
/endif%;\
/set back=$(/rev_path %traced)%;\
/endif

;; /hunt [-r] <creature> will follow creature (-r returns on last hunt)
/def -i hunt = \
/if (!getopts("r", 0)) /break%;/endif%;\
/if (%* !~ "") \
/set hunted=%;\
/mesg *NOW HUNTING $[toupper(%*)]*%;\
/def -i -F -w -t"^(.+) (hops|sneaks|leaves|climbs) ([a-z]+).$$" \
hunt_trig${world_name} = \
/if ($$[tolower(%%P1)] =/ "*$[tolower(%*)]*") \
/let dir=%%P3%%;\
/mesg *FOLLOWING $[toupper(%*)] $$[toupper(%%dir)]*%%;\
%%dir%%;\
/test regmatch("th([we])[ea]st","%%dir")%%;\
/set hunted=%%hunted $$[substr(%%dir,0,1)]\
$$[substr(%%P1,0,1)]%%;\
/endif%;\
/else \
/set hunted=$(/short_path %hunted)%;\
/if (opt_r) \
/mesg *HUNT IS OVER: RETURNING*%;\
/mesg (recorded) /walk %hunted%;\
/walk $(/rev_path %hunted)%;\
/else \
/mesg *AUTOHUNTING DISABLED*%;\
/mesg (recorded) /walk %hunted%;\
/mesg Use /eval /map \%hunted to get a map%;\
/endif%;\
/purge hunt_trig${world_name}%;\
/finished hunt%;\
/endif

;; /track <creature> will track creature
/def -i track = \
/if (%* !~ "") \
/mesg *NOW TRACKING $[toupper(%*)]*%;\
/def -i -F -w -t"tracks appear to leave the area \
(right|heading) ([a-z]+)" track_trig${world_name} = \
/if (%%P2 =~ "below") down%%;\
/elseif (%%P2 =~ "above") up%%;\
/else %%P2%%;\
/endif%;\
track %*%;\
/else \
track me%;\
/mesg *TRACKING DISABLED*%;\
/purge track_trig${world_name}%;\
/finished track%;\
/endif

;; /map will draw a map of given path; argument must be a valid path.
/def -i map = \
/let cx=100%;/let cy=100%;\
/let mapu=100%;/let mapd=100%;/let mapl=100%;/let mapr=100%;\
/let map_100_100=O%;\
/if (!getopts("f:", "")) /break%;/endif%;\
/while (%#) \
/let dir=%1%;\
/shift%;\
/if (regmatch("([0-9]+)",dir)) \
/let n=%P1%;\
/let dir=%PR%;\
/else \
/let n=1%;\
/endif%;\
/while ({n}) \
/if (!strcmp(dir,"ne")) \
/let map_$[cx+2]_$[cy+1]=\/%;\
/let cx=$[cx+4]%;/let cy=$[cy+2]%;\
/elseif (!strcmp(dir,"se")) \
/let map_$[cx+2]_$[cy-1]=\\%;\
/let cx=$[cx+4]%;/let cy=$[cy-2]%;\
/elseif (!strcmp(dir,"sw")) \
/let map_$[cx-2]_$[cy-1]=\/%;\
/let cx=$[cx-4]%;/let cy=$[cy-2]%;\
/elseif (!strcmp(dir,"nw")) \
/let map_$[cx-2]_$[cy+1]=\\%;\
/let cx=$[cx-4]%;/let cy=$[cy+2]%;\
/elseif (!strcmp(dir,"n")) \
/let map_%{cx}_$[cy+1]=\|%;\
/let cy=$[cy+2]%;\
/elseif (!strcmp(dir,"e")) \
/let i=$[cx+1]%;\
/while (i < cx+4) /let map_%{i}_%{cy}=\-%; /let i=$[i+1]%;/done%;\
/let cx=$[cx+4]%;\
/elseif (!strcmp(dir,"s")) \
/let map_%{cx}_$[cy-1]=\|%;\
/let cy=$[cy-2]%;\
/elseif (!strcmp(dir,"w")) \
/let i=$[cx-1]%;\
/while (i > cx-4) /let map_%{i}_%{cy}=\-%; /let i=$[i-1]%;/done%;\
/let cx=$[cx-4]%;\
/else \
/mesg -w *WRONG ARGUMENT TO /map*%;\
/break 3%;\
/endif%;\
/let map_%{cx}_%{cy}=O%;\
/let n=$[n-1]%;\
/done%;\
/if (cy > mapu) /let mapu=%cy%;/endif%;\
/if (cy < mapd) /let mapd=%cy%;/endif%;\
/if (cx > mapr) /let mapr=%cx%;/endif%;\
/if (cx < mapl) /let mapl=%cx%;/endif%;\
/done%;\
\
/let i=%mapu%;\
/if (strcmp(opt_f,"")!=0) /log -l %opt_f%;/endif%;\
/while (i >= mapd) \
/let j=%mapl%;\
/while (j <= mapr) \
/eval /set tmp=$$[map_%{j}_%{i}]%;\
/if (strcmp(tmp,"")==0) \
/test $[let(strcat("line=",line,"."))]%;\
/else \
/let line=$[strcat(line,tmp)]%;\
/endif%;\
/set tmp=%;\
/let j=$[j+1]%;\
/done%;\
/echo %line%;\
/let line=%;\
/let i=$[i-1]%;\
/done%;\
/if (strcmp(opt_f,"")!=0) /log -l off%;/endif%;\

;; /rush <direction> will speed through linked rooms
/def -i rush = \
/if /ismacro rush_trig%;/then /undef rush_trig%;/endif%;\
/let dirs=,n:north,s:south,e:east,w:west,ne:northeast,nw:northwest,\
se:southeast,sw:southwest,u:up,d:down,%;\
/let dir=$[regmatch(strcat(".*,",%1,":([a-z]+),.*"),%dirs) ? %P1 : %1]%;\
/def -i -p3 -w -t"obvious exit.* %dir" rush_trig${world_name} = %1%;\
/def -i -n1 -p2 -w -t"obvious exit" end_rush_trig = \
/undef rush_trig${world_name}%;\
%1

;; /fast <direction> will speed through linked rooms
/def -i fast = \
/let dir=%;\
/let dirs=,n:north,s:south,e:east,w:west,ne:northeast,nw:northwest,\
se:southeast,sw:southwest,u:up,d:down,%;\
/if (strlen(%1)>2) \
/let dir=$[regmatch(strcat("([a-z]*):",%1),dirs) ? %P1 : dir]%;\
/endif%;\
/let dir=$(/tr nsew snwe %{dir-%1})%;\
/let dir=$[regmatch(strcat(dir,":([a-z]+),"),%dirs) ? %P1 : %dir]%;\
/def -i -p2 -n1 -w -t"two obvious exits: ([a-z]*),? ?(%dir),? ?([a-z]*)\." \
fast_trig${world_name} = \
/fast %%{P1-%%P3}%;\
/if /!iswmacro end_fast_trig%;/then \
/def -i -n1 -w -t"obvious exit" end_fast_trig${world_name} = \
/undef fast_trig${world_name}%;\
/endif%;\
%1

;; /sneak - will turn on/off sneaking mode: use sneak for all normal walks
/def -i sneak = \
/if /!iswmacro sneaky%;/then \
/mesg *SNEAK MODE ON*%;\
/def -i -F -w -h'send ^(n|s|e|w|ne|sw|nw|se|u|d)$$' sneaky${world_name} = \
sneak %%P0%;\
/else \
/undef sneaky${world_name}%;\
/mesg *SNEAK MODE OFF*%;\
/endif


;***************************** TFSH HELP **************************************

;;; This is awfull, terrible, dreadfull, horrible and slow,
;;; but it preserves a nice layout for this file ;-)
/def -i tfshelp = \
/let match %{1-topics}%;\
/let str=$[regmatch(strcat(";start_of_",%match," ;(.*)end_of_",%match),\
$(/quote -decho -S '~/.tfrc)),%P1]%;\
/echo ************** TFSH INFORMATION ***************** KORESH *********************%;\
/echo%;\
/while ($(/let i $[strstr(%str,";")]) , i >= 0) \
/eval /echo $[substr(str,0,i)]%;\
/let str=$[substr(str,i+1)]%;\
/done%;\
/echo%;\
/echo *********** All code is copyright 1997, Johan van Selst (Koresh) *************

/def -i myhelp = \
/echo -aB topics, bind, walk, trig, tcp, local, macro, misc, files, new%;\
/test prompt("Enter help selection: ")%;\
/let topic $[read()]%;\
/send -w%;\
/tfshelp %topic

/def -i triggers = /tfshelp trig
/def -i tfchanges = /tfshelp tfchanges

;start_of_topics
;. Koresh.TFSH Help Topics /tfshelp topics
;
;. Key Bindings /tfshelp bind
;. Walk and Mapping macros /tfshelp walk
;. Many Triggers /tfshelp trig
;. Internet Protocol support /tfshelp tcp
;. Local Configuration aids /tfshelp local
;. Programming aids /tfshelp macro
;. Other Macros /tfshelp misc
;
;. Files used by TFSH /tfshelp files
;. New in this version /tfshelp new
;
;-au Note that some macros in this tfsh require TinyFugue version %{minor_version} or newer
;end_of_topics

;start_of_bind
;Arrow Down, Up = next, previous line in history
;Page Down, Up = next, previous world
;Esc Down, Up = save current line to stack, restore last line
;Home, End, Ins, Del = obvious
;Tab = smart tab completion (refer to /help complete)
;Arrow Left = scroll ONE line at the --More-- prompt
;
;F1 = list active sockets
;Shift-F1 = discard all output
;F2 = list aliases, keybindings and triggers
;-aB Shift-F2 = get /tfshelp menu for help on this .tfrc
;F3 = display "$(/time)"
;Shift-F3 = toggle more-mode
;F4 = review last 40 lines
;Shift-F4 = review last 40 lines from current world
;end_of_bind

;start_of_walk
;seq <commands> = execute a list of commands, seperated by %%\59
;| special command /wait will wait until an command
;| has ended (e.g. /wait aloot, /wait hunt)
;walk <path> = e.g. /walk n 3se u 2w
;map <path> = Make a nice ascii map of this path (no up/down)
;| /map -f<file> <path> will save the map
;| /eval /map %%{traced} will show map from last /trace
;rev_path <path> = show the reverse walk of this path
;short_path <path> = short version of the path (w w w -> 3w)
;rush <dir> = walk <dir> as long as possible
;fast <dir> = rush through rooms with no choice
;trace = remember which route you took [off]
;trace <leader> = remember which route the leader took [off]
;track <victim> = track and follow someone who left [off]
;hunt <victim> = follow your victim around everywhere [off]
;| /hunt -r returns on path of last hunt
;sneak = sneak around instead of walking [off]
;return = return on last walk or trace
;end_of_walk

;start_of_trig
;intro = beeps on certain events, like intro's [off]
;atrig = login trigger - will say hi [off]
;aloot = looting in several modes [off]
;asell = selling in several modes [off]
;asplit # = auto-calculate share for # people [off]
;aboard = boards an arriving ship [off]
;debug = turn debug mode on [off]
;enter = send last line instead of empty line on enter [off]
;noposs = makes sure nobody possesses me twice [always on]
;autoqueue = gets you safely through the queue [always on]
;autojoin = always join (and buy ticket when leader does) [always on]
;osx = set tile for xterm (OuterSpace/TinyFugue) [always on]
;assist = assist whenever a team member attacks [on]
;idle = prevents character from going idle in any world [on]
;schedule = keeps my schedule (notify for classes etc.) [on]
;resize = change screenwidth when resizing your screen [on]
;end_of_trig

;start_of_local
;cls (or Ctrl-L) = clear the screen (works also in visual mode)
;kill * = kill all TinyFugue processes
;purge_all = refresh ALL defines, processes and worlds
;wprompt <prompt> = use your own prompt
;| #w = world name, #t = time, #p = orig prompt
;go <reason> = go AFK and lock the screen -- works for X!
;xtitle <title> = change title of xterm (osx overrules!)
;idea <suggestion> = mail tfsh suggestions, questions to Koresh
;vi <file> = edit a remote file using %{VISUAL-vim}
;| /joe (using %{EDITOR-joe}), /jed and /emacs also work
;| use option -r for (fast) read-only mode
;get <mud> [<local>] = obvious
;put <local> [<mud>] = obvious
;ncftp <files> = optional: -h<host:${world_name}> -p<port:ftp>
;| (requires ncftp 2.3.0) -a -P -r<remdir:/> -l<locdir:~>
;| Use -a for anonymous, -P for put (not get)
;salt = get a random salt for crypt()
;tcsh = get a decent subshell
;listm <macro-name> = /list only exactly maching macro
;end_of_local

;start_of_macro
;at <time> <commands> = execute commands at specified time
;alias <name> <commands> = _better_ than /help alias
;replace <old> <new> <string> = replace occurences of old by new in string
;tr <old> <new> <string> = replace occurences of old|n by new|n in string
;redo <macro> = change a macro definition
;end_of_macro

;start_of_misc
;stest = estimate your stats
;stset = set all 6 stats at once
;ip <skill> = improve <skill> as far as possible
;| --> Use 'improve <skill> max' instead!
;compare <enemy> = compare your stats with someone else
;loot <number> = loot <number> corpses at once
;sell = sell according to the mode set with asell
;packsell = sell all from your pack
;setpack <pack> = set the type of pack you store your stuff in
;| this is used by /packsell, /aloot and /asell
;akill <type> = kill all <type>s in the room, option -h hunts them
;search <items> = examine and search a list of items in a room
;new <file> = destruct, load, update and clone a file
;
;Send-aliases (refer to /help alias):
;da, ea = drink all, eat all
;whois, whoison = people -LiabdRrsN, people -LiabdRrsl
;end_of_misc

;start_of_tcp
;day <host> = get remote time
;cso <query>@<csohost> = get CSO information on someone
;expn <user>@<host> = expand an email-alias
;finger <user>@<host> = finger anyone on the net
;whois <name> = get who-is info from rs.internic.net
;gopher <host>:<file> = display a Gopher page
;-au www <URL> = display a HTML page (with header)
;pop3 <user>@<host> = list messages on remote machine
;auth <localport> = look who's connected to a local port
;nntp <newsgroup> <server> = get newsgroup info (from %{NNTPSERVER-tuegate.tue.nl})
;| option -m will display the whole last message
;host <host> = get nameserver information about host
;portchk <host> <min> <max> = check which ports are used by host (1-1024)
;end_of_tcp

;start_of_files
;This file should always be saved as %{HOME-~}/.tfrc,
;otherwise some functions (like '/tfshelp files') will not work.
;
;At startup, your TFSH will try read to some files that come with the
;standard TF distribution and should reside in %{TFLIBDIR}.
;Also the following macro files will be read from %{HOME-~}:
;.personal.tf personal.tf paths.tf (provided these exist).
;
;The file paths.tf is used by /trace. You can change this filename by
;setting the global variable PATHFILE from your personal configuration file.
;end_of_files

;start_of_new
;-aB New in version Koresh.tfsh/%{major_version} TinyFugue/%{minor_version}:
;Some bugs fixed and option additions. More function documented.
;
;Shift-F2 now gives easy access to the tfsh functions!
;
;Paths (created with /trace) can be saved with comments.
;
;Removed some settings that are default in this version.
;
;Use /aboard for Genesis-like ship, for OuterSpace use:
;/board (for a ship), /plane (for a plane) or /space (for a spaceship).
;/space takes an optional argument: the planet where you wish to disembark.
;
;You can always obtain the latest Koresh.TFSH distribution file
;by mailing %{authormail} with the subject 'Request TFSH'.
;The latest tf can be found at http://ftp.tcp.com/pub/mud/Clients/tinyfugue/.
;end_of_new

/def -i tfrc = /quote -decho -S !grep -e '\^;\\*\\*\\*\\*' ~/.tfrc%;\
/echo -au Total #lines: $(/quote -decho -S !wc -l ~/.tfrc)

;; Load extra user-specific files:
/load ~/tch/.personal.tf
/load ~/tch/personal.tf
/eval /load %{PATHFILE}
/undef tfshgag
/cls