SHOW:
|
|
- or go back to the newest paste.
1 | - | os.loadAPI("p2") |
1 | + | |
2 | - | os.loadAPI("lg") |
2 | + | os.loadAPI("uap") |
3 | local sx,sy = term.getSize() | |
4 | local function mainButton() | |
5 | - | lg.setup("term") |
5 | + | |
6 | - | lg.drawBT("menu",1,lg.getSize().x,lg.getSize().y,lg.getSize().y,colors.white,colors.black," O") |
6 | + | if uap.getU() == true then |
7 | term.setTextColor(colors.white) | |
8 | - | local event, button, x, y = os.pullEvent( "mouse_click" ) |
8 | + | term.setBackgroundColor(colors.black) |
9 | - | if (lg.isButton(x,y) == "menu") then |
9 | + | for i=1,sx do |
10 | term.setCursorPos(i,1) | |
11 | term.write(" ") | |
12 | end | |
13 | - | lg.exit() |
13 | + | term.setCursorPos(1,1) |
14 | local time = os.time() | |
15 | local formattedTime = textutils.formatTime(time, false) | |
16 | - | function sopen(names) |
16 | + | write(formattedTime) |
17 | - | shell.run(names) |
17 | + | local isRO = false |
18 | for k,v in pairs(redstone.getSides()) do | |
19 | if (rednet.isOpen(v)) then | |
20 | - | name = namev |
20 | + | isRO = true |
21 | - | sopen(name) |
21 | + | |
22 | end | |
23 | - | function openFile(name) |
23 | + | local texxt = nil |
24 | if (isRO) then | |
25 | - | parallel.waitForAny(open,mainButton) |
25 | + | texxt = "Rednet: OK" |
26 | else | |
27 | texxt = "Rednet: OFF" | |
28 | end | |
29 | term.setCursorPos(sx-string.len(texxt),1) | |
30 | term.write(texxt) | |
31 | for i=1,sx do | |
32 | term.setCursorPos(i,sy) | |
33 | term.write(" ") | |
34 | end | |
35 | term.setCursorPos(sx/2+1,sy) | |
36 | write("O") | |
37 | uap.setU(false) | |
38 | end | |
39 | os.sleep(0.1) | |
40 | end | |
41 | end | |
42 | local function click() | |
43 | while true do | |
44 | local event, button, x, y = os.pullEvent( "mouse_click") | |
45 | if (y == sy) then | |
46 | os.reboot() | |
47 | end | |
48 | end | |
49 | end | |
50 | local namev = nil | |
51 | local function open() | |
52 | local file = fs.open(names,"r") | |
53 | if file then | |
54 | shell.run(namev) | |
55 | file.close() | |
56 | else | |
57 | term.clear() | |
58 | error("App is not installed! Maybe check Updater!") | |
59 | end | |
60 | end | |
61 | function openFile(name,noUI) | |
62 | namev = name | |
63 | if noUI then | |
64 | open() | |
65 | else | |
66 | parallel.waitForAny(click,open,mainButton) | |
67 | end | |
68 | end | |
69 | function writePersistentValue(variable,value) | |
70 | local var = fs.open(".variables/"..variable,"w") | |
71 | var.write(value) | |
72 | var.close() | |
73 | end | |
74 | function getPersistentValue(variable) | |
75 | local var = fs.open(".variables/"..variable,"r") | |
76 | value = var.readAll() | |
77 | var.close() | |
78 | return value | |
79 | end |