I searched around and I have tried a dozen things but somehow, I can't get it to work.
I can get the value 1 or 3 saved, but somewhere with reading it back, it goes wrong but I am unsure why.
Here is the AddOns code:
Code:
WorldMapFrame:SetScale(0.8)
Code:
WorldMapFrame.BlackoutFrame.Blackout:SetAlpha(0)
if SimpleMap == 1 then
PlayerMovementFrameFader.AddDeferredFrame(WorldMapFrame, .3, 3.0, .5)
elseif SimpleMap == 3 then
PlayerMovementFrameFader.AddDeferredFrame(WorldMapFrame, 1, 3.0, .5)
end
WorldMapFrame.ScrollContainer.GetCursorPosition = function(f)
local x,y = MapCanvasScrollControllerMixin.GetCursorPosition(f);
local s = WorldMapFrame:GetScale();
return x/s, y/s;
end
local function SimpleMapCommands(msg, editbox)
if msg == 'off' then
print('SimpleMap fade has been turned off.')
PlayerMovementFrameFader.AddDeferredFrame(WorldMapFrame, 1, 3.0, .5)
SimpleMap = 3
elseif msg == 'on' then
print("SimpleMap fade has been turned on.")
PlayerMovementFrameFader.AddDeferredFrame(WorldMapFrame, .3, 3.0, .5)
SimpleMap = 1
end
end
SLASH_SMFADE1 = '/smfade'
SlashCmdList["SMFADE"] = SimpleMapCommands
And here is the .toc.
Code:
## Interface: 11302
## Version: 1.1
## Title: SimpleMap
## Notes: Smaller worldmap and it fades the map when moving
## Author: Sojiro84
## Dependencies: Blizzard_WorldMap
## SavedVariables: SimpleMap
SimpleMap.lua
The savedvariable contrains either "SimpleMap = 1" or "SimpleMap = 3".
Somehow the following doesn't trigger:
Code:
if SimpleMap == 1 then
PlayerMovementFrameFader.AddDeferredFrame(WorldMapFrame, .3, 3.0, .5)
elseif SimpleMap == 3 then
PlayerMovementFrameFader.AddDeferredFrame(WorldMapFrame, 1, 3.0, .5)
end
I tried "AddOn Loaded" events and saying that variable "SimpleMap = SimpleMap" so that the value is loaded but nothing.
Clearly SimpleMap isn't being assigned with the SavedVariable value.
Can anyone help me?
It feels like the solution should be simple but I never made a WoW AddOn before so a bit difficult for me!