View difference between Paste ID: ftNsC9ww 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
32
33
34
p.setFreq(100)
35
mon.setTextColor(colors.red)
36
mon.setCursorPos(22,5)
37
mon.write("CANCELLED")
38
mon.setCursorPos(22,6)
39
mon.write("CANCELLED")
40
mon.setCursorPos(22,7)
41
mon.write("CANCELLED")
42
mon.setCursorPos(22,8)
43
mon.write("CANCELLED")
44
mon.setCursorPos(22,9)
45
mon.write("CANCELLED")
46
mon.setCursorPos(22,10)
47
mon.write("CANCELLED")
48
mon.setCursorPos(22,11)
49
mon.write("CANCELLED")
50
mon.setCursorPos(22,12)
51
mon.write("CANCELLED")
52
end
53
54
function start1()
55
56
57
58
mon.setTextColor(colors.green)
59
mon.setCursorPos(22,12)
60
mon.write("DEPARTING")
61-
   mon.clear()
61+
p.setFreq(108) 
62
pulse() 
63
sleep(2)
64
mon.setCursorPos(22,11)
65
mon.write("DEPARTING")
66-
   if rs.getInput("back") then
66+
p.setFreq(107) 
67
pulse() 
68-
   mon.setTextColor(colors.red)
68+
69-
   mon.write("TRAIN IN EXIT ZONE. CANCELLING DEPARTURES.")
69+
70
mon.write("DEPARTING")
71-
stop()
71+
72
pulse()
73-
   else
73+
74
mon.setCursorPos(22,9)
75
mon.write("DEPARTING")
76
p.setFreq(105)
77
pulse()
78
sleep(2)
79
mon.setCursorPos(22,8)
80
mon.write("DEPARTING")
81
p.setFreq(104)
82
pulse()
83-
p.setFreq(108)
83+
84-
    pulse()
84+
85
mon.write("DEPARTING")
86
p.setFreq(103)
87
pulse()
88-
p.setFreq(107)
88+
89-
    pulse()
89+
90
mon.write("DEPARTING")
91
p.setFreq(102)
92
pulse()
93
sleep(2)
94-
    pulse()
94+
95
mon.write("DEPARTING")
96
p.setFreq(101)
97
pulse()
98
end
99-
    pulse()
99+
100
101
102
103
104-
    pulse()
104+
105
local SIGNAL_SIDE = "back"
106
local timerActive = rs.getInput (SIGNAL_SIDE)
107
108
while true do
109-
    pulse()
109+
 mon.clear()
110
   mon.setCursorPos(2,2)
111
   mon.setTextColor(colors.white)
112
   mon.write("TRAIN STATION")
113
   mon.setCursorPos(2,3)
114-
    pulse()
114+
115
   mon.write("ZONE CLEAR. RESUMING DEPARTURES.          ")
116
trains()
117
118
start1()
119-
    pulse()
119+
120
sleep(1)
121
end