View difference between Paste ID: SJPnpYKc and ePjEJsih
SHOW: | | - or go back to the newest paste.
1
--version2
2
3
local monitor = peripheral.wrap("monitor_0")
4
5
--greeting function
6
function Greet()
7
  monitor.setBackgroundColor(colors.blue)
8
  monitor.setTextColor(colors.yellow)
9
  monitor.setCursorPos(1,1)
10
  monitor.setTextScale(3)
11
  monitor.clear()
12
  monitor.write("Speak Friend")
13
  monitor.setCursorPos(3,2)
14
  monitor.write("and Enter")
15
end
16
17
function Wrong()
18
  monitor.setBackgroundColor(colors.red)
19
  monitor.setTextColor(colors.black)
20
  monitor.setCursorPos(2,2)
21
  monitor.setTextScale(4)
22
  monitor.clear()
23
  monitor.write("WRONG!")
24
end
25
26
function Right()
27
  monitor.setBackgroundColor(colors.green)
28
  monitor.setTextColor(colors.white)
29
  monitor.setCursorPos(2,2)
30
  monitor.setTextScale(4)
31
  monitor.clear()
32
  monitor.write("Welcome!")
33
end
34
35
--password function
36
function PWD()
37
  while true do
38
    redstone.setOutput("back", true)
39
    term.clear()
40
    term.setCursorPos(1, 1)
41
    print("Enter Password:")
42
    input = read("*")
43
    if input == "friend" then
44
      redstone.setOutput("back", false)
45
      Right()
46-
  Greet()
46+
47-
  monitor.clear
47+
48
      Greet()
49-
  sleep(5)
49+
50-
  Greet()
50+
51
      sleep(5)
52-
  
52+
53
    end
54
  end
55-
--PWD()
55+
56
57
--Main Program  
58
Greet()
59
PWD()