Basically I'm trying to create a trigger that will trip when my health is below 50%
How would I go about making an array, or a set of numbers in between x and y? Or in my case, 1-50.
Trigger Pattern: HP :
If HP<=50%
then
send(drink vial)
whoever helps me will get a really awesome cat photo
Need help with code
Re: Need help with code
You basically just answered your own question.
The trigger line would have to be a 'perl regex' type trigger, as you want to extract data from it (in this case, what your HP percentage is). It would look something like this:
^HP\: (\d+)\%$
For the script part of your trigger, it would go something like this:
local hpPercentage = tonumber(matches[2])
if hpPercentage <= 50 then
send("drink vial")
end
I would suggest looking into a Perl Regex tutorial, so you can learn what all of those archaic symbols mean. I would also look into a basic Lua tutorial so you can learn how to program this stuff yourself. It'll help in the long run!
The trigger line would have to be a 'perl regex' type trigger, as you want to extract data from it (in this case, what your HP percentage is). It would look something like this:
^HP\: (\d+)\%$
For the script part of your trigger, it would go something like this:
local hpPercentage = tonumber(matches[2])
if hpPercentage <= 50 then
send("drink vial")
end
I would suggest looking into a Perl Regex tutorial, so you can learn what all of those archaic symbols mean. I would also look into a basic Lua tutorial so you can learn how to program this stuff yourself. It'll help in the long run!
-
- Posts: 10
- Joined: Sun Feb 14, 2016 1:06 pm
Re: Need help with code
Thanks man, works perfectly