Jump to content
Sign in to follow this  
Null33

pixelchecksum and pixelgetcolor

Recommended Posts

Null33

Hi ^_^ , I've a problem whit my code.

This is a part of my func:

$checksum= PixelChecksum (x)
While $checksum= PixelChecksum (x)
Sleep (10)
$pixel3= PixelGetColor (x)

If $pixel3= x Then
$checksum2= PixelChecksum (x)
Sleep (500)
While $checksum2= PixelChecksum (x)
Sleep (10)

WEnd
Sleep (10)
EndIf

WEnd

The problem is that it doesn't consider the if $pixel3...

I want the program to checks a part of pixel and then, if something change it checks an other part of pixel (or also the same but sleep for a few seconds). So it check some pixel, then if a pixel becomes colored, start to check an other part. I tried also whit Do...Until but probably I something wrong. How I can solve?

I don't know if you understand :ermm:

Sorry for my english. Thanks ;)

Edited by Null33

Share this post


Link to post
Share on other sites
Null33

(x) are the coordinates ;)... sorry but at the moment I haven't all the code :(, when I can I will post it...

the rest of the code works well, the problem is in if $pixelgetcolor...

I want that if something change the program restarts (and this work fine because after pixelchecksum there is a sleep), but I need that it checks if a pixel becomes colored and then checks an other area and if something change the program restart...

Maybe I was not clear, sorry...

Share this post


Link to post
Share on other sites
Null33

I want that while pixelchecksum is running if a pixel becomes for example red it stops to check the first region of pixels and starts to check an other region of pixels, Is this possible? Why with (if...) it doesn't work? The problem is in pixelchecksum?

if you don't understand I will try to explain it better.

Thanks

Share this post


Link to post
Share on other sites
Null33

This is the code ;), don't kidding me if it is written wrong, but if you can help me to write it better, thanks

Func _Func_1()

$fSTOP = False

While 1
$pixel= PixelGetColor ($var1, $var2)
if $pixel= (code of color) then
sleep ($var9)
$pixel2= PixelGetColor ($var1, $var2)
if $pixel2= (code of color) Then

$checksum= PixelChecksum ($var11, $var12, $var13, $var14)
While $checksum= PixelChecksum ($var11, $var12, $var13, $var14)
Sleep (10)
$pixel3= PixelGetColor ($var9, $var10)

If $pixel3= 16737792 Then
$checksum2= PixelChecksum ($var5, $var6, $var7, $var8)
Sleep (500)
While $checksum2= PixelChecksum ($var5, $var6, $var7, $var8)
Sleep (10)

WEnd
Msgbox ;(OR ONLY SLEEP, BECAUSE I NEED THAT THE PROGRAM RESTART FROM THE BEGINNING, SO FROM LINE 5)
Sleep (10)
EndIf

WEnd
Sleep (10)
else
Sleep (10)
EndIf
EndIf

If $fSTOP Then
Return
EndIf

Sleep (100)
WEnd

EndFunc

If I write only:

Func _Func_1()

$fSTOP = False

While 1

$checksum= PixelChecksum (coordinates)
While $checksum= PixelChecksum (coordinates)
Sleep (10)
$pixel3= PixelGetColor (coordinates)

If $pixel3= (color code) Then
$checksum2= PixelChecksum (coordinates)
Sleep (500)
While $checksum2= PixelChecksum (coordinates)

Sleep (10)

WEnd
MsgBox (0,"","yeah")
Sleep (10)
EndIf

WEnd
MsgBox (0,"","oooo")

If $fSTOP Then
Return
EndIf

Sleep (100)
WEnd

EndFunc

it seems to work, it's late I'm so confused now :S

Thanks

Edited by Null33

Share this post


Link to post
Share on other sites
Null33

Please help me, why in the first func it doesn't consider the "if $pixel3"? What's wrong?

Thanks

Share this post


Link to post
Share on other sites
Jos

Maybe you have a bit of a complex way of coding?

Anyway, you are not clear what you are trying to do and we can't run your script the way you posted it.

Func _Func_1()

    $fSTOP = False

    While 1
        $pixel = PixelGetColor($var1, $var2)
        If $pixel = (code of color) Then
            Sleep($var9)
            $pixel2 = PixelGetColor($var1, $var2)
            If $pixel2 = (code of color) Then

                $checksum = PixelChecksum($var11, $var12, $var13, $var14)
                While $checksum = PixelChecksum($var11, $var12, $var13, $var14)
                    Sleep(10)
                    $pixel3 = PixelGetColor($var9, $var10)

                    If $pixel3 = 16737792 Then
                        $checksum2 = PixelChecksum($var5, $var6, $var7, $var8)
                        Sleep(500)
                        While $checksum2 = PixelChecksum($var5, $var6, $var7, $var8)
                            Sleep(10)

                        WEnd
                        Msgbox ;(OR ONLY SLEEP, BECAUSE I NEED THAT THE PROGRAM RESTART FROM THE BEGINNING, SO FROM LINE 5)
                        Sleep(10)
                    EndIf

                WEnd
                Sleep(10)
            Else
                Sleep(10)
            EndIf
        EndIf

        If $fSTOP Then
            Return
        EndIf

        Sleep(100)
    WEnd

EndFunc   ;==>_Func_1
Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Null33

I try to explain it better:

I need a program that tests a pixel ($pixel1), if is red (for expample) it sleep for 10 seconds, then it tests an other pixel ($pixel2) and if it is red then mouseclick, after the click it must check a region of pixel ($checksum1) and if something changes sleep for a few seconds (sleep 10) and so restart from the beginning (if $pixel1...), while is checking region of pixel ($checksum1), if a pixel3 becomes red it must checks an other region of pixel ($checksum2) and if something changes in this region it must sleep for a few seconds (Sleep 10) and then restart from the beginning (if $pixel1...)

Help me if you can. Thanks

Edited by Null33

Share this post


Link to post
Share on other sites
Jos

Doesn't explain much about your intent.

Post a clear description what you want to do and a script that you have problems with that we can also run.

Jos


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Null33

I've edited the post #10... I hope I'm clear, thanks

Share this post


Link to post
Share on other sites
JohnOne

What will make it clear, is your full runnable code to test and debug.

This whole thread is just farting around trying to drag basic information from you

while you kick and scream.

pseudo code is not enough.

Edited by JohnOne

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
gnomic

im new to all this, so just say, if i should stop talking :)

$pixel3= PixelGetColor ($var9, $var10)
Msgbox(0,"",$pixel3)
If $pixel3= 15539236 Then

what does the msgbox say?

Edited by gnomic

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  

×