Sign in to follow this  
Followers 0
JØhñ ï§ §¢rïþ�ïñg ¥ðµr mðm

Pixels

12 posts in this topic

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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I thought only two or three would play

Your kidding, right? :think:

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 equal
  • Try to find an incredibly unique pixel color thats just in th area you want to click
  • Check the Help Files for certain funtions, and avoid simply copy and pasting the example codes
  • Never use tooltips in full screen games
im 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 by Paulie

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

As 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 :think:

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 :think:

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 by Paulie

Share this post


Link to post
Share on other sites

Alright, Alright you've convinced me :think:

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 screen

same 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.

Share this post


Link to post
Share on other sites

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?


[center]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.[/center]

Share this post


Link to post
Share on other sites

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 :think:

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?

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

firstx,y------------------------------------------------

-||||||||||||||||||||||||||||||||||||||||||||||||||||||-

-||||||||||||||||||||||||||||||||||||||||||||||||||||||-

-||||||||||||||||||||||||||||||||||||||||||||||||||||||-

-||||||||||||||||||||||||||||||||||||||||||||||||||||||-

-||||||||||||||||||||||||||||||||||||||||||||||||||||||-

--------------------------------------------------------lastx,y

Edited by thatsgreat2345

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

lol

Thanks smoke now i feel stupid :think:

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)
Next
This is not how the pixels actually are searched, but will give you an idea of the how the area works.

[center]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.[/center]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0