Thread Tools Display Modes
03-29-22, 08:32 AM   #1
Vremon
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2022
Posts: 14
Hello please i need help into fixing a script

hello i have a script for defensive stance aura for warrior using UNIT_AURA the script it was working before fine and also now but since blizzard change UNIT_AURA recently the script its load load load non stop alot of memory please help me

Last edited by Vremon : 03-31-22 at 10:33 AM.
  Reply With Quote
03-29-22, 11:50 AM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
I can't see anything that would cause this code to continuously consume memory. The new table payload of UNIT_ARUA will cause a temporary increase until it is garbage collected.

Code:
stance:RegisterEvent("UNIT_AURA", "player")
won't register the event just for the "player" unit. For that you would need:

Code:
stance:RegisterUnitEvent("UNIT_AURA", "player")
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 03-29-22 at 11:55 AM.
  Reply With Quote
03-29-22, 11:54 AM   #3
Vremon
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2022
Posts: 14
Originally Posted by Fizzlemizz View Post
I can't see anything that would cause this code to continuously consume memory.

Code:
stance:RegisterEvent("UNIT_AURA", "player")
won't register the event just for the "player" unit. For that you would need:

Code:
stance:RegisterUnitEvent("UNIT_AURA", "player")
but i dont understand ur answer sorry what i need to change or ? i can show in wow in game its just happen when i face players in pvp in arena or bg or npc in world enemy, and yes i want the event to work only for me player unit cause its just for stance aura defensive stance

Last edited by Vremon : 03-29-22 at 12:03 PM.
  Reply With Quote
03-29-22, 12:22 PM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
frame:RegisterEvent will send the event for all units (it will ignore the "player" parameter).

If you want to register an event for a particular unit (or units) you need to use frame:RegisterUnitEvent

Code:
local stance = CreateFrame("Frame")
stance:RegisterUnitEvent("UNIT_AURA", "player")
stance:RegisterEvent("PLAYER_ENTERING_WORLD")
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 03-29-22 at 12:28 PM.
  Reply With Quote
03-29-22, 01:07 PM   #5
Vremon
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2022
Posts: 14
Originally Posted by Fizzlemizz View Post
frame:RegisterEvent will send the event for all units (it will ignore the "player" parameter).

If you want to register an event for a particular unit (or units) you need to use frame:RegisterUnitEvent

Code:
local stance = CreateFrame("Frame")
stance:RegisterUnitEvent("UNIT_AURA", "player")
stance:RegisterEvent("PLAYER_ENTERING_WORLD")
yes sir i did that still same thing i just wonder why before it did not manifest like this loading memory constantly while in bgs or vs players its cause of new auratuil.lua change from blizz or?
  Reply With Quote
03-29-22, 02:34 PM   #6
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
The UNIT_AURA event can now come with table where it didn't before. The tables will take up memory until they are cleaned up by the garbage collector.

The more often UNIT_AURA fires, the more chance there will be more tables.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 03-29-22 at 02:40 PM.
  Reply With Quote
03-31-22, 01:17 PM   #7
jeruku
A Cobalt Mageweaver
 
jeruku's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 223
My answer after lunch.

Try using GetPlayerAuraBySpellID instead.

Replacing:
Lua Code:
  1. AuraUtil.FindAuraByName("Defensive Stance", "player", "HELPFUL") -- AuraUtil.FindAuraByName("Defensive Stance", "player")
with
Lua Code:
  1. GetPlayerAuraBySpellID(197690) -- That should be the buffID, if not you'll need to find it yourself.
__________________
"I have not failed, I simply found 10,000 ways that did not work." - Thomas Edison
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Hello please i need help into fixing a script

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off