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

Password login to os not door.

Started by BpEoEnRg, 25 May 2014 - 03:16 PM
BpEoEnRg #1
Posted 25 May 2014 - 05:16 PM
Hello, after extensive searching I found more programs then I care to count for lock doors and some questions as mine is about the log in. I think I have a very simple solution but don't know the command to make a program start another from a then statement.

Ok so first thought is simply moving/renaming the start-up file into the programs folder to be called later by the correct password at log in. Then editing any of the password door programs to navigate to and run the renamed original start-up file now called "NormalRunning" or whatever you prefer. The editing would be simple minus the fact that I don't know the syntax to navigate to and run a program (In my case "NormalRunning").

Just replace

if input == "password" then
redstone.setOutput("back", true)
sleep(2)
redstone.setOutput("back", false)
end
with

os.pullEvent = os.pullEventRaw --Lock the program

local password = "password" --Password to start computer

while true do
term.clear() --Clears the screen
term.setCursorPos(1, 1) --Set cursor back to start
write("Good morning.") --Print on screen
local input = read(*) --Hidden user entry
if input == password then
term.clear() --Clears the screen
term.setCursorPos(1, 1) --Set cursor back to start
print("Nice to see you back.") --Print on screen
run NormalRunning  --NEED HELP
else
term.clear()  --Clears the screen
term.setCursorPos(1, 1) --Set cursor back to start
print("Thanks for visiting 'My Shop' but we're closed.") --Print on screen
print("Beat the heat in our pool while you wait.") --Print on screen
end
end
If this is even possiable might someone be able to help me with the –NEED HELP line in the replacement code. As you can see it's going to be running a shop. Next would be two dir for opened and closed in the programs folder with files to work the doors, make lights fancy, and work display screens.
CodingWithClass #2
Posted 26 May 2014 - 01:48 AM
I think this is what you're asking: running a program from Lua:
shell.run("NormalRunning")
CCJJSax #3
Posted 26 May 2014 - 06:29 AM
are you talking about a password to basically unlock the computer? if so just make the redstone changes into a break, and make the password program the startup file. If you want the program to launch another program then use shell.run("yourProgramHere")

edit: when I say change the redstone changes to break, I mean that I didn't read it and remembered back to my first password programs lol
Edited on 26 May 2014 - 04:36 AM