Run

From Gwen Morse's Wiki
Jump to: navigation, search
;;
;; Author uncredited. Source: http://zombiemud.infogami.com/TinyFugue
;;
;; This script automates the movement between mobs, as well as conveying
;; a little information about each one.

;; The format for a "run" is comma seperated list of directions/actions,
;; mobs are spcified with trigger:MOB[:EXTRA INFO], and to pause not at 
;; a mob use the format pause:[EXTRA INFO]

;; Here's an example run for the druid towers.

/test _druidarea := "15 w,5 sw,12 w,path,s,w,target:ent:18K \
,u,target:willow:29K \
,u,target:trifolium:67K \
,u,target:stumpwood:107K \
,3 d,2 e,target:snake:18K \
,u,target:bull:41K \
,u,target:bear:49K \
,u,target:gorilla:67K \
,u,target:beetle:110K \
,4 d,w,s,w,target:fungus:18K \
,u,target:cube:35K \
,u,target:spore:49K \
,u,target:battlefungus:109K \
,3 d,E,target:elemental:18K \
,u,target:elemental:35K \
,u,target:elemental:42K \
,u,target:elemental:48K \
,u,target:elemental:110K \
,4 d,w,s,target:dragon:109K \
,u,target:Pegasus:42K \
,u,target:nymph:48K \
,u,target:djinni:58K \
,u,target:basilisk \
,4 d,N,path,12 e,5 ne,15 e,p' At CS"
/def druidarea = /_dorun %{_druidarea}

;; And here's the code.

/def -i list_print = \
    /@test _value := %{1} %;\
    /eval /echo %{_value}

/def -i run_list_pop = \
    /test list_pos:=strstr(list, ",") %;\
    /if (list_pos < 0) \
        /test list_pos := strlen(list) %;\
    /endif %;\
    /test _val := substr(list, 0, list_pos) %; \
    /test list := substr(list, list_pos + 1) %;\
    /result "%{_val}"

/def testrun = /_dorun 'testrun,pause:this is a pause,target:target:targeting target,'end run

/def _dorun = \
    brief %; \
    /if (strlen(%*) > 0) \
        /test list := "%*" %; \
        party create stats%; \
    /endif %; \
    /while (strlen(list) > 0) \
        /test cmd := "$(/run_list_pop)" %;\
        /if (strstr(cmd, ":") > -1) \
            /if (strstr(cmd, "pause") > -1) \
                /test info := substr(cmd, 6) %;\
                /eval p' found pause %;\
                /eval p' %{info} %;\
                /break %;\
            /endif %;\
            /test target := substr(cmd, 7) %;\
            /if (strstr(target, ":") > 0) \
                /test info := substr(target, strstr(target, ":") + 1) %;\
                /test target := substr(target, 0, strstr(target, ":")) %;\
            /else \
                /test info := " "%;\
            /endif %;\
            /eval p' target is: %{target}. %{info} %;\
            /setpartytarget %{target} %;\
            /break %;\
        /endif %;\
        /eval %{cmd} %;\
    /done %; \
    brief