PDA

View Full Version : First mod ran into a few problems


WyriHaximus
28-10-2006, 08:53 PM
To start with this is my first mod. I have programming/scripting knowledge in PHP, JavaScript, VB6.0 and some others so the putting something together wasn't realy a problem but getting it to work as I wan it :).
This is my .toc:

## Interface: 11200
## Title: WyriHaximus Map Data Gatherer v1.0
## Notes: Gathers data of every single coardinate in the game.
## SavedVariables: MapDataGatherer
MapDataGatherer.lua
MapDataGatherer.xml

This is my .xml:

<?xml-stylesheet type="text/xsl" href="/css/wowui.xsl"?>
<Ui xmlns="http://www.blizzard.com/wow/ui/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
<Script file="MapDataGatherer.lua"/>
<Frame parent="UIParent">
<Frames>
<Button name="MapDataGatherer" inherits="MapDataGathererTemplate" frameStrata="FULLSCREEN" toplevel="true">
<Scripts>
<OnLoad>
MapDataGatherer_OnLoad();
</OnLoad>
<OnEvent>
MapDataGatherer_OnEvent();
</OnEvent>
<OnUpdate>
MapDataGatherer_OnUpdate(arg1);
</OnUpdate>
</Scripts>
</Button>
</Frames>
</Frame>
</Ui>

This is my .lue:

MDG_COORDS_ID = "Coords";

function MapDataGatherer_OnLoad()
this:RegisterEvent("ZONE_CHANGED");
this:RegisterEvent("ZONE_CHANGED_INDOORS");
this:RegisterEvent("ZONE_CHANGED_NEW_AREA");
this:RegisterEvent("MINIMAP_ZONE_CHANGED");
this:RegisterEvent("PLAYER_ENTERING_WORLD");
end

function MapDataGatherer_OnEvent()
this.pvpType, this.factionName, this.isArena = GetZonePVPInfo();
this.px, this.py = GetPlayerMapPosition("player");
MapDataGatherer.[GetZoneText()].[this.px].[this.py] = {
["ZoneText"] = GetZoneText(),
["SubZOneText"] = GetSubZoneText(),
["PvP"] = {
["Type"] = this.pvpType,
["FactionName"] = this.factionName,
["isArena"] = this.isArena,
},
};
end

function MapDataGatherer_OnUpdate(arg1)
MapDataGatherer_OnEvent();
end


The problem are these 2 errors and this in my saved values file "MapDataGatherer = MapDataGatherer":
http://img63.imageshack.us/img63/1917/wowscrnshot102806201919un4.th.jpg (http://img63.imageshack.us/my.php?image=wowscrnshot102806201919un4.jpg)
(This error keeps popping up if I click it away.)
http://img124.imageshack.us/img124/710/wowscrnshot102806201843bu5.th.jpg (http://img124.imageshack.us/my.php?image=wowscrnshot102806201843bu5.jpg)
(This error is only once at login.)

The whole goal of this AddOn is gathering information about every coardinate of every area.

If someone can help em with this problem it would be very much apriciated.

Greetings,

WyriHaximus

zirah
29-10-2006, 12:08 AM
I think the following line is wrong:

MapDataGatherer.[GetZoneText()].[this.px].[this.py] = {

try

MapDataGatherer[GetZoneText()][this.px][this.py] = {

WyriHaximus
29-10-2006, 02:02 AM
This is my new code. (Note that I added continents scan aswell.)

.toc

## Interface: 11200
## Title: WyriHaximus Data Gatherer v1.0
## Notes: WyriHaximusnet Data Gatherer, gathers information from WoW. Including: map data, continent data
## SavedVariables: MapDataGatherer, ContinentDataGatherer
WyriHaximusnetDataGatherer.lua
WyriHaximusnetDataGatherer.xml

.xml

<?xml-stylesheet type="text/xsl" href="/css/wowui.xsl"?>
<Ui xmlns="http://www.blizzard.com/wow/ui/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
<Script file="WyriHaximusnetDataGatherer.lua"/>
<Frame parent="UIParent">
<Frames>
<Button name="WyriHaximusnetDataGatherer" inherits="WyriHaximusnetDataGathererTemplate" frameStrata="FULLSCREEN" toplevel="true">
<Scripts>
<OnLoad>
WyriHaximusnetDataGatherer_OnLoad();
</OnLoad>
<OnEvent>
WyriHaximusnetDataGatherer_OnEvent();
</OnEvent>
<OnUpdate>
WyriHaximusnetDataGatherer_OnUpdate(arg1);
</OnUpdate>
</Scripts>
</Button>
</Frames>
</Frame>
</Ui>


.lua

MDG_COORDS_ID = "Coords";

MapDataGatherer = {};
ContinentDataGatherer = {};

function WyriHaximusnetDataGatherer_OnLoad()
ContinentDataGatherer = {};
ContinentDataGatherer[1],ContinentDataGatherer[2],ContinentDataGatherer[3],ContinentDataGatherer[4],ContinentDataGatherer[5],ContinentDataGatherer[6],ContinentDataGatherer[7],ContinentDataGatherer[8],ContinentDataGatherer[9],ContinentDataGatherer[10] = GetMapContinents();

this:RegisterEvent("ZONE_CHANGED");
this:RegisterEvent("ZONE_CHANGED_INDOORS");
this:RegisterEvent("ZONE_CHANGED_NEW_AREA");
this:RegisterEvent("MINIMAP_ZONE_CHANGED");
this:RegisterEvent("PLAYER_ENTERING_WORLD");
end

function WyriHaximusnetDataGatherer_OnEvent()
RealZoneText = GetRealZoneText();
if RealZoneText then
pvpType, factionName, isArena = GetZonePVPInfo();
px, py = GetPlayerMapPosition("player");
px = string.format("%d",100 * px);
py = string.format("%d",100 * py);
if MapDataGatherer[px] then
-- Do Nothing
else
MapDataGatherer[px] = { };
end
if MapDataGatherer[px][py] then
-- Do Nothing
else
MapDataGatherer[px][py] = { };
end
MapDataGatherer[px][py] = {
["ZoneText"] = RealZoneText,
["SubZOneText"] = GetSubZoneText(),
["PvP"] = {
["Type"] = pvpType,
["FactionName"] = factionName,
["isArena"] = isArena,
}
};
end
end

function WyriHaximusnetDataGatherer_OnUpdate()
WyriHaximusnetDataGatherer_OnEvent();
end

I had to check if a array was there allready or not and if not I had to define it :).

The only thing that bothers me now is that I might add alot of extra load on the CPU.