I made a tutorial on how to create a basic password protected door, I really hope this helps y'all out and if it did leave some feedback!
[media]http://www.youtube.com/watch?v=ldgXEB9yz00[/media]
Hope this helped!
Dexter, out!
Tutorials require a writeup. Moved to Media.
local pass = "pass"
local side = "left"
rs.setOutput(side, false)
while true do
os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1,1)
print("This door is locked!")
write("Password: ")
password = read("*")
if password == pass then
print("Access Granted!")
rs.setOutput(side, true)
sleep(3)
rs.setOutput(side, false)
else
print("Access Denide!")
sleep(2)
end
end
sorry if there are any errors wrote off the top of my head :)/>Btw the = thing is one = is say I want this to mean this the 2 = is asking is it = to this
x = y --This sets X equal to Y
The double equal sign says "Hey, are these two equal to each other?"
if 2 == "2" then --It asks if it's equal
The triple equal sign says "Hey, are these two EXACTLY the same?"
if 2 === "2" then --This is false
if "2" === "2" then --This is true
if 2 === 2 then -- This is also true.
there is no strict comparison operator in Lua. if you try to it will error with "unexpected symbol".The triple equal sign says "Hey, are these two EXACTLY the same?"if 2 === "2" then --This is false if "2" === "2" then --This is true if 2 === 2 then -- This is also true.
Sorry about that. I'm trying to learn JavaScript at the same time, it's messing with my head :P/>there is no strict comparison operator in Lua. if you try to it will error with "unexpected symbol".The triple equal sign says "Hey, are these two EXACTLY the same?"if 2 === "2" then --This is false if "2" === "2" then --This is true if 2 === 2 then -- This is also true.
lol thanksBtw the = thing is one = is say I want this to mean this the 2 = is asking is it = to this
To clarify to those who speak English,
The single equal sign says "Hey, let's set this value to that value"The double equal sign says "Hey, are these two equal to each other?"x = y --This sets X equal to Y
The triple equal sign says "Hey, are these two EXACTLY the same?"if 2 == "2" then --It asks if it's equal
if 2 === "2" then --This is false if "2" === "2" then --This is true if 2 === 2 then -- This is also true.
You can also have things like hashed passwords on disk, timeouts after too many attempts, random biolock/player detector/rfid/mag strip card checks (from Gopher's Peripherals/MiscPeripherals/immibis's Peripherals/immibis's Peripherals respectively, and access to different doors based on passwords. For a unique tutorial (therefore more subs and likes etc.) I would make it different from the rest.
well new people should know about theYou can also have things like hashed passwords on disk, timeouts after too many attempts, random biolock/player detector/rfid/mag strip card checks (from Gopher's Peripherals/MiscPeripherals/immibis's Peripherals/immibis's Peripherals respectively, and access to different doors based on passwords. For a unique tutorial (therefore more subs and likes etc.) I would make it different from the rest.
Yeah I love doing stuff like that, this was a tutorial just for the basics, y'know?
os.pullEnent = os.pullEventRaw and input = read("*")
I didn't until I found a tutorialwell new people should know about theYou can also have things like hashed passwords on disk, timeouts after too many attempts, random biolock/player detector/rfid/mag strip card checks (from Gopher's Peripherals/MiscPeripherals/immibis's Peripherals/immibis's Peripherals respectively, and access to different doors based on passwords. For a unique tutorial (therefore more subs and likes etc.) I would make it different from the rest.
Yeah I love doing stuff like that, this was a tutorial just for the basics, y'know?os.pullEnent = os.pullEventRaw and input = read("*")
no I mean that they should be Taught that stuffI didn't until I found a tutorialwell new people should know about theYou can also have things like hashed passwords on disk, timeouts after too many attempts, random biolock/player detector/rfid/mag strip card checks (from Gopher's Peripherals/MiscPeripherals/immibis's Peripherals/immibis's Peripherals respectively, and access to different doors based on passwords. For a unique tutorial (therefore more subs and likes etc.) I would make it different from the rest.
Yeah I love doing stuff like that, this was a tutorial just for the basics, y'know?os.pullEnent = os.pullEventRaw and input = read("*")
Thanks Death. Make this video the tutorial that they learn the os.pullEvent = os.pullEventRaw and read("*")I didn't until I found a tutorialwell new people should know about theYou can also have things like hashed passwords on disk, timeouts after too many attempts, random biolock/player detector/rfid/mag strip card checks (from Gopher's Peripherals/MiscPeripherals/immibis's Peripherals/immibis's Peripherals respectively, and access to different doors based on passwords. For a unique tutorial (therefore more subs and likes etc.) I would make it different from the rest.
Yeah I love doing stuff like that, this was a tutorial just for the basics, y'know?os.pullEnent = os.pullEventRaw and input = read("*")
os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1, 1)
print("Welcome to the laboratory access point.")
print("Password is required: ")
local password = "bacon"
local input = password
password = read("*")
while input ~= password do
write("Access Denied. Try again: ")
password = read("*")
end
print("Access Granted. Welcome to the Lab, Jim!")
rs.setOutput("left", true)
sleep(3)
rs.setOutput("left", false)
os.reboot()
this is
your code
<- But without spaces in the square bracketsIf it hurts to look at, don't post it.
One thing. The code would make more sense if input was the variable that gets assigned to the user input and password was the variable that gets assigned to the actual password :D/>-snip-