[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Trigger on 3 different prompts?

Trigger on 3 different prompts?

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Kurapiira   (25 posts)  [Biography] bio
Date Fri 02 Apr 2010 05:55 AM (UTC)
Message
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.
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] bio
Date Reply #1 on Fri 02 Apr 2010 04:23 PM (UTC)

Amended on Fri 02 Apr 2010 04:24 PM (UTC) by Worstje

Message
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. :)
[Go to top] top

Posted by Kurapiira   (25 posts)  [Biography] bio
Date Reply #2 on Sat 03 Apr 2010 12:23 AM (UTC)

Amended on Sat 03 Apr 2010 02:14 AM (UTC) by Kurapiira

Message
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.



[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


11,769 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]