Page 1 of 1

I want to rest after combat if HP is low

Posted: Thu Aug 05, 2010 11:15 pm
by randomuser01
My bot runs through a pretty dense area of non-aggressive mobs. The combination of them hitting me + dots + there being so many, I have a decent chance of dieing.

What I'd like to do is once a fight is finished, if my HP is under 80% use the hide skill, wait til HP is over 90%, and then continue doing whatever.

I tried this and it didn't work:

Code: Select all

	<onLeaveCombat><![CDATA[
		sendMacro("ActionButtonUp(12)"); yrest(100);
		if (80 > player.HP/player.MaxHP*100) then
			repeat player.HP; yrest(1000) until player.HP > 13000
		end
		sendMacro("ActionButtonUp(12)"); yrest(100);
	]]></onLeaveCombat>
But that code doesn't work. I'm not very good at LUA, is there a loop..break..end type of code I could use?

Help?

Re: I want to rest after combat if HP is low

Posted: Fri Aug 06, 2010 4:17 am
by rock5
randomuser01 wrote:My bot runs through a pretty dense area of non-aggressive mobs. The combination of them hitting me + dots + there being so many, I have a decent chance of dieing.

What I'd like to do is once a fight is finished, if my HP is under 80% use the hide skill, wait til HP is over 90%, and then continue doing whatever.

I tried this and it didn't work:

Code: Select all

	<onLeaveCombat><![CDATA[
		sendMacro("ActionButtonUp(12)"); yrest(100);
		if (80 > player.HP/player.MaxHP*100) then
			repeat player.HP; yrest(1000) until player.HP > 13000
		end
		sendMacro("ActionButtonUp(12)"); yrest(100);
	]]></onLeaveCombat>
But that code doesn't work. I'm not very good at LUA, is there a loop..break..end type of code I could use?

Help?
The problem is

Code: Select all

			repeat player.HP; yrest(1000) until player.HP > 13000
It's equivalent to

Code: Select all

			repeat 
				player.HP;
				yrest(1000)
			until player.HP > 13000
player.HP does nothing. It's just a variable. What you meant to do was update it using player:update() and you should do it after the pause. Like this;

Code: Select all

			repeat yrest(1000) player:update() until player.HP > 13000
Try that.

Re: I want to rest after combat if HP is low

Posted: Fri Aug 06, 2010 1:44 pm
by randomuser01
Works great, thanks a lot!