WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Hello please i need help into fixing a script (https://www.wowinterface.com/forums/showthread.php?t=59082)

Vremon 03-29-22 08:32 AM

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

Fizzlemizz 03-29-22 11:50 AM

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")

Vremon 03-29-22 11:54 AM

Quote:

Originally Posted by Fizzlemizz (Post 340465)
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

Fizzlemizz 03-29-22 12:22 PM

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")


Vremon 03-29-22 01:07 PM

Quote:

Originally Posted by Fizzlemizz (Post 340467)
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?

Fizzlemizz 03-29-22 02:34 PM

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.

jeruku 03-31-22 01:17 PM

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.


All times are GMT -6. The time now is 05:48 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI