Page 1 of 1
player:hasBuff stops working properly with many buffs
Posted: Tue Dec 28, 2010 11:10 pm
by Alkaiser
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.
Re: player:hasBuff stops working properly with many buffs
Posted: Wed Dec 29, 2010 1:14 am
by rock5
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.
Re: player:hasBuff stops working properly with many buffs
Posted: Wed Dec 29, 2010 1:17 am
by Alkaiser
Ah! So that's what the deal is. I'll give this a try.
Re: player:hasBuff stops working properly with many buffs
Posted: Thu Dec 30, 2010 3:57 pm
by fred55555
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
have a good hoilday, thank for a great year of botting.
Re: player:hasBuff stops working properly with many buffs
Posted: Thu Dec 30, 2010 4:10 pm
by Administrator
fred55555 wrote:
is the } supposed to be ) ?
Nope. Curly braces are used for tables.
Re: player:hasBuff stops working properly with many buffs
Posted: Thu Dec 30, 2010 7:55 pm
by Alkaiser
I haven't had the opportunity to test it yet as Govinda has crashed and burned.