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:
lua
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 = 4395
SLASH_LAPCOUNT1 = "/lapcount"
lua
function SlashCmdList.LAPCOUNT(msg, editbox
print(lapCount)
end
end
local function CheckPlayerPosition()
local x, y = GetPlayerMapPosition("player")
local mapId = GetCurrentMapAreaID()
if mapId ~= DalaranID then
return
end
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
