Jump to content

Clicking on a pixel color


Recommended Posts

I am making a bot for a game and everything works except for the aim bot. When I run the hot key for it in game I get an error that reads out: line 63 error: Subscript used with non-Array variable. The code is here:

HotKeySet ( "+!h", "health" )
HotKeySet ( "+!c", "click" )
HotKeySet ( "+!b", "bunnyhop" )
HotKeySet ( "+!z", "Aimbh" )
;HotKeySet ( "+!s", "Aimbc" )
;health 0E3E9E24
;name
;
;

While 1
    Sleep(100)
    WEnd




Func health()
    Run("Health.exe")
EndFunc




Func click()
    $a=0
    while $a<60
    $pos=MouseGetPos ()
MouseClick("left", $pos[0], $pos[1], 1)
$a=$a+1
WEnd
    EndFunc




Func bunnyhop()
    Send("{a down}");Holds the A key down
    Send("{a up}");Releases the A keyA
    Send("{SPACE}")
    Sleep(200)
    Send("{LCTRL}")
EndFunc




Func Aimbh()
    $count=0
    While $count<10
$coord = PixelSearch( 0, 0, 20, 300, 0xFF0000 )
    MouseMove ( $coord [0], $coord [1], 2 )
    MouseClick("left", $coord[0], $coord[1], 1)
    $count=$count+1
    Sleep(6000)
    WEnd
    EndFunc
Link to comment
Share on other sites

You must check whether PixelSearch was successfull:

first version:

Func Aimbh()
    $count = 0
    While $count < 10
        $coord = PixelSearch(0, 0, 20, 300, 0xFF0000)
        If @error Then ExitLoop
        MouseMove($coord [0], $coord [1], 2)
        MouseClick("left", $coord[0], $coord[1], 1)
        $count = $count + 1
        Sleep(6000)
    WEnd
EndFunc   ;==>AimbhoÝ÷ ÚÇ¢woz»"¢v®¶­sdgVæ2Ö& b33c¶6÷VçBÒ vÆRb33c¶6÷VçBfÇC² b33c¶6ö÷&BÒVÅ6V&6ÂÂ#Â3Âdc bæ÷BW'&÷"FVà Ö÷W6TÖ÷fRb33c¶6ö÷&B³ÒÂb33c¶6ö÷&B³ÒÂ" Ö÷W6T6Æ6²gV÷C¶ÆVgBgV÷C²Âb33c¶6ö÷&E³ÒÂb33c¶6ö÷&E³Ò VæD` b33c¶6÷VçBÒb33c¶6÷VçB² 6ÆVWc tVæ@¤VæDgVæ2³ÓÒfwC´Ö&
Link to comment
Share on other sites

Is it just me or is this line incorrect??

MouseMove($coord [0], $coord [1], 2)

Should it not be:

MouseMove($coord[0], $coord[1], 2)

But then again, is it really necessary??

Because of this line:

MouseClick("left", $coord[0], $coord[1], 1)

That clicks on the position you specified with $coord.

EDIT: Clarity...

Edited by Bert
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...