Jump to content

Random Pixel Search


Recommended Posts

Ok i was wondering if there was a possibility of having it so my script would randomly search for a certain color but the thing is when i have it search it finds the same place each time i was wondering if there was any way to make it find the area then click randomly somewhere with in 1-5 on the x and y cuz when it checks the box it finds the pixel but clicks the same spot every time since it keeps searching for the same pixel and it doesnt matter if u put a shade variation or a step on it cuz it will always find the same pixel.

Global $Paused
HotKeySet("{f2}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("{f1}", "ShowMessage") ;Shift-Alt-d

;;;; Body of program would go here;;;;
While 1
sleep(100)
WEnd
;;;;;;;;

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func ShowMessage()
    While 1
$Coord = PixelSearch ( 371, 388, 533, 434, 0xFCB131, 0, 4)
sleep(500)
$Coord1 = PixelSearch ( 371, 388, 533, 434, 0x243302, 0, 4)
   If Not @error Then
      MouseClick ( "Left" , $Coord[0], $Coord[1] , 1 , 0 )
      sleep(3500)
      MouseClick ( "Left" , $Coord1[0], $Coord1[1] , 1 , 0 )
      sleep(3500)
  EndIf
WEnd
Endfunc
Link to comment
Share on other sites

Could you please remove that quote from your profile... I'm not stuck up, but I'm all about equality.

To try and answer your question:

Func ShowMessage()
    While 1
$Coord = PixelSearch ( 371, 388, 533, 434, 0xFCB131, 0, 4)
sleep(500)
$Coord1 = PixelSearch ( 371, 388, 533, 434, 0x243302, 0, 4)
   If Not @error Then
      MouseClick ( "Left" , $Coord[0] + Random(1, 5), $Coord[1] -  Random(1, 5), 1 , 0 )
      sleep(3500)
      MouseClick ( "Left" , $Coord1[0] + Random(1, 5), $Coord1[1] -  Random(1, 5), 1 , 0 )
      sleep(3500)
  EndIf
WEnd
Endfunc

I didn't test it, so let me know how it works.

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