-
Posted by kaleesh on Wed, 05 Jan 2011 00:32:13
So I got some coding down for my Fishing addon... It now correctly plays music when I equip my fishing pole. However, that's all the addon can do. If I try to add anything else, the rest stops working. I can't even do anything in a seperate LUA file within the addon, let alone add elseif statements within the code. I'm not sure why this is.
Here's the base code. (The soundfile directory after PlaySoundFile is not it's own line, the forum just makes it look that way)
LUA
local frame = CreateFrame("Frame") frame:RegisterEvent("PLAYER_EQUIPMENT_CHANGED") frame:SetScript("OnEvent", function(self, event, ...) if event == "PLAYER_EQUIPMENT_CHANGED" then local slot = ... local itemID = GetInventoryItemID("player", slot) if itemID == 6365 then PlaySoundFile("Interface\\AddOns\\HelpingwiththeFishing\\HelpingwiththeFishing.mp3") end end end)
XML
- <Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd"> <Script file="Helping with the Fishing.lua" /> - <Frame name="MyEventFrame"> - <Scripts> <OnLoad>self:RegisterEvent("SPELL_UPDATE_USABLE")</OnLoad> <OnEvent function="Helping_OnEvent" /> </Scripts> </Frame> </Ui>
-
Posted by jnwhiteh on Wed, 05 Jan 2011 08:27:15
Again, I'm not sure I understand. I can take this code and alter it all I want and it continues to work. Can you show me some version that doesn't work?