Forge Posted June 10, 2004 Posted June 10, 2004 $coord = PixelSearch( 1300, 240, 240, 450, 0x884B40, 10) WinWaitActive("Tibia") While $coord = @error sleep (200) WEnd send ("^{L}") Why do it directly goto 'Send' ?
pekster Posted June 10, 2004 Posted June 10, 2004 (edited) Forge said: Why do it directly goto 'Send' ?Because @error only reports the success or failure of the last command used. As soon as you tell it to Sleep(), it will change @error. You probably want the pixel search function inside your loop, and below the Sleep() so that the proper error value is being tested.Edit: You don't want to use the return value to test in your loop. Just use While @error instead. Edited June 10, 2004 by pekster [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.
Forge Posted June 10, 2004 Author Posted June 10, 2004 WinWaitActive("Tibia") While @error sleep (200) $coord = PixelSearch( 1300, 240, 240, 450, 0x884B40, 10) WEnd send ("^{L}") Still doesn't work
Forge Posted June 10, 2004 Author Posted June 10, 2004 WinWaitActive("Tibia") $coord = PixelSearch( 1300, 240, 240, 450, 0x884B40, 10) While @error sleep (200) PixelSearch( 1300, 240, 240, 450, 0x884B40, 10) WEnd send ("^{L}") Doesn't work aswell
pekster Posted June 10, 2004 Posted June 10, 2004 Forge said: WinWaitActive("Tibia") While @error sleep (200) $coord = PixelSearch( 1300, 240, 240, 450, 0x884B40, 10) WEnd send ("^{L}") Still doesn't work That time @error was 0 because the the WinWaitActive function worked fine. Try this instead: WinWaitActive("Tibia") Do sleep (200) $coord = PixelSearch( 1300, 240, 240, 450, 0x884B40, 10) Until NOT @error send ("^{L}") [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.
Forge Posted June 10, 2004 Author Posted June 10, 2004 Problem is that it never do Ctrl-L when the color appear, first I noticed I had wrong coords but I fixed but still nothing.
pekster Posted June 10, 2004 Posted June 10, 2004 (edited) The helpfile mentions that this is pretty time consuming, so maybe the pixel is moving in such a way that it avoids detection, or doesn't appear long enough to be detected. If this could be the case, try shortening your sleep, or taking a smaller region so that it takes less time to scan the region for the specific pixel color.Edit: You could also try increasing the variation to allow for more flexibility in the color, if that might also be an issue. Edited June 10, 2004 by pekster [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.
Forge Posted June 10, 2004 Author Posted June 10, 2004 (edited) Funny, I tried 50000 in variation and still no reaction. Edited June 10, 2004 by Forge
pekster Posted June 10, 2004 Posted June 10, 2004 Forge said: Funny, I tried 50000 in variation and still no reaction.That might not be a good thing to try: the helpfile says only a max of 255 is allowed. I'm not sure, but sometimes if values are out of range it will default to the default, which is 0 in this case. [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.
pekster Posted June 10, 2004 Posted June 10, 2004 Well, if your script is getting stuck in that loop, the pixel is doing 1 of 3 things:Not appearingAppearing and vanishing before the function detects it, orStaying on the screen, but moving in such a way that it avoids detection (see note below)Note: #3 could occur if the pixel moves from an undetected region of the screen to an already detected region (where the function has already scanned that iteration of the loop) and thus avoid detection. [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.
Forge Posted June 10, 2004 Author Posted June 10, 2004 * 1 - It's appearing. * 2 - It stays for about 20 secs so not a problem. * 3 - Nope
Forge Posted June 10, 2004 Author Posted June 10, 2004 Also, is there a way too check if something enters the screen in form of text?
Forge Posted June 10, 2004 Author Posted June 10, 2004 When someone enters "battle". Can you scan off the text?
pekster Posted June 10, 2004 Posted June 10, 2004 Forge said: When someone enters "battle". Can you scan off the text?It's called OCR (stands for <something> Character Recognition) but it's very hard to do. If the window background is always the same color, how about taking a PixelCheckSum (see the helpfile) of that region, and comparing that with what it is when you want to know if it says "battle" or not. Be sure you're using the latest beta of AutoIt (version 3.0.102, the later builds are usually better.)As for your pixel problem, I'm out of ideas. I did test this function myself (Using a very similar Do-Until loop like I posted) and it worked fine. It stayed in that loop until I opened a window that had a pixel I defined (a white one) in the region I gave to the PixelSearch function. Just make sure that your region is correct, and the color is correct. [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now