Sign in to follow this  
Followers 0
kevilay

Move mose on pixel?

10 posts in this topic

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

Share this post


Link to post
Share on other sites



can anyone help me out please?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

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


[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

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

[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

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