How to array

Post Reply
holypickle
Posts: 10
Joined: Sun Feb 14, 2016 1:06 pm

How to array

Post by holypickle » Wed Feb 24, 2016 7:11 am

I need to be able to heal myself when my health goes below 50%. How would I do this?

here's what the MUD sends me when I get damaged.

IE

Hp: 70 60%
Human bandit hits you.

User avatar
Belgarath
Posts: 232
Joined: Fri Jul 26, 2013 7:19 am
Discord: macjabeth#2283

Re: How to array

Post by Belgarath » Wed Feb 24, 2016 6:42 pm

Something like this (bare minimum of effort unless you want to build a modular system):
Code: [show] | [select all] lua
-- ^Hp: \d+ (\d+)%$
if tonumber(matches[2]) < 50 then
  send("heal myself")
end
And you would probably add in extra variables like your health balance or a cooldown timer so you don't spam it.

holypickle
Posts: 10
Joined: Sun Feb 14, 2016 1:06 pm

Re: How to array

Post by holypickle » Wed Feb 24, 2016 11:55 pm

Thanks man

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests