Jump to content

pixel search wait


Recommended Posts

just a quick question about pixelsearching!

when i search with the PixelSearch function to a small box about teh shape of your fingernail, i want my program to wait for that section of box to change to a different color, and once it has changed, i want it to go on with my program, but i dont want it going too soon by just using a timer, i want my program to actually be on a 'hold' until that box has changed in color, THEN go on with my program.

(sorry im a noob at this programming stuff, but im trying!)

thanks, UnknownWarrior

Link to comment
Share on other sites

just a quick question about pixelsearching!

when i search with the PixelSearch function to a small box about teh shape of your fingernail, i want my program to wait for that section of box to change to a different color, and once it has changed, i want it to go on with my program, but i dont want it going too soon by just using a timer, i want my program to actually be on a 'hold' until that box has changed in color, THEN go on with my program.

(sorry im a noob at this programming stuff, but im trying!)

thanks, UnknownWarrior

You people seriously need to look in the help file before posting.

;Say your check the top left and you want it to be red to continue.
Do
    $Pixel = PixelGetColor(1, 1)
Until $Pixel = Dec(0xFF0000)

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

Link to comment
Share on other sites

You people seriously need to look in the help file before posting.

;Say your check the top left and you want it to be red to continue.
Do
    $Pixel = PixelGetColor(1, 1)
Until $Pixel = Dec(0xFF0000)
sorry, the helpfile overwhelms me when i look through it....

Will those variables work if i just slap it in my program?

or should i say, will that piece of script work if i put it right into my program?

Link to comment
Share on other sites

sorry, the helpfile overwhelms me when i look through it....

Will those variables work if i just slap it in my program?

or should i say, will that piece of script work if i put it right into my program?

