Register forum user name Search FAQ

Gammon Forum

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 ➜ Regular Expression Issue With a Trigger

Regular Expression Issue With a Trigger

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


Posted by Antoine   (6 posts)  Bio
Date Mon 22 Apr 2013 08:54 PM (UTC)
Message
Hello,

I've watched the trigger video, checked the Tips n Tricks forum and didn't find anything similar though i could have overlooked it. I'm sure someone has asked this newbie question before. I'm trying to create a trigger to fire off when my movement is below 5 %

my status bar looks like this:

[677519308 exp] [none] <50500hp 50500m 31884/52500mv>

The hp and mana are current, i don't have them set for min/man. My real problem is i'm not sure how to write the trigger in regular expression to make me recall after i reach 5% movement and go north twice and refresh. How do i write the Trigger to ignore everything but the movement...and then write it to recall once it reaches 5%? I'm new to Mushclient so i'm finding these complex triggers difficult and confusing.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 24 Apr 2013 10:24 AM (UTC)
Message
Can you post what you tried?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Oligo   (26 posts)  Bio
Date Reply #2 on Fri 26 Apr 2013 11:59 PM (UTC)

Amended on Sat 27 Apr 2013 12:02 AM (UTC) by Oligo

Message
Your regular expression for your prompt line should look something like the below:


^\[([0-9]+) exp\] \[([a-z]+)\] \<([0-9]+)hp ([0-9]+)m ([0-9]+)/([0-9]+)mv\>


And then you want to capture the group that you want so you can do the percentage calculations.

to do the mv calculation you want something like (in Lua):

if (tonumber("%5")/tonumber("%6") <= 0.05) then
  Execute("n;n;cast 'refresh' me")
end

mud.arctic.org : 2700
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.


13,838 views.

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

Go to topic:           Search the forum


[Go to top] top

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