Trigger on 3 different prompts?

Posted by Kurapiira on Fri 02 Apr 2010 05:55 AM — 3 posts, 16,764 views.

#0
Hi,

The Mud I play has 3 different prompts,
One for warrior-like folks

HP: 93/214 Ftg: 13/61

One for mana users

HP: 104/104 Ftg: 40/40 MP: 71/71

and one for Psions

HP: 44/145 Ftg: 23/49 Psi: 0/65

I have isolated the mana and psi parts seperately
like so....

_______________________________________

for Mana warning:

<triggers>
<trigger
enabled="y"
expand_variables="y"
keep_evaluating="y"
match="^(.*?) (.*?) (.*?) (.*?) MP: (.*?)/(.*?)$"
name="manaprog"
regexp="y"
send_to="12&#8243;
sequence="100&#8243;
>
<send>mana=%5
maxmana=%6

if %5 &lt; (%6 / 3) then
Note ("LOW MANA")
end </send>
</trigger>
</triggers>
__________________________-

for low Psi warning:

<triggers>
<trigger
enabled="y"
expand_variables="y"
keep_evaluating="y"
match="^(.*?) (.*?) (.*?) (.*?) Psi: (.*?)/(.*?)$"
regexp="y"
send_to="12&#8243;
sequence="100&#8243;
>
<send>psi=%5
maxpsi=%6

if %5 &lt; (%6 / 3) then
Note ("LOW PSI")
end </send>
</trigger>
</triggers>

___________________________

My problem is capturing the health and ftg
to work with all 3 types?

here is what i'm using...

____________________________

<triggers>
<trigger
enabled="y"
expand_variables="y"
keep_evaluating="y"
match="^HP\: (.*?)\/(.*?) Ftg\: (.*?)\/(.*?) "
name="hpftg"
regexp="y"
send_to="12"
sequence="100"
>
<send> hp=%1
maxhp=%2
ftg=%3
maxftg=%4


if %1 &lt; (%2 / 3) then
Note ("LOW HEALTH")
end


if %3 &lt; (%4 / 3) then
Note ("LOW FTG")
end



SetStatus ("Current HP = ", %1)
</send>
</trigger>
</triggers>
_________________________--

it's working for all but warrior types...
I cant get the "end of the line" wildcard
to work unless i put them all in groups and turn them off and on depending upon which type of character i'm playing.

any way to do this?....mebbe a "space" wildcard?

Thanks for any help,
K.
Netherlands #1
That one is pretty simple. First of all, why not three different prompts? If a character can only ever get one particular prompt, you'd only need that particular trigger active.

However, if you really want all prompts to be matched...

HP: 93/214 Ftg: 13/61
HP: 104/104 Ftg: 40/40 MP: 71/71
HP: 44/145 Ftg: 23/49 Psi: 0/65

^HP\: (\d+)/(\d+) Ftg\: (\d+)/(\d+)(?: MP\: (\d+)/(\d+)| Psi\: (\d+)/(\d+))$


The above code assumes there's no whitespace at the end of the prompt. The different data will end up in the following captured groups:

%1: Current HP
%2: Maximum HP
%3: Current Ftg
%4: Maximum Ftg
%5: Current Mana (only has contents if present)
%6: Maximum Mana (only has contents if present)
%7: Current Psi (only has contents if present)
%8: Maximum Psi (only has contents if present)

You could use named capturing groups to keep it less confusing, but I figured the trigger was complicated enough as-is for you to understand right now. :)
Amended on Fri 02 Apr 2010 04:24 PM by Worstje
#2
I've tried just making all three triggers
but the HP ftg only one keeps giving an error
cause it sees something after the end of line?

can anyone poit me to a place with info on wildcards?
i saw the basic post, but thought mebbe there was
more info somewhere?...like..is there a "space" wildcard

I tried this but had no luck,
here is the trig...did i miss something?

<triggers>
<trigger
enabled="y"
expand_variables="y"
keep_evaluating="y"
match="^HP\: (\d+)/(\d+) Ftg\: (\d+)/(\d+)(?: MP\: (\d+)/(\d+)| Psi\: (\d+)/(\d+))$"
regexp="y"
send_to="12"
sequence="100"
>
<send>hp=%1
maxhp=%2
ftg=%3
maxftg=%4
mana=%5
maxmana=%6
psi=%7
maxpsi=%8

if %1 &lt; (%2 / 3) then
Note ("LOW HEALTH")
end

if %3 &lt; (%4 / 3) then
Note ("LOW FTG")
end

if %5 &lt; (%6 / 3) then
Note ("LOW MANA")
end

if %7 &lt; (%8 / 3) then
Note ("LOW PSI")
end </send>
</trigger>
</triggers>

______________________--

also..may i ask for a little help on
turning groups on and off?

first...is it better to turn on / off
groups...or( aliasgroups , and triggerGroups..)

and what is the difference between them?

In the helpfile it gives 2 diff examples..

world.EnableAliasGroup "groupname", 1

and for Lua

EnableAliasGroup ("groupname", true)

can you use either one?

If i have to, i guess i can just turn on
groups based on which character i will be using.

i just need a list or array of groupnames?
then i can turn off all characters groups...
and then just turn on the group i will be playing?

Thanx for any help, and sorry to
be such a pain...

K.