Page 1 of 1

regex tomatch prompt when HP<100?

Posted: Mon Oct 14, 2013 3:54 pm
by Beven
I would have thought this would be trivial, but I must be stupid. read the regex tutorials, still can't figure it out....
prompt looks like :
[221/221hp 110/110m 101/101v (8605)]>

just need to pop a trigger when hp is less than 100

Am I just stupid or is this harder than it sounds like it should be?

Re: regex tomatch prompt when HP<100?

Posted: Mon Oct 14, 2013 9:21 pm
by Tagon
Personally I'd regex to get the current hp then use lua to test if it's lower than 100.

Re: regex tomatch prompt when HP<100?

Posted: Tue Oct 15, 2013 12:17 am
by Belgarath
Code: [show] | [select all] lua
Regex: ^\[(\d+)/(\d+)hp (\d+)/(\d+)m (\d+)/(\d+)v \((\d+)\)\]
That'll match the prompt. You can capture the health and check if it's less than 100 with:
Code: [show] | [select all] lua
local hp = tonumber(matches[2])
if hp < 100 then
   echo("You gunna die")
end