player:hasBuff stops working properly with many buffs

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Alkaiser
Posts: 222
Joined: Sat Sep 25, 2010 2:03 pm

player:hasBuff stops working properly with many buffs

#1 Post by Alkaiser » Tue Dec 28, 2010 11:10 pm

I have an issue where if my character has a large number of "buffs" active, the hasBuff function will return false even if a given buff is active (true expected).

The point it breaks seems to be around 11-12 buffs.

Code: Select all

<onSkillCast>
	local health = player.HP/player.MaxHP*100
		if( 90 > health ) then
			if( not player:hasBuff("Regenerate") ) then
				player:cast("PRIEST_REGENERATE")
			end	
		end
</onSkillCast>
EDIT: Make that over 12 buffs. The 13th and higher buff is ignored by the hasBuff function.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: player:hasBuff stops working properly with many buffs

#2 Post by rock5 » Wed Dec 29, 2010 1:14 am

Alkaiser wrote:I have an issue where if my character has a large number of "buffs" active, the hasBuff function will return false even if a given buff is active (true expected).

The point it breaks seems to be around 11-12 buffs.

Code: Select all

<onSkillCast>
	local health = player.HP/player.MaxHP*100
		if( 90 > health ) then
			if( not player:hasBuff("Regenerate") ) then
				player:cast("PRIEST_REGENERATE")
			end	
		end
</onSkillCast>
EDIT: Make that over 12 buffs. The 13th and higher buff is ignored by the hasBuff function.
The function that updates the buffs uses a RoMScript command to return all the buffs. Your probably breaking the 255 character limit that RoMScript can return. You can check a specific buff yourself like this.

Code: Select all

<onSkillCast>
	local health = player.HP/player.MaxHP*100
		if( 90 > health ) then
			local HasBuff = RoMScript("} a={false} for i=1,16 do if UnitBuff('player', i) == 'Regenerate' then a={true} break end end z={");
			if not HasBuff then
				player:cast("PRIEST_REGENERATE")
			end	
		end
</onSkillCast>
Eventually we'll probably be able to get the buffs from memory but in the mean time this should work.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Alkaiser
Posts: 222
Joined: Sat Sep 25, 2010 2:03 pm

Re: player:hasBuff stops working properly with many buffs

#3 Post by Alkaiser » Wed Dec 29, 2010 1:17 am

Ah! So that's what the deal is. I'll give this a try.

fred55555
Posts: 101
Joined: Sat Aug 07, 2010 7:57 pm

Re: player:hasBuff stops working properly with many buffs

#4 Post by fred55555 » Thu Dec 30, 2010 3:57 pm

i get an error when the script is compiled when i add this routine.

is the } supposed to be ) ?

or maybe i should just ask how do you just check one buff :ugeek:

have a good hoilday, thank for a great year of botting.

User avatar
Administrator
Site Admin
Posts: 5313
Joined: Sat Jan 05, 2008 4:21 pm

Re: player:hasBuff stops working properly with many buffs

#5 Post by Administrator » Thu Dec 30, 2010 4:10 pm

fred55555 wrote: is the } supposed to be ) ?
Nope. Curly braces are used for tables.

Alkaiser
Posts: 222
Joined: Sat Sep 25, 2010 2:03 pm

Re: player:hasBuff stops working properly with many buffs

#6 Post by Alkaiser » Thu Dec 30, 2010 7:55 pm

I haven't had the opportunity to test it yet as Govinda has crashed and burned.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests