Posted 06 November 2013 - 01:06 PM
Hey guys,i just wanted to make a Short Tutorial on how to make Passwords
All you need to do is the following
Actually using Password(Behind read) is not Required but i suggest you just use Password.If you put something else instead then you have to put the same word after the if statement.Elseif is a Statement too.Its basically Else + If = Elseif.It practicaly means
"Otherwise if you do this"…You can also use "redstone.setOutput("side", true/false) to toggle Redstone Signals on and off in the Direction you want.This is useful for Using a Password to open a door…Example Code
This code works 100% Fine and is tested by me.in the "rs.setOutput("side", boolean)" thing.You can use almost anything for sides.In my case i used "bottom"…Supposing that the Door is right under the Computer.And dont forget to use "sleep(..)" after you open the Redstone Signal for as much as you want and then make sure you close it.Otherwise the Signal will keep staying open.And make sure you put "else" right after you end the code.I mean the code if the Password is correct.If you dont then all passwords will be considered Correct or Wrong.I dont know i havent tested it.Hope you enjoyed my Tutorial…
All you need to do is the following
-- This is a quick explanation
print "Please type in the Correct Password"
password = read("*")
if password == "Yourpassword" then
print "Access Granted"
elseif password == "Secondarypassword" then
print "Access Granted(Secondary Password)"
else
print "Access Not Granted"
end
Actually using Password(Behind read) is not Required but i suggest you just use Password.If you put something else instead then you have to put the same word after the if statement.Elseif is a Statement too.Its basically Else + If = Elseif.It practicaly means
"Otherwise if you do this"…You can also use "redstone.setOutput("side", true/false) to toggle Redstone Signals on and off in the Direction you want.This is useful for Using a Password to open a door…Example Code
print "Please type the Correct Password"
password = read("*")
if password = "Yourpassword" then
print "Door Opened!"
rs.setOutput("bottom", true )
sleep(3)
rs.setOutput("bottom, false )
print "Door Closed"
else
print "Wrong Password"
end
This code works 100% Fine and is tested by me.in the "rs.setOutput("side", boolean)" thing.You can use almost anything for sides.In my case i used "bottom"…Supposing that the Door is right under the Computer.And dont forget to use "sleep(..)" after you open the Redstone Signal for as much as you want and then make sure you close it.Otherwise the Signal will keep staying open.And make sure you put "else" right after you end the code.I mean the code if the Password is correct.If you dont then all passwords will be considered Correct or Wrong.I dont know i havent tested it.Hope you enjoyed my Tutorial…