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

Door Password Help?

Started by Alissa, 17 September 2012 - 12:21 AM
Alissa #1
Posted 17 September 2012 - 02:21 AM
I can't get this to work

clear()
secretPass = "967618" -- Your Password
debugPass = "8537" -- Password if you want to edit something
helpPass = "Help" -- For loners

textutils.slowPrint("			Welcome to			")
print("						  Base 0001			  ")
print(" ")
sleep(2)
io.write("Password:")
sInput = read("*")
   if secretPass == sInput then
				print("Password Accepted")
				redstone.setOutput("back", true)
				sleep(5)
				redstone.setOutput("back", false)
os.shutdown()
   elseif sInput == debugPass then
clear()
print("Debuging mode activated")
elseif sInput == helpPass then
print("Enter Password To Open Door")
sleep(2)
os.reboot()
else redstone.setOutput("back", true)
sleep(10)
print("GOODBYE :)/>/>")
redstone.setOutput("back", false)
os.shutdown()
end  
end
I am not very good at this and this is my first door.
Loopin #2
Posted 17 September 2012 - 02:31 AM
EDIT
1-You only needs one end,delete the last one.
2-you didn't defined clear() function, use shell.run("clear").
cant_delete_account #3
Posted 17 September 2012 - 04:08 AM
EDIT
1-You only needs one end,delete the last one.
2-you didn't defined clear() function, use shell.run("clear").
Using
shell.run("clear")
is a bad idea, use
term.clear() term.setCursorPos(1,1)
instead.
You could also create a function "clear":

local function clear()
term.clear()
term.setCursorPos(1,1)
end
Loopin #4
Posted 17 September 2012 - 11:18 AM
EDIT
1-You only needs one end,delete the last one.
2-you didn't defined clear() function, use shell.run("clear").
Using
shell.run("clear")
is a badanemos idea, use
term.clear() term.setCursorPos(1,1)
instead.
You could also create a function "clear":

local function clear()
term.clear()
term.setCursorPos(1,1)
end

Or:

local function clear(x,y)
term.clear()
term.setCursorPos(x,y)
end
cheekycharlie101 #5
Posted 17 September 2012 - 06:25 PM
EDIT
1-You only needs one end,delete the last one.
2-you didn't defined clear() function, use shell.run("clear").

i belive you can also use term.clear()
Loopin #6
Posted 17 September 2012 - 07:35 PM
EDIT
1-You only needs one end,delete the last one.
2-you didn't defined clear() function, use shell.run("clear").

i belive you can also use term.clear()

No and Yes, term.clear()
just clear the screen, shell.run("clear")
clear, and set the cursor to 1,1.
GopherAtl #7
Posted 17 September 2012 - 07:39 PM
it's still better to write your own two-line function, as loopin suggested in his last post, than to use shell to spawn a separate program just to run those same two lines.