waitrectcolor with if
Moderators: Dorian (MJT support), JRL
waitrectcolor with if
hi, i have some problems with a few logic commands, sorry my bad english
i have a rect in my screen and in it appear one number (0 - 100) this number is variable, but it has a color, e.g.
if this number is yellow, press np1
or
if this number is red, press np2
the pixel rect is 716,218,830,232
the cuestion is how i do this command when waitrectcolor doesn??t exist?
what is the best command to use for this?
thank u
________
buy digital scale
i have a rect in my screen and in it appear one number (0 - 100) this number is variable, but it has a color, e.g.
if this number is yellow, press np1
or
if this number is red, press np2
the pixel rect is 716,218,830,232
the cuestion is how i do this command when waitrectcolor doesn??t exist?
what is the best command to use for this?
thank u
________
buy digital scale
Last edited by chelo_100 on Tue Feb 01, 2011 10:34 pm, edited 1 time in total.
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Use GetRectCheckSum in a loop:
Change whatever to whatever value you want to wait for
Code: Select all
Label>WaitRect
GetRectCheckSum>716,218,830,232,csum
Wait>0.2
If>csum<>whatever,WaitRect
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
thanks but i changed the value with 255 wich is the red color, and doesn??t work
the example i gived to u is what i want to do
if 65535 (yellow) appears press np1
if 255 (yellow) appears press np2
this two variables appears in the rect
here is the idea
again thanks for this help
________
Ferrari 275 history
the example i gived to u is what i want to do
if 65535 (yellow) appears press np1
if 255 (yellow) appears press np2
this two variables appears in the rect
here is the idea
again thanks for this help
________
Ferrari 275 history
Last edited by chelo_100 on Tue Feb 01, 2011 10:34 pm, edited 1 time in total.
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
GetRectCheckSum returns a checksum of ALL the colors in the rectangle. Now, are you saying you want to see if ONE color, e.g. yellow, appears SOMEWHERE within the rectangle, or the ENTIRE rectangle IS yellow?
If the former we can create a loop with GetPixelColor to scan the contents of the rectangle. If the latter run GetRectCheckSum when the entire rectangle is yellow and make a note of the outcome and use that in your comparison, etc (Use the value GetRectCheckSum returns, not an actual color code).
You can do either. To help you, please clarify which you want and I can provide some example code.
If the former we can create a loop with GetPixelColor to scan the contents of the rectangle. If the latter run GetRectCheckSum when the entire rectangle is yellow and make a note of the outcome and use that in your comparison, etc (Use the value GetRectCheckSum returns, not an actual color code).
You can do either. To help you, please clarify which you want and I can provide some example code.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
yes is a number in somewhere of the rect, the color is not in all the rect
is like the draw
________
Honda CB500 Cup history
is like the draw
________
Honda CB500 Cup history
Last edited by chelo_100 on Tue Feb 01, 2011 10:34 pm, edited 1 time in total.
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
So I think what you want is, for example:
"Wait until any pixel within rectangle 716,218,830,232 is yellow"
Is that correct? If so take a look at:
http://www.mjtnet.com/forum/viewtopic.php?t=1363
So you could do something like:
So this scans all pixels within the rectangle. If one of those pixels matches the colour we jump out of the loop. If we reached the end of the rectangle without a match we start again. So it loops forever until a pixel matching the specified colour is found.
To determine the colour to check for use the cursor monitor on the Macro Properties window (or in the Editor use Tools/Cursor Monitor - the last number is the colour).
"Wait until any pixel within rectangle 716,218,830,232 is yellow"
Is that correct? If so take a look at:
http://www.mjtnet.com/forum/viewtopic.php?t=1363
So you could do something like:
Code: Select all
Label>FindColor
Let>found=no
Let>XMax=830
Let>YMax=232
Let>X=716
Repeat>X
Let>X=X+1
Let>Y=218
Repeat>Y
Let>Y=Y+1
GetPixelColor>X,Y,c
//Message>c
If>c=60159
Let>found=yes
Goto>done
endif
Until>Y,YMax
Until>X,XMax
If>found=no,FindColor
Label>done
To determine the colour to check for use the cursor monitor on the Macro Properties window (or in the Editor use Tools/Cursor Monitor - the last number is the colour).
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
thanks for all, the script that u showed me is what i want
i just need a few commands to finish this proyect
here is the script with a few commands wich i changed:
Label>FindColor
Let>found=no
Let>XMax=912
Let>YMax=125
Let>X=854
Repeat>X
Let>X=X+1
Let>Y=110
Repeat>Y
Let>Y=Y+1
GetPixelColor>X,Y,c
//Message>c
If>c=255
Let>found=yes
press np1
Goto>done
endif
if>c=65535
Let>found=yes
Press np2
goto>done
endif
if>c=65280
let>found=yes
press np2
goto>done
endif
Until>Y,YMax
Until>X,XMax
If>found=no,FindColor
Label>done
now i need to add this:
if the colors 65280 and 65535 appears again press np3
if this colors appears again press np4
if appears again press np5
if appears again press np6
if appears again press np7
if appears again press np1 (returns to the first command or the start)
i agree your msn to my list, if u like to explain this better
i hope u understand what i need, it??s easy now, the worst part was the first, thank u for this
________
Dodge Matador history
i just need a few commands to finish this proyect
here is the script with a few commands wich i changed:
Label>FindColor
Let>found=no
Let>XMax=912
Let>YMax=125
Let>X=854
Repeat>X
Let>X=X+1
Let>Y=110
Repeat>Y
Let>Y=Y+1
GetPixelColor>X,Y,c
//Message>c
If>c=255
Let>found=yes
press np1
Goto>done
endif
if>c=65535
Let>found=yes
Press np2
goto>done
endif
if>c=65280
let>found=yes
press np2
goto>done
endif
Until>Y,YMax
Until>X,XMax
If>found=no,FindColor
Label>done
now i need to add this:
if the colors 65280 and 65535 appears again press np3
if this colors appears again press np4
if appears again press np5
if appears again press np6
if appears again press np7
if appears again press np1 (returns to the first command or the start)
i agree your msn to my list, if u like to explain this better
i hope u understand what i need, it??s easy now, the worst part was the first, thank u for this
________
Dodge Matador history
Last edited by chelo_100 on Tue Feb 01, 2011 10:34 pm, edited 1 time in total.
Last edited by chelo_100 on Tue Feb 01, 2011 10:34 pm, edited 1 time in total.
thank for the post SkunkWorks but i don??t want to repeat the script, if i want to repeat it i put
Let>k=1
Repeat>k
script
Let>k=k+1
Until>k
but i want to add a memory
if 65535 or 65280 appears again press np3
i tried with
if>c=65535 or 65280
let>found=yes
press np2
wait>2
if>c=65535 or 65280 (line 17)
let>found=yes
press np3
but in line 17 i need to scan again to found this condition, but if the script scan and found 65535 or 65280 would press np2 not np3
________
no2 vaporizer
Let>k=1
Repeat>k
script
Let>k=k+1
Until>k
but i want to add a memory
if 65535 or 65280 appears again press np3
i tried with
if>c=65535 or 65280
let>found=yes
press np2
wait>2
if>c=65535 or 65280 (line 17)
let>found=yes
press np3
but in line 17 i need to scan again to found this condition, but if the script scan and found 65535 or 65280 would press np2 not np3
________
no2 vaporizer