[TF] PROMPT HOOK regexp matches, but %Pn won't be set?
Brought to you by:
kenkeys
|
From: johans at stack.nl (J. v. Selst) - 2003-03-26 14:52:30
|
Johan van Selst wrote:
> I don't think that matching on colours will work: just ignore the
> colours in your expression.
Oops, I'm completely wrong with this: in prompts the colour codes _are_
preserved so you will need to keep this in mind with your trigger.
Something to match a prompt like
^[[32m3300h, ^[[37m^[[32m3300m ^[37m^[32mcexs-
/def -p1 -mregexp -h'prompt ([0-9]*)h, .*m([0-9]*)m' prm_hook = \
/set hitp=%P1 %;\
/set manap=%P2 %;\
/test prompt({*})
You can match the escape character by a litteral escape in your trigger
(writing ^[ won't work) - or by just using '.' for any character.
So if you want to extract the colour codes as well, you can use:
/def -p1 -mregexp -h'prompt ([0-9]*)m([0-9]*)h, .*\[([0-9]*)m([0-9]*)m' \
prm_hook = \
/set hitc=%P1 %;\
/set hitp=%P2 %;\
/set manac=%P3 %;\
/set manap=%P4 %;\
/test prompt({*})
--
Johan van Selst <jo...@st...> Koresh@OuterSpace
PGP: finger jo...@va... telnet mud.stack.nl 3333
|