0

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

2
  • Where is the function "gather" called? Commented Jan 18, 2015 at 13:34
  • @UweKeim from the HotKeySet(+"{G}","gather") , it was outside the codeblock due to formatting but should be inside from what I can tell. Commented Jan 18, 2015 at 13:37

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.