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

[Lua][Error]

Started by xaviex, 29 December 2012 - 01:47 PM
xaviex #1
Posted 29 December 2012 - 02:47 PM

os.pullEvent = os.pullEventRaw
print("X.OS door/bridge LOCK")
local password = ("olakase")
local devmode = ("devmode")
local salad = read("*")
if salad == password then
rs.setOutput("left",true)
rs.setOutput("back",true)
print("Please press enter to close door and drop bridge")
write("")
read()
end
rs.setOutput("left",false)
rs.setOutput("back",false)
term.clear()
term.setCursorPos(1,1)
os.reboot()
im getting [lock:7]Attempt to call string Please help
Luanub #2
Posted 29 December 2012 - 03:08 PM
Try changing

local password = ("olakase")
local devmode = ("devmode")

--to
local password = "olakase"
local devmode = "devmode"

Also instead of doing the reboot you could just place the code in a loop


os.pullEvent = os.pullEventRaw
while true do
  print("X.OS door/bridge LOCK")
  local password = "olakase"
  local devmode = "devmode"
  local salad = read("*")
  if salad == password then
	rs.setOutput("left",true)
	rs.setOutput("back",true)
	print("Please press enter to close door and drop bridge")
	write("")
	read()
  end
  rs.setOutput("left",false)
  rs.setOutput("back",false)
  term.clear()
  term.setCursorPos(1,1)
end
xaviex #3
Posted 29 December 2012 - 03:43 PM
thanks