View difference between Paste ID: GmrdsdPR and Vwj3c3n9
SHOW: | | - or go back to the newest paste.
1
--Title: TangentLock
2-
--Version: Ver. 3
2+
--Version: Ver. 4
3-
--Last Revised: 12/26/2011
3+
--Last Revised: 1/6/2012
4
--Last Revised By: TangentDelta (alias Hydrogen)
5
--Author: TangentDelta (alias Hydrogen)
6
--Platform: ComputerCraft LUA Virtual Machine
7
--Notes: Please don't claim this as your own, give me credit if you use this!
8
9-
code = "password" --the password to "unlock" it
9+
right = "password"
10-
debug = "debug" --password to enter the terminal
10+
debug = "debug"
11-
output = "left" --the side that will send out the "unlock" signal
11+
outputface = "right"
12-
tries = 5 --how many times you can guess before it ends your session
12+
protectmode = true
13-
pulsout = 5 --how long you want the redstone to be on for. I think it's in seconds.
13+
protectside = "left"
14-
hax = true --set to true if you want it to send out a redstone signal if password is wrong
14+
opentime = 5
15-
haxout = "right" --side that you want the "incorrect password" signal to be on
15+
maxtries = 3
16
tries = 0
17-
print "TangentLock Ver. 3 Initialized" --please don't edit/remove this. I put alot of time into this lock, and this is my signature on it.
17+
hint = "for debugging purposes"
18-
write "Password: "
18+
function TangentLock()
19-
for triescnt = 1,tries,1 do
19+
password()
20-
 password = read()
20+
if user == debug then
21-
 if password == debug then
21+
 print "Leaving TangentLock. Entering CraftOS"
22-
  print "Debug Activated"
22+
 shell.run"shell"
23-
  break
23+
end
24
if user == right then
25-
  if password == (code) then
25+
 print "Password Correct"
26-
   print "Password Correct. Ending Session"
26+
 correct()
27-
   redstone.setOutput(output, true)
27+
end
28-
   sleep(pulsout)
28+
if user == "credits" then
29-
   redstone.setOutput(output, false)
29+
 print "TangentLock Version 4.0"
30
 print "A program by TangentDelta (Alias Hydrogen)"
31-
  else
31+
 print "Please don't edit/remove this text right here."
32-
    if hax then
32+
 print "This is my signature on my artwork."
33-
     print "Incorrect Password!"
33+
 sleep(10)
34-
     redstone.setOutput(haxout, true)
34+
 TangentLock()
35-
     sleep(pulsout)
35+
end
36-
     redstone.setOutput(haxout, false)
36+
if user == "hint" then
37-
     os.shutdown()
37+
 print (hint)
38
 sleep(5)
39-
    print ("Password Incorrect. Tries left: ",tries-triescnt)
39+
end
40-
    write "Password: "
40+
if not(user == right) or (user == debug) or (user == "credits") or (user == "hint") then
41-
   end
41+
 if tries == maxtries -1 then
42
  if protectmode then
43-
 if triescnt == tries then 
43+
   protect()
44-
  print "Maximum Tries Reached."
44+
45-
  sleep(2)
45+
   print "Too Many Wrong Tries"
46-
  print "shutting Down"
46+
   print "Shutting Down Now"
47-
  sleep(1)
47+
   sleep (3)
48-
  os.shutdown()
48+
49-
  else
49+
50
   else
51-
end
51+
  print "Incorrect Password."
52
  tries = tries+1
53
  print ("Tries Left: ", maxtries - tries)
54
  sleep(5)
55
  TangentLock()
56
 end
57
end
58
end
59
function correct()
60
 sleep(1)
61
 shell.run("clear")
62
 rs.setOutput(outputface, true)
63
 sleep(opentime)
64
 rs.setOutput(outputface, false)
65
 os.shutdown()
66
end
67
function protect()
68
 rs.setOutput(protectside, true)
69
 sleep(1)
70
 rs.setOutput(protectside, false)
71
 os.shutdown()
72
end
73
function password()
74
 shell.run("clear")
75
 print ("TangentLock 4.0 Running On Computer ", os.getComputerID())
76
 print "To view copyright and credits, type ' credits'"
77
 write "Password: "
78
 user=io.read()
79
end
80
TangentLock()