Posted 01 January 2013 - 12:19 PM
This is my first LUA script!!! Basically i have this opening two doors (both on right and left of computer) and if the password is wrong it will activate a dispenser to fire arrows at you( bottom redstone output). Also a master password for easy access back to your cmd line.
os.pullEvent = os.pullEventRaw -- Keeps from being Terminated
pass = "letmein" -- your password
reset = "debug" -- password to get to console
print("Please Enter Password") -- prints text
input=read() -- reads text you typed in
if input == pass then -- checks to see if text is equal to password
rs.setOutput("right",true) -- whatever side door is on /turn redstone on
rs.setOutput("left",true) -- whatever side door is on /turn redstone on
sleep(3) -- keeps doors open for 3 seconds before closing
rs.setOutput("right",false) -- whatever side door is on /turn redstone off
rs.setOutput("left",false) -- whatever side door is on /turn redstone off
os.reboot() -- reboots back to lock program
elseif input == reset then -- if text was debug then does this
print("Opening Terminal Console") -- prints text
return -- opens console for editing script
else --or else lol
print("WRONG...Prepare For DEATH!!!") --prints text
for i = 1,5 do -- loops 5 times, change to how many times to fire from dispensers
rs.setOutput("bottom",true) -- whatever side trap is on/turn redstone on
sleep(1) -- pauses for 1 second
rs.setOutput("bottom",false) --whatever side trap is on/turn redstone off
sleep(1) -- pauses for 1 second
end --ends if statement
end -- ends for statement
os.reboot() -- reboots lock program