Regular Expression Issue With a Trigger

Posted by Antoine on Mon 22 Apr 2013 08:54 PM — 3 posts, 14,525 views.

#0
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.
Australia Forum Administrator #1
Can you post what you tried?
#2
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