Your gonna have to change the coordinates of PixelGetColor() to your wanted coordinates (It'll be a bit more complex if your checking a region). Also, in the Until $Pixel = Dec(0xFF0000) you need to change the 0xFF0000 to the hex of your color (If you have the decimal value of your color then take away the Dec function). So don't just slap it in there, change some stuff. If that was confusing then give me the coordinates and color and I might be able to write it there. Edited by Minikori

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

Link to comment
Share on other sites

Your gonna have to change the coordinates of PixelGetColor() to your wanted coordinates (It'll be a bit more complex if your checking a region). Also, in the Until $Pixel = Dec(0xFF0000) you need to change the 0xFF0000 to the hex of your color (If you have the decimal value of your color then take away the Hex function). So don't just slap it in there, change some stuff. If that was confusing then give me the coordinates and color and I might be able to write it there.

i understand what you said there, but what im asking for (not to be rude) is that it constantly checks and checks that box at a specific coordinate, and continues checking it, and once that box CHANGES (it could be multiple colors that could appear in that box, thats why im trying to avoid just waiting for ONE color to appear) it will continue with the program... Im not looking for it to wait for a specific color, i want it to wait for it to CHANGE

thanks a bunch so far, i hope you can answer this if you understand it enough

Link to comment
Share on other sites

i understand what you said there, but what im asking for (not to be rude) is that it constantly checks and checks that box at a specific coordinate, and continues checking it, and once that box CHANGES (it could be multiple colors that could appear in that box, thats why im trying to avoid just waiting for ONE color to appear) it will continue with the program... Im not looking for it to wait for a specific color, i want it to wait for it to CHANGE

thanks a bunch so far, i hope you can answer this if you understand it enough

;Not sure this is the easiest way to do this, but...
$Pixel = PixelGetColor(1, 1)
Do
    $LPixel = $Pixel
    $Pixel = PixelGetColor(1, 1)
Until $Pixel <> $LPixel
Edited by Minikori

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

Link to comment
Share on other sites

;Not sure this is the easiest way to do this, but...
$Pixel = PixelGetColor(1, 1)
Do
    $LPixel = $Pixel
    $Pixel = PixelGetColor(1, 1)
Until $Pixel <> $LPixel
im not understanding that... will this work and could you explain it a little bit for me? Why is $Pixel defined twice? can you explain the whole thing for me if you dont mind
Link to comment
Share on other sites

im not understanding that... will this work and could you explain it a little bit for me? Why is $Pixel defined twice? can you explain the whole thing for me if you dont mind

$Pixel is defined before the 'loop'. Then, $LPixel, which means Last Pixel is defined. This is because the way it works, $LPixel must be first in the 'loop', then $Pixel. To prevent an error, $Pixel is also defined pre 'loop'. Sorry if you don't get that.

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

Link to comment
Share on other sites

$Pixel is defined before the 'loop'. Then, $LPixel, which means Last Pixel is defined. This is because the way it works, $LPixel must be first in the 'loop', then $Pixel. To prevent an error, $Pixel is also defined pre 'loop'. Sorry if you don't get that.

alright i sorta do, in a last final step, how should i put all this in my code

i have what im doing like this:

while 1

code, blah blah blah

*your code goes here, correct?*

-WHERE DOES $Pixel go (the first one, not inside the loop)-

After your code i want it to right click at x,y coord

WEnd
Link to comment
Share on other sites

alright i sorta do, in a last final step, how should i put all this in my code

i have what im doing like this:

while 1

code, blah blah blah

*your code goes here, correct?*

-WHERE DOES $Pixel go (the first one, not inside the loop)-

After your code i want it to right click at x,y coord

WEnd
When I said 'loop', I meant the Do...Until. Put my Do...Until in the While...WEnd, and the first $Pixel = thing right before it.

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

Link to comment
Share on other sites

Well what im confused on is the code itself... most coding that i have seen makes sense to me... could you run through the code in WORDS on how it runs...

i think the main part that is throwing me off is

Until $Pixel <> $LPixel

can you explain it all in words and explain that one line of coding in-depth...

thanks a bunch man, your really, really, helping me out

Link to comment
Share on other sites

Well what im confused on is the code itself... most coding that i have seen makes sense to me... could you run through the code in WORDS on how it runs...

i think the main part that is throwing me off is

Until $Pixel <> $LPixel

can you explain it all in words and explain that one line of coding in-depth...

thanks a bunch man, your really, really, helping me out

With notes:

$Pixel = PixelGetColor(1, 1);Declared to prevent error.
Do;Do whatever...
    $LPixel = $Pixel;Saves the last color recorded
    $Pixel = PixelGetColor(1, 1);Gets the current color of 1,1.
Until $Pixel <> $LPixel;Until $Pixel and $LPixel are different. <> means greater than or less than.
;The previous code I gave didn't work. I actually tested this and it does 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

Link to comment
Share on other sites

well i tried both your codes and resorted back to your first code:

Do
                    $Pixel = PixelGetColor(843, 133)
                Until $Pixel = Dec(0x525152)
                Send("{F5}")
                Sleep(5000)
                Exit

it didnt work, neither of them did... could anyone help me out on this... is there a different way to do it maybe?

EDIT::: Testing the new thing you gave me... lemme re-do

Edited by UnknownWarrior
Link to comment
Share on other sites

well i tried both your codes and resorted back to your first code:

Do
                    $Pixel = PixelGetColor(843, 133)
                Until $Pixel = Dec(0x525152)
                Send("{F5}")
                Sleep(5000)
                Exit

it didnt work, neither of them did... could anyone help me out on this... is there a different way to do it maybe?

I'll put it how your code would be:

$Pixel = PixelGetColor(843, 133)
While 1
    Do
        $LPixel = $Pixel
        $Pixel = PixelGetColor(843, 133)
    Until $Pixel <> $LPixel
    Send("{F5}")
    Sleep(5000)
    ;Anymore of your code that you need...
WEnd
Exit

Hope that helps.

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

Link to comment
Share on other sites

I'll put it how your code would be:

$Pixel = PixelGetColor(843, 133)
While 1
    Do
        $LPixel = $Pixel
        $Pixel = PixelGetColor(843, 133)
    Until $Pixel <> $LPixel
    Send("{F5}")
    Sleep(5000)
    ;Anymore of your code that you need...
WEnd
Exit

Hope that helps.

Sleep(15000)
                
                Do;Do whatever...
                    $LPixel = $Pixel;Saves the last color recorded
                    $Pixel = PixelGetColor(843, 133);Gets the current color of 1,1.
                Until $Pixel <> $LPixel
                Sleep(1000)
                
                
                Send("{F4}")
                Sleep(3000)
                Exit

i appreciate alllll your help, but it REFUSES to work... It actually send F4 this time, but it didnt wait til 843, 133 even changed... i think what it did is delayed that 15 seconds, skipped the Do/Until and went straight to f4.... :P

Yes, i tested it again, its not working... it just sends F4, skipping the Do/Until section completely

Edited by UnknownWarrior
Link to comment
Share on other sites

Sleep(15000)
                
                Do;Do whatever...
                    $LPixel = $Pixel;Saves the last color recorded
                    $Pixel = PixelGetColor(843, 133);Gets the current color of 1,1.
                Until $Pixel <> $LPixel
                Sleep(1000)
                
                
                Send("{F4}")
                Sleep(3000)
                Exit

i appreciate alllll your help, but it REFUSES to work... It actually send F4 this time, but it didnt wait til 843, 133 even changed... i think what it did is delayed that 15 seconds, skipped the Do/Until and went straight to f4.... :P

Yes, i tested it again, its not working... it just sends F4, skipping the Do/Until section completely

What do you have just before your While 1?

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

Link to comment
Share on other sites

Func _Start ()
    $ClickIt = 1
    While $ClickIt = 1
        If BitAND(GUICtrlRead($Checkbox_1), $GUI_CHECKED) = $GUI_CHECKED Then
            $Pixel = PixelGetColor(843, 133)
            While 1;--- the while 1 your talking about
Trying putting a MsgBox() instead of the Send() to see if it even does something. Also, lower your 15 second sleep to like 2 seconds so you can check faster. Do that then let me know what I can do.

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...