You may also want to adjust your flee code. If you're sitting (memorizing spells or whatever) and you want to flee, the position code is smart enough that if you (or your flee code) doesn't issue a stand it will sit you back down.**
You'll need to provide curpos and lastpos variables from your prompt to make this work. position_verify should be called from wherever you update curpos and lastpos.
send_command and incr are simple helper functions from elsewhere in my code.
Code: Select all
#nop escape processing
#ali send_command \%0;
#nop simple counter code
#ali incr #math {%1} {${%1} + 1};
Code: Select all
#nop some abbreviations
#ali st stand
#ali sta stand
#ali stan stand
#ali rec recline
#ali recl recline
#ali recli recline
#ali reclin recline
#ali si sit
#ali kn kneel
#ali kne kneel
#ali knee kneel
#nop map the commands to a common code handler
#ali stand check_pos stand
#ali sit check_pos sit
#ali recline check_pos recline
#ali kneel check_pos kneel
#nop just in case, I don't track what failed.
#act {^Nah... You feel too relaxed to do that...} {alert}
#nop translations between commands and the P: items
#var pos_abbrev_stand std
#var pos_abbrev_recline rcl
#var pos_abbrev_kneel knl
#var pos_abbrev_sit sit
#nop we want to be standing initially.
#var pos_intent stand
#nop if position has changed,
#nop if new position doesn't match intent,
#nop adjust
#ali position_verify {
#if {("${lastpos}"!="${curpos}") && ("${curpos}" != "${pos_abbrev_${pos_intent}}")} {
send_command ${pos_intent};
}
}
#nop if intent has changed
#nop adjust
#ali check_pos {
#if {"%1"!="${pos_intent}"}
{
#var pos_intent %1;
send_command %1;
}
}
* There is a proc in the mud where you have to trigger off the text. I know of only one, but since I'm rewriting my triggers from hand I don't have that string handy. The problem occurs because of the way the proc is coded. I consider this an acceptable failure mode (using a #act blah stand) in this one special case as coding can break any trigger set.
** It would go
1) flee stands you
2) your flee repeat code fires
3) resit occurs
4) repeat if step #2 was a failed flee