Thread Tools Display Modes
06-26-10, 07:15 AM   #1
PeterAtYorkshire
A Murloc Raider
 
PeterAtYorkshire's Avatar
Join Date: Dec 2009
Posts: 4
Question Replacing GetMapZones

Hello I have been trying to create a replacement for GetMapZones() where I can add in new locations but I can't get my array to represent the same data and comes with this error.
Date: 2010-06-25 20:42:29
ID: 1
Error occured in: Global
Count: 1
Message: ..\AddOns\Blackrock\WorldMapFrame.lua line 647:
attempt to call upvalue 'GetAceZones' (a table value)
And this is what I have tried to replace it with:
Code:
local GetAceZones = {
	--Kalimdor ZoneNames
	[1] = {
		[1] = "Ashenvale",
		[2] = "Azshara",
		[3] = "Azuremyst lsle",
		[4] = "Bloodmyst lsle",
		[5] = "Darkshore",
		[6] = "Darnassus",
		[7] = "Desolace",
		[8] = "Durotar",
		[9] = "Dustwallow Marsh",
		[10] = "Felwood",
		[11] = "Feralas",
		[12] = "Moonglade",
		[13] = "Mulgore",
		[14] = "Orgrimmar",
		[15] = "Silithus",
		[16] = "Stonetalon Mountains",
		[17] = "Tanaris",
		[18] = "Teldrassil",
		[19] = "The Barrens",
		[20] = "The Exodar",
		[21] = "Thousand Needles",
		[22] = "Thunder Bluff",
		[23] = "Un'Goro Crater",
		[24] = "Winterspring",
		},
	--Eastern KingdomsAzeroth
	[2] = {
		[1] = "Alterac Mountains",
		[2] = "Arathi Highlands",
		[3] = "Badlands",	--"Blackrock Mountain"
		[4] = "Blasted Lands",
		[5] = "Burning Steppes",
		[6] = "Deadwind Pass",
		[7] = "Dun Morogh",
		[8] = "Duskwood",
		[9] = "Eastern Plaguelands",
		[10] = "Elwynn Forest",
		[11] = "Eversong Woods",
		[12] = "Ghostlands",
		[13] = "Hilsbrad Foothills",
		[14] = "Ironforge",
		[15] = "Isle of Quel'Danas",
		[16] = "Loch Modan",
		[17] = "Redridge Mountains",
		[18] = "Searing Gorge",
		[19] = "Silvermoon City",
		[20] = "Silverpine Forest",
		[21] = "Stormwind City",
		[22] = "Stranglethorn Vale",
		[23] = "Swamp of Sorrows",
		[24] = "The Hinterlands",
		[25] = "Tirisfal Glades",
		[26] = "Undercity",
		[27] = "Western Plaguelands",
		[28] = "Westfall",
		[29] = "Wetlands",
	},
	--Outland
	[3] = {
		[1] = "Blades Edge Mountains",
		[2] = "Hellfire Peninsula",
		[3] = "Nagrand",
		[4] = "Netherstorm",
		[5] = "Shadowmoon Valley",
		[6] = "Shattrath City",
		[7] = "Terokkar Forest",
		[8] = "Zangarmarsh",
	},
	--Northrend
	[4] = {
		[1] = "Borean Tundra",
		[2] = "Crystalsong Forest",
		[3] = "Dalaran",
		[4] = "Dragonblight",
		[5] = "Grizzly Hills",
		[6] = "Howling Fjord",
		[7] = "Icecrown",
		[8] = "Sholazar Basin",
		[9] = "Storm Peaks",
		[10] = "Wintergrasp",
		[11] = "Zul'Drak",
	},
}
...
function WorldMapZoneDropDown_Initialize()
WorldMapFrame_LoadZones(GetAceZones(GetCurrentMapContinent()));

end
I'm aware it needs to be a function of some kind but not sure how to structure it. Any input would be appreciated.
  Reply With Quote
06-26-10, 08:30 AM   #2
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
Code:
local zones = {
    [1] = {
        [1] = "Ashenvale",
    },
    ...
}

local function GetAceZones(contID)
    if(zones[contID]) then
        return unpack(zones[contID])
    end
end
The function accesses the tables, looks if there's an entry for the contID and then unpacks the continent-table, so you get the results back the same way as it is in GetMapZones:
local zone1, zone2, zone3, ... = GetAceZones(1)
__________________
« Website | GitHub »

Oh hai!

Last edited by xConStruct : 06-26-10 at 08:34 AM. Reason: Make it actually work.
  Reply With Quote
06-26-10, 01:19 PM   #3
PeterAtYorkshire
A Murloc Raider
 
PeterAtYorkshire's Avatar
Join Date: Dec 2009
Posts: 4
Thumbs up

Thanks I've done exactly what you've said and it works I just had to add a blank entry before each zone [0] = "". Now for entering a new result in it just moves the maps out of sinc and does not separate Blackrock as a Map. I suspect another function probably function WorldMapFrame_LoadZones(...) will have to be changed.
Still I'm getting warm.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Replacing GetMapZones


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off