47 posts
Location
A bit lost
Posted 17 December 2013 - 10:10 PM
I made a program to lock my door with a password, just like alot of other people, and I put "os.pullEvent = os.pullEventRaw" at the top, but forgot to add a modifier to it. And in turn, the program won't end. Is there any way to end it, or is it forever running?
local pullEvent = os.pullEvent
os.pullEvent = os.pullEventRaw
localside = "back"
local password = "14363"
local opentime = 5
while true do
term.clear()
term.setCursorPos(1,1)
write("Password:")
local input = read("*")
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Access Granted")
rs.setOutput(side,true)
sleep(opentime)
else
print("Access Denied")
sleep(30)
end
end
724 posts
Location
Kinda lost
Posted 18 December 2013 - 06:53 AM
He can make a floppy disk with a empty startup file on it. Then after placing said floppy in disk drive next to computer restart computer. It will load up startup from floppy first (empty so nothing will happen) then go to standard shell where he can edit program.
Edited on 18 December 2013 - 09:21 AM
47 posts
Location
A bit lost
Posted 18 December 2013 - 09:48 PM
Oh, it's that simple? Cool, thanks.
882 posts
Location
Behind you.
Posted 18 December 2013 - 11:43 PM
Here's a nice fix to your code
local pullEvent = os.pullEventRaw
local side = "back"
local password = "14363"
local opentime = 5
while true do
term.clear()
term.setCursorPos(1,1)
print("Password:")
if read("*") == password then
term.clear()
term.setCursorPos(1,1)
print("Access Granted")
rs.setOutput(side,true)
sleep(opentime)
rs.setOutput(side,false)
else
print("Access Denied")
sleep(3) --Don't do it TOO long: P
end
end
331 posts
Posted 19 December 2013 - 02:56 AM
Here's a nice fix to your code
local pullEvent = os.pullEventRaw
Nope, can still be Ctrl+T'ed :P/>. Just a silly mistake is all replace
pullEvent = os.pullventRaw
with
os.pullEvent = os.pullEventRaw
Heat must be getting to everyone
Cuz this works in lua :P/>, looks like you were having a bad day…
whoops. yeh, the heat is getting to me, its sending me crazy *eye twitches*, its currently 44ºC (111ºF) inside my house…
Edit: Air conditioner is at other end of the house :/
Edited on 19 December 2013 - 01:57 AM
7508 posts
Location
Australia
Posted 19 December 2013 - 04:41 AM
Here's a nice fix to your code
local pullEvent = os.pullEventRaw
Nope, can still be Ctrl+T'ed :P/>. Just a silly mistake is all replace
pullEvent = os.pullventRaw
with
os.pullEvent = os.pullEventRaw
It'd actually error. you can't localise something that's being declared in a table
882 posts
Location
Behind you.
Posted 19 December 2013 - 07:40 AM
I keep forgetting you can't do that. The other parts of the code were good, right?