View difference between Paste ID: dWsMYhha and 7GT19HrD
SHOW: | | - or go back to the newest paste.
1
mon = peripheral.wrap("right")
2
p = peripheral.wrap("left")
3
4
function pulse()
5
redstone.setOutput("left", true)
6
sleep(2)
7
redstone.setOutput("left", false)
8
end
9
10
function trains()
11
mon.setTextColor(colors.white)
12
mon.setCursorPos(2,5)
13
mon.write("TRAIN 1 - Water")
14
mon.setCursorPos(2,6)
15
mon.write("TRAIN 2 - Oil")
16
mon.setCursorPos(2,7)
17
mon.write("TRAIN 3 -")
18
mon.setCursorPos(2,8)
19
mon.write("TRAIN 4 -")
20
mon.setCursorPos(2,9)
21
mon.write("TRAIN 5 -")
22
mon.setCursorPos(2,10)
23
mon.write("TRAIN 6 -")
24
mon.setCursorPos(2,11)
25
mon.write("TRAIN 7 -")
26
mon.setCursorPos(2,12)
27
mon.write("TRAIN 8 -")
28
end
29
30-
function stop()
30+
function stop1()
31
mon.setTextColor(colors.red)
32
33
mon.setCursorPos(22,5)
34
mon.write("CANCELLED")
35
36
mon.setCursorPos(22,6)
37
mon.write("CANCELLED")
38
39
mon.setCursorPos(22,7)
40
mon.write("CANCELLED")
41
42
mon.setCursorPos(22,8)
43
mon.write("CANCELLED")
44
45
mon.setCursorPos(22,9)
46
mon.write("CANCELLED")
47
48
mon.setCursorPos(22,10)
49
mon.write("CANCELLED")
50
51
mon.setCursorPos(22,11)
52
mon.write("CANCELLED")
53
54
mon.setCursorPos(22,12)
55
mon.write("CANCELLED")
56
end
57
58
function start1()
59
mon.setTextColor(colors.green)
60
61-
   mon.clear()
61+
62-
   mon.setCursorPos(2,2)
62+
63-
   mon.setTextColor(colors.white)
63+
64-
   mon.write("TRAIN STATION")
64+
65
sleep(2)
66-
   if rs.getInput("back") then
66+
67-
   mon.setCursorPos(2,3)
67+
68
p.setFreq(107)
69
    pulse()
70
sleep(2)
71-
stop()
71+
72
mon.write("DEPARTING")
73-
   else
73+
74-
   mon.setCursorPos(2,3)
74+
75
sleep(2)
76
mon.setCursorPos(22,9)
77
mon.write("DEPARTING")
78
p.setFreq(105)
79
    pulse()
80
sleep(2)
81
mon.setCursorPos(22,8)
82
mon.write("DEPARTING")
83
p.setFreq(104)
84
    pulse()
85
sleep(2)
86
mon.setCursorPos(22,7)
87
mon.write("DEPARTING")
88
p.setFreq(103)
89
    pulse()
90
sleep(2)
91
mon.setCursorPos(22,6)
92
mon.write("DEPARTING")
93
p.setFreq(102)
94
    pulse()
95
sleep(2)
96
mon.setCursorPos(22,5)
97
mon.write("DEPARTING")
98
p.setFreq(101)
99
    pulse()
100
end
101
102
while true do
103
  event = os.pullEvent()
104
  if event == "redstone" and rs.getInput("back") == true then
105
  mon.setCursorPos(2,3)
106
   mon.setTextColor(colors.red)
107
   mon.write("TRAIN IN EXIT ZONE. CANCELLING DEPARTURES.")
108
trains()
109
stop1()
110
end
111
  if event == "redstone" and rs.getInput("back") == false then
112
mon.setCursorPos(2,3)
113
   mon.setTextColor(colors.green)
114
   mon.write("ZONE CLEAR. RESUMING DEPARTURES.          ")
115
trains()
116
start1()
117
118
end
119
end