crazynight Posted August 17, 2007 Share Posted August 17, 2007 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: expandcollapse popupHotKeySet ( "+!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 More sharing options...
Zedna Posted August 17, 2007 Share Posted August 17, 2007 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´Ö& Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
BrettF Posted August 17, 2007 Share Posted August 17, 2007 (edited) 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 August 17, 2007 by Bert Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Zedna Posted August 17, 2007 Share Posted August 17, 2007 MouseMove($coord[0], $coord[1], 2) But then again, is it really necessary?? Yes. MouseMove is not neccessary, MouseClick will do all needed job here. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now