# -*-tcl-*-
# This is my char init file for a mystic on Realms of the Dragon.
#################################################################

# automatically recast some spells

action set {^Your skin returns to normal} {write "ah me"}

action set {^The Sword of Orion disentegrates} {
    write cc
    after 2000 write equip
}

action set {^You revert to your natural form} {
    write sh
}

action set {^Your Field of Chaos wears off} {
    write pd
}

action set {^Your Animal Agility Spell Expire} {write aa}

action set {^Your extra limbs form back into your body} {
    write pf
    after 2000 write equip
}

# Beep when someone talks to us.

action set {^%w tells you|^%w asks you} {bell}

# For the truly paranoid, set target to anyone
# who enters a room with you or who is in a room
# you enter. The first arg turns the action on or off.

alias set paranoid {
    set pattern {^%s arrives|^%s is here}

    if {$1} {
	action set $pattern {
	    set targ $1$2
	    echo [color target: {bold magenta}] $targ
	}
    } else {
	action delete -exact -- $pattern
    }
}

# Get to places quickly
# speedwalk is defined in the sample mmucl.rc
alias set toeluten {speedwalk 4n10w7ne2nw2n2w}
alias set tokhan {speedwalk 2n5w10n3w2nen2e2nen}

# Set up some convenient key bindings.

# Hit Control-Escape to bail out.
key set Control-Escape {write quit}

# protective spells
key set F1 {write ah}
key set F2 {write pd}
key set F3 {write aa}
key set F4 {write eb}

# unused
key set F5 {echo unused}
key set F6 {echo unused}
key set F7 {echo unused}
key set F8 {echo unused}

# miscellaneous
key set F9  {write "look $targ"}
key set F10 {echo unused}
key set F11 {echo unused}
key set F12 {
    if {[walk suspend]} {
	walk suspend 0
	echo "WALK CONTINUED"
    } else {
	walk suspend 1
	echo "WALK STOPPED"
    }
}

# Turn a robot for a location on or off.
# kill and walk are arrays holding info
# for the ak and walk commands.

alias set robot {
    if {$1} {
	ak on $kill($2) hh q
	walk on $walk($2)
	monitor on

#	action set "^You look around and can't seem to find your target" {
#	    write q
#	    walk suspend 0
#	}
    } else {
	walk off
	ak off
	#action delete -exact -- \
		"^You look around and can't seem to find your target"
    }
}

# This is used by monitor defined in mmucl.rc
# It is called everytime status(hp) changes.

proc hp_check {args} {
    global status

    if {$status(hp) < 1000} {
	write quit
    } elseif {$status(hp) < 3000} {
	write nb
	#after 4000  write pd
	#after 8000  write sh
	#after 16000 write aa
    }
}
