[TF] Prompt Hook
Brought to you by:
kenkeys
|
From: bargle at umiacs.umd.e. (G. Jackson) - 2003-02-06 16:23:52
|
On Thu, 6 Feb 2003, Johan van Selst wrote: >James West wrote: >> Is it possible to program triggers or hooks based on information contained >> in a prompt? What I would like to set up is a hook that replenishes my >> health in-game when my health gets below a certain number. This number >> is shown in the prompt. Is this possible? > >Yes, you can use -h"prompt pattern" for this. >For example a macro like > > /def -mregexp -h"prompt health:([0-9]+)" = /let health=%P1%;\ > /if (health < 10) replenish%;/endif > >would set the variable %health to the current health level and send the >"replenish" command if it drops below 10. Assuming you prompt looks >something like > > [Warrior health:20/30 mana:03/20] > >See /help hooks for more details. One caveat: hooks don't strip out ANSI codes like triggers, so if you've got a color prompt, you might have trouble. On the MUD I used to play (Nodeka, nodeka.com:6000), we could set up our own prompts, including carriage returns, so I just set up an easily parsed line before the real prompt that triggered other things, and got gagged. -- Gary Jackson ba...@um... |