Jump to content
Sign in to follow this  
mtDEW101

Pixel Search Issue

Recommended Posts

mtDEW101

I'm trying to learn the pixel search cmd but I'm having some dumb problems. I get confused with left, top, right, bottom. Does it mean that literally? I use those and I just can't get them correctly. The flash game I'm trying to conquer is Cutie Quake.

I got a pic, is this a correct picture?

Posted Image

Oh, and here is the code I have so far.

#include <GUIConstantsEx.au3>


hotkeyset("q", "stop")


Func stop()

$coord = PixelSearch(-375, 94, 179, 511, 0xFFFFFF, 10, 10)
            If IsArray($coord) = 1 Then
                MouseClick('left', $coord[0], $coord[1], 1, 0)


EndIf

EndFunc


While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

EndSwitch


WEnd

Share this post


Link to post
Share on other sites
pugboy

The directions are usually the way you have shown, if they are pixels from the side.

Share this post


Link to post
Share on other sites
enaiman

You can't have negative values there.

The top-left pixel of your screen has (0,0) coordinates. Telling your script to start the search at -375 that would be way out of your screen ...

Think of PixelSearch this way .. suppose you search for your color:

PixelSearch(0, 0, 10, 10, 0xFFFFFF)

The search will be done: (0,0) (0,1) (0,2) ... (0,9) - first row

then (1,0) (1,1) (1,2) .....

.....

last (9,0) (9,1) ... (9,9)

... and the picture is correct ;)


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites
Writeous

I'm trying to learn the pixel search cmd but I'm having some dumb problems. I get confused with left, top, right, bottom. Does it mean that literally? I use those and I just can't get them correctly. The flash game I'm trying to conquer is Cutie Quake.

I got a pic, is this a correct picture?

Posted Image

Oh, and here is the code I have so far.

#include <GUIConstantsEx.au3>


hotkeyset("q", "stop")


Func stop()

$coord = PixelSearch(-375, 94, 179, 511, 0xFFFFFF, 10, 10)
            If IsArray($coord) = 1 Then
                MouseClick('left', $coord[0], $coord[1], 1, 0)


EndIf

EndFunc


While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

EndSwitch


WEnd
PixelSearch command searches for a given rectangle. So, using Autoit Window Info. Go to your Mouse coords, you will see X, Y. For the pixelsearch rectangle, X & Y represent Left and Top, then Right and Bottom.

So... move your mouse to the top left of the game screen, enter X & Y as Left and Top coords. Then move your mouse to the bottom right of the game screen, enter X & Y as Right and Bottom coords. There you have it, you've created a rectangle around the screen of your game! Enjoy!

Does that make it a little more clearer?

Edited by Writeous

[center][/center]

Share this post


Link to post
Share on other sites
qazwsx

I think the reason most people get confused with this is because the topleft is (0,0) rather than the bottom left. The best way to think of it is that you are in the IV quadrant of the coordinate system and all numbers are their absolute value. If that confuses you more just ignore me.

Share this post


Link to post
Share on other sites
Writeous

Well, I just created a perfectly working aim bot for the game 'Cutie Quake'. My bot's score is as follows. Shots fired: 130, Hitpoints: 316, Accuracy Bonus: 121, TOTAL SCORE: 437. With one run, did pretty well. If you need the source code of it for learning purposes, let me know.

Posted Image

Edited by Writeous

[center][/center]

Share this post


Link to post
Share on other sites
mtDEW101

Thank you everyone for helping me out ;)

Writeous, yes..please if you would post the source code. I am still a little bit confused.

Share this post


Link to post
Share on other sites
Writeous

Thank you everyone for helping me out ;)

Writeous, yes..please if you would post the source code. I am still a little bit confused.

If you need additional help, feel free to IM me on AIM: Bluetigerprd

Cheers!

CODE
#include <Misc.au3> ; Must be used with _Singleton

_Singleton ('Flashbot') ; Only allows one instance of this program to run at a time.

WinWaitActive ("Cutie Quake - 2 Flash Games - Windows Internet Explorer")

Global $eyeballs ;--- Global variables

Global $eyeballs1

Global $color

Global $color1

Global $color2

HotKeySet ("{F3}", "terminate")

Func terminate() ; Function to terminate the program

exit 0

EndFunc

While 1 ; Main code of the program

$eyeballs = PixelSearch ( 197, 195, 837, 612, 0xCACACA, 1, 0)

If @Error Then

; The color was not found

Else

; The color was found

MouseClick('left', $eyeballs[0], $eyeballs[1], 1, 0)

EndIf

$eyeballs1 = PixelSearch ( 197, 195, 837, 612, 0xCCCCCC, 1, 0)

If @Error Then

; The color was not found

Else

; The color was found

MouseClick('left', $eyeballs1[0], $eyeballs1[1], 2, 0)

EndIf

$color = PixelSearch ( 197, 195, 837, 612, 0xB2B2B2, 1, 0)

If @Error Then

; The color was not found

Else

; The color was found

MouseClick('left', $color[0], $color[1], 2, 0)

EndIf

$color1 = PixelSearch ( 197, 195, 837, 612, 0xB146B1, 1, 2)

If @Error Then

; The color was not found

Else

; The color was found

MouseClick('left', $color1[0], $color[1], 2, 0)

EndIf

$color2 = PixelSearch ( 197, 195, 837, 612, 0xFFFFFF, 1, 0)

If @Error Then

; The color was not found

Else

; The color was found

MouseClick('left', $color2[0], $color2[1], 2, 0)

EndIf

WEnd

Edited by Writeous

[center][/center]

Share this post


Link to post
Share on other sites
mtDEW101

Thank you so much. I understand it so much better now. Thank you for your help

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.