JØhñ ï§ §¢rïþ�ïñg ¥ðµr mðm Posted April 29, 2006 Share Posted April 29, 2006 It seems like alot of people on this site play diablo, I thought only two or three would play, anyways I had troble with pixel search until I found this nice code, sleep(5000) Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") While 1 $coord = PixelSearch(0,0,@DesktopWidth,@DesktopHeight, 0xAD31A1); put a step to improve speed. If IsArray($coord) = 1 Then MouseClick("left", $coord[0], $coord[1], 10 , 0) ; you do want x and y because you need it.... EndIf WEnd Exit Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc but I want to set it to click something in a certain spot and thats what confused me the most, well I think that is the part that confuses us all in autoit, well atleast the people not good with pixels. Hi, I have been with autoit since MsgBox(4096, "I registered", "I have been with the autoit forums since 4/27/2006", 10)My hobbys, partying, messing up computers, throwing things, riding to places i shouldntMy qoutes, me?....i always tell the truth......even when i lie, you got small words for a big mouth, im not getting sex but i sure am getting fucked. Link to comment Share on other sites More sharing options...
Paulie Posted April 29, 2006 Share Posted April 29, 2006 (edited) I thought only two or three would play Your kidding, right? Anyway, When it comes to the code, i like my pixelsearch t be exactly correct, which in a usually full screen game like diablo, this is difficult. Things to do:Make sure your game and screen resolution are equalTry to find an incredibly unique pixel color thats just in th area you want to clickCheck the Help Files for certain funtions, and avoid simply copy and pasting the example codesNever use tooltips in full screen gamesim not sure if you can find a truly unique color for the diablo though the code i would sugest opt(MouseCoordMode,0) opt(MouseClickDelay,0) opt(MouseClickDownDelay,0) Global $Paused = 0 HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") WinWaitActive("Diablo II: Lord of Destruction") While $Paused = 0 $coord = PixelSearch(0,0,@DesktopWidth,@DesktopHeight, 0xAD31A1); If NOT @Error Then MouseClick("left", $coord[0], $coord[1], 10 , 0) EndIf WEnd Exit Func TogglePause() If $Paused = 0 then $Paused = 1 EndIf If $Paused = 1 then $Paused = 0 EndIf EndFunc Func Terminate() Exit 0 EndFunc Edited April 29, 2006 by Paulie Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted April 29, 2006 Share Posted April 29, 2006 if the thing is in the same spot the entire time why not pixelgetcolor? and or if its in the same relative location define the pixelsearch to only that area with your script ur using @desktopwidth/height and thats searching the whole screen even though as u pointed out in your picture that you want it to only check the top left corner area Link to comment Share on other sites More sharing options...
Paulie Posted April 29, 2006 Share Posted April 29, 2006 if the thing is in the same spot the entire time why not pixelgetcolor? and or if its in the same relative location define the pixelsearch to only that area with your script ur using @desktopwidth/height and thats searching the whole screen even though as u pointed out in your picture that you want it to only check the top left corner areaAs a diablo fanatic myself, I know for a fact that the location of the thing that he wants to click on is dependant on the number of people on his party, and if this is the case and he is only seacring that area, then it wouldn't work.But a simple solution, would be to just searc about an inch into the top of the screen and across, but that would require usig autoit windo ifo to get the pixels and thats work, so its way easier and (doesn't really hurt anything) to just check the entire screen Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted April 29, 2006 Share Posted April 29, 2006 actualy it really does hurt to check the entire screen, from his screen shot it looks like the thing isnt taking up to much space, if you only search the top part of the screen even half the screen its still going to be WAYYY faster then searching the entire screen when you know for a fact theres not going to be anything on the bottom that ur looking for Link to comment Share on other sites More sharing options...
Paulie Posted April 29, 2006 Share Posted April 29, 2006 (edited) actualy it really does hurt to check the entire screen, from his screen shot it looks like the thing isnt taking up to much space, if you only search the top part of the screen even half the screen its still going to be WAYYY faster then searching the entire screen when you know for a fact theres not going to be anything on the bottom that ur looking for Alright, Alright you've convinced me But unfortunatly, I actually never quite understood how the first four numbers in PixelSearch defined a rectangle. :"> :"> :"> Yes i looked at the help File, but they don't explain tat in it, all it says is: PixelSearch ( left, top, right, bottom, color [, shade-variation][, step]] )I mean to define a coordinate on screen, don't you need 2 numbers (x,y) so how is each number represented in coords if it's only 1 number per point? Thats why for me, its easier to search the entire screen Edited April 29, 2006 by Paulie Link to comment Share on other sites More sharing options...
JØhñ ï§ §¢rïþ�ïñg ¥ðµr mðm Posted April 29, 2006 Author Share Posted April 29, 2006 Alright, Alright you've convinced me But unfortunatly, I actually never quite understood how the first four numbers in PixelSearch defined a rectangle. :"> :"> :"> Yes i looked at the help File, but they don't explain tat in it, all it says is:I mean to define a coordinate on screen, don't you need 2 numbers (x,y) so how is each number represented in coords if it's only 1 number per point?Thats why for me, its easier to search the entire screensame with me I don't get the rectangles, but I think I got something up my sleeve tyo make it work Hi, I have been with autoit since MsgBox(4096, "I registered", "I have been with the autoit forums since 4/27/2006", 10)My hobbys, partying, messing up computers, throwing things, riding to places i shouldntMy qoutes, me?....i always tell the truth......even when i lie, you got small words for a big mouth, im not getting sex but i sure am getting fucked. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 29, 2006 Moderators Share Posted April 29, 2006 You need a starting and an ending point in a rectangle don't you? $xTop / $yTop (one pixel for start) $xBottom / $yBottom (one pixel to end at) Make sense? 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...
Paulie Posted April 29, 2006 Share Posted April 29, 2006 You need a starting and an ending point in a rectangle don't you? $xTop / $yTop (one pixel for start) $xBottom / $yBottom (one pixel to end at) Make sense?lol Thanks smoke now i feel stupid So to do just the top inch of a screen(about) you would do PixelSearch(0, 0, 1279, 125, 0xAD31A1) Am i right, or mixed up? Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted April 29, 2006 Share Posted April 29, 2006 (edited) firstx,y------------------------------------------------ -||||||||||||||||||||||||||||||||||||||||||||||||||||||- -||||||||||||||||||||||||||||||||||||||||||||||||||||||- -||||||||||||||||||||||||||||||||||||||||||||||||||||||- -||||||||||||||||||||||||||||||||||||||||||||||||||||||- -||||||||||||||||||||||||||||||||||||||||||||||||||||||- --------------------------------------------------------lastx,y Edited April 29, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
JØhñ ï§ §¢rïþ�ïñg ¥ðµr mðm Posted April 29, 2006 Author Share Posted April 29, 2006 works perfect thanks Hi, I have been with autoit since MsgBox(4096, "I registered", "I have been with the autoit forums since 4/27/2006", 10)My hobbys, partying, messing up computers, throwing things, riding to places i shouldntMy qoutes, me?....i always tell the truth......even when i lie, you got small words for a big mouth, im not getting sex but i sure am getting fucked. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 29, 2006 Moderators Share Posted April 29, 2006 lol Thanks smoke now i feel stupid So to do just the top inch of a screen(about) you would do PixelSearch(0, 0, 1279, 125, 0xAD31A1) Am i right, or mixed up?Local $xTop = 0 Local $yTop = 0 Local $xBottom = 1275 Local $yBottom = 125 For $x = $xTop To $xBottom MouseMove($x, $yTop, 0) Next For $y = $yTop To $yBottom MouseMove($xBottom, $y, 0) Next For $x = $xBottom To $xTop Step - 1 MouseMove($x, $y, 0) Next For $y = $yBottom To $yTop Step - 1 MouseMove($x, $y, 0) NextThis is not how the pixels actually are searched, but will give you an idea of the how the area works. 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...
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