i want to add condition in waitpixelcolor
basically i want script to keep looking for 2 different cordinates for different colors... if 1st come it will do something and if 2nd come it will do another thing
like if waitpixelcolor>0,111,111,0
say hi
ifelse waitpixelcolor>1,222,222,0
say hello..
means which will come first it do that work
any idea how to do
waitpixelcolor
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: waitpixelcolor
Since WaitPixelColor waits you can't wait for two at once, so instead use GetPixelColor in a loop:
So this keeps looking at two different coordinates and checking what colours are there. It does something if either matches and then continues to loop. This example loops forever but you could make it stop based on some condition. Whatever you want.
If you think about it WaitPixelColor is really just GetPIxelColor in a loop, so that's what you need - a loop with two GetPixelColors in it where you check for two different positions/colours ...
Code: Select all
Label>loop
GetPixelCOlor>X1,Y1,color1
GetPixelColor>X2,Y2,color2
If>color1=whatever1
MessageModal>hi
Endif
If>color2=whatever2
MessageModal>hello
Endif
Wait>0.02
Goto>loop
If you think about it WaitPixelColor is really just GetPIxelColor in a loop, so that's what you need - a loop with two GetPixelColors in it where you check for two different positions/colours ...
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?
-
- Newbie
- Posts: 3
- Joined: Sun Jan 15, 2017 1:01 am
Re: waitpixelcolor
thanks for this it helped but i want to add subcondition with both conditions and then want to restart whole script
like
label>start
if>color=0
gosub>done
endif
if>color=1
gosub>notdone
endif
srt>done
anything
goto>start
end>done
but its giving me errorbranching out of aubroutine is not recommended
like
label>start
if>color=0
gosub>done
endif
if>color=1
gosub>notdone
endif
srt>done
anything
goto>start
end>done
but its giving me errorbranching out of aubroutine is not recommended
- CyberCitizen
- Automation Wizard
- Posts: 721
- Joined: Sun Jun 20, 2004 7:06 am
- Location: Adelaide, South Australia
Re: waitpixelcolor
What about not going to a subroutine and just include it in the match.
label>start
if>color=0
Let>vSomething=Something
Goto>Start
endif
if>color=1
gosub>notdone
endif
end>done
label>start
if>color=0
Let>vSomething=Something
Goto>Start
endif
if>color=1
gosub>notdone
endif
end>done
FIREFIGHTER