-
Posted by l3gsh0t on Thu, 28 Apr 2011 12:44:58
I have this below, it checks to see if a player gets a killing blow on another player and then it puts a message in the chat log and the middle of the players screen. I'm getting an error on it all the time which I didn't get before the last patch.
if (event == "COMBATLOGEVENT_UNFILTERED") then
local player = UnitGUID("player"); local eventType, srcGUID, srcName, _, dstGUID, dstName, dstFlags = select(1, ...); local playerType = tonumber(dstGUID:sub(5,5), 16) % 8; if (eventType == "PARTY_KILL" and srcGUID == player and playerType == 0) then if (HeroStatusVars.enabled == 1) then if (HeroStatusVars.killing_blow_alert == 1) then HS_Message("Killing Blow on: " .. dstName); HS_TextMessage("Killing Blow"); HS_KillingBlowSound(); end end end
end
The error is "attempt to index local 'dstGUID' (a number value)". Can you explain what's going on? I'm not sure I understand what the error means by index.
-
Posted by l3gsh0t on Thu, 28 Apr 2011 15:44:00
Through trial and error I've figured it out. Also thanks to Chapter 21.
-
Posted by jnwhiteh on Thu, 28 Apr 2011 16:08:45
There was an additional argument added to the
COMBAT_LOG_EVENT_UNFILTERED
event calledhideCaster
. I believe this is now the third argument for this event, so everything else needs to move up one slot. -
Posted by l3gsh0t on Thu, 28 Apr 2011 16:59:26
What's the hidecaster for?
-
Posted by jnwhiteh on Thu, 28 Apr 2011 17:00:01
Absolutely no idea, no one seems to know.
-
Posted by l3gsh0t on Thu, 28 Apr 2011 17:03:45
Seems as though another part of my mod is broken, how can I find out if there are more additions to event arguments or api calls?
-
Posted by jnwhiteh on Thu, 28 Apr 2011 17:06:27
There's no comprehensive list, you can check the official WoW forums, or check out the compares between versions of the UI, but you'll be stabbing in the dark if you can't describe your problem more clearly.
-
Posted by l3gsh0t on Thu, 28 Apr 2011 17:20:17
I'm not getting any errors yet, and I haven't tried to debug it. However, it's supposed to find healers in battlegrounds and put an icon over their heads (if nameplates are on). Admittedly there is more work to do on this, but it used to work for me.
local heallist = {};
local function UpdatePlate(self) if heallist[self.HPname:GetText()] then
self.HPHeal:Show();
else
self.HPHeal:Hide();
end end
local function IsValidFrame (frame) if frame:GetName() then
return;
end overlayRegion = select(2, frame:GetRegions()); return overlayRegion and overlayRegion:GetObjectType() == "Texture" and overlayRegion:GetTexture() == "Interface\Tooltips\Nameplate-Border"; end
local function CreatePlate(frame) if frame.done then return; end
frame.nameplate = true; frame.healthBar, frame.castBar = frame:GetChildren(); local healthBar, castBar = frame.healthBar, frame.castBar; local _, _, _, _, _, _, nameTextRegion, _, _, _, _ = frame:GetRegions();
frame.HPname = nameTextRegion; frame.HPHeal = frame:CreateTexture(); frame.HPHeal:SetHeight(50); frame.HPHeal:SetWidth(50); frame.HPHeal:SetPoint("BOTTOM", frame, "TOP", 0, 10); frame.HPHeal:SetTexture(); frame.HPHeal:SetTexture("Interface\LFGFrame\UI-LFG-ICON-RoleS"); frame.HPHeal:SetTexCoord(GetTexCoordsForRole("HEALER")); frame.done = true;
UpdatePlate(frame); frame:SetScript("OnShow", UpdatePlate); end
local numKids = 0; local lastUpdate = 0;
local f = CreateFrame("Frame") f:SetScript("OnUpdate", function(self, elapsed) lastUpdate = lastUpdate + elapsed; if lastUpdate > 5 then
lastUpdate = 0; local newNumKids = WorldFrame:GetNumChildren(); if newNumKids ~= numKids then for i = numKids + 1, newNumKids do local frame = select(i, WorldFrame:GetChildren()); if IsValidFrame(frame) then CreatePlate(frame); end end numKids = newNumKids; end
end end)
local lastcheck = 0; local t = CreateFrame("Frame");
local function CheckHealers(self, elapsed) lastcheck = lastcheck + elapsed; if lastcheck > 30 then
lastcheck = 0; heallist = {}; for i = 1, GetNumBattlefieldScores() do local name, _, _, _, _, faction, _, class, classToken, damageDone, healingDone, _, _ = GetBattlefieldScore(i); if (healingDone > damageDone*1.2) and faction == 1 and class ~= "Warrior" and class ~= "Death Knight" and class ~= "Warlock" then name = name:match("(.+)%-.+") or name; heallist[name] = true; end end
end end
local function checkloc(self, event) if (event == "PLAYERENTERINGWORLD") or (event == "PLAYERENTERINGBATTLEGROUND") then
local isin, instype = IsInInstance(); if isin and instype == "pvp" then t:SetScript("OnUpdate", CheckHealers); else heallist = {}; t:SetScript("OnUpdate", nil); end
end end t:RegisterEvent("PLAYERENTERINGWORLD"); t:RegisterEvent("PLAYERENTERINGBATTLEGROUND"); t:SetScript("OnEvent", checkloc);
-
Posted by l3gsh0t on Fri, 29 Apr 2011 00:19:45
I have removed this post because after further review, I feel I may be able to figure this out. You can't be bothered anyways.
-
Posted by l3gsh0t on Fri, 29 Apr 2011 03:16:29
What does frame:GetRegions() return now? This isn't outlined in the book or on the website as far as I can tell. I'm having a hard time returning the name from a nameplate without knowing what I'm working with.
-
Posted by jnwhiteh on Fri, 29 Apr 2011 09:54:13
It does just what the documentation says it does for normal frames. I don't know if it works differently for nameplates these days or not, you'd be in a better position to answer that then I am.
-
Posted by l3gsh0t on Fri, 29 Apr 2011 15:58:26
I can't be sure if nameplates are being protected or not, but when I use numregions I can see how many regions there are. Then I dump those with getregions, and they are all nill. So... it's not looking good for the home team.
Thanks for your help.
-
Posted by jnwhiteh on Fri, 29 Apr 2011 17:28:27
But other nameplate addons are working?
-
Posted by l3gsh0t on Sat, 30 Apr 2011 16:07:46
I checked out a nameplate lib that was just updated, and yes it's now different. The regions changed, so what I was looking for isn't what I was getting. Also they weren't nill... I was doing it wrong. Once I figured it out I could test and work with it. Now I'm done fixing it, they changed how nameplates are stored as well, best I can tell is they used to have incrementing nameplates which made every nameplate you see unique, and now they are only unique as far as how many you have on the screen. This means they will recycle nameplate names, and I had to adjust for this also.
Thanks for the help again, even though this time you only made me think about it differently. I love knowing that you will respond to my posts. If it wasn't for your book I wouldn't have started making mods.