Posted 03 January 2013 - 09:16 AM
Hello, i am trying to write an SD program, but I have a problem with having an active countdown and also waiting for input in case I want to abort it.
This is simplified program without detonation signal, abort signal, else's and stuff like that, that's easy, all I attached was alarm to see if I managed to get the abort right.
It should look like this:
Counting:
60..1
(line awaiting for correct input)
Also, if you can add what to type for code looking like *'s it would help unless I find it before someone answers :D/> (optional)
Thx!
This is simplified program without detonation signal, abort signal, else's and stuff like that, that's easy, all I attached was alarm to see if I managed to get the abort right.
It should look like this:
Counting:
60..1
(line awaiting for correct input)
Also, if you can add what to type for code looking like *'s it would help unless I find it before someone answers :D/> (optional)
term.clear()
term.setCursorPos(1,1)
print ("Self-destruction sequence initiated:")
sleep (2)
rs.setOutput("bottom", true) -- Howler alarm --
print ("Countdown started: 60 seconds untill")
print ("detonation.")
sleep (1.5)
x=59
term.clear()
term.setCursorPos(1,1)
print ("Counting:")
for i=1,59 do
term.setCursorPos(1,2)
term.clearLine()
print (x)
sleep (1)
i=i+1
x=x-1
end
------------
read(input)
if input=="abort" then
print ("Enter abort password:")
read(pass)
if pass=="bejesus" then
rs.setOutput("bottom", false)
term.clear()
term.setCursorPos(1,1)
print("Self-destruct sequence aborted")
end
end
------------
Thx!