View difference between Paste ID: 10eY0EBH and 9HxQvdgS
SHOW: | | - or go back to the newest paste.
1
function l()
2
        print("")
3
    end
4
     
5
    function cl()
6
        term.setCursorPos(1,1)
7
        term.clear()
8
    end
9
     
10
    function lane()
11
        print("Control Panel Alpha 0.1")
12
        l()
13
    end
14
     
15
    local function addoutput(sside, ...)
16
        local c = colors.combine(rs.getBundledOutput(sside), ...)
17
        rs.setBundledOutput(sside, c)
18
    end
19
     
20
    local function removeoutput(sside, ...)
21
       local c = colors.subtract(rs.getBundledOutput(sside), ...)    
22
       rs.setBundledOutput(sside, c)
23
    end
24
     
25
	function outputaus(testside)
26
27-
    	input = io.Read()
27+
    	input = io.read()
28
		    if input == "1" then
29
		    removeoutput(testside, 1)
30
		
31
		    elseif input == "2" then
32
			removeoutput(testside, 2)
33
		    
34
		    elseif input == "3" then
35
			removeoutput(testside, 4)
36
			
37
		    elseif input == "4" then
38
			removeoutput(testside, 8)
39
			
40
		    elseif input == "5" then
41
			removeoutput(testside, 16)
42
			
43
		    elseif input == "6" then
44
			removeoutput(testside, 32)
45
			
46
		    elseif input == "7" then
47
			removeoutput(testside, 64)
48
			
49
		    elseif input == "8" then
50
			removeoutput(testside, 128)
51
			
52
		    elseif input == "9" then
53
			removeoutput(testside, 256)
54
			
55
		    elseif input == "10" then
56
			removeoutput(testside, 512)
57
			
58
		    elseif input == "11" then
59
			removeoutput(testside, 1024)
60
			
61
		    elseif input == "12" then
62
			removeoutput(testside, 2048)
63
			
64
		    elseif input == "13" then
65
			removeoutput(testside, 4096)
66
			
67
		    elseif input == "14" then
68
			removeoutput(testside, 8192)
69
			
70
		    elseif input == "15" then
71
			removeoutput(testside, 16384)
72
			
73
		    elseif input == "16" then
74
			removeoutput(testside, 32768)
75
			
76
		end	
77
	end
78
	 
79
    function testoutput(testside)
80
     
81
        while true do
82
       
83
        cl()
84
        print("(q) Menu")    
85
     
86
        if rs.testBundledInput(testside, colors.white) then
87-
                print("White    : AN")
87+
                print("White    : (1) AN")
88-
				write("    (1) Ausschalten")
88+
89
                print("White    : Aus")
90
            end
91-
				write("    (1) Ausschalten")
91+
92
                print("Orange   : (2) AN")
93
            else
94-
                print("Orange   : AN")
94+
95-
				write("    (2) Ausschalten")
95+
96
            if rs.testBundledInput(testside, colors.magenta) then
97
                print("Magenta  : (3) AN")
98-
				write("    (2) Ausschalten")
98+
99
                print("Magenta  : Aus")
100
            end
101-
                print("Magenta  : AN")
101+
102-
				write("    (3) Ausschalten")
102+
                print("LightBlue: (4) AN")
103
            else
104
                print("LightBlue: Aus")
105-
				write("    (3) Ausschalten")
105+
106
            if rs.testBundledInput(testside, colors.yellow) then
107
                print("Yellow   : (5) AN")
108-
                print("LightBlue: AN")
108+
109-
				write("    (4) Ausschalten")
109+
110
            end
111
        if rs.testBundledInput(testside, colors.lime) then
112-
				write("    (4) Ausschalten")
112+
                print("Lime     : (6) AN")
113
            else
114
                print("Lime     : Aus")
115-
                print("Yellow   : AN")
115+
116-
				write("    (5) Ausschalten")
116+
117
                print("Pink     : (7) AN")
118
            else
119-
				write("    (5) Ausschalten")
119+
120
            end
121
            if rs.testBundledInput(testside, colors.gray) then
122-
                print("Lime     : AN")
122+
                print("Gray     : (8) AN")
123-
				write("    (6) Ausschalten")
123+
124
                print("Gray     : Aus")
125
            end
126-
				write("    (6) Ausschalten")
126+
127
                print("LightGray: (9) AN")
128
            else
129-
                print("Pink     : AN")
129+
130-
				write("    (7) Ausschalten")
130+
131
            if rs.testBundledInput(testside, colors.cyan) then
132
                print("Cyan     : (10) AN")
133-
				write("    (7) Ausschalten")
133+
134
                print("Cyan     : Aus")
135
            end
136-
                print("Gray     : AN")
136+
137-
				write("    (8) Ausschalten")
137+
                print("Purple   : (11) AN")
138
            else
139
                print("Purple   : Aus")
140-
				write("    (8) Ausschalten")
140+
141
            if rs.testBundledInput(testside, colors.blue) then
142
                print("Blue     : (12) AN")
143-
                print("LightGray: AN")
143+
144-
				write("    (9) Ausschalten")
