Speedwalk do eval list

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

While this wasn't originally written by me, I organized all the clean-up and requested the assistance on the Tinyfugue mailing list and it's evolved into my work.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; 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 trailing pipe | as delimiter
;;; and to have a configurable time pause
;;;
;;; This is the base movement macro for the /tel speedwalker and the CrystalMUSH /walker
;;; 
;;; Syntax: /do_eval_list <speedwalk path>~~<optional delay>
;;; The path needs to be a trailing pipe-delimited list and the delay is in seconds.
;;;
;;; The path can include calls to other macros or paths. To avoid timing delays they 
;;; should only be included as the last step in the path.
;;; 
;;; If no delay is set, <delay> defaults to 2 seconds.
;;; To change this, find the line in the macro that says:
;;;
;;; /let var 2%; \
;;;
;;; and change it to the new value in seconds.


/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