Posted 29 September 2013 - 08:07 PM
Hello, I am still working on my OS.
Now, I am busy recreating my hole OS,
so I started with startup, now
I load my custom APIs in startup, and I want to make it so that if I push S during startup, or
for the first five seconds of startup, it'll quit the startup and return to shell.
(I figured it has something to do with a timer or something)
I am working on a little code, here it is:
(I used any key just to make things easy and simple for testing)
The problem:
I want it to time down whilst listening for a key input, so then if you don't push
any key, it'll return to shell, but if you do push a key it'll show the secret.
But on that little code, it'll display the secret on key press, but it won't
return to shell as if I never pushed a key,
Am I stupid meaning it has nothing to do with timers or is there a problem?
(I will give the person who helped me most credit in my OS for helping me if the problem is resolved)
Now, I am busy recreating my hole OS,
so I started with startup, now
I load my custom APIs in startup, and I want to make it so that if I push S during startup, or
for the first five seconds of startup, it'll quit the startup and return to shell.
(I figured it has something to do with a timer or something)
I am working on a little code, here it is:
(I used any key just to make things easy and simple for testing)
shell.run("clear")
print("Press any key to hear a secret.")
os.startTimer(3)
if os.pullEvent("key") then
print("ComputerCraft is awesome.")
else
os.pullEvent(timer)
end
The problem:
I want it to time down whilst listening for a key input, so then if you don't push
any key, it'll return to shell, but if you do push a key it'll show the secret.
But on that little code, it'll display the secret on key press, but it won't
return to shell as if I never pushed a key,
Am I stupid meaning it has nothing to do with timers or is there a problem?
(I will give the person who helped me most credit in my OS for helping me if the problem is resolved)