Quantcast
Load variables at Client start - WoWInterface
Thread Tools Display Modes
08-05-22, 03:50 AM   #1
cozmos
A Murloc Raider
Join Date: Mar 2007
Posts: 8
Load variables at Client start

Hello,

im trying to set some variables at wow start to change the position of some ui elements but Im experiencing some serious lags when using.

Im modifying the buffframe so I think everytime a new buff is applied the client uses the variable from the addon which causes the lag.

Is there a way to set the varaibles without the client using the addon? Or am I just bad at coding?
Which I actually am

The Addon looks like this:

Code:
                BuffFrame:SetScale(1.5);
		TemporaryEnchantFrame:SetScale(1.5);
		
		local cap = ZoneAbilityFrame.ClearAllPoints
                local sp = ZoneAbilityFrame.SetPoint
            hooksecurefunc(ZoneAbilityFrame, "SetPoint", function(self)
            cap(self)
            sp(self, "BOTTOM", UIParent, "BOTTOM", 0, 90)
        end)
		ZoneAbilityFrame:SetScale(1.3);
		ZoneAbilityFrame.Style:SetAlpha(0)
		ZoneAbilityFrame.Style:Hide()
		
		DurabilityFrame:Hide();
		
		local cap = VehicleSeatIndicator.ClearAllPoints
        local sp = VehicleSeatIndicator.SetPoint
        hooksecurefunc(VehicleSeatIndicator, "SetPoint", function(self)
            cap(self)
            sp(self, "TOPRIGHT", Minimap, "BOTTOMLEFT", -30, -10)
        end)

SlashCmdList['RELOADUI'] = function() ReloadUI() end
	SLASH_RELOADUI1 = '/rl'

SlashCmdList["READYCHECK"] = function() DoReadyCheck() end
	SLASH_READYCHECK1 = '/rc'

SlashCmdList["CHECKROLE"] = function() InitiateRolePoll() end
	SLASH_CHECKROLE1 = '/cr'

print("|cFF0048ffButler|r - It aint much but its honest work")
  Reply With Quote
08-06-22, 07:17 AM   #2
cozmos
A Murloc Raider
Join Date: Mar 2007
Posts: 8
i found the solution I think.

The problem I think it was I was setting a global value.
I set it in an container to load at player login and the lags are gone, also no spikes and CPU cycles are more then low >0,001 in an 40min dungeon.

The Code is:

Code:
local EventFrame = CreateFrame("frame", "EventFrame")
		EventFrame:RegisterEvent("PLAYER_ENTERING_WORLD")

	EventFrame:SetScript("OnEvent", function(self, event, ...)
	if(event == "PLAYER_ENTERING_WORLD") then
		ZoneAbilityFrame:SetScale(1.3);
		ZoneAbilityFrame.Style:SetAlpha(0);
		ZoneAbilityFrame.Style:Hide();
		DurabilityFrame:Hide();
		BuffFrame:SetScale(1.5);
		TemporaryEnchantFrame:SetScale(1.5);
		ObjectiveTrackerFrame:SetScale(1.1);
		ObjectiveTrackerFrame:SetSize(260,750);
	end
	end)
		
		
	local cap = ZoneAbilityFrame.ClearAllPoints
        local sp = ZoneAbilityFrame.SetPoint
        hooksecurefunc(ZoneAbilityFrame, "SetPoint", function(self)
            cap(self)
            sp(self, "BOTTOM", UIParent, "BOTTOM", 0, 90)
        end)
		
		
		local cap = VehicleSeatIndicator.ClearAllPoints
        local sp = VehicleSeatIndicator.SetPoint
        hooksecurefunc(VehicleSeatIndicator, "SetPoint", function(self)
            cap(self)
            sp(self, "TOPRIGHT", Minimap, "BOTTOMLEFT", -30, -10)
        end)
		
		local cap = ObjectiveTrackerFrame.ClearAllPoints
        local sp = ObjectiveTrackerFrame.SetPoint
        hooksecurefunc(ObjectiveTrackerFrame, "SetPoint", function(self)
            cap(self)
            sp(self, "TOPLEFT", 40, -10)
        end)
		
