Originally Posted by ZunaSW
Hm, nothing, doesn't seem to work, I'm using this code, might be wrong though:
Code:
function IMOnZoneChanged(0, GetUnitZone("player"))
if zoneName == "Eastmarch" then
MainImage0:SetTexture("IM/textures/Image1.dds")
end
if zoneName == "Stonefalls" then
MainImage0:SetTexture("IM/textures/Image2.dds")
end
end
And I'm getting this error:
Code:
user:/AddOns/IM/IM.lua:30: <name> or "..." expected near '0
I might have done something wrong with the event. I'm pretty new on this, so I don't really know :S
|
I was not precise (or lazy?)
Calling, not declaring.
Lua Code:
local function IMOnZoneChanged(eventCode, zoneName, subZoneName, newSubzone)
if zoneName == "Eastmarch" then
MainImage0:SetTexture("IM/textures/Image1.dds")
end
if zoneName == "Stonefalls" then
MainImage0:SetTexture("IM/textures/Image2.dds")
end
end
local function PlayerActivated()
EVENT_MANAGER:UnregisterForEvent(IM.name, EVENT_PLAYER_ACTIVATED)
IMOnZoneChanged(0, GetUnitZone("player"))
end
EVENT_MANAGER:RegisterForEvent(IM.name, EVENT_ZONE_CHANGED, IMOnZoneChanged)
EVENT_MANAGER:RegisterForEvent(IM.name, EVENT_PLAYER_ACTIVATED, PlayerActivated)
^^ Typed without testing
About names from API you should read
this.