What Seerah said, it should look like this:
Code:
local Map_Changed = false;
-------------------------------------
function RepWatch:WORLD_MAP_UPDATE()
-------------------------------------
if WorldMapFrame:IsVisible() then
Map_Changed = true
end
end
-------------------------------------
local function MapUpdate()
-------------------------------------
if ( (Map_Changed) and not WorldMapFrame:IsVisible() ) then
Map_Changed = false;
RepWatch:Print("Map Closed")
end
end
WorldMapFrame:SetScript("OnUpdate", MapUpdate)
I'd make the MapUpdate function local instead of global
To avoid the issue that Seerah mentioned with the WorldMapFrame OnUpdate script, I would suggest definately making an independent frame to run the script on. Just add...
Code:
local MapChangedFrame = CreateFrame("Frame")
...prior to your code snippet above and should should be all set. Associate the OnUpdate script to that frame and you don't have to worry about the WorldMapFrame anymore.