Help executing/running a function

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
liamroblox
Posts: 1
Joined: 03 May 2024, 16:12

Help executing/running a function

03 May 2024, 16:24

Hello! I am fairly new to AHK, so this might be a dumb question. Whenever I try and run a function, Windows just makes this weird noise and the script stops.

This is my code:

Code: Select all

TeleportPosX = 1536
TeleportPosY = 39
TeleportSearchPosX = 1351
TeleportSearchPosY = 250
AreaToGoToX = 956
AreaToGoToY = 353

^F1::GoToArea("Void Spiral", false)

GoToArea(Area, AutoFarm)
{
    MouseMove, TeleportPosX, TeleportPosY
    Click
    Click
    MouseMove, TeleportSearchPosX, TeleportSearchPosY
    Click
    Click
    Click
    Sleep, 500
    send %Area%
    MouseMove, AreaToGoToX, AreaToGoToY
    Click
}
Does anyone know how to fix this?

[Mod edit: Added [code][/code] tags. Please use them yourself when posting code!]
[Mod edit: Moved topic from AHK v2 help since this is v1 code.]
Rohwedder
Posts: 7706
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Help executing/running a function

04 May 2024, 00:43

Hallo,
try:

Code: Select all

TeleportPosX = 1536
TeleportPosY = 39
TeleportSearchPosX = 1351
TeleportSearchPosY = 250
AreaToGoToX = 956
AreaToGoToY = 353

^F1::GoToArea("Void Spiral", false)

GoToArea(Area, AutoFarm)
{
    Global ; <<<<<<
	MouseMove, TeleportPosX, TeleportPosY
    Click
    Click
    MouseMove, TeleportSearchPosX, TeleportSearchPosY
    Click
    Click
    Click
    Sleep, 500
    send %Area%
    MouseMove, AreaToGoToX, AreaToGoToY
    Click
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: arrondark, Bing [Bot], CoffeeChaton, mikeyww, ntepa, pilgrimlyieu and 114 guests