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
➜ Trying to get my health variable to do a trigger
Trying to get my health variable to do a trigger
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Rivius
(99 posts) Bio
|
Date
| Mon 05 Apr 2010 02:58 PM (UTC) |
Message
| Basically, I want to make a trigger than activates when my health is below a certain threshold.
This is what the prompt looks like, it is sent after each line of output.
1672h, 1128m, 1197e, 0p, 6380en, 4310w ex-
Health is the first variable.
What I did is, I made a trigger with this as the tagline
^*h, *m, *e, *p, *en, *w ex-$
And I set this as the code (lua, and I am sending to script)
health=%1
mana=%2
if health<400 then
send("Health is low! Escape)
end
But it did nothing... Can someone explain to me what I'm doing wrong? | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #1 on Mon 05 Apr 2010 05:49 PM (UTC) |
Message
| The problem is your use of the asterisk (*). With regex disabled, it means "match stuff here". With regex enabled, it means "0 or more of the previous character".
Here's a full trigger I made for Achaea that should hopefully work for you. I assume you're playing Lusternia or Imperian, so it will need some tweaking, but I hope it's not too hard to see how it works.
^\d+h, (?:\d+m,? )?(?:\d+e,? )?(?:\d+w,? )?c?e?x?k?d?b?(?: Vote)?-
This one is capturing nothing, just matching on any (Achaean) prompt. You can capture any of them by putting () around one of them, like (\d+)h for capturing health, or (e)?(x)? to capture your equilibrium and balance. Like so:
^(\d+)h, (?:\d+m,? )?(?:\d+e,? )?(?:\d+w,? )?c?(e)?(x)?k?d?b?(?: Vote)?-
With this setup, health is %1, equilibrium is %2, and balance is %3. Again, you'll need to make adjudments for the prompt style of your MUD. For example, to add your "p" and "en" stats:
^\d+h, (?:\d+m,? )?(?:\d+e,? )?(?:\d+p,? )?(?:\d+en,? )?(?:\d+w,? )?c?e?x?k?d?b?(?: Vote)?-
|
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Kurapiira
(25 posts) Bio
|
Date
| Reply #2 on Sat 10 Apr 2010 02:07 AM (UTC) |
Message
|
try it like so mebbe?
if %1<400 then
send("Health is low! Escape)
end
K. | Top |
|
Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
Date
| Reply #3 on Sat 10 Apr 2010 03:07 AM (UTC) Amended on Sat 10 Apr 2010 03:08 AM (UTC) by Nick Gammon
|
Message
| Don't forget the trailing quote:
if %1 < 400 then
Send("Health is low! Escape")
end
And Lua is case-sensitive so it is Send, not send.
And since I doubt the MUD recognizes "Health is low!" you probably mean Note, not Send. |
- 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.
15,335 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top