Jump to content

Move mose on pixel?


Recommended Posts

ok i wanna make a simple au3 file that just has the mouse follow around a pixel. Its for some game i want the mouse to follow around a ball. Just say the pixel colour for it was 1234567 how would i do it? if you do not understand what im saying ask for clarification on a part.

thanks,

kevin

Link to comment
Share on other sites

While 1
   $Coord = PixelSearch ( left, top, right, bottom,1234567[, shade-variation] [, step]] )
   If Not @error Then
      MouseClick ( "Left" , $Coord[0], $Coord[1] , clicks , speed )
   EndIf
Wend

I left most of the fields blank so you can fill them in, but theres a basic template. BTW I just assumed you wanted it to click at the colour.

Edited by Burrup

qq

Link to comment
Share on other sites

ok this is what i got and it dosent work for some reason. noting happens

While 1

$Coord = PixelSearch ( 0, 0, 500, 500, 11927419)

If Not @error Then

MouseClick ( "Left" , $Coord[0], $Coord[1] , 0 , 0 )

EndIf

Wend

im about 95% sure pixel is right

Link to comment
Share on other sites

Your telling mouse click not to click at all... because you set the clicks to zero. Try this...

While 1
   $Coord = PixelSearch ( 0, 0, 500, 500, 11927419)
   If Not @error Then
      MsgBox(4096,"Test","Colour found at..." & @CRLF & "X: " $Coord[0] & @CRLF & "Y: " & $Coord[1])
   Else
      MsgBox(4096,"Error","Colour not found!")
   EndIf
Wend

Edit: Also you are not using a shade variation. This means you are searching for the exact colour. If you are not sure it is exactly right add a shade variation, start with 5, and see if it finds it.

Edited by Burrup

qq

Link to comment
Share on other sites

Your telling mouse click not to click at all... because you set the clicks to zero. Try this...

While 1
   $Coord = PixelSearch ( 0, 0, 500, 500, 11927419)
   If Not @error Then
      MsgBox(4096,"Test","Colour found at..." & @CRLF & "X: " $Coord[0] & @CRLF & "Y: " & $Coord[1])
   Else
      MsgBox(4096,"Error","Colour not found!")
   EndIf
Wend

Edit: Also you are not using a shade variation. This means you are searching for the exact colour. If you are not sure it is exactly right add a shade variation, start with 5, and see if it finds it.

<{POST_SNAPBACK}>

ill try what u said but i just need the mouse to follow pixel not click but good eye man
Link to comment
Share on other sites

ok its comming back that it got pixel some times and somtimes it didnt. I think its because what im tring to do is not static but it dosent change alot so it should work anyways

so what dosent it work?

edit: if i increase the shade variation would it come back with sucess more then it is now?

Edited by kevilay
Link to comment
Share on other sites

Yes, you will get more successs but you have to sacrifice being less exact on the colour.

<{POST_SNAPBACK}>

ok i got the pixel thing working almost everytime but when i try my script nothing happens. it dosent move to the pixel?

;AutoItSetOption("MustDeclareVars", 1)
AutoItSetOption("MouseCoordMode", 0)
AutoItSetOption("PixelCoordMode", 0)
;AutoItSetOption("RunErrorsFatal", 0)
;AutoItSetOption("TrayIconDebug", 1)
;AutoItSetOption("WinTitleMatchMode", 4)

While 1
   $Coord = PixelSearch ( 0, 0, 500, 500, 11927419, 15)
   If Not @error Then
   MouseClick ( "Left" , $Coord[0], $Coord[1] , 0 , 0 )
   EndIf
Wend

thats the full script, the pixel works so i dont know :S

Link to comment
Share on other sites

As I said before, you arn't clicking... you have it set to ZERO.

Try this...

AutoItSetOption("MouseCoordMode", 0)
AutoItSetOption("PixelCoordMode", 0)

While 1
   $Coord = PixelSearch ( 0, 0, 500, 500, 11927419, 15)
   If Not @error Then
   MouseClick ( "Left" , $Coord[0], $Coord[1] , 1 , 0 )
   EndIf
Wend

Lets play... spot the difference.

Edit: Also the script does it just move to the pixel, it will also click at it. I said that in my very first post as I assumed you would want to click on the pixel.

Edited by Burrup

qq

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...