Posted 19 July 2012 - 09:58 AM
Hello,
I found the ComputerCraft Mod a few days ago and I really like it. I'm writing and testing programs nearly the whole day, because it's a lot of fun. But today I got a problem, which I couldn't solve by myself.
I write a lot of programs, which shouldn't be terminated by ctrl + t. So I'm gonna put in: os.pullEvent = os.pullEventRaw .
But: I still want to be able to exit the program to remove bugs or things like that. So I got an idea: I wrote the following startup file:
I thought: Okay, it will take one second more to boot the computer and in this period of time I have the possibility to press a key and login as administrator and jump to the command line.
Some of you may have seen the problem already: os.pullEvent() will wait for an event. So I have to push every reboot a key (and also when I leave the server and reconnect).
Does anyone have an idea how to fix it? So how can I stop searching for an pullEvent after 1 second or how can I say that it should only look if there is an event but don't wait for one?
Thank you very much for your help. I hope you can understand the problem. If you want, you can also answer in German, because I'm from Germany. But English is, of course, also possible.
Patrick
I found the ComputerCraft Mod a few days ago and I really like it. I'm writing and testing programs nearly the whole day, because it's a lot of fun. But today I got a problem, which I couldn't solve by myself.
I write a lot of programs, which shouldn't be terminated by ctrl + t. So I'm gonna put in: os.pullEvent = os.pullEventRaw .
But: I still want to be able to exit the program to remove bugs or things like that. So I got an idea: I wrote the following startup file:
sleep(1)
local sEvent, param = os.pullEvent()
if param == 56 then
print("Bitte Kennwort eingeben:")
pw = read("*")
if( pw == "mypw" )
return
end
end
shell.run("doorlock")
I thought: Okay, it will take one second more to boot the computer and in this period of time I have the possibility to press a key and login as administrator and jump to the command line.
Some of you may have seen the problem already: os.pullEvent() will wait for an event. So I have to push every reboot a key (and also when I leave the server and reconnect).
Does anyone have an idea how to fix it? So how can I stop searching for an pullEvent after 1 second or how can I say that it should only look if there is an event but don't wait for one?
Thank you very much for your help. I hope you can understand the problem. If you want, you can also answer in German, because I'm from Germany. But English is, of course, also possible.
Patrick