I tried following the directions here:
http://wiki.esoui.com/Writing_your_first_addon
...just up to the point where I expect to see messages in the chat tab, but I don't. i don't get any errors, I see the "add on" listed, and it is checked off to be used, but it doesn't seem to do anything at all.
What's the best way to troubleshoot this little "Hello World" project? I don't see any logs produced. Are there dev tools to see what is going on?
Thanks! Looking forward to getting up to speed and joining the community. I've never written Lua before, but I've been writing ColdFusion applications for over a decade. Not the same thing, I know, but hopefully I can make the jump
I love the game and plan on staying for a long time.
Lua Code:
-- First, we create a namespace for our addon by declaring a top-level table that will hold everything else.
FooAddon = {}
-- This isn't strictly necessary, but we'll use this string later when registering events.
-- Better to define it in a single place rather than retyping the same string.
FooAddon.name = "FooAddon"
-- Next we create a function that will initialize our addon
function FooAddon:Initialize()
self.inCombat = IsUnitInCombat("player")
EVENT_MANAGER:RegisterForEvent(self.name, EVENT_PLAYER_COMBAT_STATE, self.OnPlayerCombatState)
end
-- Then we create an event handler function which will be called when the "addon loaded" event
-- occurs. We'll use this to initialize our addon after all of its resources are fully loaded.
function FooAddon.OnAddOnLoaded(event, addonName)
-- The event fires each time *any* addon loads - but we only care about when our own addon loads.
if addonName == FooAddon.name then
FooAddon:Initialize()
end
end
function FooAddon.OnPlayerCombatState(event, inCombat)
-- The ~= operator is "not equal to" in Lua.
if inCombat ~= FooAddon.inCombat then
-- The player's state has changed. Update the stored state...
FooAddon.inCombat = inCombat
-- ...and then announce the change.
if inCombat then
d("Entering combat.")
else
d("Exiting combat.")
end
end
end
-- Finally, we'll register our event handler function to be called when the proper event occurs.
EVENT_MANAGER:RegisterForEvent(FooAddon.name, EVENT_ADD_ON_LOADED, FooAddon.OnAddOnLoaded)
EDITED: I went ahead and added the syntax highlight, thanks for the advice! ; I feel extra lost I suppose, I don't see any syntax tools, just smilies.