Originally Posted by Galseb
In general, in a nutshell. I wanted to make an addon on WotLK, which does the calculation of the number of circles in Dalaran. But the problem is that when you enter the command, it writes that it is unknown
code:
Code:
local points = {
A = {x1 = 58, y1 = 46, x2 = 80, y2 = 49},
B = {x1 = 47, y1 = 28, x2 = 49, y2 = 36},
C = {x1 = 39, y1 = 48, x2 = 47, y2 = 52},
D = {x1 = 50, y1 = 58, x2 = 52, y2 = 63},
}
local currentPoint = "A"
local lapCount = 0
local DalaranID = 125
SLASH_LAPCOUNT1 = "/lapcount"
function SlashCmdList.LAPCOUNT(msg, editbox)
print(lapCount)
end
local function CheckPlayerPosition()
local mapId = C_Map.GetBestMapForUnit("player")
if mapId ~= DalaranID then
return
end
local x, y = C_Map.GetPlayerMapPosition(mapId, "player")
if x >= points[currentPoint].x1 and x <= points[currentPoint].x2 and y >= points[currentPoint].y1 and y <= points[currentPoint].y2 then
if currentPoint == "A" then
currentPoint = "B"
elseif currentPoint == "B" then
currentPoint = "C"
elseif currentPoint == "C" then
currentPoint = "D"
elseif currentPoint == "D" then
currentPoint = "A"
lapCount = lapCount + 1
end
end
end
local frame = CreateFrame("Frame")
frame:SetScript("OnUpdate", CheckPlayerPosition)
I have a problem with the output of information, the game does not register the command. Help me fix the code please. ty for attention
|
I fixed the problems visible to the naked eye (no testing)
You need to enable Lua errors from interface options to even see what's happening.
There's no way that code even run.