dandymcgee Posted August 11, 2006 Share Posted August 11, 2006 (edited) I'm trying to make my modified version of Wrench's diablo II town portal bot work. I keep getting this: ----------------------ERROR------------------------ AutoIt Error Line 18 (File "C:\.....\......\Desktop\Town Portal.au3) MouseClick("left", $Pix[0], $Pix[1]) MouseClick("left", $Pix^ ERROR Error: Subscript used with non-Array variable. ----------------------ERROR------------------------ Here is the code: HotKeySet("z", "MakeTP") HotKeySet("{End}", "Close") While 1 Sleep(100) WEnd Func MakeTP() Sleep(100) Send("{F8}") MouseClick("right", 1, 1) Sleep(2000) $Pix = PixelSearch(374, 206, 658, 440, 0x6490E0) Sleep(1000) If @error Then MsgBox(0, "error", "cannot find tp") Else MouseClick("left", $Pix[0], $Pix[1]) EndIf Sleep(10000) EndFunc Func Close() Exit EndFunc I'm using PixelSearch which is supposed to return two variables, but the error states it isn't array. I don't understand what is going on (obviously because I am posting this ). Any help is appreciated. Dan Edited August 11, 2006 by dandymcgee - Dan [Website] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 11, 2006 Moderators Share Posted August 11, 2006 The Sleep(1000) right before the @error throws the @error offFunc MakeTP() Sleep(100) Send("{F8}") MouseClick("right", 1, 1) Sleep(2000) $Pix = PixelSearch(374, 206, 658, 440, 0x6490E0) Sleep(1000) If Not IsArray($Pix) Then MsgBox(0, "error", "cannot find tp") Else MouseClick("left", $Pix[0], $Pix[1]) EndIf Sleep(10000) EndFunc Func Close() Exit EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
dandymcgee Posted August 11, 2006 Author Share Posted August 11, 2006 (edited) next post..... Edited August 11, 2006 by dandymcgee - Dan [Website] Link to comment Share on other sites More sharing options...
dandymcgee Posted August 11, 2006 Author Share Posted August 11, 2006 wow man, thanks for the instant reply. Now its just popping up my message box saying, "cannot find tp". I don't understand why it doesn't think that $Pix is an array... Please help. - Dan [Website] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 11, 2006 Moderators Share Posted August 11, 2006 wow man, thanks for the instant reply. Now its just popping up my message box saying, "cannot find tp". I don't understand why it doesn't think that $Pix is an array... Please help.Pix isn't an array because the color isn't found... Simple as that.Make sure your PixelCoordMode matches the type of coords you gathered from your application. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Buckw1 Posted August 11, 2006 Share Posted August 11, 2006 wow man, thanks for the instant reply. Now its just popping up my message box saying, "cannot find tp". I don't understand why it doesn't think that $Pix is an array... Please help.whatever this line is looking for is not found, either wrong screen size, pictures changed or Blizzard put in blocking code which I don't think they did..$Pix = PixelSearch(374, 206, 658, 440, 0x6490E0) Link to comment Share on other sites More sharing options...
Kyler Carlson Posted August 11, 2006 Share Posted August 11, 2006 should $Pix = PixelSearch(374, 206, 658, 440, 0x6490E0) be $Pix = PixelSearch(374, 206, 658, 440, "0x6490E0") I know that I always put the color in quotes. I'm not sure if it has to be though. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 11, 2006 Moderators Share Posted August 11, 2006 should $Pix = PixelSearch(374, 206, 658, 440, 0x6490E0) be $Pix = PixelSearch(374, 206, 658, 440, "0x6490E0") I know that I always put the color in quotes. I'm not sure if it has to be though.No Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
dandymcgee Posted August 11, 2006 Author Share Posted August 11, 2006 Ok, thanks for all your answers. I couldn't get the color hex right, so I just used mouse click seens as the townportal is always in the center of the screen, and I added Send("{Space}") before the click incase i happened to have my inventory open. Thanks again. - Dan [Website] Link to comment Share on other sites More sharing options...
Kiesp Posted August 28, 2006 Share Posted August 28, 2006 (edited) First i would like to say hi.. i am making a script that finds the color red (or an other color, but that doesn't matter) but i keep getting the same error.. but i dont have the sleep func. it complains about the $dc[0] and $dc[1] while 1 = 1 $loot = pixelsearch(1,1,1,1, 0xFFFFFF) if not @error then mouseclick('left', $loot[0], $loot[1], 3, 0) endif wend EDIT: changed the code a bit Edited August 28, 2006 by Kiesp http://www.autoitscript.com/forum/index.php?showtopic=69911 <-- Best hacker ever :D 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