Page 1 of 2
1
2
LastLast
  1. #1

    Question Misc Lua-Questions for the Lua-Gods here

    1. how do I do a /loot in a lua-script cant seem to find anything about it anywhere?
    (apart from Google wowpedia.org has nopthing about opening or closing it under World_of_Warcraft_API#Loot_Functions)

    2. With MultiBarRight:SetScale(UIScale) and MainMenuBar:SetScale(UIScale) I can scale my bars like I want them too but how do I move them whats the syntax for that?

    3. Last but not least how do I hook the Error-(Statusmessages) from PetBattles to print them to my chat so I can see the message even later?

    TIA

  2. #2
    2) You'd want SetPoint.
    3) Where are those printed? The default error frame near the top? Look into UI_ERROR_MESSAGE. If that's not it, run a /eventtrace during a pet battle.
    UI & AddOns expert | Interface & Macros moderator - My work

  3. #3
    Thanks alot! Both where excactly what I was looking for!
    But I suppose you dont know how to use /loot inside lua-code?

  4. #4
    What does that command do? Opens the loot window for your current target?
    UI & AddOns expert | Interface & Macros moderator - My work

  5. #5
    Quote Originally Posted by Fummockelchen View Post
    1. how do I do a /loot in a lua-script cant seem to find anything about it anywhere?
    (apart from Google wowpedia.org has nopthing about opening or closing it under World_of_Warcraft_API#Loot_Functions)
    Quote Originally Posted by Treeston View Post
    What does that command do? Opens the loot window for your current target?
    It opens the loot history window.

    Function defined in Framexml is called ToggleLootHistoryFrame()

  6. #6
    Quote Originally Posted by Crudor View Post
    Function defined in Framexml is called ToggleLootHistoryFrame()
    Thank you so very much also! excactly what I wanted!

  7. #7
    So I got another one - I want to build myself a Popup that I can change the gmotd with so I get
    Code:
    StaticPopupDialogs["GMOTD"] = {
    	text = "Guild Message of the Day",
    	button1 = SAVE,
    	hasEditBox = 1,
    	editBoxWidth = 400,
        	preferredIndex = 3, --???
    	OnShow = function(self)
    		local editBox = _G[frame:GetName().."EditBox"]
    		if editBox then
    			editBox:SetText(GetGuildRosterMOTD())
    			editBox:SetFocus()
    			editBox:HighlightText(0)
    		end
    		local button = _G[frame:GetName().."Button1"]
    		if button then
    			button:ClearAllPoints()
    			button:SetWidth(200)
    			button:SetPoint("CENTER", editBox, "CENTER", 0, -30)
    		end
    	end,
    	EditBoxOnEscapePressed = function(frame) frame:GetParent():Hide() end,
    	EditBoxOnEnterPressed = function(frame) frame:GetParent():Hide() end,
    	timeout = 0,
    	hideOnEscape = 1,
    	maxLetters=2048,
    }
    As you can see I even managed to close my popup with ESC and Enter apart from the Button but I cant seem to figure out HOW to get the text from the Editbox out of it after closing the popup and not even reuturning it ;(
    every help is very appreciated, tia!

    - - - Updated - - -

    Okay I got half what I want now:

    Code:
    StaticPopupDialogs["TEST2"] = {
    	preferredIndex = 3, -- ???
    	text = "Guild Message of the Day",
    	hasEditBox = 1,
    	editBoxWidth = 400,
    	button1 = OKAY,
    	button2 = CANCEL,
    	EditBoxOnEscapePressed = function(self) self:GetParent():Hide() end,
    	EditBoxOnEnterPressed = function(self) self:GetParent():Hide() 
                -- ????????????? --
                end,
    	OnShow = function(self)
    		_G[self:GetName().."EditBox"]:SetText(GetGuildRosterMOTD())
    		_G[self:GetName().."EditBox"]:SetFocus()
    	end,
    	OnAccept = function(self)
    		local gmotd = GetGuildRosterMOTD()
    		local text = _G[self:GetName().."EditBox"]:GetText()
    		if text ~= gmotd then
    			GuildSetMOTD(text)
    		end
    	end,
    --	OnCancel = function(self)
    --		print('canceled')
    --	end,
    	timeout = 0,
    	exclusive = 1,
    	hideOnEscape = 1,
    }
    now I just need a genius to tell me what to put into -- ????????????? -- so that I get the same result as clicking the Save-Button?
    Last edited by Fummockelchen; 2013-08-01 at 03:32 PM.

  8. #8
    Code:
    EditBoxOnEnterPressed=function(box) box:GetParent().button1:Click() end,
    OnAccept = function(frame)
        if CanEditMOTD() then
            GuildSetMOTD(frame.editBox:GetText())
        else
            print("Permissions issue: cannot edit MOTD.")
        end
    end,
    Last edited by Treeston; 2013-08-02 at 06:11 AM.
    UI & AddOns expert | Interface & Macros moderator - My work

  9. #9
    @Treeston: thanks man, you literally made my day!

  10. #10
    Sorry to bother you guys again with this NUB questions but the tuts on the webs are just plain sh** and dont explain stuff so I can understand them.

    I wanted to try to make an addon that prints out pet battle errors to chat and if a pet is dead gives me a button to heal but that shit doesnt seem to work when i take it out of my ace-playground-addon to make it an own addon

    Code:
    ## Interface: 50300
    ## Title: PetBattleFix
    ## Notes: This AddOn does nothing but errors....
    ## Author: me
    PetBattleFix.lua
    and
    Code:
    print('PetBattleFix loaded!')
    PetBattleFix:RegisterEvent('UI_ERROR_MESSAGE', UI_ERROR_MESSAGE)
    
    function PetBattleFix_UI_ERROR_MESSAGE(UI_ERROR_MESSAGE)
    	-- finding error msgs concerning pet battles	
    	if (strfind(UI_ERROR_MESSAGE, 'pet battle') or strfind(UI_ERROR_MESSAGE, 'pet') or strfind(UI_ERROR_MESSAGE, 'Pet')) then
    		UIErrorsFrame:Clear();
    		print('|cffff0000' .. UI_ERROR_MESSAGE .. '|r' )
    		
    		-- requeue if oppenent cancels the pet battle or yourself didnt accepted
    	 	if (strfind(UI_ERROR_MESSAGE, 'Opponent declined pet battle invitation. You have been returned to the queue.') 
    	 		or strfind(UI_ERROR_MESSAGE, 'You did not respond to the pet battle invitation.')) then
    	 	 	print('ReQueue!');
    	 		C_PetBattles.StartPVPMatchmaking()
    	 	end
    
    	else
    
    		if strfind(UI_ERROR_MESSAGE, 'Pet in slot') then
    			UIErrorsFrame:Clear();
    			print('|cffff0000' .. UI_ERROR_MESSAGE .. '|r' )
    			-- revive and queue
    			print('You have to revive pets!')
    
    			local HEAL_PET_SPELL = 125439
    			local spellName, spellSubname, spellIcon = GetSpellInfo(HEAL_PET_SPELL)
    			local start, duration, enable = GetSpellCooldown(HEAL_PET_SPELL)
    			local itemCount = GetItemCount(86143)
    	
    			if (itemCount > 0) then spellIcon = GetItemIcon(86143)
    			end
    	
    			local frame = CreateFrame("FRAME", nil, UIParent)
    			frame:SetWidth(41)
    			frame:SetHeight(41)
    			frame:SetPoint("CENTER", UIParent, "CENTER")
    
    			frame.btn = CreateFrame("BUTTON", nil, frame, "SecureActionButtonTemplate")
    			frame.btn:SetWidth(40)
    			frame.btn:SetHeight(40)
    			frame.btn:SetAttribute("unit", "player")
    			frame.btn:SetAttribute("type", "macro")
    			if (itemCount < 1) then frame.btn:SetAttribute("macrotext","/cast "..spellName)
    			else 
    				frame.btn:SetAttribute("macrotext","/use item:86143" )
    				frame.btn.QuantityOwned = frame.btn:CreateFontString(nil,"OVERLAY","GameFontHighlight")
    				frame.btn.QuantityOwned:SetText(itemCount)
    				frame.btn.QuantityOwned:SetPoint("BOTTOMRIGHT",frame.btn,"BOTTOMRIGHT",-2,2)
    				frame.btn.QuantityOwned:SetJustifyH("RIGHT")
    			end
    		
    			frame.btn.Icon = frame.btn:CreateTexture("Icon","ARTWORK")
    			frame.btn.Icon:SetTexture(spellIcon)
    			frame.btn.Icon:SetAllPoints()
    			frame.btn.Border = frame.btn:CreateTexture("Border","OVERLAY","ActionBarFlyoutButton-IconFrame")
    			frame.btn:SetPushedTexture("Interface\\Buttons\\UI-Quickslot-Depress")
    			frame.btn:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square","ADD")
    			frame.btn:SetText("Heal!")
    			frame.btn:SetPoint("CENTER", frame, "CENTER")
    		
    			--frame.btn:SetScript("OnMouseUp", function() frame.btn:Hide() end)
    			frame.btn:SetAlpha(1)
    			frame.btn:Show()
     			-- frame:SetScript("OnMouseUp", function() frame:Hide() end)		
    			frame:Show()
    
    		end
    	 	
    
    	
    	end
    
    --
    end

    All I get is completly shit nonesense messages (for me at least) about PetBattleFix being Nil or an '=' missing....
    (I tried to use the example from http://wowpedia.org/Getting_started_with_writing_addons but that crap does nothing and I dont wanna use xml as i dont need a frame...)

  11. #11
    Yes, you need a frame. Any time you want to register for events, you'll need a frame. What you mean is you don't need a visible frame.

    Code:
    local PetBattleFix = CreateFrame("Frame")
    _G.PetBattleFix = PetBattleFix
    
    PetBattleFix:SetScript("OnEvent",function(self,event,msg)
        if not msg:find('[pP]et') then return end
        UIErrorsFrame:Clear()
        print('|cffff0000'..msg..'|r')
        if (msg == ERR_PETBATTLE_QUEUE_OPPONENT_DECLINED) or (msg == ERR_PETBATTLE_QUEUE_PROPOSAL_DECLINED) then
            print('ReQueue!')
            C_PetBattles.StartPVPMatchmaking()
        elseif msg:match(ERR_PETBATTLE_QUEUE_SLOT_DEAD) then
            print('You have to revive pets!')
            -- button stuff here
        end
    end)
    PetBattleFix:RegisterEvent('UI_ERROR_MESSAGE')
    UI & AddOns expert | Interface & Macros moderator - My work

  12. #12
    @Treeston: thank you very much one more question from the stupid me - if i enable frame.btn:SetScript("OnMouseUp", function() frame.btn:Hide() end the button is hidden without the macrotext executed. Am I doing things wrong - again - or is this intended to avoid farming bots in lua?

  13. #13
    Use PostClick instead of OnMouseUp. Also, consider recycling the button instead of re-creating it every time.
    UI & AddOns expert | Interface & Macros moderator - My work

  14. #14
    Code:
    local PetBattleFix = CreateFrame("Frame", nil, UIParent)
    _G.PetBattleFix    = PetBattleFix
    
    PetBattleFix:SetWidth(80)
    PetBattleFix:SetHeight(40)
    PetBattleFix:SetPoint("CENTER", UIParent, "CENTER")
    PetBattleFix:Hide()
    
    local spellName, spellSubname, spellIcon1 = GetSpellInfo(125439)
    local start, duration, enable = GetSpellCooldown(125439)
    local itemCount = GetItemCount(86143)
    local spellIcon2 = GetItemIcon(86143)
    
    PetBattleFix.Knopf1 = CreateFrame("BUTTON", nil, PetBattleFix, "SecureActionButtonTemplate")
    PetBattleFix.Knopf1:SetPoint("CENTER", PetBattleFix, "LEFT")
    PetBattleFix.Knopf1:SetWidth(40)
    PetBattleFix.Knopf1:SetHeight(40)
    PetBattleFix.Knopf1:SetAttribute("unit", "player")
    PetBattleFix.Knopf1:SetAttribute("type", "macro")
    PetBattleFix.Knopf1:SetAttribute("macrotext","/cast "..spellName)
    PetBattleFix.Knopf1.Icon = PetBattleFix.Knopf1:CreateTexture("Icon","ARTWORK")
    PetBattleFix.Knopf1.Icon:SetTexture(spellIcon1)
    PetBattleFix.Knopf1.Icon:SetAllPoints()
    PetBattleFix.Knopf1.Border = PetBattleFix.Knopf1:CreateTexture("Border","OVERLAY","ActionBarFlyoutButton-IconFrame")
    PetBattleFix.Knopf1:SetPushedTexture("Interface\\Buttons\\UI-Quickslot-Depress")
    PetBattleFix.Knopf1:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square","ADD")
    PetBattleFix.Knopf1:SetScript("PostClick", function() PetBattleFix:Hide() C_PetBattles.StartPVPMatchmaking() end)
    PetBattleFix.Knopf1:SetAlpha(1)
    PetBattleFix.Knopf1:Show()
    
    PetBattleFix.Knopf2 = CreateFrame("BUTTON", nil, PetBattleFix, "SecureActionButtonTemplate")
    PetBattleFix.Knopf2:SetPoint("CENTER", PetBattleFix, "CENTER")
    PetBattleFix.Knopf2:SetWidth(40)
    PetBattleFix.Knopf2:SetHeight(40)
    PetBattleFix.Knopf2:SetAttribute("unit", "player")
    PetBattleFix.Knopf2:SetAttribute("type", "macro")
    PetBattleFix.Knopf2:SetAttribute("macrotext","/use item:86143" )
    PetBattleFix.Knopf2.Icon = PetBattleFix.Knopf2:CreateTexture("Icon","ARTWORK")
    PetBattleFix.Knopf2.Icon:SetTexture(spellIcon2)
    PetBattleFix.Knopf2.Icon:SetAllPoints()
    PetBattleFix.Knopf2.Border = PetBattleFix.Knopf2:CreateTexture("Border","OVERLAY","ActionBarFlyoutButton-IconFrame")
    PetBattleFix.Knopf2:SetPushedTexture("Interface\\Buttons\\UI-Quickslot-Depress")
    PetBattleFix.Knopf2:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square","ADD")
    PetBattleFix.Knopf2:SetScript("PostClick", function() PetBattleFix:Hide() C_PetBattles.StartPVPMatchmaking() end)
    PetBattleFix.Knopf2:SetAlpha(1)
    PetBattleFix.Knopf2:Show()
    
    
    PetBattleFix:SetScript("OnEvent",function(self,event,msg)
    	
    	if not (msg:find('[pP]et') or msg:find('Haustier')) then return end
    
    	UIErrorsFrame:Clear()
    
    	if msg ~= (ERR_PETBATTLE_QUEUE_ALREADY_QUEUED) then
    		print('|cffff0000'..msg..'|r')
    	end
    	
    	if msg:match(ERR_PETBATTLE_QUEUE_QUEUED) then
    		local team = ""
    		for loop=1, 3 do
    			local petID, _, _, _, _ = C_PetJournal.GetPetLoadOutInfo(loop)
    			local _, _, _, _, _, _, _, _, petIcon, _, _, _, _, _, _, _, _ = C_PetJournal.GetPetInfoByPetID(petID)
    			local link = C_PetJournal.GetBattlePetLink(petID)
    			team = team .. "|T" .. petIcon .. ":12:12|t" .. link .. ' '
    		end
    		print('with team '..team)
    	end
    
    	if msg:match(ERR_PETBATTLE_QUEUE_SLOT_EMPTY) then
    		-- make it stick open when even number of pets are missing
    		TogglePetJournal(2)
    	end
    
    	if msg:match(ERR_PETBATTLE_QUEUE_OPPONENT_DECLINED) or msg:match(ERR_PETBATTLE_QUEUE_PROPOSAL_DECLINED) then
    		print('You have been requeued!')
    		C_PetBattles.StartPVPMatchmaking()
    	elseif msg:match(ERR_PETBATTLE_QUEUE_SLOT_DEAD) then
    		if (PetBattleFix:IsVisible()) then
    		else
    			local start, duration, enable = GetSpellCooldown(125439)
    			local itemCount = GetItemCount(86143)
    			-- do something with the data
    			-- ...
    			print('You have to revive pet(s)!')
    			PetBattleFix:Show()
    		end
    	end
    end)
    
    PetBattleFix:RegisterEvent('UI_ERROR_MESSAGE')
    
    print('PetBattleFix for nuubs loaded!')
    This is what I got now - Is this better concerning the buttons?

  15. #15
    I wouldn't parent your SecureActionButtons to your global frame, but instead parent them to UIParent. I'd also strongly consider removing the initial 'if not then return end' from the OnEvent. Performance gain is neglegible to non-existant and it will present you lots of localization issues (as you correctly corrected in your code, but that will still only work properly for deDE and enUS/enGB locales. Instead, I'd use something like this: (drycoded, as always)

    Code:
    local PetBattleFix = CreateFrame("Frame")
    _G.PetBattleFix    = PetBattleFix
    
    local REVIVE_SPELL = 125439
    local REVIVE_ITEM = 86143
    
    
    function PetBattleFix.init()
        if PetBattleFix.hadInit then return end
        if InCombatLockdown() then print("Error! PetBattleFix.init() called in combat lockdown. This should never happen.") return end
    
        local spellName,_, spellIcon = GetSpellInfo(REVIVE_SPELL)
        local itemName,_,_,_,_,_,_,_,_, itemIcon = GetItemInfo(REVIVE_ITEM)
        if not (spellName and spellIcon and itemName and itemIcon) then
            print("One of the following informations is not present for some reason. Aborting:")
            print("spellName: "..spellName)
            print("spellIcon: "..spellIcon)
            print("itemName: "..itemName)
            print("itemIcon: "..itemIcon)
            return
        end
    
        local postClick = function(self) self:Hide() C_PetBattles.StartPVPMatchmaking() end
    
        PetBattleFix.Knopf1 = CreateFrame("BUTTON", nil, UIParent, "SecureActionButtonTemplate")
        PetBattleFix.Knopf1:SetPoint("CENTER", UIParent, "CENTER")
        PetBattleFix.Knopf1:SetSize(40,40)
        PetBattleFix.Knopf1:SetAttribute("unit", "player")
        PetBattleFix.Knopf1:SetAttribute("type", "spell")
        PetBattleFix.Knopf1:SetAttribute("name",spellName)
        PetBattleFix.Knopf1.Icon = PetBattleFix.Knopf1:CreateTexture("Icon","ARTWORK")
        PetBattleFix.Knopf1.Icon:SetTexture(spellIcon)
        PetBattleFix.Knopf1.Icon:SetAllPoints()
        PetBattleFix.Knopf1.Border = PetBattleFix.Knopf1:CreateTexture("Border","OVERLAY","ActionBarFlyoutButton-IconFrame")
        PetBattleFix.Knopf1:SetPushedTexture("Interface\\Buttons\\UI-Quickslot-Depress")
        PetBattleFix.Knopf1:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square","ADD")
        PetBattleFix.Knopf1:SetScript("PostClick", postClick)
        PetBattleFix.Knopf1:Hide()
    
        PetBattleFix.Knopf2 = CreateFrame("BUTTON", nil, PetBattleFix, "SecureActionButtonTemplate")
        PetBattleFix.Knopf2:SetPoint("CENTER", UIParent, "CENTER")
        PetBattleFix.Knopf2:SetSize(40,40)
        PetBattleFix.Knopf2:SetAttribute("unit", "player")
        PetBattleFix.Knopf2:SetAttribute("type", "item")
        PetBattleFix.Knopf2:SetAttribute("name", itemName)
        PetBattleFix.Knopf2.Icon = PetBattleFix.Knopf2:CreateTexture("Icon","ARTWORK")
        PetBattleFix.Knopf2.Icon:SetTexture(itemIcon)
        PetBattleFix.Knopf2.Icon:SetAllPoints()
        PetBattleFix.Knopf2.Border = PetBattleFix.Knopf2:CreateTexture("Border","OVERLAY","ActionBarFlyoutButton-IconFrame")
        PetBattleFix.Knopf2:SetPushedTexture("Interface\\Buttons\\UI-Quickslot-Depress")
        PetBattleFix.Knopf2:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square","ADD")
        PetBattleFix.Knopf2:SetScript("PostClick", postClick)
        PetBattleFix.Knopf2:Hide()
    
        PetBattleFix.hadInit = true
    end
    
    
    PetBattleFix:SetScript("OnEvent",function(self,event,msg)
    
    	--[[if msg ~= (ERR_PETBATTLE_QUEUE_ALREADY_QUEUED) then
    		print('|cffff0000'..msg..'|r')
    	end--]]
    	
    	if msg:match(ERR_PETBATTLE_QUEUE_QUEUED) then
    		local team = ""
    		for loop=1, 3 do
    			local petID, _, _, _, _ = C_PetJournal.GetPetLoadOutInfo(loop)
    			local _, _, _, _, _, _, _, _, petIcon, _, _, _, _, _, _, _, _ = C_PetJournal.GetPetInfoByPetID(petID)
    			local link = C_PetJournal.GetBattlePetLink(petID)
    			team = team .. "|T" .. petIcon .. ":12:12|t" .. link .. ' '
    		end
    		print('with team '..team)
    	elseif msg:match(ERR_PETBATTLE_QUEUE_SLOT_EMPTY) then
    		-- make it stick open when even number of pets are missing
    		TogglePetJournal(2)
    	elseif msg:match(ERR_PETBATTLE_QUEUE_OPPONENT_DECLINED) or msg:match(ERR_PETBATTLE_QUEUE_PROPOSAL_DECLINED) then
    		print('You have been requeued!')
    		C_PetBattles.StartPVPMatchmaking()
    	elseif msg:match(ERR_PETBATTLE_QUEUE_SLOT_DEAD) then
                if InCombatLockdown() then
                    print("You'd have to revive pet(s), but you are in combat so we can't give you any neat buttons, sadly ;(")
                    return
                end
                if not PetBattleFix.hadInit then PetBattleFix.init() end
    	    local start, duration, enable = GetSpellCooldown(REVIVE_SPELL)
    	    local itemCount = GetItemCount(REVIVE_ITEM)
    	    if start == 0 then
                    PetBattleFix.Knopf1:Show()
                    PetBattleFix.Knopf2:Hide()
                elseif itemCount > 0 then
                    PetBattleFix.Knopf1:Hide()
                    PetBattleFix.Knopf2:Show()
                else
                    PetBattleFix.Knopf1:Hide()
                    PetBattleFix.Knopf2:Hide()
                    print(("You'd have to revive pet(s), but you don't have any %s in your inventory and %s is on cooldown."):format((select(2,GetItemInfo(REVIVE_ITEM))),GetSpellLink(REVIVE_SPELL))
                end
    	else
                return end
            end
    end)
    
    PetBattleFix:RegisterEvent('UI_ERROR_MESSAGE')
    
    print('PetBattleFix for nuubs loaded!')
    Last edited by Treeston; 2013-08-08 at 08:34 PM.
    UI & AddOns expert | Interface & Macros moderator - My work

  16. #16
    Thank you - 3 more questions:
    a) how you come up with stuff like ERR_PETBATTLE_QUEUE_OPPONENT_DECLINED when all I find with google about that is an MMOC news entry?!
    b) where do i find ALL FCFManager_ and/or FCF_ functions to switch to a specific chat window (PET_BATTLE_COMBAT_LOG in this case)?
    c) how do I get something usefull out of >END_OF_PET_BATTLE_RESULT = "petbattleresult";< from https://github.com/p3lim/wow-ui-sour...tBattleUI.lua?

    TIA

  17. #17
    a) GlobalStrings.lua
    b) Never worked with those, but they seem to be defined in FloatingChatFrame.lua. Might be worth a look.
    c) I'm actually not sure what that var does. I'm assuming you're trying to find out who won the battle? Most pet battle events are undocumented, sadly, so your best bet is running an /eventtrace to find out what fires when.
    UI & AddOns expert | Interface & Macros moderator - My work

  18. #18
    Quote Originally Posted by Treeston View Post
    c) I'm actually not sure what that var does. I'm assuming you're trying to find out who won the battle? Most pet battle events are undocumented, sadly, so your best bet is running an /eventtrace to find out what fires when.
    Yep, after playing with Eventtrace I have come to PET_BATTLE_FINAL_ROUND BUT it only works if I have won (all of the opponents pets are dead)

    But when I forfit, my opponent forfits, my opponents win or its a tie (all pets are dead) PET_BATTLE_FINAL_ROUND is set to 2.
    Id expected for at least my opponent forfits it to be set to 1 (I yet have to check more carefully if its counted as win for the archivements or not....)

  19. #19
    Okay another question - how do I change the code so i can change "PetBattleFix.Knopf1:SetScript("PostClick", postClick)" later cause sometimes I want
    PostClick to be "function() PetBattleFix:Hide() C_PetBattles.StartPVPMatchmaking() end)" and sometimes it should just be "function() PetBattleFix:Hide() end)"
    and the way it is atm i cant change PetBattleFix.Knopf1:SetScript("PostClick") at all ;/

  20. #20
    Move the definition of postClick out of the .init function.

    Code:
    local postClick = function(self) self:Hide() C_PetBattles.StartPVPMatchmaking() end
    local postClick2 = function(self) self:Hide() end
    
    function PetBattleFix.init()
    Then you can simply :SetScript("PostClick",postClick) and :SetScript("PostClick",postClick2) as needed.
    UI & AddOns expert | Interface & Macros moderator - My work

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •