Sign in to follow this  
Followers 0
Mellowz

Working with PixelSearch

4 posts in this topic

Is there a way to make the range of PixelSearch follow the mouse instead of just stay in the middle where the given location is?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I'm afraid I do not understand. This is how I have it setup:

While 1
        If $TeamID > -1 Then
            If $TeamID = 0 Then
                $coord = PixelSearch(473, 349, 552, 419, 0x333F29, 0)
            Else
                $coord = PixelSearch(473, 349, 552, 419, 0x7D6340, 0)
            EndIf

            If Not @error Then
                MouseMove($coord[0], $coord[1], 0)
                ContinueLoop
            Else
                Sleep(100)
            EndIf
        EndIf
    WEnd

Also, thanks for the reply.

Edited by Mellowz

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Not tested, But, Does this work?

AdlibEnable("_MousePos", 1)
    Global $Pos
    
    While 1
        If $TeamID > -1 Then
            If $TeamID = 0 Then
                $coord = PixelSearch($Pos[0] - 10, $Pos[1] - 10, $Pos[0] + 10, $Pos[1] + 10, 0x333F29, 0)
            Else
                $coord = PixelSearch($Pos[0] - 10, $Pos[1] - 10, $Pos[0] + 10, $Pos[1] + 10, 0x7D6340, 0)
            EndIf

            If Not @error Then
                MouseMove($coord[0], $coord[1], 0)
                ContinueLoop
            Else
                Sleep(100)
            EndIf
        EndIf
    WEnd
    
    Func _MousePos()
        $Pos = MouseGetPos()
    EndFunc

Should, Search a 10px square around the mouse.

EDIT::

Larry beat me =O

EDIT::

And his is probly better than mine =P

Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Oh, I was going to try MouseGetPos, Larry, but I didn't understand what you meant, so I posted the code so we could work together on it. However, thanks for this version of it, both of you.

Edited by Mellowz

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