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
➜ General
➜ Trigger that detects either a number or '???' ?
Trigger that detects either a number or '???' ?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Eloni
(28 posts) Bio
|
Date
| Tue 06 Dec 2016 01:25 PM (UTC) |
Message
| My mud sometimes reports percentage health of mobs as "???". I can't seem to figure out how to make a single trigger that fires when it sees a percentage (number 0-100) OR '???'.
The trigger fires off of my prompt. The sixth asterisk is where either a percentage or the three question marks appear:
Quote: <*hp *mana *move> * <*> <* percent>
I've tried several variations of regular expressions and normal triggers and nothing seems to work. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Tue 06 Dec 2016 08:53 PM (UTC) Amended on Tue 06 Dec 2016 08:54 PM (UTC) by Nick Gammon
|
Message
| Please show what you have tried.
|
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.
|
Also copy and paste an example line of output from the MUD. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Eloni
(28 posts) Bio
|
Date
| Reply #2 on Tue 06 Dec 2016 09:04 PM (UTC) Amended on Tue 06 Dec 2016 09:16 PM (UTC) by Eloni
|
Message
|
<*hp *m *mv *ac> * <*> <* percent>
<*hp *m *mv *ac> * <*> <??? percent>
Both work individually.
^\<(.*?)hp (.*?)m (.*?)mv (.*?)ac\> (.*?) \<(.*?)\> \<((.*?)|\?\?\?) percent\> $
<*hp *m *mv *ac> * <*> <(*|???) percent>
Neither of these worked.
edit: Forgot to include compile error
Compile error
World: world.com
Immediate execution
[string "Trigger: TrackInCombatStats"]:18: unexpected symbol near '?'
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Wed 07 Dec 2016 06:56 AM (UTC) |
Message
| If you would be kind enough to re-read reply #1, and do what it suggests in the link, that would be much appreciated.
You clearly have a problem in your code, code which you haven't posted. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Eloni
(28 posts) Bio
|
Date
| Reply #4 on Wed 07 Dec 2016 07:45 AM (UTC) Amended on Wed 07 Dec 2016 07:48 AM (UTC) by Eloni
|
Message
| My apologies, Mr. Gammon. I think my brain didn't associate that part of your post with a response to my message. I guess it was processed like an automated forum signature, or like an ad and subconsciously ignored.
The first two triggers work fine by themselves. The third trigger is my best attempt to combine the two, and it returns the compile error seen just below it.
------
<triggers>
<trigger
enabled="y"
match="^\<(.*?)hp (.*?)m (.*?)mv (.*?)ac\> (.*?) \<(.*?)\> \<\?\? percent\> $"
name="TrackInCombatStats"
regexp="y"
send_to="12"
sequence="100"
>
<send>
print "Detecting IN COMBAT, inCombat == true"
inCombat = true
MyHealth = %1
MyMana = %2
MyMove = %3
print "%7"
--print "%5"
FightOrFlight(%7)
</send>
</trigger>
</triggers>
------
<triggers>
<trigger
enabled="y"
match="^\<(.*?)hp (.*?)m (.*?)mv (.*?)ac\> (.*?) \<(.*?)\> \<(.*?) percent\> $"
name="TrackInCombatStats"
regexp="y"
send_to="12"
sequence="100"
>
<send>
print "Detecting IN COMBAT, inCombat == true"
inCombat = true
MyHealth = %1
MyMana = %2
MyMove = %3
print "%7"
--print "%5"
FightOrFlight(%7)
</send>
</trigger>
</triggers>
------
<triggers>
<trigger
enabled="y"
match="^\<(.*?)hp (.*?)m (.*?)mv (.*?)ac\> (.*?) \<(.*?)\> \<((.*?)|\?\?) percent\> $"
name="TrackInCombatStats"
regexp="y"
send_to="12"
sequence="100"
>
<send>
print "Detecting IN COMBAT, inCombat == true"
inCombat = true
MyHealth = %1
MyMana = %2
MyMove = %3
print "%7"
--print "%5"
FightOrFlight(%7)
</send>
</trigger>
</triggers>
-----
Compile error
World: world.com
Immediate execution
[string "Trigger: TrackInCombatStats"]:18: unexpected symbol near '?'
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #5 on Wed 07 Dec 2016 10:07 PM (UTC) |
Message
|
You probably need to quote that. If wildcard 7 is ??? then you now have:
Hence the error message. You should have:
|
- 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.
16,731 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top