Thx in advance.
The Error!
Date: 2009-05-15 17:29:30
ID: 1
Error occured in: Global
Count: 1
Message: ..\AddOns\DWMPack\DWMPackRep.lua line 128:
attempt to index local 'buttonText' (a nil value)
Debug:
(tail call): ?
[C]: ?
DWMPack\DWMPackRep.lua:128: DWMPackRepScrollFrame_Update()
[string "*:OnShow"]:1:
[string "*:OnShow"]:1
[C]: Show()
The LUA code.
Code:
DWMP_NUM_FACTIONS_DISPLAYED = 15;
DWMPACKREPFRAME_FACTIONHEIGHT = 26;
-- Hard coded =(, will need to add entries for each expansion
MAX_PLAYER_LEVEL_TABLE = {};
MAX_PLAYER_LEVEL_TABLE[0] = 60;
MAX_PLAYER_LEVEL_TABLE[1] = 70;
MAX_PLAYER_LEVEL_TABLE[2] = 80;
MAX_PLAYER_LEVEL = 0;
DWMPACKREPFRAME_ROWSPACING = 23;
--------------------------------------------------------------------------
-- Color chart per faction level
--------------------------------------------------------------------------
DWM_FACTION_BAR_COLORS = {
[1] = {r = 1.0, g = 0, b = 0}, -- 36000 Hated - Red
[2] = {r = 1.0, g = 0.5019608, b = 0}, -- 3000 Hostile - Orange
[3] = {r = 1.0, g = 0.8196079, b = 0}, -- 3000 Unfriendly - Yellow
[4] = {r = 0.8, g = 0.9, b = 0.8}, -- 3000 Neutral - Grey
[5] = {r = 1.0, g = 1.0, b = 1.0}, -- 6000 Friendly - White
[6] = {r = 0, g = 0.6, b = 0.1}, -- 12000 Honored - Green
[7] = {r = 0, g = 0, b = 1.0}, -- 21000 Revered - Blue
[8] = {r = 0.5803922, g = 0, b = 0.827451}, -- 1000 Exalted - Purple
};
------------------------------
-- Tracking information tables (Not in use yet)
------------------------------
--~ DWMPackRepData = { };
--~ DWMPackRepData["RCFactions"] = {
--~ [1] = "FACTIONS_DARKSPEAR",
--~ [2] = "FACTIONS_ORGRIMMAR",
--~ [3] = "FACTIONS_SILVERMOON",
--~ [4] = "FACTIONS_THUNDERBLUFF",
--~ [5] = "FACTIONS_UNDERCITY",
--~ [6] = "FACTIONS_DARNASSUS",
--~ [7] = "FACTIONS_EXODAR",
--~ [8] = "FACTIONS_GNOMEREGAN",
--~ [9] = "FACTIONS_IRONFORGE",
--~ [10] = "FACTIONS_STORMWIND",
--~ };
--~ DWMPackRepData["HodirFaction"] = {
--~ [1] = "UlduarRelic",
--~ [2] = "CrystalShard",
--~ };
--~ DWMPackRepData["CanarionFaction"] = {
--~ [1] = "CooilfangArms",
--~ [2] = "LackeyEars",
--~ };
--~ DWMPackRepData["Aldor"] = {
--~ [1] = "KiljadenMarks",
--~ [2] = "SargerasMarks",
--~ [3] = "FelArms",
--~ };
--~ DWMPackRepData["Scryers"] = {
--~ [1] = "FirewingSignet",
--~ [2] = "SunfurySignet",
--~ [3] = "ArcaneTomes",
--~ };
FACTION_STANDING_LABEL = {
[1] = "Hated",
[2] = "Hostile",
[3] = "Unfriendly",
[4] = "Neutral",
[5] = "Friendly",
[6] = "Honored",
[7] = "Revered",
[8] = "Exalted"
}
function DWMPackRepFrame_OnLoad(self)
local DWMPackRepFrame_UpdateFrame
self:RegisterEvent("UPDATE_FACTION");
-- Initialize max player level
MAX_PLAYER_LEVEL = MAX_PLAYER_LEVEL_TABLE[GetAccountExpansionLevel()];
local _, race = UnitRace("player")
end
-- Round function for percentages
function round(x)
return floor(x + 0.5)
end
function DWMPackRepScrollFrame_Update(self)
local numFactions = GetNumFactions();
local line, name, _, standingID, bottomValue, topValue, earnedValue, _, _, isHeader, _, hasRep, isWatched, _;
local name, faction, items, standing, percent, session, numbers, reptogo;
local button, buttonText, factionText, itemsText, standingText, percentText, sessionText, numbersText, reptogoText;
local dwmpackrepIndex;
local columnTable;
local dwmpackrepOffset = FauxScrollFrame_GetOffset(DWMPackRepScrollFrame);
local color = DWM_FACTION_BAR_COLORS[standingID];
local showScrollBar = nil;
if ( numFactions > DWMP_NUM_FACTIONS_DISPLAYED ) then
showScrollBar = 1;
end
local displayedText = "";
for i = 1, GetNumFactions() do
name, _, standingID, bottomValue, topValue, earnedValue, _, _, isHeader, _, hasRep, isWatched, _ = GetFactionInfo(i)
end
for i = 1, 50 do
name, _, standingID, bottomValue, topValue, earnedValue, _, _, isHeader, _, hasRep, isWatched, _ = GetFactionInfo(i)
if not isHeader then
dwmpackrepIndex = dwmpackrepOffset + i;
button = getglobal("DWMPackRepEntry"..i);
button.dwmpackrepIndex = dwmpackrepIndex;
faction, items, standing, percent, session, numbers, reptogo = GetText(dwmpackrepIndex);
columnTable = { faction, items, standing, percent, session, numbers, reptogo };
buttonText = getglobal("DWMPackRepEntry"..i.."Faction");
buttonText:SetText(name);
buttonText = getglobal("DWMPackRepEntry"..i.."Items");
buttonText:SetText("items");
buttonText = getglobal("DWMPackRepEntry"..i.."Standing");
buttonText:SetText(factionStandingtext);
buttonText = getglobal("DWMPackRepEntry"..i.."Percent");
buttonText:SetText(math.floor( (earnedValue-bottomValue)/(topValue-bottomValue) * 100).."% ");
buttonText = getglobal("DWMPackRepEntry"..i.."Session");
buttonText:SetText("session");
buttonText = getglobal("DWMPackRepEntry"..i.."Numbers");
buttonText:SetText(earnedValue-bottomValue.."/"..topValue-bottomValue);
buttonText = getglobal("DWMPackRepEntry"..i.."RepToGo");
buttonText:SetText(topValue-earnedValue);
local variableText = getglobal("DWMPackRepEntry"..i.."Standing");
variableText:SetText(columnTable[FACTION_STANDING_LABEL_GetSelectedID(factionStandingtext)]);
local factionStandingtext = GetText("FACTION_STANDING_LABEL"..standingID, gender);
end
factionStandingtext = ""
if standingID == 1 then
factionStandingtext = "|cff8b0000"..name.."|r";
elseif standingID == 2 then
factionStandingtext = "|cffff1919"..name.."|r";
elseif standingID == 3 then
factionStandingtext = "|cffff8C00"..name.."|r";
elseif standingID == 4 then
factionStandingtext = "|cffc0c0c0"..name.."|r";
elseif standingID == 5 then
factionStandingtext = "|cffffffff"..name.."|r";
elseif standingID == 6 then
factionStandingtext = "|cff19ff19"..name.."|r";
elseif standingID == 7 then
factionStandingtext = "|cff4169e1"..name.."|r";
elseif standingID == 8 then
factionStandingtext = "|cff9932cc"..name.."|r";
end
DWMPackRepScrollFrame:Show();
end
end
function DWMPackRepFrameColumn_SetWidth(frame, width)
frame:SetWidth(width);
getglobal(frame:GetName().."Middle"):SetWidth(width - 9);
end
function DWMPackRepFrame_OnShow()
DWMPackRepFrame_Update();
end
function DWMPackRepFrame_OnEvent(self, event, ...)
if ( event == "UPDATE_FACTION" ) then
if ( self:IsVisible() ) then
DWMPackRepFrame_Update();
end
end
end
function DWMPackRepFrame_OnShow(self)
if ( DWMPackRepFrame:IsShown() ) then
DWMPackRepScrollFrame:Show();
DWMPackRepFrame_Update();
end
end
and the xml virtual button code.
Code:
<Button name="DWMPackRepEntryTemplate" hidden="false" virtual="true">|||/shoo
<Size>
<AbsDimension x="670" y="14" />
</Size>
<Layers>
<Layer level="BACKGROUND">
<FontString name="|cff19ff19$parentFaction|r" inherits="GameFontNormal" justifyH="LEFT">
<Size>
<AbsDimension x="140" y="14"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="7" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="|cffff8C00$parentItems|r" inherits="GameFontHighlight" justifyH="CENTER">
<Size>
<AbsDimension x="50" y="14"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentFaction" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="5" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentStanding" inherits="GameFontHighlight" justifyH="LEFT">
<Size>
<AbsDimension x="80" y="14"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentItems" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="25" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentPercent" inherits="GameFontHighlight" justifyH="RIGHT">
<Size>
<AbsDimension x="47" y="14"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentStanding" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="10" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentSession" inherits="GameFontHighlight" justifyH="CENTER">
<Size>
<AbsDimension x="55" y="14"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentPercent" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="19" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentNumbers" inherits="GameFontHighlight" justifyH="RIGHT">
<Size>
<AbsDimension x="90" y="14"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentSession" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="37" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentRepToGo" inherits="GameFontHighlight" justifyH="RIGHT">
<Size>
<AbsDimension x="60" y="14"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentNumbers" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="18" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="39" y="-90" />
</Offset>
</Anchor>
</Anchors>
<ButtonText name="$parentText">
<FontHeight>
<AbsValue val="10" />
</FontHeight>
</ButtonText>
<NormalFont style="GameFontNormalSmall" />
<PushedTextOffset x="0" y="0" />
<Scripts>
<OnLoad>
self.sortType = "name";
self:SetFrameLevel(self:GetFrameLevel() + 1);
</OnLoad>
</Scripts>
</Button>
/reported|||Reported for what? Asking for assistance? Looking for some advice on code manipulation because its used directly from a blizzard source? Go ahead and report me for attempting to create a useful mod that perhaps some people may enjoy using once complete. I don't know you nor do I care to even try. You don't know me either so why do I care so much? simply because I am sick to death of forum ridicule. If its a joke well it's a lame one.
BTW I won't go go away at all, I have just as much right here as anyone else does!|||Quote:
Reported for what? Asking for assistance? Looking for some advice on code manipulation because its used directly from a blizzard source? Go ahead and report me for attempting to create a useful mod that perhaps some people may enjoy using once complete. I don't know you nor do I care to even try. You don't know me either so why do I care so much? simply because I am sick to death of forum ridicule. If its a joke well it's a lame one.
BTW I won't go go away at all, I have just as much right here as anyone else does!
I wasnt reporting you, there was a gold spammer on this thread that i reported.|||Oh ok then I do apologize for my outburst...lol....I got the goldspammer email but deleted it. I thought you were having a go at me directly. sorry...
btw any chance of some assistance here?....... :P
No comments:
Post a Comment