Jump to content

pixel search help?


Recommended Posts

NEW PROBLEM, READ MY LAST POST! THANKS FOR YOUR TIME!

I see no reason why this wouldn't work, What I want the script to do is explained in the script in notes, but it jsut doenst work!

Script:

$color = 0xB50400
$game = 0
HotKeySet("+p", "Play")
HotKeySet("{ESC}", "quit")
While 1
    If $game = 1 Then
        $coord = PixelSearch( 0, 0, 1023, 651, $color)  ;searches screen for color 0xB50400
        If IsArray($coord) = 1 Then                     ;if it finds the color then:
            MouseMove( $coord[0], $coord[1] - 15, 1, 0) ;move the mouse 15 pixels below color
            $pos = MouseGetPos()                        ;and find the postion of where the mouse is.
            $coord2 = 511-$pos[0], 375-$pos[1]          ;find the difference of the position and midscreen.
            $pos2 = 511-$coord2[0], 375-$coord2[1]      ;Goes equidistant from midscreen OPPOSITE direction
            Mouseclick( "left" , $pos2[0], $pos2[1], 1) ;Clicks left at this position
            Sleep(500)
        EndIf
    EndIf   
WEnd   

Func Play()
    If $game < 1 Then
        $game = $game + 1
    Else
        $game = 0
    EndIf
EndFunc

Func quit()
    Exit
EndFunc

Thanks for your time and help.

Edited by bigassmuffin
Link to comment
Share on other sites

that was a mess...

Maybe

$color = 0xB50400
$game = 0
Dim $coord2[3]
Dim $pos2[3]

HotKeySet("+p", "Play")
HotKeySet("{ESC}", "quit")
While 1
    If $game = 1 Then
        $coord = PixelSearch( 0, 0, 1023, 651, $color)  ;searches screen for color 0xB50400
        If IsArray($coord) = 1 Then                     ;if it finds the color then:
            MouseMove( $coord[0], $coord[1] - 15) ;, 1, 0) ;move the mouse 15 pixels below color
            $pos = MouseGetPos()                        ;and find the postion of where the mouse is.
            $coord2[0] = 511-$pos[0]
            $coord2[1] = 375-$pos[1]          ;find the difference of the position and midscreen.
            $pos2[0] = 511-$coord2[0]
            $pos2[1] = 375-$coord2[1]      ;Goes equidistant from midscreen OPPOSITE direction
            Mouseclick( "left" , $pos2[0], $pos2[1], 1) ;Clicks left at this position
            Sleep(500)
        EndIf
    EndIf 
    Sleep(1)
WEnd   

Func Play()
    $game = Not $game
EndFunc

Func quit()
    Exit
EndFunc

**** NOT TESTED

$pos = MouseGetPos() is not used

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

i dunt got an error anymore, and yours mostly works, its wierd thoguh, it clicks on the red, not equidistance fomr midscreen of the red, thanks thoguh for fast reply and time!

nm, works gr8, i jsut had to switch

$pos2[0] = 511-$coord2[0]

$pos2[1] = 375-$coord2[1]

to

$pos2[0] = 511+$coord2[0]

$pos2[1] = 375+$coord2[1]

Edited by bigassmuffin
Link to comment
Share on other sites

Why the comment character here: [NVM - I see why now]

MouseMove( $coord[0], $coord[1] - 15) ;, 1, 0) ;move the mouse 15 pixels below color

Shouldn't that be $coord[1] + 15

MouseMove( $coord[0], $coord[1] - 15) ;, 1, 0) ;move the mouse 15 pixels below color

edit: for nvm comment

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

i dunt got an error anymore, and yours mostly works, its wierd thoguh, it clicks on the red, not equidistance fomr midscreen of the red, thanks thoguh for fast reply and time!

nm, works gr8, i jsut had to switch

$pos2[0] = 511-$coord2[0]

$pos2[1] = 375-$coord2[1]

to

$pos2[0] = 511+$coord2[0]

$pos2[1] = 375+$coord2[1]

Glad it works... and plato is correct also

thats why i put

**** NOT TESTED

$pos = MouseGetPos() is not used

8)

NEWHeader1.png

Link to comment
Share on other sites

Alright, this works great, but I would like the pixel search,

$coord = PixelSearch( 140, 140, 883, 627, $color)  ;searches screen for color 0xB50400oÝ÷ ÚÇ­È_¦»ayÊ%¢ºÞwbr·w+·Múrh®Úz·nëHÁ©íÛh±æ«rè®X¤{]+yÚbÅélv«£âë(!Ê%¢ºQEÊZËr

Thanks for your time!

Edited by bigassmuffin
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...