|
09-15-09, 08:35 PM | #1 |
Dependency Conflict
Hey I'm currently making a mod, well its more like a script, that configures the default MainMenuBar into a config I like. I'm having Issues with moving the menu buttons around. First of all here's teh code for moving the buttons:
Code:
-- micro menu buttons QuestLogMicroButton:ClearAllPoints(); QuestLogMicroButton:SetPoint("BOTTOMLEFT", "ActionButton12", "BOTTOMRIGHT", 3, -0); TalentMicroButton:ClearAllPoints(); TalentMicroButton:SetPoint("BOTTOM", "QuestLogMicroButton", "TOP", 0, -20); CharacterMicroButton:ClearAllPoints(); CharacterMicroButton:SetPoint("BOTTOM", "TalentMicroButton", "TOP", 0, -20); MainMenuMicroButton:ClearAllPoints(); MainMenuMicroButton:SetPoint("LEFT", "QuestLogMicroButton", "RIGHT", 3, 0); SocialsMicroButton:ClearAllPoints(); SocialsMicroButton:SetPoint("BOTTOM", "MainMenuMicroButton", "TOP", 0, -20); SpellbookMicroButton:ClearAllPoints(); SpellbookMicroButton:SetPoint("BOTTOM", "SocialsMicroButton", "TOP", 0, -20); LFGMicroButton:Hide(); PVPMicroButton:Hide(); AchievementMicroButton:Hide(); HelpMicroButton:Hide(); Code:
Message: Interface\\FrameXML\\MainMenuBarMicroButtons.lua:171: AchievementMicroButton:SetPoint(): TalentMicroButton is dependent on this Time: 09/15/09 20:31:07\nCount: 1 Stack: [string \"Interface\\FrameXML\\BasicControls.xml:<Scrip...\"]:18: in function <[string \"Interface\\FrameXML\\BasicControls.xml:<Scrip...\"]:4> [C]: ? [C]: in function `SetPoint' Interface\\FrameXML\\MainMenuBarMicroButtons.lua:171: in function `UpdateTalentButton' Interface\\FrameXML\\MainMenuBarMicroButtons.lua:159: in function <Interface\\FrameXML\\MainMenuBarMicroButtons.lua:152> Locals: (*temporary) = AchievementMicroButton { 0 = <userdata> } (*temporary) = \"BOTTOMLEFT\" (*temporary) = \"TalentMicroButton\" (*temporary) = \"BOTTOMRIGHT\" (*temporary) = -2 (*temporary) = 0 " |
|
![]() |
09-15-09, 09:03 PM | #2 |
When you hide a frame like that you remove the possibility for other frames to anchor to them, you are hiding a frame thats in the default UI and could be needed for more stuff than you know about.
You should find another way to do this without using the Hide() function, maby you can position the frames off the screen or maby use the SetAlpha() function ?
__________________
« bTracker | bProflink| bOpenBags | TipCounter | oUF: Brun | Broker: Refills | Chinchilla: Gloss » |
|
![]() |
09-16-09, 07:42 AM | #3 |
Ok I tried implementing :
Code:
LFGMicroButton:ClearAllPoints(); LFGMicroButton:SetPoint("BOTTOM", "UIParent", "TOP", 0, 0); PVPMicroButton:ClearAllPoints(); PVPMicroButton:SetPoint("BOTTOM", "UIParent", "TOP", 0, 0); AchievementMicroButton:ClearAllPoints(); AchievementMicroButton:SetPoint("BOTTOM", "UIParent", "TOP", 0, 0); HelpMicroButton:ClearAllPoints(); HelpMicroButton:SetPoint("BOTTOM", "UIParent", "TOP", 0, 0); Code:
Message: Interface\FrameXML\MainMenuBarMicroButtons.lua:171: AchievementMicroButton:SetPoint(): TalentMicroButton is dependent on this Time: 09/16/09 07:40:17 Count: 1 Stack: [string "Interface\FrameXML\BasicControls.xml:<Scrip..."]:18: in function <[string "Interface\FrameXML\BasicControls.xml:<Scrip..."]:4> [C]: ? [C]: in function `SetPoint' Interface\FrameXML\MainMenuBarMicroButtons.lua:171: in function `UpdateTalentButton' Interface\FrameXML\MainMenuBarMicroButtons.lua:159: in function <Interface\FrameXML\MainMenuBarMicroButtons.lua:152> Locals: (*temporary) = AchievementMicroButton { 0 = <userdata> } (*temporary) = "BOTTOMLEFT" (*temporary) = "TalentMicroButton" (*temporary) = "BOTTOMRIGHT" (*temporary) = -2 (*temporary) = 0 ![]() |
|
![]() |
09-16-09, 11:56 AM | #4 | |
The problem is that AchievementMicroButton_Update anchors QuestLogMicroButton to AchievementMicroButton and UpdateTalentButton anchors AchievementMicroButton to TalentMicroButton. Since Blizzard doesn't call ClearAllPoints before calling SetPoint (didn't really need to) and you are anchoring TalentMicroButton to QuestLogMicroButton in your code it creates a circular logic issue with respect to anchoring. The easiest solution would be just to do something like: AchievementMicroButton_Update = function() end |
||
![]() |
09-16-09, 12:18 PM | #5 |
Ah thank you very much, I got it kluged together now. Its not pretty but it works and doesn't throw any errors. I doubt its very efficient cause I'm new to coding in general. Here's what I got for code:
Code:
function OnLoad() this:RegisterEvent("PLAYER_ENTERING_WORLD"); this:RegisterEvent("VARIABLES_LOADED"); if( DEFAULT_CHAT_FRAME ) then DEFAULT_CHAT_FRAME:AddMessage("CleanBarBare has been successfully loaded...", 0.0, 1.0, 1.0); end end AchievementMicroButton_Update = function() QuestLogMicroButton:ClearAllPoints(); AchievementMicroButton:ClearAllPoints(); TalentMicroButton:ClearAllPoints(); end UpdateTalentButton = function() QuestLogMicroButton:ClearAllPoints(); AchievementMicroButton:ClearAllPoints(); TalentMicroButton:ClearAllPoints(); end function DoYourThing() BarPlacement(); MainMenuBar:ClearAllPoints(); MainMenuBar:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", -0, 0); -- micro menu buttons AchievementMicroButton:ClearAllPoints(); QuestLogMicroButton:SetPoint("BOTTOMLEFT", "ActionButton12", "BOTTOMRIGHT", 3, -0); AchievementMicroButton:Hide(); LFGMicroButton:ClearAllPoints(); LFGMicroButton:SetPoint("BOTTOM", "UIParent", "TOP", 0, 0); --LFGMicroButton:Hide(); PVPMicroButton:ClearAllPoints(); PVPMicroButton:SetPoint("BOTTOM", "UIParent", "TOP", 0, 0); --PVPMicroButton:Hide(); HelpMicroButton:ClearAllPoints(); HelpMicroButton:SetPoint("BOTTOM", "UIParent", "TOP", 0, 0); --HelpMicroButton:Hide(); TalentMicroButton:ClearAllPoints(); TalentMicroButton:SetPoint("BOTTOM", "QuestLogMicroButton", "TOP", 0, -20); CharacterMicroButton:ClearAllPoints(); CharacterMicroButton:SetPoint("BOTTOM", "TalentMicroButton", "TOP", 0, -20); MainMenuMicroButton:ClearAllPoints(); MainMenuMicroButton:SetPoint("LEFT", "QuestLogMicroButton", "RIGHT", 3, 0); SocialsMicroButton:ClearAllPoints(); SocialsMicroButton:SetPoint("BOTTOM", "MainMenuMicroButton", "TOP", 0, -20); SpellbookMicroButton:ClearAllPoints(); SpellbookMicroButton:SetPoint("BOTTOM", "SocialsMicroButton", "TOP", 0, -20); -- page turn buttons MainMenuBarPageNumber:Hide(); ActionBarUpButton:Hide(); ActionBarDownButton:Hide(); -- shapeshift bar art ShapeshiftBarLeft:Hide(); ShapeshiftBarRight:Hide(); ShapeshiftBarMiddle:Hide(); -- bags MainMenuBarBackpackButton:Hide(); CharacterBag0Slot:Hide(); CharacterBag1Slot:Hide(); CharacterBag2Slot:Hide(); CharacterBag3Slot:Hide(); KeyRingButton:Hide(); --art MainMenuBarTexture0:Hide(); MainMenuBarTexture1:Hide(); MainMenuBarTexture2:Hide(); MainMenuBarTexture3:Hide(); SlidingActionBarTexture0:Hide(); SlidingActionBarTexture1:Hide(); ShapeshiftBarLeft:Hide(); ShapeshiftBarRight:Hide(); ShapeshiftBarMiddle:Hide(); -- rep and xp bars MainMenuBarLeftEndCap:Hide() MainMenuBarRightEndCap:Hide(); ExhaustionTick:Hide(); ExhaustionLevelFillBar:Hide(); MainMenuExpBar:Hide(); MainMenuBarMaxLevelBar:Hide(); ReputationWatchBar:Hide(); end function BarPlacement() MultiBarBottomLeft:ClearAllPoints(); MultiBarBottomLeft:SetPoint("BOTTOMLEFT", "ActionButton1", "TOPLEFT", -0, 5); MultiBarBottomRight:ClearAllPoints(); MultiBarBottomRight:SetPoint("BOTTOMLEFT", "MultiBarBottomLeftButton1", "TOPLEFT", -0, 5); MultiBarBottomLeft:Show(); MultiBarBottomRight:Show(); MultiCastActionBarFrame:ClearAllPoints(); MultiCastActionBarFrame:SetPoint("BOTTOMLEFT", "MultiBarBottomRightButton1", "TOPLEFT", 7, 5); ShapeshiftBarFrame:ClearAllPoints(); ShapeshiftBarFrame:SetPoint("BOTTOMLEFT", "MultiBarBottomRightButton1", "TOPLEFT", 7, 5); PetActionBarFrame:ClearAllPoints(); PetActionBarFrame:SetPoint("BOTTOMLEFT", "MultiBarBottomRightButton1", "TOPLEFT", 7, 5); end function OnEvent() if (event=="PLAYER_ENTERING_WORLD") or (event=="VARIABLES_LOADED") then DoYourThing() end end function Update() DoYourThing() end ![]() Cheers! |
|
![]() |
09-16-09, 12:36 PM | #6 |
1. use self instead of this
2. make your functions local instead of polluting the global namespace with nondescript/generic function names - they will get overwritten (unless you're calling them from an xml file but they're located in a lua file - then they'll need to be global - but at least make them less generic and specific to your addon) 3. semicolons ( ![]() 4. are you passing the event arg to your OnEvent function? Then you need to tell the function how to find the event variable (ie, OnEvent(self,event)) 5. you actually don't even need to pass those arguments and check for the event, though, because you're not doing different things based on event. Just call your code in OnEvent straight out |
|
![]() |
09-17-09, 02:55 PM | #7 |
If you want to make it harder for other addons to come in later an change what you've done and make it easier to change which frames you hide/reposition then you could do something like:
Code:
local function DoNothing() end local hide = { 'AchievementMicroButton', 'ActionBarDownButton', 'ActionBarUpButton', 'CharacterBag0Slot', 'CharacterBag1Slot', 'CharacterBag2Slot', 'CharacterBag3Slot', 'ExhaustionLevelFillBar', 'ExhaustionTick', 'HelpMicroButton', 'KeyRingButton', 'LFGMicroButton', 'MainMenuBarBackpackButton', 'MainMenuBarLeftEndCap', 'MainMenuBarMaxLevelBar', 'MainMenuBarPageNumber', 'MainMenuBarRightEndCap', 'MainMenuBarTexture0', 'MainMenuBarTexture1', 'MainMenuBarTexture2', 'MainMenuBarTexture3', 'MainMenuExpBar', 'PVPMicroButton', 'ReputationWatchBar', 'ShapeshiftBarLeft', 'ShapeshiftBarMiddle', 'ShapeshiftBarRight', 'SlidingActionBarTexture0', 'SlidingActionBarTextur1' } local reposition = { CharacterMicroButton = { 'BOTTOM', TalentMicroButton, 'TOP', 0, -20 }, MainMenuBar = { 'BOTTOMLEFT', UIParent, 'BOTTOMLEFT', 0, 0 }, MainMenuMicroButton = { 'LEFT', QuestLogMicroButton, 'RIGHT', 3, 0 }, MultiBarBottomLeft = { 'BOTTOMLEFT', ActionButton1, 'TOPLEFT', 0, 5 }, MultiBarBottomRight = { 'BOTTOMLEFT', MultiBarBottomLeftButton1, 'TOPLEFT', 0, 5 }, MultiCastActionBarFrame = { 'BOTTOMLEFT', MultiBarBottomRightButton1, 'TOPLEFT', 7, 5 }, PetActionBarFrame = { 'BOTTOMLEFT', MultiBarBottomRightButton1, 'TOPLEFT', 7, 5 }, QuestLogMicroButton = { 'BOTTOMLEFT', ActionButton12, 'BOTTOMRIGHT', 3, 0 }, ShapeshiftBarFrame = { 'BOTTOMLEFT', MultiBarBottomRightButton1, 'TOPLEFT', 7, 5 }, SocialsMicroButton = { 'BOTTOM', MainMenuMicroButton, 'TOP', 0, -20 }, SpellbookMicroButton = { 'BOTTOM', SocialsMicroButton, 'TOP', 0, -20 }, TalentMicroButton = { 'BOTTOM', QuestLogMicroButton, 'TOP', 0, -20 } } local _G, frame = _G for _, name in ipairs(hide) do frame = _G[name] if frame then frame:Hide() frame.Hide, frame.Show = DoNothing, DoNothing end end for name in pairs(reposition) do if _G[name] then _G[name]:ClearAllPoints() end end local unpack = unpack for name, position in pairs(reposition) do frame = _G[name] if frame then frame:SetPoint(unpack(position)) frame.ClearAllPoints, frame.SetAllPoints, frame.SetPoint = DoNothing, DoNothing, DoNothing end end |
|
![]() |
09-30-09, 08:04 AM | #8 |
OMG Thank you so much, I have no idea what half of that does but it works great. Kudos
|
|
![]() |
WoWInterface » Developer Discussions » General Authoring Discussion » Dependency Conflict |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
![]() |
![]() |
![]() |
|
|