Okiic.
Okiic.

Reputation: 117

Why does my AutoIt script compile but doesn't do anything?

My AutoIt script compiles but doesn't do what it's supposed to do. Code:

HotKeySet(+"{G}","gather")

While 1
    sleep(100)
WEnd

Global $charRunTimeS = 2;
Global $collectKey = "{LWIN}";
Global $vehicleInvKey = "{T}";
Global $charRunTimeMS = $charRunTimeS * 1000

Global $posItemX = 820;
Global $posItem1Y = 300;
Global $posItem2Y = 340;
Global $posItem3Y = 365;
Global $posItem4Y = 397;
Global $posBtnStore = 678;
Global $posItemSelectedY = $posItem4Y

Func gather()

$counter = 0;
While $counter <= 2

    Send("{s down}")
    Sleep($charRunTimeMS)
    Send("{s up}")

    $counter1 = 0;
    While $counter1 <= 4
        Send($collectKey)
        Sleep(100)
        Send($collectKey)
        Sleep(30000)
        $counter1 = $counter1 + 1
    WEnd

    Send("{w down}")
    Sleep($charRunTimeMS)
    Send("{w up}")

    Send($vehicleInvKey)
    MouseClick("primary", $posItemX, $posItemSelectedY)

    $counter2 = 0;
    While $counter2 <= 30
        MouseClick($posItemX, $posBtnStore)
        $counter2 = $counter2 + 1
    WEnd

    Send("{ESC}")
    $counter = $counter + 1
WEnd

EndFunc

Output from de-bug. First line is when compiling and running, the second line is when I stop the code:

"C:\Program Files (x86)\AutoIt3\SciTE..\autoit3.exe" /ErrorStdOut "C:\Users\RichusX\Desktop\AltisGatherScript.au3"

Process failed to respond; forcing abrupt termination... Exit code: 1 Time: 14.39

Upvotes: 0

Views: 1248

Answers (1)

Xenobiologist
Xenobiologist

Reputation: 2151

I guess all you need to do is write the call like this:

HotKeySet("G", "gather")

You do not need the +, because of the capital G. If you want to then you have to put it into to "". Have a look at the send function.

Upvotes: 1

Related Questions