gabrielarg Posted May 22, 2009 Share Posted May 22, 2009 Hi im traing to use a bot, but when i run the script in autoit bring me this error: MouseClick($Click, $SearchResult[0]+25, $SearchResult[1]+35, 7, 3) MouseClick($Click, $SearchResult ERROR Error: Subscript used with non-Array variable can anyone help me? here is the code Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) WinWait("LastChaos - Aeria Games & Entertainment (Window 1024x768)","") If Not WinActive("LastChaos - Aeria Games & Entertainment (Window 1024x768)","") Then WinActivate("LastChaos - Aeria Games & Entertainment (Window 1024x768)","") WinWaitActive("LastChaos - Aeria Games & Entertainment (Window 1024x768)","") ;HotKeySet('{enter}', '_Exit') ;This sets the key to exit script (which is currently enter) anything after a semicolon is a comment, and does not affect the script ;While 1 = 1 ;Read it like a sentence. This means that while one equals one (hint: thats always), it runs the following. ;Sleep(10) ;Wait 10 milliseconds. If you want 5 minutes, the number would be 5 times 60 times 1000. 1 second = 1000 Milliseconds ;WEnd ;Func _Exit() ;Exit ;EndFunc ;Last 3 lines just make the script turn off when enter is pressed. HotKeySet('{esc}', '_Exit') ;Hotkey escape Dim $Coord, $Click, $Target, $SearchResult $Target = 0x5B9600 ;What you are targeting. This is a color in hex or decimal notation. Currently its set for white. $Click = "Right" ;Which mouse button. Right click selects without moving, so if the script misses the monster, it wont start walking where it missed, as it would with left click. While 1 = 1 Sleep(100) ;I added the sleep there so it only clicks once every 100 milliseconds. Without this, the camera is often messed up because the mouse is dragged while its right clicking, moving the camera. $SearchResult = PixelSearch(252,196,768,487,$Target,5,3) ;First set of numbers is where it searches. Remember, keep LC centered (untouched) when you start the program. If you run LC in a different resolution than you set the pixel search coordinates for it will not work. (continued below) ;The first number is variation (5). This means it varies the hue by 5, so it is not exactly green always. The second number is step. (continued below) ;Pixel search searches every pixel, at 2, it skips every other pixel. This makes it go faster, searching every pixel is unnecessary. Three could probably work, as well. If you want it to go faster, push this number up a little (personally I think its fine). If @error Then Else MouseClick($Click, $SearchResult[0]+25, $SearchResult[1]+35, 7, 3);Clicks with right key, a little below and to the right, so it clicks on mosnter instead of name. if $SearchResult = PixelSearch(237,193,806,638,$Target,5,1) Then Send("{F1}") ;Press "A" in LC, This should be the action window, in "general" tab. Drag regular "Attack" into F1. Send("{F3}") ;Drag the gather hotkey (horse or yourself). Horse is nice, but yourself makes it look less like a bot, I think. Else Send("{Right}") ;Right arrow key is sent, to rotate your camera $SearchResult = PixelSearch(342,342,1000,342,$Target,5,3) MouseClick($Click, $SearchResult[0]+25, $SearchResult[1]+35, 7, 3);Clicks with right key, a little below and to the right, so it clicks on mosnter instead of name. if $SearchResult = PixelSearch(237,193,806,638,$Target,5,1) Then Send("{F1}") ;Press "A" in LC, This should be the action window, in "general" tab. Drag regular "Attack" into F1. Send("{F3}") ;Drag the gather hotkey (horse or yourself). Horse is nice, but yourself makes it look less like a bot, I think. EndIf EndIf EndIf WEnd Func _Exit() Exit EndFunc While 1 Sleep(5*60*1000);Minutes*Seconds*Milliseconds. Change the first number to change amount of minutes. Send("{F3}") WEnd ;Else ;Sleep(100) ;I added the sleep there so it only clicks once every 100 milliseconds. Without this, the camera is often messed up because the mouse is dragged while its right clicking, moving the camera. ;$SearchResult = PixelSearch(252,196,768,487,$Target,5,3) ;First set of numbers is where it searches. Remember, keep LC centered (untouched) when you start the program. If you run LC in a different resolution than you set the pixel search coordinates for it will not work. (continued below) ;;The first number is variation (5). This means it varies the hue by 5, so it is not exactly green always. The second number is step. (continued below) ;;Pixel search searches every pixel, at 2, it skips every other pixel. This makes it go faster, searching every pixel is unnecessary. Three could probably work, as well. If you want it to go faster, push this number up a little (personally I think its fine). ;Send("{F1}") Link to comment Share on other sites More sharing options...
Authenticity Posted May 22, 2009 Share Posted May 22, 2009 expandcollapse popupOpt("WinWaitDelay", 100) Opt("WinTitleMatchMode", 4) Opt("WinDetectHiddenText", 1) Opt("MouseCoordMode", 0) HotKeySet('{esc}', '_Exit') Dim $Coord, $Click, $Target, $SearchResult WinWait("LastChaos - Aeria Games & Entertainment (Window 1024x768)", "") If Not WinActive("LastChaos - Aeria Games & Entertainment (Window 1024x768)", "") Then WinActivate("LastChaos - Aeria Games & Entertainment (Window 1024x768)", "") WinWaitActive("LastChaos - Aeria Games & Entertainment (Window 1024x768)", "") $Target = 0x5B9600 $Click = "Right" While 1 = 1 Sleep(100) $SearchResult = PixelSearch(252, 196, 768, 487, $Target, 5, 3) If Not @error Then MouseClick($Click, $SearchResult[0] + 25, $SearchResult[1] + 35, 7, 3) If $SearchResult = PixelSearch(237, 193, 806, 638, $Target, 5, 1) Then Send("{F1}") Send("{F3}") Else Send("{Right}") $SearchResult = PixelSearch(342, 342, 1000, 342, $Target, 5, 3) If Not @error Then MouseClick($Click, $SearchResult[0] + 25, $SearchResult[1] + 35, 7, 3) If $SearchResult = PixelSearch(237, 193, 806, 638, $Target, 5, 1) Then Send("{F1}") Send("{F3}") EndIf EndIf EndIf WEnd Func _Exit() Exit EndFunc While 1 Sleep(5 * 60 * 1000) Send("{F3}") WEnd Mind to explain what "If $SearchResult = PixelSearch(237, 193, 806, 638, $Target, 5, 1) Then" should achieve? Eventually, you're just comparing "If 0 = 0 Then. 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