144+
145
            end
146
			if rs.testBundledInput(testside, colors.brown) then
147-
				write("    (9) Ausschalten")
147+
                print("Brown    : (13) AN")
148
            else
149
                print("Brown    : Aus")
150-
                print("Cyan     : AN")
150+
151-
				write("    (10) Ausschalten")
151+
152
                print("Green    : (14) AN")
153
            else
154-
				write("    (10) Ausschalten")
154+
155
            end
156
            if rs.testBundledInput(testside, colors.red) then
157-
                print("Purple   : AN")
157+
                print("Red      : (15) AN")
158-
				write("    (11) Ausschalten")
158+
159
                print("Red      : Aus")
160
            end
161-
				write("    (11) Ausschalten")
161+
162
                print("Black    : (16) AN")
163
            else
164-
                print("Blue     : AN")
164+
165-
				write("    (12) Ausschalten")
165+
166
     
167
    sleep(2.5)
168-
				write("    (12) Ausschalten")
168+
169
	 outputaus(testside)
170
	 
171-
                print("Brown    : AN")
171+
172-
				write("    (13) Ausschalten")
172+
173
            if e2 == "char" and p2 == "q" then
174
            sleep(0.5)
175-
				write("    (13) Ausschalten")
175+
176
          end
177
       end
178-
                print("Green    : AN")
178+
179-
				write("    (14) Ausschalten")
179+
180
     
181
    function output()
182-
				write("    (14) Ausschalten")
182+
183
        cl()
184
        lane()
185-
                print("Red      : AN")
185+
186-
				write("    (15) Ausschalten")
186+
187
        print("(1) back")
188
        print("(2) right")
189-
				write("    (15) Ausschalten")
189+
190
        print("(4) top")
191
        print("(5) bottom")
192-
                print("Black    : AN")
192+
193-
				write("    (16) Ausschalten")
193+
194
     
195
            local e1, p1 = os.pullEvent()
196-
				write("    (16) Ausschalten")
196+
197
                color("back")
198
            elseif e1 == "char" and p1 == "2" then
199
                color("right")
200
            elseif e1 == "char" and p1 == "3" then
201
                color("left")
202
            elseif e1 == "char" and p1 == "4" then
203
                color("top")
204
            elseif e1 == "char" and p1 == "5" then
205
                color("bottom")
206
             end
207
            end                        
208
     
209
    end
210
     
211
     
212
    function color(side)
213
        cl()
214
        lane()
215
        print("Ausgewaehlte Seite: " ..side)
216
        print("Bitte Farbe eintippen")
217
        farbe = io.read()
218
        if farbe == "white" then
219
            id = 1
220
        elseif farbe == "orange" then
221
            id = 2
222
        elseif farbe == "magenta" then
223
            id = 4
224
        elseif farbe == "lightblue" then
225
            id = 8
226
        elseif farbe == "yellow" then
227
            id = 16
228
        elseif farbe == "lime" then
229
            id = 32
230
        elseif farbe == "pink" then
231
            id = 64
232
        elseif farbe == "gray" then
233
            id = 128
234
        elseif farbe == "lightgray" then
235
            id = 256
236
        elseif farbe == "cyan" then
237
            id = 512
238
        elseif farbe == "purple" then
239
            id = 1024
240
        elseif farbe == "blue" then
241
            id = 2048
242
        elseif farbe == "brown" then
243
            id = 4096
244
        elseif farbe == "green" then
245
            id = 8192
246
        elseif farbe == "red" then
247
            id = 16384
248
        elseif farbe == "black" then
249
            id = 32768
250
       end
251
     
252
        print(farbe.. " wurde ausgewaehlt")
253
        sleep(2)
254
        addoutput(side, id)
255
        sleep(0.5)
256
     
257
       return menu()
258
     
259
    end
260
     
261
    function status()
262
     
263
        cl()
264
        lane()
265
        print("Output Seite waehlen")
266
        l()                              
267
        print("(1) back")
268
        print("(2) right")
269
        print("(3) left")
270
        print("(4) top")
271
        print("(5) bottom")
272
     
273
        while true do
274
     
275
            local e1, p1 = os.pullEvent()
276
            if e1 == "char" and p1 == "1" then
277
                testoutput("back")
278
            elseif e1 == "char" and p1 == "2" then
279
                testoutput("right")
280
            elseif e1 == "char" and p1 == "3" then
281
                testoutput("left")
282
            elseif e1 == "char" and p1 == "4" then
283
                testoutput("top")
284
            elseif e1 == "char" and p1 == "5" then
285
                testoutput("bottom")
286
                end
287
        end                          
288
     
289
       
290
       
291
    end
292
     
293
    function menu()
294
        cl()  
295
        lane()
296
        print("(a) Output setzen")
297
        print("(b) Status und Abschaltung")
298
       
299
        while true do
300
     
301
            local event, param = os.pullEvent()
302
            if event == "char" and param == "a" then
303
                output()
304
               
305
            elseif event == "char" and param == "b" then
306
                status()
307
            end
308
        end
309
    end
310
     
311
    menu()