Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local monitor = peripheral.wrap("monitor_0")
- --password function
- function PWD()
- while true do
- redstone.setOutput("back", true)
- term.clear()
- term.setCursorPos(1, 1)
- print("Enter Password:")
- input = read("*")
- if input == "friend" then
- redstone.setOutput("back", false)
- Right()
- sleep(4)
- redstone.setOutput("back", true)
- else
- Wrong()
- sleep(5)
- Greet()
- end
- end
- end
- --greeting function
- function Greet()
- monitor.setBackgroundColor(colors.blue)
- monitor.setTextColor(colors.yellow)
- monitor.setCursorPos(1,1)
- monitor.setTextScale(3)
- monitor.clear()
- monitor.write("Speak Friend")
- monitor.setCursorPos(3,2)
- monitor.write("and Enter")
- end
- function Wrong()
- monitor.setBackgroundColor(colors.red)
- monitor.setTextColor(colors.black)
- monitor.setCursorPos(2,2)
- monitor.setTextScale(4)
- monitor.clear()
- monitor.write("WRONG!")
- end
- function Right()
- Greet()
- monitor.clear
- monitor.write("Welcome!")
- sleep(5)
- Greet()
- end
- Greet()
- --PWD()
Advertisement
Add Comment
Please, Sign In to add comment