make GetPixelColor> work liek GetCursorPos>
Moderators: JRL, Dorian (MJT support)
-
- Pro Scripter
- Posts: 63
- Joined: Sat Dec 25, 2004 3:23 pm
make GetPixelColor> work liek GetCursorPos>
Is it possible to do this..
GetPixelColor>x,y,Variable (but leave the x and y like GetCursorPos>x,y
so that it searches the whole screen for the color..so you dont have to do this...)
GetPixelColor>333,444
GetPixelColor>333,445
GetPixelColor>333,446
GetPixelColor>333,447
ETC....
This would be a ncie feature.
-Mark
GetPixelColor>x,y,Variable (but leave the x and y like GetCursorPos>x,y
so that it searches the whole screen for the color..so you dont have to do this...)
GetPixelColor>333,444
GetPixelColor>333,445
GetPixelColor>333,446
GetPixelColor>333,447
ETC....
This would be a ncie feature.
-Mark
No, but you can search the whole screen with a simple nested loop. You don't need multiple GetPixelColor commands.
Let>XMax=600
Let>YMax=480
Let>X=0
Repeat>X
Let>X=X+1
Let>Y=0
Repeat>Y
Let>Y=Y+1
GetPixelColor>X,Y,c
Message>c
Until>Y,YMax
Until>X,XMax
Let>XMax=600
Let>YMax=480
Let>X=0
Repeat>X
Let>X=X+1
Let>Y=0
Repeat>Y
Let>Y=Y+1
GetPixelColor>X,Y,c
Message>c
Until>Y,YMax
Until>X,XMax
MJT Net Support
[email protected]
[email protected]
-
- Pro Scripter
- Posts: 63
- Joined: Sat Dec 25, 2004 3:23 pm
-
- Pro Scripter
- Posts: 63
- Joined: Sat Dec 25, 2004 3:23 pm
Yes, in place of the "Message>c" line (which just displays the colour code in a message box) you can put an If statement and do whatever you want to do should the color match.
If you want to do something only on the first instance of the chosen colour I would use a Goto and jump out of the loop.
On the other hand if you want to perform some routine for every instance of the color you are searching for I would use a GoSub and create a subroutine for the code you want to perform. That way the loop will continue after the subroutine has been performed.
If you want to do something only on the first instance of the chosen colour I would use a Goto and jump out of the loop.
On the other hand if you want to perform some routine for every instance of the color you are searching for I would use a GoSub and create a subroutine for the code you want to perform. That way the loop will continue after the subroutine has been performed.
MJT Net Support
[email protected]
[email protected]
-
- Pro Scripter
- Posts: 63
- Joined: Sat Dec 25, 2004 3:23 pm
Can i do that but only in a certain spot...like a rack of basketballs..just have it look for colors where the coordinates are of the balls.support wrote:No, but you can search the whole screen with a simple nested loop. You don't need multiple GetPixelColor commands.
Let>XMax=600
Let>YMax=480
Let>X=0
Repeat>X
Let>X=X+1
Let>Y=0
Repeat>Y
Let>Y=Y+1
GetPixelColor>X,Y,c
Message>c
Until>Y,YMax
Until>X,XMax
Yes, just change the start and end positions. Change XMax and YMax accordingly and instead of Let>X=0 and Let>Y=0 at the start of each loop change to the new start positions.
MJT Net Support
[email protected]
[email protected]
I don't know what you guys are asking for...
For Ze Penny, couldn't you just monitor one pixel location and have it check whether the color changes to the color you want?
It wouls just be like
Label>Start
Getpixelcolor>X,Y,PC
If>PC=yourcolor
place action here (which would likely include a goto to get out of the loop)
wait>10
endif
goto>start
(I suppsoe using Repeat and Untill would be better, but I didn't know they existed untill recently (I'm used to for loops and while loops, etc.)
I have no idea What Mark Gevry is suggesting for the program, nor do I know what you want done with your basketball racks or whatever
For Ze Penny, couldn't you just monitor one pixel location and have it check whether the color changes to the color you want?
It wouls just be like
Label>Start
Getpixelcolor>X,Y,PC
If>PC=yourcolor
place action here (which would likely include a goto to get out of the loop)
wait>10
endif
goto>start
(I suppsoe using Repeat and Untill would be better, but I didn't know they existed untill recently (I'm used to for loops and while loops, etc.)
I have no idea What Mark Gevry is suggesting for the program, nor do I know what you want done with your basketball racks or whatever
Thanks for the reply guest.
Could you show me a complete working script that detects multiple colours on the screen and then clicks on it and after clicking once on it .. it starts searching for another one after 10 seconds.
Also its a particular window that i need the colour detected in but i dont know how to get the x y co-ordinates of that particular window but in the script could u show me how would i be able to do with with the whole window screen. Sorry for the annoying questions.. its just that i am completely new to these stuff. Thanks.
Could you show me a complete working script that detects multiple colours on the screen and then clicks on it and after clicking once on it .. it starts searching for another one after 10 seconds.
Also its a particular window that i need the colour detected in but i dont know how to get the x y co-ordinates of that particular window but in the script could u show me how would i be able to do with with the whole window screen. Sorry for the annoying questions.. its just that i am completely new to these stuff. Thanks.