with the command WAIT, the macro simply waits for the designated time.
I need a command that will skip a certain if then statement if 5 seconds hasn't passed.
Example (simplified--my real script is 45 pages long):
//--------------------------------------------------------------------
getpixelcolor>123,123,thing1
if>thing1=255
do something
endif
if>thing1=65546 and 5 seconds has elapsed from the last time thing1 colorcheck caused and event
do something
endif
//--------------------------------------------------------------------
since checking the system clock using the SEC> or MIN> command will store the current time, I am thinking there must be a way to do this; however, I can't swing it because if it just so happens to record the seconds as 59 seconds, how can i tell if 5 seconds has passed when the SEC> command will actually record 4 as the variable instead of 63 seconds.
Can someone please set me straight on this one? The wait command wont work because it freezes the script to actually "wait".
need command similar to wait
Moderators: Dorian (MJT support), JRL
possible solution..
SRT>Face
SEC>seconds
if>seconds>54
let>seconds1=%seconds%-30
else
let>seconds1=%seconds%
endif
SEC>seconds
if>secondsseconds2=%seconds%+25
else
let>seconds2=%seconds%-5
endif
If>seconds1=seconds2
let>turn=1
endif
getpixelcolor>blah,blah,movecheck1
getpixelcolor>blah,blah,movecheck2
If>turn=1
If>{(%movecheck1% = 251) OR (%movecheck1% = 64498)}
If>{(%movecheck2% = 255) OR (%movecheck2% = 65526)}
mousemove>100,456
wait>.3
Rdown
mousemove>1100,456
wait>.3
Rup
wait>1
add>turn,1
let>fightcounter=1
END>Face
endif
endif
endif
UNTESTED
this will probably work; however, do you know a faster way?
SEC>seconds
if>seconds>54
let>seconds1=%seconds%-30
else
let>seconds1=%seconds%
endif
SEC>seconds
if>secondsseconds2=%seconds%+25
else
let>seconds2=%seconds%-5
endif
If>seconds1=seconds2
let>turn=1
endif
getpixelcolor>blah,blah,movecheck1
getpixelcolor>blah,blah,movecheck2
If>turn=1
If>{(%movecheck1% = 251) OR (%movecheck1% = 64498)}
If>{(%movecheck2% = 255) OR (%movecheck2% = 65526)}
mousemove>100,456
wait>.3
Rdown
mousemove>1100,456
wait>.3
Rup
wait>1
add>turn,1
let>fightcounter=1
END>Face
endif
endif
endif
UNTESTED
this will probably work; however, do you know a faster way?
Try something like this:
Code: Select all
//--------------------------------------------------------------------
//Set next line to maximum wait time in seconds
Let>WaitMax=5
VBSTART
VBEND
VBEval>Timer,WaitStarted
Label>getpixelcolor_loop
getpixelcolor>123,123,thing1
if>thing1=255
//do something
endif
VBEval>Timer,WaitCheck
Let>WaitDiff=%WaitCheck%-%WaitStarted%
//I don't know what you're doing so I don't know if you want
//an "AND" or an "OR" in the following complex If> statement
if>{(%thing1%=65546)OR(%WaitDiff%>%WaitMax%)}
//and 5 seconds has elapsed from the last time thing1 colorcheck caused and event
//do something by jumping out of this loop
Goto>jump_out_of_loop
endif
Wait>0.01
Goto>getpixelcolor_loop
Label>jump_out_of_loop
//--------------------------------------------------------------------
Thank you,JRL wrote:Try something like this:
Code: Select all
//-------------------------------------------------------------------- //Set next line to maximum wait time in seconds Let>WaitMax=5 VBSTART VBEND VBEval>Timer,WaitStarted Label>getpixelcolor_loop getpixelcolor>123,123,thing1 if>thing1=255 //do something endif VBEval>Timer,WaitCheck Let>WaitDiff=%WaitCheck%-%WaitStarted% //I don't know what you're doing so I don't know if you want //an "AND" or an "OR" in the following complex If> statement if>{(%thing1%=65546)OR(%WaitDiff%>%WaitMax%)} //and 5 seconds has elapsed from the last time thing1 colorcheck caused and event //do something by jumping out of this loop Goto>jump_out_of_loop endif Wait>0.01 Goto>getpixelcolor_loop Label>jump_out_of_loop //--------------------------------------------------------------------
I managed to use this example and mix it up a bit to make it work nicely.