@program tracks.muf 1 10000 d i $author Alynna $version 1.27 $def PROGVER prog "_version" getprop ( (C) 2000-2003 Alynna Trypnotk - alynna@animaltracks.net Release terms: GNU GPL v2 http://www.gnu.org/copyleft/gpl.html Just tell me where you got me, where your using this program (host/port) and distribute your changes under the same terms as you got them [GNU GPL v2] ) ( Installation: @propset #0=d:_depart/tracks:tracks.muf @act back;goback;backtrace=#0 @link back=tracks.muf ) $include $lib/alynna $def MAGIC 16 $def nameEx dup #-3 dbcmp if pop "*HOME*" else me @ "W" flag? not if ansi_name else ansi_unparseobj then then $def refsonly { swap foreach swap pop dup dbref? not if pop then repeat }array $libdef lastroom : lastroom[ ref:target int:item -- ref:location ] var tmp target @ "/./lastloc" array_get_reflist item @ [] tmp ! tmp @ case dbref? not when #-3 end int 0 <= when #-3 end int dbtop int >= when #-3 end room? not when #-3 end default end endcase ; PUBLIC lastroom : help { { "Tracks " PROGVER " -- (C) 2003 Alynna Trypnotk" }cat " " "Syntax:" " " { " backtrace List the last " MAGIC " places you were at" }cat " back Go back to the last place you were at" " back <#> Go back to the place you specified from your backtrace list." " " "MUF primitive:" " $lib/lastroom:" " lastroom ( d:target i:item -- d:location )" " Retrieves an item from ones lastlocation list." " 0 lastroom -- will return the last location one was at." }array atellme ; : main var! param var tmp var count param @ "#help" smatch if help exit then param @ atoi count ! command @ tolower case "{back|goback}" smatch when me @ "/./lastloc" array_get_reflist dup count @ [] tmp ! count @ array_delitem 0 MAGIC -- array_getrange #-3 swap array_appenditem tmp @ if me @ tmp @ moveto else me @ #-3 moveto then me @ "/./lastloc" rot refsonly array_put_reflist end "{backtrace}" smatch when { "^UNDERLINE^Your last " MAGIC " locations^NORMAL^" }tell 0 MAGIC -- 1 for { swap dup intostr 2 rj swap ": " me @ rot lastroom nameEx }tell repeat end default pop loc @ me @ 0 lastroom dbcmp not if me @ "/./lastloc" { loc @ me @ "/./lastloc" array_get_reflist 0 MAGIC -- -- array_getrange array_vals pop }array refsonly array_put_reflist then end endcase ; . c q