Edamh
Posts: 106 Joined: Tue May 24, 2011 11:56 pm
#1
Post
by Edamh » Sun Oct 14, 2012 12:15 am
Any ideas how to code the following pseudocode?
Code: Select all
Arrive at location
Wait/sleep 10 minutes
if keystroke within 10 minutes
then
continue to point B
else
logout (that is, no keystroke in 10 minutes)
end ifI don't know how to sleep AND check for keystroke during the 10 minutes. Tips and pointers appreciated. Thanks.
rock5
Posts: 12173 Joined: Tue Jan 05, 2010 3:30 am
Location: Australia
#2
Post
by rock5 » Sun Oct 14, 2012 12:38 am
Maybe
Code: Select all
local starttime = os.clock()
repeat
yrest(50)
if os.clock() - starttime > 600 then
player:logout()
end
until keyPressed(key.VK_SPACE)I don't think there is a way to say if
any key is pressed. I think it has to be a specific key. I used space bar in the code above.
Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
How to: copy and paste in micromacro
________________________
Quote:
“They say hard work never hurt anybody, but I figure, why take the chance.”
Edamh
Posts: 106 Joined: Tue May 24, 2011 11:56 pm
#3
Post
by Edamh » Mon Oct 15, 2012 9:17 am
Works great. Thank you!