Sign in to follow this  
Followers 0
bigassmuffin

pixel search help?

7 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Instead of using set values for "midscreen", you should divide the width/height by 2.

Also, could you tell us what it is not doing?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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]

Share this post


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

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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

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