This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
TheOutcast5's profile picture

TheOutcast5's Programs

Started by TheOutcast5, 25 March 2012 - 09:34 AM
TheOutcast5 #1
Posted 25 March 2012 - 11:34 AM
This thread is for all my programs I make

Content
- Door Lock
- Minecart Terminal


Door Lock
This is my Door Lock program
Spoiler
pass = "123"

print "Door Status: Locked"
write "Password: "
input = read("*")
if pass == input then
shell.run("clear")
print "Door Status: Unlocked"
redstone.setOutput("back",true)
sleep(5)
redstone.setOutput("back",false)
os.shutdown()
else
print "Door Status: Locked"
sleep(2)
os.shutdown()
end

Minecart Terminal
This is my Minecart Terminal program. Its very basic.
Spoiler

shell.run("clear")
print "1- Activate Minecart"
write "Enter Digit Here: "
input = read()
if input == "1" then
shell.run("clear")
print "Minecart Activated"
sleep(2)
redstone.setOutput("back",true)
sleep(5)
redstone.setOutput("back",false)
shell.run("clear")
print "Terminal Shutting Down"
sleep(2)
os.shutdown()
else
shell.run("clear")
print "You have enter the wrong code"
sleep(2)
print "Terminal Shutting Down"
sleep(2)
os.shutdown()
end
kamnxt #2
Posted 25 March 2012 - 11:43 AM
You should add a way to prevent the door lock program from being terminated… Maybe use "_, input = pcall("read","*")"
BlackRa1n #3
Posted 25 March 2012 - 01:57 PM
You should add a way to prevent the door lock program from being terminated… Maybe use "_, input = pcall("read","*")"

Or just use this:

os.pullEvent() = os.pullEventRaw()
Espen #4
Posted 25 March 2012 - 02:50 PM
Or just use this:
os.pullEvent = os.pullEventRaw
Fixed :(/>/>

Edit: Because using the brackets calls the functions, whereas using only their names returns the function references themselves.
Edited on 25 March 2012 - 12:51 PM
BlackRa1n #5
Posted 25 March 2012 - 02:55 PM
Or just use this:
os.pullEvent = os.pullEventRaw
Fixed :(/>/>

Edit: Because using the brackets calls the functions, whereas using only their names returns the function references themselves.

Aw. And I was so close to looking smart as well if it wasn't for you meddling brackets!
Kadecamz #6
Posted 25 March 2012 - 11:28 PM
uh…what do I enter to be able to edit it once ran the program?
Kadecamz #7
Posted 25 March 2012 - 11:59 PM
I keep getting bios:206: [string "startup"]"19: unexpected symbol when using the password program
TheOutcast5 #8
Posted 30 March 2012 - 09:40 AM
I keep getting bios:206: [string "startup"]"19: unexpected symbol when using the password program

I dont know why your getting that error, it should work. it does for me unless if you tried typing it in and got a small part wrong