http://www.mjtnet.com/usergroup/viewtopic.php?t=6601
I have created a new thread, because this is a fundamentally different problem than the one Marcus helped me work through yesterday.
I can't seem to get my code to post correctly on this forum, so I posted it to FreeTextHost.
http://freetexthost.com/q43bi1alc2
What I am trying to do is check a single pixel on the screen. As long as it is dark, I run the primary routine, FastClick. However, if it is not dark, I want to run SlowClick, then check again after 5, 10 and 30 seconds. If it is still not dark, the script should end.
I have debugged the code and it seems that most of it works. The problem I am having is I don't know how to return to the top of the conditional tests after running FastClick or SlowClick. After FastClick runs, it goes up to the next if statement in CycleDarkCheck, rather than starting at the beginning. After doing some research, I think this may have to do with the difference between goto and gosub, but I am really not sure. After 48 hours, I am starting to really enjoy the challenges of simple programming, but I am still a novice.
Your help would be greatly appreciated.
Thanks.
I have edited this post to include the code below. To read, you need to replace {symbol for less than} with the symbol for less than. Somehow, the combination of less thans follwed by a greater thans, truncated the code in between.
Code: Select all
Let>x=0
Label>CycleDarkCheck
Repeat>x
//if pixel is dark, do FastClick, otherwise wait 2 seconds and try again
GetPixelColor>112,152,color
If>%color%{symbol for less than}5000000,FastClick
Wait>2
//if pixel is dark now, do SlowClick, otherwise wait 5, 10, 30 seconds
GetPixelColor>112,152,color
If>%color%{symbol for less than}5000000,SlowClick
Wait>5
GetPixelColor>112,152,color
If>%color%{symbol for less than}5000000,SlowClick
Wait>10
GetPixelColor>112,152,color
If>%color%{symbol for less than}5000000,SlowClick
Wait>30
//if pixel is still not dark, end script
GetPixelColor>112,152,color
If>%color%{symbol for less than}5000000,SlowClick,EOF
//end script when counter = 200, if not already terminated
Until>x=200
//Click, wait, press "a", wait, advance counter by 1 and return to beginning of CycleDarkCheck
SRT>FastClick
MouseMove>900,320
LClick
GoSub>RandShortWait
press a
GoSub>RandShortWait
Let>x=x+1
End>FastClick
//Click, wait, press "a", wait, advance counter by 4 and return to beginning of CycleDarkCheck
SRT>SlowClick
MouseMove>900,320
LClick
GoSub>RandLongWait
press a
GoSub>RandLongWait
Let>x=x+4
End>SlowClick
//Wait a random amount of time betwen 0.25 and 0.30 seconds
SRT>RandShortWait
Random>50,rndRange
Let>rndTime={(%rndRange%+250)/1000}
Wait>rndTime
End>RandShortWait
//Wait a random amount of time betwen 1.00 and 1.20 seconds
SRT>RandLongWait
Random>200,rndRange
Let>rndTime={(%rndRange%+1000)/1000}
Wait>rndTime
End>RandLongWait
Label>EOF