View difference between Paste ID: piffJuD8 and kNsMY0nw
SHOW: | | - or go back to the newest paste.
1-
term.clear()
1+
2-
term.setCursorPos(1,1)
2+
3
id = 28
4
 
5
function GUI()
6
        term.clear()
7-
--ID test-read
7+
8-
local file = fs.open("config","r")
8+
9-
id = tonumber(file.readAll())
9+
10-
file.close()
10+
11
        paintutils.drawFilledBox(10,2,19,4,colors.cyan)
12-
--Config fix(if needed)
12+
13-
function confix()
13+
14-
        if id == nil then
14+
15-
                local file = fs.open("config","w")
15+
16-
                file.write(tostring(000))
16+
17-
                file.close()
17+
18-
                sleep(1)
18+
19
        paintutils.drawFilledBox(1,12,6,13,colors.brown)
20
       
21
        paintutils.drawFilledBox(1,15,6,16,colors.brown)
22-
--run confix
22+
23
        paintutils.drawFilledBox(1,18,6,19,colors.brown)
24-
confix()
24+
25
        paintutils.drawFilledBox(8,12,14,13,colors.green)
26
       
27-
--Fixed id
27+
28
       
29-
local file = fs.open("config","r")
29+
30-
id = tonumber(file.readAll())
30+
31-
file.close()
31+
32
       
33
        paintutils.drawFilledBox(25,3,26,18,colors.blue)
34
       
35-
function setup()
35+
36
       
37-
        term.setCursorPos(1,1)
37+
38-
        print("Remote Control GUI v2.2 - [Setup]")
38+
39
        paintutils.drawFilledBox(16,18,22,19,colors.red)
40-
        print("Turtle ID:")
40+
41-
        term.setCursorPos(3,4)
41+
42
        term.setCursorPos(3,3)
43-
        local file = fs.open("config","w")
43+
44-
        file.write(tostring(read()))
44+
45-
        file.close()
45+
46-
        sleep(1)
46+
47
        term.setCursorPos(12,3)
48-
        shell.run("startup")
48+
49
        term.setCursorPos(9,6)
50
        print("LEFT")
51
        term.setCursorPos(17,6)
52
        print("RIGHT")
53
        term.setCursorPos(13,9)
54
        print("BACK")
55
 
56
        term.setBackgroundColor(colors.brown)
57
                term.setCursorPos(2,12)
58-
        term.setCursorPos(1,1)
58+
59-
        print("Remote Control GUI v2.2")
59+
60-
--Buttons- up, down
60+
61
        term.setCursorPos(2,16)
62
        print("DIG")
63
                term.setCursorPos(2,18)
64
                print("DIG")
65
                term.setCursorPos(2,19)
66
                print("DOWN")
67
 
68
        term.setBackgroundColor(colors.green)
69
                term.setCursorPos(9,12)
70
                print("PLACE")
71
                term.setCursorPos(11,13)
72
                print("UP")
73
        term.setCursorPos(9,16)
74
        print("PLACE")
75
                term.setCursorPos(9,18)
76
                print("PLACE")
77
                term.setCursorPos(10,19)
78
                print("DOWN")
79
 
80
        term.setBackgroundColor(colors.blue)
81
                term.setCursorPos(24,2)
82
                print("INV")
83
                term.setCursorPos(26,3)
84
                print("1")
85
                term.setCursorPos(26,4)
86
                print("2")
87
                term.setCursorPos(26,5)
88
                print("3")
89
                term.setCursorPos(26,6)
90
                print("4")
91
                term.setCursorPos(26,7)
92
                print("5")
93
                term.setCursorPos(26,8)
94
                print("6")
95
                term.setCursorPos(26,9)
96
                print("7")
97
                term.setCursorPos(26,10)
98
                print("8")
99
                term.setCursorPos(26,11)
100
                print("9")
101
                term.setCursorPos(25,12)
102
                print("10")
103
                term.setCursorPos(25,13)
104
                print("11")
105
                term.setCursorPos(25,14)
106
                print("12")
107
                term.setCursorPos(25,15)
108
                print("13")
109
                term.setCursorPos(25,16)
110
                print("14")
111
                term.setCursorPos(25,17)
112
                print("15")
113
                term.setCursorPos(25,18)
114
                print("16")
115
		term.setCursorPos(23,19)
116
		print("FUEL")
117
        term.setBackgroundColor(colors.red)
118
                term.setCursorPos(18,12)
119
                print("^^^")
120
                term.setCursorPos(18,13)
121
                print("|||")
122
                term.setCursorPos(18,15)
123
                print("RED")
124
                term.setCursorPos(17,16)
125
                print("STONE")
126
                term.setCursorPos(18,18)
127
                print("|||")
128
                term.setCursorPos(18,19)
129
                print("vvv")
130
 
131
        term.setBackgroundColor(colors.black)
132
        term.setCursorPos(2,17)
133
 
134
        local evnt = { os.pullEvent("mouse_click") }
135
        local x = evnt[3]
136
        local y = evnt[4]
137
        if y >= 1 and y <= 6 and x >= 2 and x <= 4 then
138
                rednet.send(id,"up")
139
                print("up")
140
                sleep(.5)
141
        end
142
 
143
        if y >= 7 and y <= 9 and x >= 1 and x <= 6 then
144
                rednet.send(id,"down")
145
                print("down")
146
                sleep(.5)
147
        end
148
 
149
        if y >= 2 and y <= 4 and x >= 10 and x <= 19 then
150
                rednet.send(id,"forward")
151
                print("forward")
152
                sleep(.5)
153
        end
154
 
155
        if y >= 5 and y <= 7 and x >= 7 and x <= 13 then
156
                rednet.send(id,"left")
157
                print("left")
