29 posts
Posted 25 November 2013 - 04:48 PM
function sevens()
countdown()
sm = 7
while true do
sm = sm+7
input = read()
print(sm)
sleep(10)
end
end
What it does: does not allow for text to be input,
What is expected: When the input is placed, the screen will display 7,14 etc… One number per click
1140 posts
Location
Kaunas, Lithuania
Posted 25 November 2013 - 04:57 PM
You never call your function. To call your function use:
sevens()
Edited on 25 November 2013 - 03:57 PM
29 posts
Posted 25 November 2013 - 04:59 PM
I have, this was just a snippet
1140 posts
Location
Kaunas, Lithuania
Posted 25 November 2013 - 05:00 PM
What does countdown() function look like?
29 posts
Posted 25 November 2013 - 05:01 PM
function countdown()
clear()
print("Workout starting in 3 second(s)")
sleep(1000)
print("Workout starting in 2 second(s)")
sleep(1000)
print("Workout starting in 1 second(s)")
sleep(1000)
clear()
end
8543 posts
Posted 25 November 2013 - 05:02 PM
Please post the whole code.
Edit: Sleep is in seconds, so sleep(1000) will sleep for 16 minutes and 40 seconds.
1140 posts
Location
Kaunas, Lithuania
Posted 25 November 2013 - 05:04 PM
function countdown()
clear()
print("Workout starting in 3 second(s)")
sleep(1000)
print("Workout starting in 2 second(s)")
sleep(1000)
print("Workout starting in 1 second(s)")
sleep(1000)
clear()
end
sleep function waits for seconds not milliseconds. So, your code is waiting for 1000 seconds, then prints "Workout starting in 3 second(s)", then waits another 1000 seconds and so on.
29 posts
Posted 25 November 2013 - 05:13 PM
http://pastebin.com/StTMU1iPIt's designed for a emulator with slightly different API, but you get the idea:
http://pastebin.com/StTMU1iPThe API I use uses ms
7083 posts
Location
Tasmania (AU)
Posted 26 November 2013 - 05:40 AM
So you've overridden sleep(), and presumably provided a clear() function?
Did you also override read() while you were at it, maybe?
What does it do instead of letting you type? Only knowing what it "doesn't" do leaves lots to the imagination.