Mercurial > hg > batmud > maputils
view tf/mapwalk.tf @ 2815:11aa4bb37e40
Sync HCbat locs.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 11 Apr 2024 22:43:04 +0300 |
parents | 472316d37c30 |
children |
line wrap: on
line source
;; ;; Mapping helper for a walking ;; ;; Report location /def -i prreportloc =\ /send @party say !!PLR: %{plr_x},%{plr_y};map ;;----------------------------------------------------------------------------- ;; Update coordinates /def -i prmyupdate =\ /if ({1}=~"nw"|{1}=~"northwest") /test plr_y-={2}%;/test plr_x-={2}%;\ /elseif ({1}=~"n"|{1}=~"north") /test plr_y-={2}%;\ /elseif ({1}=~"ne"|{1}=~"northeast") /test plr_y-={2}%;/test plr_x+={2}%;\ /elseif ({1}=~"w"|{1}=~"west") /test plr_x-={2}%;\ /elseif ({1}=~"e"|{1}=~"east") /test plr_x+={2}%;\ /elseif ({1}=~"sw"|{1}=~"southwest") /test plr_y+={2}%;/test plr_x-={2}%;\ /elseif ({1}=~"s"|{1}=~"south") /test plr_y+={2}%;\ /elseif ({1}=~"se"|{1}=~"southeast") /test plr_y+={2}%;/test plr_x+={2}%;\ /endif ;; Update coordinates, move, report location+map /def -i prmymove =\ /test old_x:=plr_x%;/test old_y:=plr_y%;\ /test prmyupdate({1},{2})%;/send @%{2} %{1}%;/prreportloc /def -i -msimple -t"You cannot go that way." prmove_cant =\ /echo -p @{BCred}Canceling move@{n}: %{plr_x},%{plr_y} -> %{old_x},%{old_y}%;\ /test plr_x:=old_x%;/test plr_y:=old_y ;; This is for GgrTF's numpad movement /def -i prmove_peer =\ /set prmove_last=%{1}%;/gstatus_update%;/test prmymove({1},1) ;; Catch movement commands (hopefully) /def -i -p1 -mregexp -h'send ^([0-9]+)? ?(n|s|e|w|ne|sw|nw|se|u|d)$' prmove_send =\ /if ({P1}!~"") /test prmymove({P2},{P1})%;/else /test prmymove({P2},1)%;/endif ;; Prevent from running with N/E/etc /def -i -p99999 -mregexp -h'send ^([0-9]+)? ?(N|S|E|W|NE|SW|NW|SE)$' prmove_send2 =\ /echo -p @{BCred}No you wont!@{n} ;; Reset position to 0,0, start a new logfile /def -i preset =\ /echo -p @{BCgreen}Position reset!@{n}%;\ /eval /log mapping.log%;\ /if ({#} == 2)\ /set plr_x=%{1}%;/set plr_y=%{2}%;\ /else \ /test plr_x:=0%;/test plr_y:=0%;\ /endif%;\ /prreportloc ;; Report position /def -i pos =\ /echo -p @{BCgreen}Position@{n}: @{BCwhite}%{plr_x},%{plr_y}@{n} ;; Initialize ;/preset /move peer