I would like to know how i can go back to the first function
I wanna do 3 functions in the button 6;
First he goes to TOPX and TOPY, on the second click he goes to MIDX and MID, in the third click to the BOTX and BOTY; after this if i click again he return to the first function.
local CENTER, MIDX, MIDY, BOTX, BOTY, TOPX, TOPY
----------------------Init------------------------------------------------------------------------------------------------------------------------------------------------------------------
CENTER = 32767
TOPX = 59305
TOPY = 54527
MIDX = 61764
MIDY = 58683
BOTX = 64060
BOTY = 63056
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--/
function OnEvent(event, arg)
--MIDLANE
if
event == "MOUSE_BUTTON_PRESSED" and arg == 6 then
MoveMouseTo(MIDX, MIDY)
-- PressMouseButton(1);
-- ReleaseMouseButton(1);
-- Sleep(20);
MoveMouseTo(MIDX, MIDY);
function OnEvent(event, arg)
--BOTLANE
if
event == "MOUSE_BUTTON_PRESSED" and arg == 6 then
MoveMouseTo(BOTX,BOTY) ;
-- PressMouseButton(1);
-- ReleaseMouseButton(1);
Sleep(20);
MoveMouseTo(CENTER, CENTER)
--TOPLANE
elseif
event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
MoveMouseTo(TOPX,TOPY) ;
-- PressMouseButton(1);
-- ReleaseMouseButton(1);
Sleep(20);
end
end
end
end
Your wording is a bit confusing. You don't want to "do 3 functions". From your text I take that you want to call MoveMouseTo
with different coordinates every third time.
So put them into a table:
button6Coords = {
{x = TOPX, y = TOPY},
{x = MIDX, y = MIDY},
{x = BOTX, y = BOTY},
}
then have a global counter that increments each time you click button6.
counter6 = 0
In the event handler:
...
if event == "MOUSE_BUTTON_PRESSED" and arg == 6 then
counter6 = counter6 % 3 + 1
local coords = button6Coords[counter6]
MoveMouseTo(coords.x, coords.y)
...