Sign in to follow this  
Followers 0
brookemoskalev

Pixel Help

7 posts in this topic

So I've ran into a script that searches for a certain color of pixel and clicks on it but its not fast enough to bot a game in high levels...this script is as follows...

Opt("MouseCoordMode", 0)

Opt("PixelCoordMode", 0)

$searchcolor = 0x423C42

While 1

Sleep(0)

$coord = PixelSearch(0, 0, 675, 620, $searchcolor)

If IsArray($coord) = 1 Then

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

EndIf

Wend

What is going on in this simple game: guys are parachuting from the top of the screen, you need to click on them to deploy the parachute, the background stays the same.

I'm wondering if since the background stays the same if there is a way to just search for any changing pixels and then click on them, which would of course deploy the parachute and save those little men :)

Share this post


Link to post
Share on other sites



Say the background is black, you could do:

$Search = Not 0x000000
PixelSearch(200, 200, 400, 400, $Search)

Would that work?


For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Say the background is black, you could do:

$Search = Not 0x000000
PixelSearch(200, 200, 400, 400, $Search)

Would that work?

No the background is a simple landscape that is colored and shaded.... so i think i will need something to detect a pixel that has changed and click on the changed pixel's position Edited by brookemoskalev

Share this post


Link to post
Share on other sites

Possibly something like:

For $x = 1 To 200
Dim $Color[$x] = PixelGetColor($x, $x)
Next

Then repeat and check for changes with <>.


For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

if there is certain places where the guys fall down then try using PixelGetColor in the areas taht they fall and for an If then try If $var1 <> $var 2 then mouseclick

$var1 = PixelGetColor(100,100)
 
$x = 1
 
While $x = 1 
    $var2 = PixelGetColor(100,100)
    if $var1 <> $var 2 Then
        MouseClick("Left")
    EndIf
WEnd
Edited by Rental

Share this post


Link to post
Share on other sites

if there is certain places where the guys fall down then try using PixelGetColor in the areas taht they fall and for an If then try If $var1 <> $var 2 then mouseclick

$var1 = PixelGetColor(100,100)
 
$x = 1
 
While $x = 1 
    $var2 = PixelGetColor(100,100)
    if $var1 <> $var 2 Then
        MouseClick("Left")
    EndIf
WEnd
i dont know if you read my last post but i tried to create a horizontal line of clicks in increments of 20 (this proved to be even slower the pixel search script i posted in my original post but here is the code that Arakard helped me with on http://www.autoitscript.com/forum/index.php?showtopic=81616 :

$ClickX = 50

$ClickY = 200

While(1)

MouseClick("left", $ClickX, $ClickY, 1, 0)

If $ClickX < 650 Then

$ClickX = $ClickX + 20

else

$ClickX = 50

EndIf

WEnd

is there a way to combine these two so i can search a horizontal line in increments of 20 for changed pixels so you dont have to type in the location of the pixels individually?

Share this post


Link to post
Share on other sites

So i've made a bit of a script with the help i've gotten but want to make sure that it looks correct? Thanks to everyone that has replied!

HotKeySet("{ESC}", "Terminate")
$var1 = PixelGetColor(75,200)
$var3 = PixelGetColor(100,200)
$var5 = PixelGetColor(125,200)
$var7 = PixelGetColor(150,200)
$var9 = PixelGetColor(175,200)
$x = 1
 
While $x = 1
    $var2 = PixelGetColor(75,200)
    if $var1 <> $var2 Then
        MouseClick('left', 75, 200, 1, 0)
    EndIf
WEnd
 
While $x = 1
    $var4 = PixelGetColor(100,200)
    if $var3 <> $var4 Then
        MouseClick('left', 100, 200, 1, 0)
    EndIf
WEnd

While $x = 1
    $var6 = PixelGetColor(125,200)
    if $var5 <> $var6 Then
        MouseClick('left', 125, 200, 1, 0)
    EndIf
WEnd

While $x = 1
    $var8 = PixelGetColor(150,200)
    if $var7 <> $var8 Then
        MouseClick('left', 150, 200, 1, 0)
    EndIf
WEnd
While $x = 1
    $var10 = PixelGetColor(175,200)
    if $var9 <> $var10 Then
        MouseClick('left', 175, 200, 1, 0)
    EndIf
WEnd
Func Terminate()
    Exit 0
EndFunc  ;==>Terminate

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