-- Slash Command List
	
SlashCmdList['RELOADUI'] = function() ReloadUI() end
	SLASH_RELOADUI1 = '/rl'

SlashCmdList["READYCHECK"] = function() DoReadyCheck() end
	SLASH_READYCHECK1 = '/rc'

SlashCmdList["CHECKROLE"] = function() InitiateRolePoll() end
	SLASH_CHECKROLE1 = '/cr'
The problem I encountered was when playing at uwqhd or 4k some elements like the bufframe were way too small and changing the UI scales just made other elements way too big.

Then I just repositioned some other stuff like objective tracker, zone ability frame, vehicle seat indicator and durability frame because I wanted to have them at an different postion.

Also whilst my research I found some code and varibles which might be useful for someone who is looking for something similar.

Code:
--[[SetCVar("autoLootDefault", 1)
		SetCVar("Sound_EnableErrorSpeech", 0)
		SetCVar("enableFloatingCombatText", 1)
		SetCVar("cameraDistanceMaxZoomFactor", 2.6)
		SetCVar("SkyCloudLOD", 3)
		SetCVar("autoDismount", 1)
		SetCVar("autoDismoduntFlying", 1)
		SetCVar("rawMouseEnable", 1)  --raw mouse
		SetCVar("rawMouseAccelerationEnable", 0)	--acceleration
		SetCVar("screenshotQuality", 10)]]--
		
		--[[

		hooksecurefunc("BuffFrame_UpdateAllBuffAnchors", function()
		BuffFrame:ClearAllPoints()
		BuffFrame:SetPoint("TOPRIGHT", Minimap, "TOPLEFT", -40, 0)
		end)
		
		--BuffFrame:ClearAllPoints();
	    --BuffFrame:SetPoint("TOPRIGHT", Minimap, "TOPLEFT", -60, 0);
	    BuffFrame:SetScale(1.5);
		TemporaryEnchantFrame:SetScale(1.5);]]--

--local cap = TalkingHeadFrame.ClearAllPoints
        --local sp = TalkingHeadFrame.SetPoint
		--[[hooksecurefunc("TalkingHeadFrame_PlayCurrent", function()
		TalkingHeadFrame:Hide()
		TalkingHeadFrame_CloseImmediately()
		end)]]--
		
		--[[
		local cap = GroupLootContainer.ClearAllPoints
        local sp = GroupLootContainer.SetPoint
        hooksecurefunc(GroupLootContainer, "SetPoint", function(self)
            cap(self)
            sp(self, "TOPLEFT", 400, -100)
        end)
		GroupLootContainer:SetScale(1.1);
		GroupLootContainer:SetSize(260,750);]]--
		
		
		--CompactRaidFrame1HealthBarBackground:Hide()
		--CompactRaidFrame1HealthBarBackground:SetAlpha(0)
		
		--RAID_CLASS_COLORS['PALADIN']["r"] = 0.83
		--RAID_CLASS_COLORS['PALADIN']["g"] = 0.69
		--RAID_CLASS_COLORS['PALADIN']["b"] = 0.22
		--RAID_CLASS_COLORS['PALADIN']["colorStr"] = "d4af37"
This is what it looks like

Last edited by cozmos : 08-06-22 at 07:36 AM.
  Reply With Quote
08-08-22, 11:42 PM   #3
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,215
Using PLAYER_ENTERING_WORLD could mean you are setting those on every initial login, and on every UI reload. In most cases, PLAYER_LOGIN is the preferred event to hook, as it fires once.

There are exceptions, like my own HideMinimapWorldButton addon, which only sets on PEW, although I can unregister the even as soon as the UI element is set.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Load variables at Client start

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