Jump to content

Coords Driving me Crazy


Recommended Posts

HotKeySet("{F1}", "Attack")
HotKeySet("{F2}", "Sendz")
MsgBox(0,"!","Loaded! - Jpres")

While 1
    sleep(50)
WEnd

Func Attack()
    $CoordX = MouseGetPos(0)
    $CoordY = MouseGetPos(1)
EndFunc

Func Sendz()
    MouseClick("right")
    sleep(50)
    Send("{ShiftDown}",0)
    sleep(50)
    MouseClick("right")
    sleep(50)
    Send("a",1)
    sleep(50)
    if not @error Then
        sleep(50)
        MouseMove($CoordX,$CoordY)
        if not @error Then
        sleep(50)
        MouseClick("left")
        EndIf
    EndIf
                Send("{ShiftUp}",0)
EndFunc

Everytime it gets to MouseMove$CoordX,$CoordY) - I get an error - Variable used without being declared - the problem is I don't get what i'm doing wrong, since I thought the pressing of F1 would've declared it.

Link to comment
Share on other sites

Like this:

HotKeySet("{F1}", "Attack")
HotKeySet("{F2}", "Sendz")
MsgBox(0,"!","Loaded! - Jpres")

Dim $CoordX, $CoordY

While 1
    Sleep(50)
WEnd

Func Attack()
    $CoordX = MouseGetPos(0)
    $CoordY = MouseGetPos(1)
EndFunc

Func Sendz()
    MouseClick("right")
    Sleep(50)
    Send("{ShiftDown}",0)
    Sleep(50)
    MouseClick("right")
    Sleep(50)
    Send("a",1)
    Sleep(50)
    If Not @error Then
            Sleep(50)
            MouseMove($CoordX,$CoordY)
            If Not @error Then
            Sleep(50)
            MouseClick("left")
        EndIf
    EndIf
    Send("{ShiftUp}",0)
EndFunc
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...