SHOW:
|
|
- or go back to the newest paste.
1 | - | mon = peripheral.wrap("right") |
1 | + | -- Dateien die erstellt werden müssen_ |
2 | -- doors, strom, ... | |
3 | - | mon.setTextScale(2) |
3 | + | |
4 | ||
5 | mon = peripheral.wrap("back") | |
6 | - | mon.setCursorPos(2,2) |
6 | + | redstone.setBundledOutput("right", 0) |
7 | - | mon.setTextColor(colors.white) |
7 | + | |
8 | - | mon.write("Mobfarm") |
8 | + | mon.setTextScale(1.5) |
9 | mon.clear() | |
10 | ||
11 | - | if rs.getInput("bottom") then |
11 | + | -- Hilfsfunktionen -- |
12 | - | mon.setTextColor(colors.lime) |
12 | + | |
13 | - | mon.setCursorPos(10,2) |
13 | + | function color(color) |
14 | - | mon.write(" ") |
14 | + | mon.setTextColor(color) |
15 | - | mon.setCursorPos(10,2) |
15 | + | end |
16 | - | mon.write("jetzt voll") |
16 | + | |
17 | function pos(gap, line) | |
18 | - | if not rs.getInput("bottom") then |
18 | + | mon.setCursorPos(gap1,line1) |
19 | - | mon.setTextColor(colors.red) |
19 | + | end |
20 | - | mon.setCursorPos(10,2) |
20 | + | |
21 | - | mon.write(" ") |
21 | + | function zzz(a,b,c,text) |
22 | - | mon.setCursorPos(10,2) |
22 | + | mon.setCursorPos(a,b) |
23 | - | mon.write("noch leer") |
23 | + | mon.setTextColor(c) |
24 | mon.write(text) | |
25 | - | sleep(0.5) |
25 | + | end |
26 | - | end |
26 | + | |
27 | function bg(color) | |
28 | mon.setBackgroundColor(color) | |
29 | end | |
30 | ||
31 | function msg(gap, line, color, groundb, text) | |
32 | if color == 1 then | |
33 | color = 1 | |
34 | elseif color == 02 then | |
35 | color = 2 | |
36 | elseif color == 03 then | |
37 | color = 4 | |
38 | elseif color == 04 then | |
39 | color = 8 | |
40 | elseif color == 05 then | |
41 | color = 16 | |
42 | elseif color == 06 then | |
43 | color = 32 | |
44 | elseif color == 07 then | |
45 | color = 64 | |
46 | elseif color == 08 then | |
47 | color = 128 | |
48 | elseif color == 09 then | |
49 | color = 256 | |
50 | elseif color == 10 then | |
51 | color = 512 | |
52 | elseif color == 11 then | |
53 | color = 1024 | |
54 | elseif color == 12 then | |
55 | color = 2048 | |
56 | elseif color == 13 then | |
57 | color = 4096 | |
58 | elseif color == 14 then | |
59 | color = 8192 | |
60 | elseif color == 15 then | |
61 | color = 16384 | |
62 | elseif color == 16 then | |
63 | color = 32768 | |
64 | end | |
65 | if groundb == 1 then | |
66 | groundb = 1 | |
67 | elseif groundb == 02 then | |
68 | groundb = 2 | |
69 | elseif groundb == 03 then | |
70 | groundb = 4 | |
71 | elseif groundb == 04 then | |
72 | groundb = 8 | |
73 | elseif groundb == 05 then | |
74 | groundb = 16 | |
75 | elseif groundb == 06 then | |
76 | groundb = 32 | |
77 | elseif groundb == 07 then | |
78 | groundb = 64 | |
79 | elseif groundb == 08 then | |
80 | groundb = 128 | |
81 | elseif groundb == 09 then | |
82 | groundb = 256 | |
83 | elseif groundb == 10 then | |
84 | groundb = 512 | |
85 | elseif groundb == 11 then | |
86 | groundb = 1024 | |
87 | elseif groundb == 12 then | |
88 | groundb = 2048 | |
89 | elseif groundb == 13 then | |
90 | groundb = 4096 | |
91 | elseif groundb == 14 then | |
92 | groundb = 8192 | |
93 | elseif groundb == 15 then | |
94 | groundb = 16384 | |
95 | elseif groundb == 16 then | |
96 | groundb = 32768 | |
97 | end | |
98 | ||
99 | mon.setBackgroundColor(groundb) | |
100 | mon.setCursorPos(gap,line) | |
101 | mon.setTextColor(color) | |
102 | text = mon.write(text) | |
103 | end | |
104 | ||
105 | -- Hauptfunctionen -- | |
106 | ||
107 | function kabelbelegung() | |
108 | mon.setBackgroundColor(colors.black) | |
109 | mon.clear() | |
110 | zzz(01,01,16384,"Farbbelegung gelbes Bundled-Wire:") | |
111 | bg(32768) zzz(01,02,00256,"01. Mobfarm voll/leer") | |
112 | bg(16) zzz(35,02,00001," ") | |
113 | bg(32768) zzz(01,03,00256,"02. Alle Türen auf/zu") | |
114 | bg(01) zzz(35,03,00001," ") | |
115 | bg(32768) zzz(01,04,00256,"03. noch frei") | |
116 | bg(265) zzz(35,04,00001," ") | |
117 | bg(32768) zzz(01,05,00256,"04. noch frei") | |
118 | bg(265) zzz(35,05,00001," ") | |
119 | bg(32768) zzz(01,06,00256,"05. noch frei") | |
120 | bg(265) zzz(35,06,00001," ") | |
121 | bg(32768) zzz(01,07,00256,"06. noch frei") | |
122 | bg(265) zzz(35,07,00001," ") | |
123 | bg(32768) zzz(01,08,00256,"07. noch frei") | |
124 | bg(265) zzz(35,08,00001," ") | |
125 | bg(32768) zzz(01,09,00256,"08. noch frei") | |
126 | bg(265) zzz(35,09,00001," ") | |
127 | bg(32768) zzz(01,10,00256,"09. noch frei") | |
128 | bg(265) zzz(35,10,00001," ") | |
129 | bg(32768) zzz(01,11,00256,"10. noch frei") | |
130 | bg(265) zzz(35,11,00001," ") | |
131 | bg(32768) zzz(01,12,00256,"11. noch frei") | |
132 | bg(265) zzz(35,12,00001," ") | |
133 | bg(32768) zzz(01,13,00256,"12. noch frei") | |
134 | bg(265) zzz(35,13,00001," ") | |
135 | bg(32768) zzz(01,14,00256,"13. noch frei") | |
136 | bg(265) zzz(35,14,00001," ") | |
137 | bg(32768) zzz(01,15,00256,"14. noch frei") | |
138 | bg(265) zzz(35,15,00001," ") | |
139 | bg(32768) zzz(01,16,00256,"15. noch frei") | |
140 | bg(265) zzz(35,16,00001," ") | |
141 | bg(32768) zzz(01,17,00256,"16. noch frei") | |
142 | bg(265) zzz(35,17,00001," ") | |
143 | os.pullEvent("monitor_touch") | |
144 | shell.run("1") | |
145 | end | |
146 | -------------------------------------- | |
147 | function doors1() | |
148 | msg(01,01,16,15," ") | |
149 | msg(01,02,16,15," Türen manuell ") | |
150 | msg(01,03,16,15," ") | |
151 | end | |
152 | function doors2() | |
153 | msg(01,01,16,06," ") | |
154 | msg(01,02,16,06," Türen auf ") | |
155 | msg(01,03,16,06," ") | |
156 | end | |
157 | -------------------------------------- | |
158 | function strom1() | |
159 | msg(01,05,16,15," ") | |
160 | msg(01,06,16,15," Haus-Strom ") | |
161 | msg(01,07,16,15," ") | |
162 | end | |
163 | function strom2() | |
164 | msg(01,05,16,06," ") | |
165 | msg(01,06,16,06," Haus-Strom ") | |
166 | msg(01,07,16,06," ") | |
167 | end | |
168 | -------------------------------------- | |
169 | function farben() | |
170 | msg(01,15,16,01," ") | |
171 | msg(01,16,16,01," Farbbelegung ") | |
172 | msg(01,17,16,01," ") | |
173 | end | |
174 | -------------------------------------- | |
175 | farben() | |
176 | ||
177 | file = fs.open("doors", "r") | |
178 | local inhalt = file.readLine() | |
179 | file.close() | |
180 | if inhalt == "rot" then | |
181 | doors1() | |
182 | sleep(0.5) | |
183 | redstone.setBundledOutput("right",colors.combine(redstone.getBundledOutput("right"), colors.white)) | |
184 | sleep(0.5) | |
185 | elseif inhalt == "gruen" then | |
186 | doors2() | |
187 | sleep(0.5) | |
188 | redstone.setBundledOutput("right",colors.subtract(redstone.getBundledOutput("right"), colors.white)) | |
189 | sleep(0.5) | |
190 | end | |
191 | -------------------------------------- | |
192 | file = fs.open("strom", "r") | |
193 | local inhalt = file.readLine() | |
194 | file.close() | |
195 | if inhalt == "rot" then | |
196 | strom1() | |
197 | sleep(0.5) | |
198 | redstone.setBundledOutput("right",colors.subtract(redstone.getBundledOutput("right"), colors.red)) | |
199 | sleep(0.5) | |
200 | elseif inhalt == "gruen" then | |
201 | strom2() | |
202 | sleep(0.5) | |
203 | redstone.setBundledOutput("right",colors.combine(redstone.getBundledOutput("right"), colors.red)) | |
204 | sleep(0.5) | |
205 | end | |
206 | ||
207 | -------------------------------------- | |
208 | --file = fs.open("beispiel", "r") | |
209 | --local inhalt = file.readLine() | |
210 | --file.close() | |
211 | --if inhalt == "rot" then | |
212 | -- beispiel() | |
213 | -- sleep(0.5) | |
214 | -- -- redstone.setBundledOutput("right",colors.combine(redstone.getBundledOutput("right"), colors.yellow)) | |
215 | -- sleep(0.5) | |
216 | --elseif inhalt == "gruen" then | |
217 | -- beispiel() | |
218 | -- sleep(0.5) | |
219 | -- -- redstone.setBundledOutput("right",colors.subtract(redstone.getBundledOutput("right"), colors.yellow)) | |
220 | -- sleep(0.5) | |
221 | --end | |
222 | -------------------------------------- | |
223 | ||
224 | while true do | |
225 | local event, side, X, Y = os.pullEvent("monitor_touch") | |
226 | if X >= 1 and X <= 16 and Y >= 15 and Y <= 17 and side == "back" then | |
227 | kabelbelegung() | |
228 | ---------------------------------------------------------------------------------------------------------------------- | |
229 | elseif X >= 1 and X <= 15 and Y >= 1 and Y <= 3 and side == "back" then | |
230 | file = fs.open("doors", "r") | |
231 | local inhalt = file.readLine() | |
232 | file.close() | |
233 | if inhalt == "rot" then | |
234 | doors2() | |
235 | file = fs.open("doors", "w") | |
236 | file.write("gruen") | |
237 | file.close() | |
238 | sleep(0.5) | |
239 | redstone.setBundledOutput("right",colors.combine(redstone.getBundledOutput("right"), colors.white)) | |
240 | sleep(0.5) | |
241 | elseif inhalt == "gruen" then | |
242 | doors1() | |
243 | file = fs.open("doors", "w") | |
244 | file.write("rot") | |
245 | file.close() | |
246 | sleep(0.5) | |
247 | redstone.setBundledOutput("right",colors.subtract(redstone.getBundledOutput("right"), colors.white)) | |
248 | sleep(0.5) | |
249 | end | |
250 | ---------------------------------------------------------------------------------------------------------------------- | |
251 | elseif X >= 1 and X <= 15 and Y >= 5 and Y <= 7 and side == "back" then | |
252 | file = fs.open("strom", "r") | |
253 | local inhalt = file.readLine() | |
254 | file.close() | |
255 | if inhalt == "rot" then | |
256 | strom2() | |
257 | file = fs.open("strom", "w") | |
258 | file.write("gruen") | |
259 | file.close() | |
260 | sleep(0.5) | |
261 | redstone.setBundledOutput("right",colors.combine(redstone.getBundledOutput("right"), colors.red)) | |
262 | sleep(0.5) | |
263 | elseif inhalt == "gruen" then | |
264 | strom1() | |
265 | file = fs.open("strom", "w") | |
266 | file.write("rot") | |
267 | file.close() | |
268 | sleep(0.5) | |
269 | redstone.setBundledOutput("right",colors.subtract(redstone.getBundledOutput("right"), colors.red)) | |
270 | sleep(0.5) | |
271 | end | |
272 | end | |
273 | end | |
274 | ---------------------------------------------------------------------------------------------------------------------- | |
275 | ||
276 | ||
277 | ||
278 | ||
279 | ||
280 | ||
281 | ||
282 | ||
283 | ||
284 |