View Single Post
07-18-18, 01:27 PM   #1
Uggers
A Fallenroot Satyr
 
Uggers's Avatar
Join Date: May 2008
Posts: 26
SetMap - Addon Assitance

I currently have an addon which is throwing up errors it appears to be related to the fact it can't set the map/get the map ID.

The code I have for this portion is like this;

Code:
function MountManager:ZONE_CHANGED_NEW_AREA()
	if not InCombatLockdown() then
		SetMapToCurrentZone();
		state.zone = GetCurrentMapAreaID()
	end
	
	self:UpdateZoneStatus()
end
function MountManager:UpdateZoneStatus(event)
    if InCombatLockdown() or state.inCombat or state.inPetBattle then return end
    
    local prevSwimming = state.isSwimming
    local prevFlyable = state.isFlyable
    
    state.isSwimming = IsSwimming() or IsSubmerged()
    
	local usable, _ = IsUsableSpell(flightTest)
    if IsFlyableArea() and self.db.char.mount_skill > 2 and usable == true then
        state.isFlyable = true
    else
        state.isFlyable = false
    end
    
    if (prevSwimming ~= state.isSwimming) or (prevFlyable ~= state.isFlyable) then
        self:GenerateMacro()
    end
end
I'm not sure if its SetMapToCurrentZone or GetCurrentMapAreaID that needs updating, I tried changing to C_Map.GetAreaInfo but I still get this error;

Code:
20x MountManager\MountManager-v1.0.0.lua:260: attempt to call upvalue 'SetMapToCurrentZone' (a nil value)
MountManager\MountManager-v1.0.0.lua:260: in function `?'
...Ons\Ace3\CallbackHandler-1.0\CallbackHandler-1.0-6.lua:145: in function <...Ons\Ace3\CallbackHandler-1.0\CallbackHandler-1.0.lua:145>
[string "safecall Dispatcher[1]"]:4: in function <[string "safecall Dispatcher[1]"]:4>
[C]: ?
[string "safecall Dispatcher[1]"]:13: in function `?'
...Ons\Ace3\CallbackHandler-1.0\CallbackHandler-1.0-6.lua:90: in function `Fire'
Ace3\AceEvent-3.0\AceEvent-3.0-4.lua:120: in function <Ace3\AceEvent-3.0\AceEvent-3.0.lua:119>

Locals:
nil
  Reply With Quote