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

Multi door lock help

Started by xxangel17xx, 01 November 2012 - 06:22 PM
xxangel17xx #1
Posted 01 November 2012 - 07:22 PM
I am making a multi door locking system and have ran it to a slite error when runing it says expected <eof>
Code
Spoiler


os.pullEvent = os.pullEventRaw

term.clear()
term.setCursorPos(1,1)

local side = "bottom"
local num1 = "1"
local pass1 = "opendoor1"
local num2 = "2"
local pass2 = "opendoor2"
local num3 = "3"
local pass3 = "opendoor3"
local num4 = "4"
local pass4 = "opendoor4"
local num5 = "5"
local pass5 = "opendoor5"
local num6 = "6"
local pass6 = "opendoor6"
local num7 = "7"
local pass7 = "opendoor7"
local num8 = "8"
local pass8 = "opendoor8"
local num9 = "9"
local pass9 = "opendoor9"
local passwordadmin = "evolution"

print("Welcome to Evolution-Labs")
print("Please Enter a Door Id Number")
print("=1=2=3=4=5=6=7=8=9=")
write("Number: ")

local input = read("*")

if input == num1 then
print("Enter Door Password")
write ("Password: ")
if input == pass1 then
rs.setBundledOutput("side", colors.red)
sleep(3)
shell.run ("reboot")
end
end
if input == num2 then
print("Enter Door Password")
write ("Password: ")
if input == pass2 then
rs.setBundledOutput("side", colors.green)
sleep(3)
shell.run ("reboot")
end
end
if input == num3 then
print("Enter Door Password")
write ("Password: ")
if input == pass3 then
rs.setBundledOutput("side", colors.blue)
sleep(3)
shell.run ("reboot")
end
end
if input == num4 then
print("Enter Door Password")
write ("Password: ")
if input == pass4 then
rs.setBundledOutput("side", colors.yellow)
sleep(3)
shell.run ("reboot")
end
end
if input == num5 then
print("Enter Door Password")
write ("Password: ")
if input == pass5 then
rs.setBundledOutput("side", colors.lime)
sleep(3)
shell.run ("reboot")
end
end
if input == num6 then
print("Enter Door Password")
write ("Password: ")
if input == pass6 then
rs.setBundledOutput("side", colors.white)
sleep(3)
shell.run ("reboot")
end
end
if input == num7 then
print("Enter Door Password")
write ("Password: ")
if input == pass7 then
rs.setBundledOutput("side", colors.pink)
sleep(3)
shell.run ("reboot")
end
end
if input == num8 then
print("Enter Door Password")
write ("Password: ")
if input == pass8 then
rs.setBundledOutput("side", colors.black)
sleep(3)
shell.run ("reboot")
end
end
if input == num9 then
print("Enter Door Password")
write ("Password: ")
if input == pass9 then
rs.setBundledOutput("side", colors.brown)
sleep(3)
shell.run ("reboot")
end
end
if input == passwordadmin then 
 term.clear() 
 term.setCursorPos(1,1)
 print("Admin overide!") 
 print("Computer unlocking...")
 print("Please shutdown the console before leaving")
 os.pullEvent(terminate)
 end
end
else
print("Good Bye!")
sleep(3)
os.reboot
Luanub #2
Posted 01 November 2012 - 08:04 PM
You've got a couple of problems.

The eof(end of file) error is due to your os.reboot not having () after it.

You're os.pullEvent(terminate) is also not going to work. The only arguments that pullEvent takes is event types to filter(and they needs quotes around them "os.pullEvent("redstone")" would only pick up redstone events and discard the rest). I think you want the queueEvent() instead.

You also need to set your Bundled Output side. You currently have it set to "side" which is not a valid side. Change it to top, bottom, front, back. left, or right.

Or if you want you can do something like this.

local side = "left"
rs.setBundledOutput(side, colors.brown) --notice no quotes around side since it is a variable
Edited on 01 November 2012 - 07:05 PM
xxangel17xx #3
Posted 01 November 2012 - 09:40 PM
Thank you i cant believe i didn't notice it i guess i will be taking more lessons in Lua thanks for the help