bvr Posted December 21, 2005 Share Posted December 21, 2005 (edited) I want to make this work, and its been difficult, and this is the hardest part. I'm trying to make autoit search for press tab, because that displays all the item names that are on the ground, and I want it to search for a color, which I have the color already, then I want it to click where it finds the color. I have most of it figured out except where to click. I can get the choords, but I dunno how to make it click there cause I have to run to program to find the choords. Here is my code, from using the helpfile. ;----------------------------------------------------------------------- ; This is a test script to see if I can make a pickit for my D2 Bot ;----------------------------------------------------------------------- ; Find a pixel color for a unquie item on D2 WinActivate ( 'Diablo II' ) Sleep ( 500 ) Send("{ALTDOWN}") Sleep(500) $coord = PixelSearch( 219, 290, 393, 308, 0x443428, 10 ) MouseMove("$X,$Y");(problem is here, I don't know what X and Y are yet!) Sleep(500) MouseClick("left") Sleep(1000) If Not @error Then MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1]) EndIf Edited December 21, 2005 by bmroyer Link to comment Share on other sites More sharing options...
bvr Posted December 21, 2005 Author Share Posted December 21, 2005 on this part: $coord = PixelSearch( 219, 290, 393, 308, which coord do I use? X or Y? Left= 219 Top=290 Right=393 Bottom=308 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 21, 2005 Moderators Share Posted December 21, 2005 Top Left X = 219 Top Left Y = 290 Bottom Right X = 393 Bottom Right Y = 308 2 different sets of coords, a starting point and an ending point. 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...
bvr Posted December 21, 2005 Author Share Posted December 21, 2005 I must have the color wrong. Is it possible to get the color for an item name? There are 3 magical item names, which are different colors. Here is a pic of a set item:Is there an easier way to get the color of that set? Link to comment Share on other sites More sharing options...
Valuater Posted December 21, 2005 Share Posted December 21, 2005 try this expandcollapse popup;*********** Use ************** ; Press Esc to terminate script ; Press F8 to open a color dialog box and choose a color ; Or ; Press F9 to get the color under the mouse pointer ; by Valuater...... Enjoy!!! ;****************************** #include <GuiConstants.au3> #include <Misc.au3> Global $var, $Color_win, $pos HotKeySet("{F8}", "Color_Box") HotKeySet("{ESC}", "Terminate") HotKeySet("{F9}", "Get_Color") ToolTip('Get Color - is Running',0,0) While 1 Sleep(100) WEnd ;;;;;;;; Func Color_Box() $var = _ChooseColor (2) Show_Color() EndFunc Func Terminate() Exit 0 EndFunc Func Get_Color() $pos = MouseGetPos() $Svar = PixelGetColor( $pos[0] , $pos[1]) $var = "0x" & Hex($Svar,6) Show_Color() EndFunc Func Show_Color() GUIDelete($Color_win) ClipPut($var) $Color_win = GUICreate("RGB Color = " & $var, 290, 150, -1, -1) GUISetBkColor($var) GUISetFont(9, 400, -1, "MS Sans Serif") GUICtrlCreateLabel(" This Color has been Copied to the ClipBoard " & @CRLF & @CRLF & " Just Paste it wherever you would like"& @CRLF & @CRLF & @CRLF & " Mouse position X=" & $pos[0] & " Y=" & $pos[1] , 10, 10, 270, 100) GUICtrlSetFont(-1, 9, 650) If $var = 0x000000 Then GUICtrlSetColor( -1, 0xFFFFFF) $OK_Btn = GUICtrlCreateButton("&OK", 100, 110, 80, 30) GUISetState() While 2 $msg1 = GUIGetMsg() If $msg1 = $OK_Btn Or $msg1 = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete($Color_win) EndFunc 8) Link to comment Share on other sites More sharing options...
bvr Posted December 21, 2005 Author Share Posted December 21, 2005 says $var = _ChooseColor (2) UNKNOWN FUNCTION NAME Link to comment Share on other sites More sharing options...
bvr Posted December 21, 2005 Author Share Posted December 21, 2005 just bumping this, your above code doesn't work, also, is this more efficient than the one that comes with autoit, the autoit spy window? Link to comment Share on other sites More sharing options...
Josbe Posted December 21, 2005 Share Posted December 21, 2005 says $var = _ChooseColor (2) UNKNOWN FUNCTION NAMEthis func. was included in: #include <Misc.au3> • AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
Valuater Posted December 21, 2005 Share Posted December 21, 2005 i think you need the beta versionhttp://www.autoitscript.com/forum/index.php?showtopic=10256#_ChooseColor() is an autoit control/command it is located in the help file8) Link to comment Share on other sites More sharing options...
bvr Posted December 21, 2005 Author Share Posted December 21, 2005 (edited) Man I thought I had it working, but then I threw some diff colored items on the ground and it just picked them up too. It just clicks anywhere it wants to really, isn't really clicking on my color, if that is the color of the item, not sure if I captured the right one or not. ~edit I took a screen shot and loaded it in paint shop then blew it up and captured the color. It worked, I dropped lotts of different colored items and it picked up the correct one everytime. But I have another issue, I moved to a different part of the game, and then tried the same thing, and it misses it everytime, like it only worked in that one area that I took the coords from. Is there a way to make it work anywhere in the game? Also, If more than one item of that color drops, I want to pick both up, how do I make it search and pickup till there is no more? Edited December 21, 2005 by bmroyer Link to comment Share on other sites More sharing options...
bvr Posted December 23, 2005 Author Share Posted December 23, 2005 I got it working, but I want it to keep picking up items (click on teh color) untill they are all picked up. I also am going to add different colors later on of different item types, I could us If statements on that, but I'm not sure how to make it keep picking up or search for the color until it is no longer there. Here is my current code that you helped me with WinActivate ( 'Diablo II' ) Sleep ( 500 ) Send("{ALTDOWN}") Sleep(500) $coord = PixelSearch( 213, 198, 427, 355, 0x948064, ) If Not @error Then MouseMove($coord[0],$coord[1],0) Sleep(500) MouseClick("left") Sleep(1000) Send("{ALTUP}") EndIf Link to comment Share on other sites More sharing options...
Shinies Posted December 24, 2005 Share Posted December 24, 2005 (edited) How about: WinActivate ( 'Diablo II' ) Sleep ( 500 ) Send("{ALTDOWN}") Sleep(500) Do $coord = PixelSearch( 213, 198, 427, 355, 0x948064, ) MouseMove($coord[0],$coord[1],0) Sleep(500) MouseClick("left") Sleep(1000) Send("{ALTUP}") Until @error Edited December 24, 2005 by Smirk_zero Link to comment Share on other sites More sharing options...
bvr Posted December 24, 2005 Author Share Posted December 24, 2005 ah that makes random clicks, it doesn't click the colors Link to comment Share on other sites More sharing options...
Shinies Posted December 24, 2005 Share Posted December 24, 2005 Well then its bcuz getting pixles from Diablo II is just way too hard, trust me iv tried it, its never accurate. What you need to do to make it work is mod Diablo so that it shows a square of the Uniques color then the name etc. PM me if u need help with this, its not hard. Link to comment Share on other sites More sharing options...
bvr Posted December 24, 2005 Author Share Posted December 24, 2005 couldn't I do a (Do Until) somehow? Like repeat the cycle until the color is not long present? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 24, 2005 Moderators Share Posted December 24, 2005 WinActivate ( 'Diablo II' ) Sleep ( 500 ) Send("{ALTDOWN}") Sleep(500) $coord = PixelSearch( 213, 198, 427, 355, 0x948064) If Not @error Then Do MouseClick("left", $coord[0],$coord[1]) Sleep(1000) Send("{ALTUP}") Until PixelSearch( 213, 198, 427, 355, 0x948064) = 1 EndIf 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...
bvr Posted December 24, 2005 Author Share Posted December 24, 2005 That does about the same as the other guys, maybe I should have the mouse coord go to zero everytime? If I write the code twice it works, but I want it to search to see if it has to repeat itself. I dunno why this won't work, don't make much sense. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 24, 2005 Moderators Share Posted December 24, 2005 You had it in one of your post, I haven't read the post.. I just showed you how to do a Do/Until the PixelSearch() returned a negative in the color being there Per your specific question that post. 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...
bvr Posted December 24, 2005 Author Share Posted December 24, 2005 How do I go about adding it to my script? Can't seem to get it to work. WinActivate ( 'Diablo II' ) Sleep ( 500 ) Send("{ALTDOWN}") Sleep(500) $coord = PixelSearch( 213, 198, 427, 355, 0x948064, ) If Not @error Then MouseMove($coord[0],$coord[1],0) = 1 Sleep(500) MouseClick("left") Sleep(1000) Send("{ALTUP}") EndIf Link to comment Share on other sites More sharing options...
bvr Posted December 26, 2005 Author Share Posted December 26, 2005 I am now testing a different color, and I get this errorThis is the code:Opt("MouseCoordMode", 0) WinActivate ( 'Diablo II' ) Sleep ( 500 ) Send("{ALTDOWN}") Sleep(500) $coord = PixelSearch( 213, 198, 427, 355, 0xd8b864, ) If Not @error Then MouseMove($coord[0],$coord[1],0) Sleep(500) MouseClick("left") Sleep(1000) PixelSearch( 213, 198, 427, 355, 0x948064, ) = 0 EndIf 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