# -----------------------------------------------------------------
# --- file:        follow
# --- date:        3 mar. 2002
# --- revised by:  Selim
# --- revised on:  3 mar. 2002
# --- author:      Frank Scherthan aka Taros
# --- email:       t.a.r.o.s@gmx.de
# --- mud name:    Tubmud
# --- mud ip/port: ?
# --- mud base:    LP
# --- comments:    follow: an easy way to to follow someone around.
# ---              
# ---
# --- ex.:
# ---  follow NAME
# ---  where NAME is the name of someone you want to follow
# ---  (Name is case sensitive!)
# ---
# --- my mud sends stings like this: 'Taros leaves north.'
# ---  To follow Taros I had to type 'north', but with this script
# ---  that is automated when I type:
# ---  follow Taros
# ---
# --- to stop following someone just type:
# ---  stopfollow
# ---
#

::smm::showme "follow loaded!"

::set _followname "fname"

::proc follow {followname} {
    ::variable _followname
    ::set _followname $followname
    ::proc dofollow {line} {
	::variable _followname
	::if {[::regexp "^$_followname leaves (.*).$" $line dummy go]} {
	    ::eval $go
	}
    }
    ::smm::action::set dofollow 10
}

::proc stopfollow {} {
    ::smm::action::unset dofollow
}