Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Tips and tricks
➜ needing help on a trigger
|
needing help on a trigger
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| KewlGuy
(5 posts) Bio
|
| Date
| Sat 01 Jan 2005 04:10 PM (UTC) |
| Message
| heya all,
ive gone through like 90% of these forums and havn't come across anything that has helped me with one trigger i want to get working but ive also learned alot im basicly new to muchclient well that's enough bable bout this any how here is the problem i have
i want a line to show in status bar on this text:
hp: */* sp: */* mana: */* e: [*] pty: (*%)
NB * = numbers and letters also : character
the problem i believe i have is it doesn't like to pick up the
e: [*] pty: (*%)
the e: [*] is sposed to be [monster : status] or [none] whene in and out of battle
pty: (*%) is percent of faith my god has in me
ive tried with out monster status so i can get pty to work but it says it can't work cause it doesn't like \p or \P
and so this has stumped me like totally i think ive tried nearly all the techiques that are shown in these forums
so i thought id ask and see if anyone can enlighten me on my problem
thanks in advance
KewlGuy
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Sat 01 Jan 2005 06:56 PM (UTC) |
| Message
| All this stuff can be made to work, there is practically nothing you can't do with triggers and regular expressions.
However to help you we need more information:
You have said it doesn't like \p - it is hard to know what you mean without seeing the trigger you are writing. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| KewlGuy
(5 posts) Bio
|
| Date
| Reply #2 on Sat 01 Jan 2005 07:07 PM (UTC) |
| Message
| okay here is an example of what i need it to work from
HP: 762/740 SP: 152/315 MANA: 58/1315 E: [none] PTY: (71%)
now for what i have so far that is working
<triggers>
<trigger
enabled="y"
ignore_case="y"
lines_to_match="2"
match="HP\:\s+\d+\/\d+\s+\SP\:\s+\d+\/\d+\s+\MANA\:\s+\d+\/\d+"
regexp="y"
send_to="3"
sequence="100"
>
<send>%0</send>
</trigger>
</triggers>
basicly what im trying to do is put that line on the status bar cause my battles in the game get really spammy ant it's very hard to know what my stats are for every round unless it's somewhere like the status bar
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Sat 01 Jan 2005 07:11 PM (UTC) Amended on Sat 01 Jan 2005 07:13 PM (UTC) by Nick Gammon
|
| Message
| OK, that worked, so what is the problem exactly?
HP: 762/740 SP: 152/315 MANA: 58/1315 E: [none] PTY: (71%)
TRACE: Matched trigger "HP\:\s+\d+\/\d+\s+\SP\:\s+\d+\/\d+\s+\MANA\:\s+\d+\/\d+"
I turned trace mode on to confirm it matched. And it copied the status line to the status bar.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| KewlGuy
(5 posts) Bio
|
| Date
| Reply #4 on Sat 01 Jan 2005 07:17 PM (UTC) |
| Message
| the problem is i can't find a way to get the mob status and pty into the status bar what i have there and working so far is just hp sp and mana if you know what i mean
what i want is the whole line that shows to goto the status bar
ive tried lots of different ways but can't seem to get it to work i can however get it to pick up some of the things and others it tells me whene i goto click okay that it doesn't parse it correctly or there is an error but i can't seem to see the error myself | | Top |
|
| Posted by
| KewlGuy
(5 posts) Bio
|
| Date
| Reply #5 on Sat 01 Jan 2005 07:21 PM (UTC) |
| Message
| what also make it alot harder for me is that the E: [none] changes in battle to a format like this
E: [Owen the : bleeding] | | Top |
|
| Posted by
| Flannel
USA (1,230 posts) Bio
|
| Date
| Reply #6 on Sat 01 Jan 2005 07:22 PM (UTC) |
| Message
| Just tack on a .* at the end of that.
Actually, add '^' to the beginning, and .*$ to the end (^ and $ will ensure you capture the entire line)
^HP\:\s+\d+\/\d+\s+\SP\:\s+\d+\/\d+\s+\MANA\:\s+\d+\/\d+.*$ |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | | Top |
|
| Posted by
| KewlGuy
(5 posts) Bio
|
| Date
| Reply #7 on Sat 01 Jan 2005 07:24 PM (UTC) |
| Message
| | ahhhh that worked thanks i must of had the syntax for tacking the * on the end wrong thanks guys for the help ;) | | Top |
|
| Posted by
| Flannel
USA (1,230 posts) Bio
|
| Date
| Reply #8 on Sat 01 Jan 2005 07:25 PM (UTC) |
| Message
| Or you could get more fancy and make sure it has the E: and the PTY:
Like this:
^HP\:\s+\d+\/\d+\s+\SP\:\s+\d+\/\d+\s+\MANA\:\s+\d+\/\d+ E\:\[.*\] PTY\: \(\d{1,3}\%\)$
If you have trailing spaces, you'll need to allow for those:
^HP\:\s+\d+\/\d+\s+\SP\:\s+\d+\/\d+\s+\MANA\:\s+\d+\/\d+ E\:\[.*\] PTY\: \(\d{1,3}\%\).*$ |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #9 on Sat 01 Jan 2005 07:26 PM (UTC) Amended on Sat 01 Jan 2005 07:27 PM (UTC) by Nick Gammon
|
| Message
| OK, I got it to match. I reworked your trigger a bit, to make it a bit easier to read. Fortunately I was just doing a write-up on regular expressions yesterday. :)
<triggers>
<trigger
enabled="y"
ignore_case="y"
lines_to_match="2"
match=
"(?x) HP: (\s+ \d+ / \d+ \s+) SP: (?1) MANA: (?1) E: \s+ \[ .* \] \s+ PTY: \s+ \( \d+ % \)"
regexp="y"
send_to="3"
sequence="100"
>
<send>%0</send>
</trigger>
</triggers>
What you probably did wrong, although it is hard to say without seeeing the one that didn't work, is that with brackets you need to "escape" them by putting a backslash in front of them.
Also for SP you had it as \SP which is wrong, because \S means "match on not a space", which probably worked for S (which is not a space) but is confusing.
In the trigger above I put in (?x) so I could put in spaces to make it clearer. I also used the (?1) idea so that the matching on (space)(number)/(number)(space) didn't have to be written three times over.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #10 on Sat 01 Jan 2005 07:30 PM (UTC) Amended on Sat 01 Jan 2005 07:31 PM (UTC) by Nick Gammon
|
| Message
|
Quote:
what also make it alot harder for me is that the E: [none] changes in battle to a format like this
E: [Owen the : bleeding]
Using \[.*\] will match that easily enough. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | 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.
33,013 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top