Thread Tools Display Modes
Prev Previous Post   Next Post Next
06-18-23, 09:48 PM   #1
Galseb
A Defias Bandit
Join Date: Jun 2023
Posts: 2
Unhappy Addon does not display messages in chat

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
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Addon does not display messages in chat


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off