Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.wrap("front")
- mon2 = peripheral.wrap("top")
- local password = {
- digit1 = "*",
- digit2 = "*",
- digit3 = "*",
- digit4 = "*"
- }
- mon.clear()
- mon.setCursorPos(2,1)
- mon.setBackgroundColor((colors.red))
- mon.write("Reset")function writePad()
- local i = 1
- local x = 2
- local y = 2
- while i <= 9 do
- mon.setBackgroundColor((colors.lime))
- mon.setCursorPos(y,x)
- mon.write(i)
- mon.setCursorPos(y+1, x)
- mon.setBackgroundColor((colors.black))
- mon.write(" ")
- y = y + 2
- if y == 8 then
- y = 2
- x = x + 1
- end
- i = i + 1
- end
- end
- writePad()mon.setBackgroundColor((colors.black))
- function writePass()
- local pass = {
- pass1 = "_",
- pass2 = "_",
- pass3 = "_",
- pass4 = "_"
- }
- if password.digit1 ~= "*" then
- pass.pass1 = "*"
- endif password.digit2 ~= "*" then
- pass.pass2 = "*"
- end
- if password.digit3 ~= "*" then
- pass.pass3 = "*"
- endif password.digit4 ~= "*" then
- pass.pass4 = "*"
- end
- mon.setCursorPos(2,5)
- mon.write(pass.pass1..pass.pass2..pass.pass3..pass.pass4)
- endwritePass()
- local passPos = 1
- local mousePosW = 1
- local mousePosH = 1function setDigit(digit)
- if passPos == 1 then
- password.digit1 = digit
- end
- if passPos == 2 then
- password.digit2 = digit
- end
- if passPos == 3 then
- password.digit3 = digit
- end
- if passPos == 4 then
- password.digit4 = digit
- end
- passPos = passPos + 1
- endfunction checkMousePos()
- if mousePosH == 1 then
- resetPass()
- end
- if mousePosH == 2 then
- if mousePosW == 2 or mousePosW == 3 then
- setDigit("1")
- end
- if mousePosW == 4 or mousePosW == 5 then
- setDigit("2")
- end
- if mousePosW == 6 or mousePosW == 7 then
- setDigit("3")
- end
- end
- if mousePosH == 3 then
- if mousePosW == 2 or mousePosW == 3 then
- setDigit("4")
- end
- if mousePosW == 4 or mousePosW == 5 then
- setDigit("5")
- end
- if mousePosW == 6 or mousePosW == 7 then
- setDigit("6")
- end
- end
- if mousePosH == 4 then
- if mousePosW == 2 or mousePosW == 3 then
- setDigit("7")
- end
- if mousePosW == 4 or mousePosW == 5 then
- setDigit("8")
- end
- if mousePosW == 6 or mousePosW == 7 then
- setDigit("9")
- end
- end
- endfunction resetPass()
- password.digit1 = "*"
- password.digit2 = "*"
- password.digit3 = "*"
- password.digit4 = "*"
- passPos = 1
- writePass()
- end
- while true do
- if passPos == 5 then
- if password.digit1 == "2" and password.digit2 == "1" and password.digit3 == "0" and password.digit4 == "3" then -- this is where the actual password is hardcoded in
- rs.setOutput("left", true)
- mon2.setCursorPos(1,1)
- mon2.clear()
- mon2.write("Welcome to the Reactor Room") -- change this to whatever message you want
- sleep(4)
- rs.setOutput("left", false)
- resetPass()
- else
- local timer = 3
- mon2.setTextColor(16384)
- while timer > 0 do
- mon2.setCursorPos(1,1)
- mon2.clear()
- mon2.write("Fuck off, you are not welcome!")
- sleep(0.5)
- mon2.setCursorPos(1,1)
- mon2.clear()
- sleep(0.5)
- timer = timer - 1
- end
- resetPass()
- end
- end
- mon2.setTextColor(1)
- mon2.setCursorPos(1,1)
- mon2.clear()
- mon2.write("Authorised Personel Only")
- event,p1,p2,p3 = os.pullEvent()
- if event == "monitor_touch" then
- mousePosH = p3
- mousePosW = p2
- checkMousePos()
- endwritePass()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement