11-21-21, 06:24 PM | #1 |
Two related errors that are confusing me
Attached is the retail zip of RepByZone in progress. As it stands, I'm getting the following error:
Lua Code:
Lua Code:
Lua Code:
Please send help! I've run out of ideas. |
|
11-21-21, 07:28 PM | #2 |
Somewhere, adding the extra lines has created a recursive call that gets back to RepByZone:SwitchedZones()
Simple check, change: Code:
function RepByZone:SwitchedZones() Code:
local count = 0 function RepByZone:SwitchedZones() count = count + 1 print("count", count)
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 11-21-21 at 10:20 PM. |
|
11-22-21, 06:25 AM | #3 | |||||
This is triggered both from RepByZone:OnEnable() calling RepByZone:ZoneAndFactionList() and your events calling RepByZone:SwitchedZones().
Code:
zonesAndFactions = self:ZoneAndFactionList() This continues on to RepByZone:CheckSholazarBasin(), which proceeds with calling RepByZone:SwitchedZones(). Note this function hasn't returned yet either and continues holding up the line. Now RepByZone:SwitchedZones() is running, but because neither of the functions have had the ability to return yet, subZonesAndFactions (to be set after zonesAndFactions in RepByZone:OnEnable()) is still nil. I suggest removing self:SwitchedZones() from RepByZone:CheckSholazarBasin(). That one line is what's causing all of your problems. If you need to call RepByZone:SwitchedZones() from RepByZone:OnEnable(), put it in there.
__________________
WoWInterface AddOns
|
||||||
11-22-21, 07:34 AM | #4 |
Whew. Thank you SDPhantom. That was driving me crazy. Do I need to/should I be calling self:SwitchedZones() in Options.lua? I can't tell if that is causing a stack overflow that isn't being caught, as commenting out the lines or leaving them in doesn't seem to make BugSack unhappy.
Also, now that I no longer have any errors, something else is confusing me. After your explanation, I fixed the code in self:CheckSolazarBasin(). So far so good.... until I zoned into my garrison. Once there, I still don't get any errors (woot~ ) but now my bodyguard's faction isn't being set as the watched faction. My Night Elf Demon Hunter is watching Darnassus in both the garrison and the mine/excavation. Heading out to Shadowmoon Valley watches Council of Exarchs, which would be correct if I wasn't supposed to be watching Delvar Ironfist. So, the code is ignoring the bodyguards. Hm, okay. But why? Attached is the updated zip. |
|
11-24-21, 02:11 AM | #5 | |||
Code:
local isWoDZone = #self.WoDFollowerZones > 0 and self.WoDFollowerZones[UImapID] or self.WoDFollowerZones[parentMapID] Code:
RepByZone.WoDFollowerZones = { [525] = true, -- Frostfire Ridge [534] = true, -- Tanaan Jungle [535] = true, -- Talador [539] = true, -- Shadowmoon Valley [542] = true, -- Spires of Arak [543] = true, -- Gorgrond [550] = true, -- Nagrand [579] = true, -- Lunarfall Excavation 1 [580] = true, -- Lunarfall Excavation 2 [581] = true, -- Lunarfall Excavation 3 [582] = true, -- Lunarfall [585] = true, -- Frostwall Mine 1 [586] = true, -- Frostwall Mine 2 [587] = true, -- Frostwall Mine 3 [588] = true, -- Ashran [590] = true, -- Frostwall } Another unrelated issue is you should reinitialize your data tables when a Pandaren chooses their faction. Otherwise, the faction-specific reps won't load correctly. The following additions should correct this. Code:
function RepByZone:CheckPandaren(event, success) if success then A = UnitFactionGroup("player") == "Alliance" and ALLIANCE H = UnitFactionGroup("player") == "Horde" and HORDE if UnitFactionGroup("player") ~= nil then instancesAndFactions = self:InstancesAndFactionList() zonesAndFactions = self:ZoneAndFactionList() subZonesAndFactions = self:SubZonesAndFactions() self:GetRacialRep() if db.watchedRepID == 1216 then db.watchedRepID, db.watchedRepName = self:GetRacialRep() self:Print(L["You have joined the faction %s, switching watched saved variable to %s."]:format(A or H, db.watchedRepName)) self:SwitchedZones() end end end if A or H then self:UnregisterEvent(event) end end
__________________
WoWInterface AddOns
Last edited by SDPhantom : 11-24-21 at 02:41 AM. |
||||
11-25-21, 03:46 AM | #6 |
Attached is the latest zip with all the file changes.
I have the feeling that CheckBodyguard() is returning nil because "Lua doesn't work that way", a mistake I seem to make a lot, given this thread. For brevity, here's the function by itself. The commented URL is a list of IsQuestCompleted() if the player talks to the bodyguard and says "come with me, I need muscle". I'm not sure if I need to check for quest completion, or if simply assigning the follower to the barracks is enough. If the follower is not actually hanging out with the player, the follower does not gain reputation, so I might have to check. Lua Code:
|
|
11-25-21, 03:49 PM | #7 | |
The first thing that caught my attention.
Code:
local bodyguardRep = self:CheckBodyguard() self:Print("DEBUG: The value of bodyguard is", bodyguard)
__________________
WoWInterface AddOns
|
||
WoWInterface » Developer Discussions » Lua/XML Help » Two related errors that are confusing me |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|