158
                sleep(.5)
159
        end
160
 
161
        if y >= 5 and y <= 7 and x >= 16 and x <= 22 then
162
                rednet.send(id,"right")
163
                print("right")
164
                sleep(.5)
165
        end
166
 
167
        if y >= 8 and y <= 10 and x >= 10 and x <= 19 then
168
                rednet.send(id,"back")
169
                print("back")
170
                sleep(.5)
171
        end
172
       
173
        if y >= 12 and y <= 13 and x >= 1 and x <= 6 then
174
                rednet.send(id,"digup")
175
                print("digUp")
176
                sleep(.5)
177
        end
178
 
179
        if y >= 15 and y <= 16 and x >= 1 and x <= 6 then
180
                rednet.send(id,"dig")
181
                print("dig")
182
                sleep(.5)
183
        end
184-
        term.setCursorPos(2,11)
184+
185-
        print("Turtle ID: "..id)
185+
186
                rednet.send(id,"digdown")
187
                print("DigDown")
188
                sleep(.5)
189
        end
190
 
191
        if y >= 12 and y <= 13 and x >= 8 and x <= 14 then
192
                rednet.send(id,"placeup")
193
                print("placeUp")
194
                sleep(.5)
195
        end
196
 
197
        if y >= 15 and y <= 16 and x >= 8 and x <= 14 then
198
                rednet.send(id,"place")
199
                print("place")
200
                sleep(.5)
201
        end
202
 
203
        if y >= 18 and y <= 19 and x >= 8 and x <= 14 then
204
                rednet.send(id,"placedown")
205
                print("placeDown")
206
                sleep(.5)
207
        end
208
 
209
        if y >= 3 and y <= 3 and x >= 25 and x <= 26 then
210
                rednet.send(id,"inv1")
211
                print("inv1")
212
                sleep(.5)
213
        end
214
 
215
        if y >= 4 and y <= 4 and x >= 25 and x <= 26 then
216
                rednet.send(id,"inv2")
217
                print("inv2")
218
                sleep(.5)
219
        end
220
 
221
        if y >= 5 and y <= 5 and x >= 25 and x <= 26 then
222
                rednet.send(id,"inv3")
223
                print("inv3")
224
                sleep(.5)
225
        end
226
 
227
        if y >= 6 and y <= 6 and x >= 25 and x <= 26 then
228
                rednet.send(id,"inv4")
229
                print("inv4")
230
                sleep(.5)
231
        end
232
 
233
        if y >= 7 and y <= 7 and x >= 25 and x <= 26 then
234
                rednet.send(id,"inv5")
235
                print("inv5")
236
                sleep(.5)
237
        end
238
 
239
        if y >= 8 and y <= 8 and x >= 25 and x <= 26 then
240
                rednet.send(id,"inv6")
241
                print("inv6")
242
                sleep(.5)
243
        end
244
 
245
        if y >= 9 and y <= 9 and x >= 25 and x <= 26 then
246
                rednet.send(id,"inv7")
247
                print("inv7")
248
                sleep(.5)
249
        end
250
 
251
        if y >= 10 and y <= 10 and x >= 25 and x <= 26 then
252
                rednet.send(id,"inv8")
253
                print("inv8")
254
                sleep(.5)
255
        end
256
 
257
        if y >= 11 and y <= 11 and x >= 25 and x <= 26 then
258
                rednet.send(id,"inv9")
259
                print("inv9")
260
                sleep(.5)
261
        end
262
 
263
        if y >= 12 and y <= 12 and x >= 25 and x <= 26 then
264
                rednet.send(id,"inv10")
265
                print("inv10")
266
                sleep(.5)
267
        end
268
 
269
        if y >= 13 and y <= 13 and x >= 25 and x <= 26 then
270
                rednet.send(id,"inv11")
271
                print("inv11")
272
                sleep(.5)
273
        end
274
 
275
        if y >= 14 and y <= 14 and x >= 15 and x <= 26 then
276
                rednet.send(id,"inv12")
277
                print("inv12")
278
                sleep(.5)
279
        end
280
 
281
        if y >= 15 and y <= 15 and x >= 25 and x <= 26 then
282
                rednet.send(id,"inv13")
283
                print("inv13")
284
                sleep(.5)
285
        end
286
 
287
        if y >= 16 and y <= 16 and x >= 25 and x <= 26 then
288
                rednet.send(id,"inv14")
289
                print("inv14")
290
                sleep(.5)
291
        end
292
 
293
        if y >= 17 and y <= 17 and x >= 25 and x <= 26 then
294
                rednet.send(id,"inv15")
295
                print("inv15")
296
                sleep(.5)
297
        end
298
299
	if y >= 19 and y <= 19 and x >= 23 and x <= 26 then
300
                rednet.send(id,"refuel")
301
                sleep(.5)
302
        end
303
 
304
        if y >= 18 and y <= 18 and x >= 25 and x <= 26 then
305
                rednet.send(id,"inv16")
306
                print("inv16")
307
                sleep(.5)
308
        end
309
 
310
        if y >= 12 and y <= 13 and x >= 16 and x <= 22 then
311
                rednet.send(id,"rsup")
312
                print("RedstoneUp")
313
                sleep(.5)
314
        end
315
 
316
        if y >= 15 and y <= 16 and x >= 16 and x <= 22 then
317
                rednet.send(id,"rsfront")
318
                print("RedstoneFront")
319
                sleep(.5)
320
        end
321
 
322
        if y >= 18 and y <= 19 and x >= 16 and x <= 22 then
323
                rednet.send(id,"rsdown")
324
                print("RedstoneDown")
325
                sleep(.5)
326
        end
327
end
328
 
329
 
330
while true do
331
 GUI()
332
end