Abelinc's Aardwolf Speedwalk

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

You'll have to change "~/wolf/runs.dat" to the path and file you'll use for speedruns.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Abelinc's Aardwolf Speedwalk System
;;; http://homepage.mac.com/mikeride/abelinc/scripts/
;;;
;; from Abelinc: I wrote a new speedwalk system, because my old one pissed me off. 
;; This one lets you add new speedwalks without having to edit any external files, 
;; lets you use Zmud speedwalks (no more %;, it now understands ; as a delimiter) and it 
;; generally is friendly to the environment.

;; To use it, paste the script somewhere you'll be able to find it and /load it in Tinyfugue. Then, you can add speedwalks with /addrun.

;; Example: /addrun dump run 4s To use the speedwalks, just type 'runto <place>', like this: runto dump (Note that you don't need a / on the runto.)

;; Other commands included: /purgeruns (clears all your speedwalks, but does NOT save to disk - 
;; if you really want to blow all your speedwalks away use /purgeruns and follow it up with /saveruns) You can remove a specific run with /rmrun <place>

;; If someone asks you for a speedwalk, you don't have to cut and paste anymore! Use /quotesw <place> <prefix>
;; Example: /quotesw dump ftalk

;; And finally, although it's a bit messy, you can see a list of all your runs with /listruns.

;; New speedwalk system! Yay.
;; Required: textutil.tf
/require textutil.tf

;; Usage: /addrun keyword directions

/def addrun = \
  /if ({#} < 2) /echo ** addrun usage: /addrun keyword directions %; /else \
  /test tolower(%1) %; \
  /let tmp=$[tolower({1})] %; \
  /set run_%tmp=%{-1} %; \
  /saveruns %; \
  /endif

/def rmrun = \
  /if ({#} < 1) /echo ** rmrun usage: /rmrun keyword %; /else \
  /unset run_%1 %; /if ({?}) /echo ** rmrun: run to %1 removed. %; \
  /saveruns %; \
  /else /echo ** rmrun: run to %1 not found %; \
  /endif %; \
  /endif

;; Usage: /saveruns
/def saveruns = /listvar run_* %| /writefile ~/wolf/runs.dat %; \
  /echo ** Runs saved.

;; Usage: /purgeruns
/def purgeruns=/echo ** Runs purged (but only in memory - still safe on disk) %; \
  /quote -S /unset `/listvar -s run_* 

;; Usage: /listruns
/def listruns = /listvar -s run_*

;; Usage: /quotesw keyword 
;; Example: /quotesw kerofk
;; Example: /quotesw fabledcity ftalk
/def quotesw = \
  /if ({#} < 1) \
    /echo Usage: %{0}   %; \
  /else \
    /test strlen(run_%1) %; \
    /let mylen=%? %; \
    /if ({mylen} > 0) \
      /let swprefix=%{-1-say} %; \
      /test strcat(run_%1) %; /let outrun=%? %; \
      /send %swprefix [%1]: %outrun %; \
    /else /echo ** quotesw: no such destination. [%1] %; \
    /endif %; \
  /endif

;; Usage: runto place
;/def -wwolf -mglob -h'SEND {runto}*' runto = /set dir=$[strcat("run_",{2})] %; /eval %%{%{dir}}

/def -mglob -h'SEND {runto}*' runto = \
  /test strlen(run_%2) %; \
  /let mylen=%? %; \
  /if ({mylen} > 0) \
  /test replace( ";", "\%;", run_%2 )%;/eval %? %; \
  /send echo ** Destination Reached [%2] %; \
  /else /echo ** runto: unknown destination [%2] %; /endif

/load ~/wolf/runs.dat

/echo ** New speedwalk system loaded