Pastebin Link to code:
http://pastebin.com/Cdn9wJCK
Raw Paste Data:
local function clearScreen()
term.clear()
term.setCursorPos(1, 1)
end
while true do
clearScreen()
passone = ("weapons")
passtwo = ("equipped")
passthree = ("armor")
print("Password One:")
if read("*") == passone then
clearScreen()
print("Password Two:")
if read("*") == passtwo then
clearScreen()
print("Password Three:")
if read("*") == passthree then
clearScreen()
print("Accepted")
redstone.setOutput("left", true)
redstone.setOutput("back", true)
redstone.setOutput("right", true)
sleep(8)
clearScreen()
redstone.setOutput("left", false)
redstone.setOutput("back", false)
redstone.setOutput("right", false)
else
clearScreen()
print("Denied")
sleep(3)
end
end
end
end
Sidenotes:
1) In the passone, passtwo, and passthree slots, the passwords are, expectably, customizable.
2) This does, indeed, keep your doors triple-locked, and also supports making three doors open one-by-one, as detailed with the three redstone.setOutput functions.
3) I do like feedback. Not because I'm narcisistic, but because I actually care about other people's opinions (to an extent). If you like it, say you like it. If there's problems (which I tried my best to fix), then tell me so I can improve.
4) Thanks very much to Casper7526's Interactive Computercraft Tutorial. Couldn't have done this without you!
RockLegend2's Coded Triple-Lock Security Door
Started by RockLegend2, Apr 05 2012 02:44 AM
lua help computer
7 replies to this topic
#1
Posted 05 April 2012 - 02:44 AM
#2
Posted 05 April 2012 - 03:34 AM
well that is a nice one ^^ but i think it will be better with bundled cables (only if you're using red power)
#3
Posted 05 April 2012 - 11:28 AM
virtualayu, on 05 April 2012 - 03:34 AM, said:
well that is a nice one ^^ but i think it will be better with bundled cables (only if you're using red power)
I know basically nothing about the "red power" commands. Redstone commands were what I was introduced to through videos on Youtube and stuff back when Computercraft was for Minecraft 1.0.0.
#4
Posted 05 April 2012 - 12:02 PM
may i propose you to use this ingame tutorial?
it is the one poposed in the tuto section of this forum it's a verygood one and a good start with bundled cables ^^
http://www.computerc...torial-in-game/
it is the one poposed in the tuto section of this forum it's a verygood one and a good start with bundled cables ^^
http://www.computerc...torial-in-game/
#5
Posted 05 April 2012 - 05:07 PM
I have this program and I read through the entire thing. Guess I wasn't paying much attention to the bundled cables part. And I thought the "colors" part of it was rather strange, but informative.
(I mentioned that I read and used information from this in my Sidenote #4.)
(I mentioned that I read and used information from this in my Sidenote #4.)
#6
Posted 05 April 2012 - 06:01 PM
Nice little program!
/> My first program was a lock, too, but I focussed on making it fancy and user-friendly.
#7
Posted 19 May 2012 - 12:00 AM
Constructive Critisizm:
Indentions are a powerful tool, one that you should use.
indentions are basically ways to tell apart commands in 'blocks'. eg.
uses indentions. The next example is the same source code, but without indentions.
It's much harder to read. Think of a script the length of this, and multiply it by ten. Twenty. Fifty. It would be very hard to read. Also, a wall of text (no indentions) is next to impossible to debug if it doesn't work.
Indentions are a powerful tool, one that you should use.
indentions are basically ways to tell apart commands in 'blocks'. eg.
function doSomething(whoopie)
print("Calculating whoopie...")
if (not whoopie) then
return nul
end
if (whoopie > 2) then
return -9
end
return 9000
end
uses indentions. The next example is the same source code, but without indentions.
function doSomething(whoopie)
print("Calculating whoopie...")
if (not whoopie) then
return nul
end
if (whoopie > 2) then
return -9
end
return 9000
end
It's much harder to read. Think of a script the length of this, and multiply it by ten. Twenty. Fifty. It would be very hard to read. Also, a wall of text (no indentions) is next to impossible to debug if it doesn't work.
#8
Posted 25 May 2012 - 11:46 AM
MathManiac, on 19 May 2012 - 12:00 AM, said:
Constructive Critisizm:
Indentions are a powerful tool, one that you should use.
indentions are basically ways to tell apart commands in 'blocks'. eg.
uses indentions. The next example is the same source code, but without indentions.
It's much harder to read. Think of a script the length of this, and multiply it by ten. Twenty. Fifty. It would be very hard to read. Also, a wall of text (no indentions) is next to impossible to debug if it doesn't work.
Indentions are a powerful tool, one that you should use.
indentions are basically ways to tell apart commands in 'blocks'. eg.
function doSomething(whoopie)
print("Calculating whoopie...")
if (not whoopie) then
return nul
end
if (whoopie > 2) then
return -9
end
return 9000
end
uses indentions. The next example is the same source code, but without indentions.
function doSomething(whoopie)
print("Calculating whoopie...")
if (not whoopie) then
return nul
end
if (whoopie > 2) then
return -9
end
return 9000
end
It's much harder to read. Think of a script the length of this, and multiply it by ten. Twenty. Fifty. It would be very hard to read. Also, a wall of text (no indentions) is next to impossible to debug if it doesn't work.
I see what you mean, but I always found the "wall of text" much less daunting. The indented text always made all of the text look longer, more extensive, and far more complicated. The wall of text allows one to reference each line against each other so they aren't intimidated by more complex code. Also, Computercraft, the only place I use Lua in, tells me what the error is when I happen to trip in my coding run. I understand your concern, but I guess that's just helpful to everyone else.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











