Sign in to follow this  
Followers 0
Popeye1

Help with script issue.

7 posts in this topic

I'm looking to solve an issue in my script, but am not sure where to even look. The script checks an if statement using pixelsearch, if for example 0x000000 is found, then the script needs to store that information and add +1. The script would then continue on and eventually start at the beginning of the master while loop again, and come back round to this pixelsearch if statement and if the colour is still 0x000000 then it needs to add another +1, so if the original value was 0, it would now be 2, and every time the script repeats this cycle and finds 0x000000, it would add another +1.

A different section in the script would be checking to see if this number has became 30 or greater (for example) and executing some code if so, aswell as resetting the number back to 0 again.

I don't even know where to look in the help file for this, can anyone help?

Share this post


Link to post
Share on other sites



Heres a simple way, although I find it quite difficult to believe you searched either the forum of the help file after having said you've written a script.

$count = 0
While 1
    PixelSearch(0, 0, 10, 10, 0x000000)
    If @error <> 1 Then
        $count += 1
        If $count >= 30 Then
            MsgBox(0, "", "Yippeeeee")
            $count = 0
        EndIf
    EndIf
WEnd

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Great, that works, thanks. Can I use the message box to display what number $count is currently at?

Share this post


Link to post
Share on other sites

you can, but you would definately want a timeout on it otherwise you would have to keep clicking ok.

MsgBox(0,"Count",$count,5)


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

I'm using a tooltip instead of a messagebox

ToolTip(" check xxx", 400, 3)

Can this be used to display the number %count is at?

Share this post


Link to post
Share on other sites

I'm using a tooltip instead of a messagebox

ToolTip(" check xxx", 400, 3)

Can this be used to display the number %count is at?

I don't see why not

if xxx is your count then it would be

ToolTip(" check "&$count,400,3)


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

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