· last year · Jan 25, 2024, 02:35 AM
1-- For advance computers else change colours to black and white!!
2
3-- Version 0.0.3
4
5sleep(1) -- Wait some time so the portal can start.
6
7local file -- Local to put file names in.
8
9local w, h = term.getSize() -- Get screen height and width.
10
11local interface -- Local for the portal interface.
12local Monitor -- Local for the Monitor.
13local OldTerm -- Local to put in the terminal screen when switch to monitor
14local test -- Local just for testing stuff
15local MonitorState = "M" -- Local for the monitor state. M = monitor, T = Terminal
16local found = false -- Local for if something is found or not.
17
18local CLS = term.clear -- New command for clearing the complete screen.
19local setCurs = term.setCursorPos -- New command for setting the cursor position.
20local Loop = true -- Local for head menu to loop or end.
21
22for i,name in pairs(peripheral.getNames()) do -- Go through all attached things and get the names.
23
24 for j,method in pairs(peripheral.getMethods(name)) do -- Go through all methods that are avadible.
25
26 if (method == 'clear') then -- If found metod clear then do
27
28 Monitor = peripheral.wrap(name) -- Set and warp local monitor to the real monitor.
29 found = true -- Set local found to true.
30
31 end -- end if statement
32
33 if (found) then -- If local found is true then do.
34
35 break -- Break the for ..... do.
36
37 end -- end if statement.
38
39 end -- end for ..... do.
40
41 if (found) then -- If local found is true then do.
42
43 break -- Break the for ..... do.
44
45 end -- end if statement.
46
47end -- end for ..... do.
48
49local X, Y -- local for the height and width for the screen or monitor
50
51if MonitorState == "T" then -- If local monitorstate is T do.
52 X, Y = term.getSize() -- Get screen height and width.
53elseif MonitorState == "M" and Monitor then -- Else if local monitorstate is M do.
54 OldTerm = term.redirect(Monitor) -- Set the term screen in the local oldterm to not loose it,
55 Monitor.setTextScale(1) -- Set the scale of the text on the screen
56 X, Y = Monitor.getSize() -- Get screen height and width.
57end -- end if statement.
58
59local X2, Y2 = X / 2, Y /2 -- Some calculations for the screen and saved in the locals.
60local a = X + 1 - X2 -- Some calculations for the screen and saved in the locals.
61local b = Y + 1 - Y2 -- Some calculations for the screen and saved in the locals.
62
63local MenuScreen = window.create(term.current(),1,1,X2,Y) -- Make in screen a new window.
64MenuScreen.setBackgroundColour(colours.blue) -- Set background color in this window.
65MenuScreen.setTextColour(colours.white) -- Set text color in this window.
66MenuScreen.clear() -- Clear the window and put in that backgound color.
67local MenuScreenX, MenuScreenY = MenuScreen.getSize() -- Get window height and width.
68local MenuScreenX2, MenuScreenY2 = MenuScreenX/2, MenuScreenY/2 -- Some calculations for the window and saved in the locals.
69
70local DailScreen = window.create(term.current(),X2+1,1,a,Y2) -- Make in screen a new window.
71DailScreen.setBackgroundColour(colours.green) -- Set background color in this window.
72DailScreen.setTextColour(colours.black) -- Set text color in this window.
73DailScreen.clear() -- Clear the window and put in that backgound color.
74local DailScreenX, DailScreenY = DailScreen.getSize() -- Get window height and width.
75local DailScreenX2, DailScreenY2 = DailScreenX/2, DailScreenY/2 -- Some calculations for the window and saved in the locals.
76
77local IncomingScreen = window.create(term.current(),X2+1,Y2+1,a,b) -- Make in screen a new window.
78IncomingScreen.setBackgroundColour(colours.red) -- Set background color in this window.
79IncomingScreen.setTextColour(colours.black) -- Set text color in this window.
80IncomingScreen.clear() -- Clear the window and put in that backgound color.
81local IncomingScreenX, IncomingScreenY = IncomingScreen.getSize() -- Get window height and width.
82local IncomingScreenX2, IncomingScreenY2 = IncomingScreenX/2, IncomingScreenY/2 -- Some calculations for the window and saved in the locals.
83
84local Text = "" -- Local for text.
85local timer -- Local for a timer.
86local z -- Local for a line number.
87
88local Addresses = { -- Local for adresses to dail to.
89 [1] = {
90 Name = "Abydos", -- Name to dail to.
91 Address = {26,6,14,31,11,29,0} -- ID (Address) to dail to, end with a 0 (zero) to start dailing.
92 },
93 [2] = {
94 Name = "Chulak",
95 Address = {8,1,22,14,36,19,0}
96 },
97 [3] = {
98 Name = "Lantea",
99 Address = {18,20,1,15,14,7,19,0}
100 },
101 [4] = {
102 Name = "Earth",
103 Address = {16,23,32,12,19,15,18,22,0} -- own made potal, change me to ur own.
104 },
105 [5] = {
106 Name = "Space Fairy",
107 Address = {35,27,26,29,34,25,23,31,0} -- Space station in orbid (Ad astra mod), change me to ur own or del me and make nether roof number 5.
108 },
109 [6] = {
110 Name = "Nether Roof",
111 Address = {8,35,34,25,14,27,15,2,0} -- found nether roof portal.
112 }
113} -- add your own adress to TXT or Press = in Menu, Or do it like her and change them.
114
115if fs.exists("Addresses.txt") then -- If file exists then do.
116 file = fs.open("Addresses.txt", "r") -- Open the file.
117 Addresses = textutils.unserialize(file.readAll()) -- Read the file and save it in the local Addresses.
118 file.close() -- Close the file.
119else -- If file not exists then do.
120 file = fs.open("Addresses.txt", "w") -- Make the file.
121 file.write(textutils.serialize(Addresses)) -- Safe the local Addresses in the file.
122 file.close() -- Close the file.
123end -- end if statement.
124
125found = false -- Set local found to false again.
126
127for i,name in pairs(peripheral.getNames()) do -- Go through all attached things and get the names.
128
129 for j,method in pairs(peripheral.getMethods(name)) do -- Go through all methods that are avadible.
130
131 if (method == 'getChevronsEngaged') then -- If found metod getVhevronsEngaged then do
132
133 interface = peripheral.wrap(name) -- Set and warp local interface to the portal interface.
134 found = true -- Set local found to true.
135
136 end -- end if statement.
137
138 if (found) then -- If local found is true then do.
139
140 break -- Break the for ..... do.
141
142 end -- end if statement.
143
144 end -- end for ..... do.
145
146 if (found) then -- If local found is true then do.
147
148 break -- Break the for ..... do.
149
150 end -- end if statement.
151
152end -- end for ..... do.
153
154local buttona = {} -- Local for Api Buttons.
155local color = {
156 normale = {
157 text = colors.white,
158 background = colors.blue
159 },
160 clicked = {
161 text = colors.blue,
162 background = colors.white
163 }
164 } -- Set some colors for the buttons.
165
166function classButton() -- Make the button Api.
167
168 clsButton = {}
169 clsButton.__index = clsButton -- failed table lookups on the instances should fallback to the class table, to get methods
170
171 local self = setmetatable({}, clsButton)
172
173 function clsButton.clearButtons(self) buttona = {} end -- Clear the local buttona
174
175 function clsButton.setButton(self, name, func, xmin, xmax, ymin, ymax, state, extra)
176
177 buttona[name] = {}
178 buttona[name]["func"] = func
179 buttona[name]["extra"] = extra
180 buttona[name]["active"] = false
181 buttona[name]["show"] = state
182 buttona[name]["xmin"] = xmin
183 buttona[name]["ymin"] = ymin
184 buttona[name]["xmax"] = xmax
185 buttona[name]["ymax"] = ymax
186
187 end
188
189 function clsButton.setButtonShow(self, name, data)
190
191 buttona[name]["show"] = data
192
193 end
194
195 function clsButton.onScreen(self)
196
197 local background
198 local text
199
200 for name,data in pairs(buttona) do
201
202 if data["show"] then
203
204 if term.isColor then
205
206 if (data["active"]) then
207
208 background = color.clicked.background
209 text = color.clicked.text
210
211 else
212
213 background = color.normale.background
214 text = color.normale.text
215
216 end
217
218 else
219
220 if (data["active"]) then
221
222 background = colors.white
223 text = colors.black
224
225 else
226
227 background = colors.black
228 text = colors.white
229
230 end
231
232 end
233
234 term.setBackgroundColor(background)
235 term.setTextColor(text)
236
237 local yspot = math.floor((data["ymin"] + data["ymax"]) /2)
238 local xspot = math.floor((data["xmax"] - data["xmin"] - string.len(name)) /2) +1
239
240 for j = data["ymin"], data["ymax"] do
241
242 term.setCursorPos(data["xmin"]-2, j)
243
244 if j == yspot then
245
246 term.write(name)
247
248 else
249
250 for i = data["xmin"], data["xmax"] do
251
252 term.write(" ")
253
254 end
255
256 end
257
258 end
259
260 term.setBackgroundColor(colors.black)
261 term.setTextColor(colors.white)
262
263 end
264
265 end
266
267 end
268
269 function clsButton.toggleButton(self, name)
270
271 buttona[name]["active"] = not buttona[name]["active"]
272 clsButton.onScreen()
273
274 end
275
276 function clsButton.flashButton(self, name)
277
278 clsButton.toggleButton(self, name)
279 clsButton.onScreen(self)
280 sleep(0.15)
281 clsButton.toggleButton(self, name)
282 clsButton.onScreen(self)
283
284 end
285
286 function clsButton.buttonPressed(self, x, y)
287
288 for name, data in pairs(buttona) do
289
290 if data["show"] then
291
292 if y>=data["ymin"] and y <= data["ymax"] then
293
294 if x>=data["xmin"] and x<= data["xmax"] then
295
296 clsButton.flashButton(self,name)
297
298 if data["extra"] then
299
300 data["func"](data["extra"])
301
302 else
303
304 data["func"]()
305
306 end
307
308 return true
309
310 end
311
312 end
313
314 end
315
316 end
317
318 return false
319
320 end
321
322 return self
323
324end
325
326local Button = classButton() -- Set the button Api.
327
328
329function MakeButtons() -- To make the buttons.
330 z = 2
331 for i in pairs(Addresses) do -- For the addresses
332 z = z + 1
333 MenuScreen.setCursorPos(2, z)
334 if i <= 9 then
335 Text = string.format("%3i%s%s", i, " = ", Addresses[i].Name) -- Set text
336 Button:setButton(Text, dial, 2, MenuScreenX - 1, z, z, true, Addresses[i]) -- Make a button with the text and use some locals to set heigh and width. (Text, function, xmin, xmax, ymin, ymax, Visable, extra for the funtion like Funtion -> Dail(extra -> addresses(1))).
337 end
338
339
340 -- This is for if there are more then 9 addresses.
341 -- if i > 9 then
342 -- if i == 10 then
343 -- Text = string.format("%s%s%s", "A", " = ", Addresses[i].Name)
344 -- Button:setButton(Text, dial, 2, MenuScreenX - 1, z, z, true, Addresses[i])
345 -- elseif i == 11 then
346 -- Text = string.format("%s%s%s", "B", " = ", Addresses[i].Name)
347 -- Button:setButton(Text, dial, 2, MenuScreenX - 1, z, z, true, Addresses[i])
348 -- end
349 -- end
350 end
351
352 if Monitor then -- If monitor found do.
353 MenuScreen.setCursorPos(2, z+2)
354 Text = " M = Change Screen"
355 Button:setButton(Text, ChangeMonitor, 2, MenuScreenX - 1, z+2, z+2, true)
356 MenuScreen.setCursorPos(2, z+3)
357 Text = " R = Reset"
358 Button:setButton(Text, Resset, 2, MenuScreenX - 1, z+3, z+3, true)
359 MenuScreen.setCursorPos(2, z+4)
360 Text = " Q = Quit Program"
361 Button:setButton(Text, Quitt, 2, MenuScreenX - 1, z+4, z+4, true)
362 else -- If no monitor found do.
363 MenuScreen.setCursorPos(2, z+3)
364 Text = " R = Reset"
365 Button:setButton(Text, Resset, 2, MenuScreenX - 1, z+3, z+3, true)
366 MenuScreen.setCursorPos(2, z+4)
367 Text = " Q = Quit Program"
368 Button:setButton(Text, Quitt, 2, MenuScreenX - 1, z+4, z+4, true)
369 end
370
371end
372
373function Buttonshow(What) -- To set a button to visable or not.
374 for i in pairs(Addresses) do
375 if i <= 9 then
376 Text = string.format("%3i%s%s", i, " = ", Addresses[i].Name)
377 Button:setButtonShow(Text, What)
378 end
379 end
380end
381
382
383function Recount() -- When change monitor to screen or back, it need to recount every thing.
384
385 if MonitorState == "T" then
386 X, Y = term.getSize()
387 elseif MonitorState == "M" then
388 Monitor.setTextScale(1)
389 X, Y = Monitor.getSize()
390 end
391
392 X2, Y2 = X / 2, Y /2
393 a = X + 1 - X2
394 b = Y + 1 - Y2
395
396 MenuScreen.reposition(1,1,X2,Y,term.current())
397 MenuScreenX, MenuScreenY = MenuScreen.getSize()
398 MenuScreenX2, MenuScreenY2 = MenuScreenX/2, MenuScreenY/2
399
400 DailScreen.reposition(X2+1,1,a,Y2,term.current())
401 DailScreenX, DailScreenY = DailScreen.getSize()
402 DailScreenX2, DailScreenY2 = DailScreenX/2, DailScreenY/2
403
404 IncomingScreen.reposition(X2+1,Y2+1,a,b,term.current())
405 IncomingScreenX, IncomingScreenY = IncomingScreen.getSize()
406 IncomingScreenX2, IncomingScreenY2 = IncomingScreenX/2, IncomingScreenY/2
407
408end
409
410function ChangeMonitor() -- When change monitor to screen or back.
411 if MonitorState == "T" and Monitor then
412 term.setBackgroundColour(colours.black)
413 CLS()
414 OldTerm = term.redirect(Monitor) -- Set term in oldterm and change to monitor
415 MonitorState = "M"
416 Recount()
417 term.setBackgroundColour(colours.blue)
418 elseif MonitorState == "M" and Monitor then
419 term.setBackgroundColour(colours.black)
420 CLS()
421 test = term.redirect(OldTerm) -- Set monitor in test and change back to term
422 MonitorState = "T"
423 Recount()
424 term.setBackgroundColour(colours.blue)
425 end
426end
427
428
429
430function SaveFile() -- Save the adresses in a file
431 file = fs.open("Addresses.txt", "w")
432 file.write(textutils.serialize(Addresses))
433 file.close()
434end
435
436function dial(address) -- Dial to the gate
437 local a = address.Address
438 local addressLength = #a
439 local start = interface.getChevronsEngaged() + 1
440
441 Buttonshow(false)
442 MenuScreen.clear()
443
444 term.setBackgroundColour(colours.green)
445 term.setTextColour(colours.black)
446
447 DailScreen.clear()
448
449 for chevron = start,addressLength,1 do
450
451 local symbol = address.Address[chevron]
452
453 if chevron % 2 == 0 then
454 interface.rotateClockwise(symbol)
455 else
456 interface.rotateAntiClockwise(symbol)
457 end
458
459 DailScreen.clear()
460 DailScreen.setCursorPos(DailScreenX2 - 10, DailScreenY2 - 1)
461 print("Dailing:",address.Name)
462 DailScreen.setCursorPos(DailScreenX2 - 10, DailScreenY2)
463 print("Symbol:",chevron," = ",symbol)
464 DailScreen.setCursorPos(DailScreenX2 - 10, DailScreenY2 + 1)
465 print("State: Locating")
466
467 while(not interface.isCurrentSymbol(symbol)) do
468 sleep(0)
469 end
470
471 if interface.openChevron() == 11 then
472
473 DailScreen.clear()
474 DailScreen.setCursorPos(DailScreenX2 - 10, DailScreenY2 - 1)
475 print("Dailing:",address.Name)
476 DailScreen.setCursorPos(DailScreenX2 - 10, DailScreenY2)
477 print("Symbol:",chevron," = ",symbol)
478 DailScreen.setCursorPos(DailScreenX2 - 10, DailScreenY2 + 1)
479 print("State: Lock On")
480 sleep(1)
481 end
482
483 if interface.closeChevron() == 1 then
484
485 DailScreen.clear()
486 DailScreen.setCursorPos(DailScreenX2 - 10, DailScreenY2 - 1)
487 print("Dailing:",address.Name)
488 DailScreen.setCursorPos(DailScreenX2 - 10, DailScreenY2)
489 print("Symbol:",chevron," = ",symbol)
490 DailScreen.setCursorPos(DailScreenX2 - 10, DailScreenY2 + 1)
491 print("State: Locked")
492 sleep(1)
493 end
494
495 if chevron == addressLength then
496
497 DailScreen.clear()
498 DailScreen.setCursorPos(DailScreenX2 - 10, DailScreenY2 - 1)
499 print("Opening portal to:")
500 DailScreen.setCursorPos(DailScreenX2 - 10, DailScreenY2)
501 print(address.Name)
502 sleep(3)
503 DailScreen.clear()
504 DailScreen.setCursorPos(DailScreenX2 - 10, DailScreenY2 - 1)
505 print("Portal Open to")
506 DailScreen.setCursorPos(DailScreenX2 - 10, DailScreenY2)
507 print(address.Name)
508 term.setBackgroundColour(colours.red)
509 IncomingScreen.clear()
510 IncomingScreen.setCursorPos(IncomingScreenX2 - 10, IncomingScreenY2 - 1)
511 print("Incoming Portal from ")
512 IncomingScreen.setCursorPos(IncomingScreenX2 - 10, IncomingScreenY2)
513 print("?")
514 IncomingScreen.setCursorPos(IncomingScreenX2 - 10, IncomingScreenY2 + 1)
515 print("Portal Open True")
516 while interface.isStargateConnected() do
517 timer = os.startTimer(3)
518 local Event, p1, p2, p3, p4, p5 = os.pullEvent()
519 if Event == "timer" then
520 sleep(0)
521 elseif Event == "key" then
522 if p1 == keys.zero or p1 == keys.numPad0 then
523 interface.disconnectStargate()
524 end
525 end
526 end
527 end
528 end
529
530 term.setBackgroundColour(colours.blue)
531 term.setTextColour(colours.white)
532
533end
534
535function Incoming() -- On incoming wormhole
536
537 term.setBackgroundColour(colours.red)
538 term.setTextColour(colours.black)
539
540 MenuScreen.clear()
541
542 IncomingScreen.clear()
543 IncomingScreen.setCursorPos(IncomingScreenX2 - 10, IncomingScreenY2 - 1)
544 print("Incoming Portal from ")
545 IncomingScreen.setCursorPos(IncomingScreenX2 - 10, IncomingScreenY2)
546 print("?")
547 IncomingScreen.setCursorPos(IncomingScreenX2 - 10, IncomingScreenY2 + 1)
548 print("Portal Open True")
549 while interface.isStargateConnected() do
550 timer = os.startTimer(1)
551 local Event, p1, p2, p3, p4, p5 = os.pullEvent()
552 if Event == "timer" then
553 sleep(0)
554 elseif Event == "key" then
555 if p1 == keys.zero or p1 == keys.numPad0 then
556 interface.disconnectStargate() -- close the gate
557 end
558 end
559 end
560 IncomingScreen.clear()
561 term.setBackgroundColour(colours.blue)
562 term.setTextColour(colours.white)
563 CLS()
564end
565
566function AddAddress() -- Add address
567
568 CLS()
569 setCurs(1,Y2)
570 term.write("Name: ")
571 local name = io.read()
572
573 CLS()
574 setCurs(1,Y2)
575 term.write("Close with a zero")
576 setCurs(1,Y2+1)
577 term.write("Adress A:")
578 local A = tonumber(io.read())
579 local B
580 local C
581 local D
582 local E
583 local F
584 local G
585 local H
586 local I
587
588 if A ~= 0 and A ~= nil then
589 CLS()
590 setCurs(1,Y2)
591 term.write("Close with a zero")
592 setCurs(1,Y2+1)
593 term.write("Adress B:")
594 B = tonumber(io.read())
595 end
596
597 if B ~= 0 and B ~= nil then
598 CLS()
599 setCurs(1,Y2)
600 term.write("Close with a zero")
601 setCurs(1,Y2+1)
602 term.write("Adress C:")
603 C = tonumber(io.read())
604 end
605
606 if C ~= 0 and C ~= nil then
607 CLS()
608 setCurs(1,Y2)
609 term.write("Close with a zero")
610 setCurs(1,Y2+1)
611 term.write("Adress D:")
612 D = tonumber(io.read())
613 end
614
615 if D ~= 0 and D ~= nil then
616 CLS()
617 setCurs(1,Y2)
618 term.write("Close with a zero")
619 setCurs(1,Y2+1)
620 term.write("Adress E:")
621 E = tonumber(io.read())
622 end
623
624 if E ~= 0 and E ~= nil then
625 CLS()
626 setCurs(1,Y2)
627 term.write("Close with a zero")
628 setCurs(1,Y2+1)
629 term.write("Adress F:")
630 F = tonumber(io.read())
631 end
632
633 if F ~= 0 and F ~= nil then
634 CLS()
635 setCurs(1,Y2)
636 term.write("Close with a zero")
637 setCurs(1,Y2+1)
638 term.write("Adress G:")
639 G = tonumber(io.read())
640 end
641
642 if G ~= 0 and G ~= nil then
643 CLS()
644 setCurs(1,Y2)
645 term.write("Close with a zero")
646 setCurs(1,Y2+1)
647 term.write("Adress H:")
648 H = tonumber(io.read())
649 end
650
651 if H ~= 0 and H ~= nil then
652 CLS()
653 setCurs(1,Y2)
654 term.write("Close with a zero")
655 setCurs(1,Y2+1)
656 term.write("Adress I:")
657 I = tonumber(io.read())
658 end
659
660 local Data = { Name = tostring(name), Address = {A, B, C, D, E, F, G, H, I} }
661
662 table.insert(Addresses, Data)
663
664 SaveFile()
665end
666
667function Resset() -- Reset the gate. Like if crashed while dialing.
668 Buttonshow(false)
669 MenuScreen.clear()
670 interface.closeChevron()
671 sleep(1)
672 interface.rotateClockwise(0)
673 while(not interface.isCurrentSymbol(0)) do
674 sleep(0)
675 end
676 interface.openChevron()
677 sleep(1)
678 interface.closeChevron()
679 sleep(1)
680
681 if interface.isStargateConnected() then
682 interface.disconnectStargate()
683 end
684
685 interface.closeChevron()
686 sleep(1)
687 interface.rotateClockwise(0)
688 while(not interface.isCurrentSymbol(0)) do
689 sleep(0)
690 end
691 interface.openChevron()
692 sleep(1)
693 interface.closeChevron()
694 sleep(1)
695
696 if interface.isStargateConnected() then
697 interface.disconnectStargate()
698 end
699 term.setBackgroundColour(colours.blue)
700 term.setTextColour(colours.white)
701end
702
703function Quitt() -- Quit the program and reboot the computer
704 Loop = false
705 CLS()
706 setCurs(1, 1)
707end
708
709
710MakeButtons() -- Go to and do
711
712CLS()
713MenuScreen.clear()
714
715while Loop do
716
717 timer = os.startTimer(1) -- Start a timer
718
719 term.setBackgroundColour(colours.blue)
720 term.setTextColour(colours.white)
721
722 MenuScreen.setCursorPos(2, 1)
723 print("Awaiting input:")
724
725 Button:onScreen()
726
727 term.setBackgroundColour(colours.green)
728 term.setTextColour(colours.black)
729
730 DailScreen.clear()
731 DailScreen.setCursorPos(DailScreenX2 - 10, DailScreenY2 - 1)
732 print("Dailing:")
733 DailScreen.setCursorPos(DailScreenX2 - 10, DailScreenY2)
734 print("Symbol:")
735 DailScreen.setCursorPos(DailScreenX2 - 10, DailScreenY2 + 1)
736 print("State:")
737
738 term.setBackgroundColour(colours.red)
739 term.setTextColour(colours.black)
740
741 IncomingScreen.clear()
742 IncomingScreen.setCursorPos(IncomingScreenX2 - 10, IncomingScreenY2 - 1)
743 print("Incoming Portal from ")
744 IncomingScreen.setCursorPos(IncomingScreenX2 - 10, IncomingScreenY2)
745 print("?")
746 IncomingScreen.setCursorPos(IncomingScreenX2 - 10, IncomingScreenY2 + 1)
747 print("Portal Open False")
748
749 term.setBackgroundColour(colours.blue)
750 term.setTextColour(colours.white)
751
752 local Event, p1, p2, p3, p4, p5 = os.pullEvent()
753
754 if Event == "key" then -- wWen a key is pressed
755
756 MenuScreen.clear()
757
758 if p1 == keys.one or p1 == keys.numPad1 then -- Dial to
759 dial(Addresses[1])
760 elseif p1 == keys.two or p1 == keys.numPad2 then -- Dial to
761 dial(Addresses[2])
762 elseif p1 == keys.three or p1 == keys.numPad3 then -- Dial to
763 dial(Addresses[3])
764 elseif p1 == keys.four or p1 == keys.numPad4 then -- Dial to
765 dial(Addresses[4])
766 elseif p1 == keys.five or p1 == keys.numPad5 then -- Dial to
767 dial(Addresses[5])
768 elseif p1 == keys.six or p1 == keys.numPad6 then -- Dial to
769 dial(Addresses[6])
770 -- elseif p1 == keys.a then -- Dial to
771 -- dial(Addresses[10])
772 elseif p1 == keys.m and Monitor then -- Change to monitor or back to terminal
773 ChangeMonitor()
774 elseif p1== keys.equals then -- Add address
775 AddAddress()
776 elseif p1 == keys.q then -- Quit
777 Quitt()
778 elseif p1 == keys.r then -- Reset
779 Resset()
780 elseif p1 == keys.zero or p1 == keys.numPad0 then -- Dissconnect
781 interface.disconnectStargate()
782 end
783
784 Buttonshow(true)
785 DailScreen.clear()
786 CLS()
787
788 elseif Event == "mouse_click" and MonitorState == "T" then -- For the buttons when clicked on them
789
790 MenuScreen.clear()
791
792 local Buton, MX, MY = p1, p2, p3
793
794 Button:buttonPressed(MX, MY)
795
796 Buttonshow(true)
797 DailScreen.clear()
798 CLS()
799
800 elseif Event == "monitor_touch" and MonitorState == "M" then -- For the buttons when clicked on them
801
802 MenuScreen.clear()
803
804 local Buton, MX, MY = p1, p2, p3
805
806 Button:buttonPressed(MX, MY)
807
808 Buttonshow(true)
809 DailScreen.clear()
810 CLS()
811
812 elseif Event == "timer" then -- when the timer expires
813
814 if interface.isStargateConnected() == true then
815 Buttonshow(false)
816 Incoming()
817 Buttonshow(true)
818 end
819
820 sleep(0)
821
822 end
823
824end
825
826
827os.reboot()
828