local stickT = Point.get(2717, 247) -- Верхний левый угол
local stickB = Point.get(2994, 344) -- Нижний правый угол
local buyBtn = Point.get(1953, 1456) -- Кнопка "Купить"
local confirmBtn = Point.get(3456, 532) -- Кнопка "Подтвердить"
local checkDelay = 250
local clickDelay = 1000
function captureRegion(topLeft, bottomRight)
return CaptureArea(topLeft.x, topLeft.y, bottomRight.x - topLeft.x, bottomRight.y - topLeft.y)
end
function imagesAreEqual(img1, img2)
if img1.width ~= img2.width or img1.height ~= img2.height then
return false
end
for x = 0, img1.width - 1 do
for y = 0, img1.height - 1 do
if img1:GetPixel(x, y) ~= img2:GetPixel(x, y) then
return false
end
end
end
return true
end
function clickWithRandomization(point)
local randomX = point.x + math.random(-5, 5)
local randomY = point.y + math.random(-5, 5)
MoveMouseTo(randomX, randomY)
PressMouseButton(1)
Sleep(50)
ReleaseMouseButton(1)
end
local previousImage = captureRegion(stickT, stickB)
while not EXIT do
local currentImage = captureRegion(stickT, stickB)
if not imagesAreEqual(previousImage, currentImage) then
print("Обнаружено изменение в области!"
clickWithRandomization(buyBtn)
print("Нажата кнопка 'Купить'"
Sleep(clickDelay)
clickWithRandomization(confirmBtn)
print("Нажата кнопка 'Подтвердить'"
previousImage = currentImage
end
Sleep(checkDelay)
end
local stickB = Point.get(2994, 344) -- Нижний правый угол
local buyBtn = Point.get(1953, 1456) -- Кнопка "Купить"
local confirmBtn = Point.get(3456, 532) -- Кнопка "Подтвердить"
local checkDelay = 250
local clickDelay = 1000
function captureRegion(topLeft, bottomRight)
return CaptureArea(topLeft.x, topLeft.y, bottomRight.x - topLeft.x, bottomRight.y - topLeft.y)
end
function imagesAreEqual(img1, img2)
if img1.width ~= img2.width or img1.height ~= img2.height then
return false
end
for x = 0, img1.width - 1 do
for y = 0, img1.height - 1 do
if img1:GetPixel(x, y) ~= img2:GetPixel(x, y) then
return false
end
end
end
return true
end
function clickWithRandomization(point)
local randomX = point.x + math.random(-5, 5)
local randomY = point.y + math.random(-5, 5)
MoveMouseTo(randomX, randomY)
PressMouseButton(1)
Sleep(50)
ReleaseMouseButton(1)
end
local previousImage = captureRegion(stickT, stickB)
while not EXIT do
local currentImage = captureRegion(stickT, stickB)
if not imagesAreEqual(previousImage, currentImage) then
print("Обнаружено изменение в области!"
clickWithRandomization(buyBtn)
print("Нажата кнопка 'Купить'"
Sleep(clickDelay)
clickWithRandomization(confirmBtn)
print("Нажата кнопка 'Подтвердить'"
previousImage = currentImage
end
Sleep(checkDelay)
end