View difference between Paste ID: LFBEHD3w and ctKYtt2u
SHOW: | | - or go back to the newest paste.
1
os.pullEvent = os.pullEventRaw
2
 
3
local w,h = term.getSize()
4
 
5
function printCentered( y,s )
6
   local x = math.floor((w - string.len(s)) / 2)
7
   term.setCursorPos(x,y)
8
   term.clearLine()
9
   term.write( s )
10
end
11
 
12
local nOption = 1
13
 
14
local function drawMenu()
15
   term.clear()
16
   term.setCursorPos(1,1)
17
   term.write("FoxOS by FoxWorn3365  |  2020")
18
term.setCursorPos(1,2)
19
shell.run("id")
20
 
21
   term.setCursorPos(w-11,1)
22
   if nOption == 1 then
23
   term.write("Indietro")
24
elseif nOption == 2 then
25
   term.write("Nuovo Foglio")
26
elseif nOption == 3 then
27
   term.write("Files")
28
elseif nOption == 4 then
29
   term.write("WGet")
30
elseif nOption == 5 then
31
   term.write("PasteBin")
32
elseif nOption == 6 then
33
   term.write("Console")
34
else
35
end
36
 
37
end
38
 
39
--GUI
40
term.clear()
41
local function drawFrontend()
42
   printCentered( math.floor(h/2) - 3, "")
43
   printCentered( math.floor(h/2) - 2, "UtilitåA0" )
44
   printCentered( math.floor(h/2) - 1, "")
45
   printCentered( math.floor(h/2) + 0, ((nOption == 1) and "> Torna Indietro") or "Torna Indietro" )
46
   printCentered( math.floor(h/2) + 1, ((nOption == 2) and "> Nuovo Foglio") or "Nuovo Foglio" )
47
   printCentered( math.floor(h/2) + 2, ((nOption == 3) and "> Visualizza i File") or "Visualizza i File" )
48
   printCentered( math.floor(h/2) + 3, ((nOption == 4) and "> Visualizza Pacchetti WGet") or "Visualizza Pacchetti WGet" )
49
   printCentered( math.floor(h/2) + 4, ((nOption == 5) and "> Importa un Pastebin") or "Importa un Pastebin" )
50
   printCentered( math.floor(h/2) + 5, ((nOption == 6) and "> Usa la Console") or "Usa la Console" )
51
end
52
 
53
--Display
54
drawMenu()
55
drawFrontend()
56
 
57
while true do
58
 sleep(0.1)
59
 local e,p = os.pullEvent()
60
 if e == "key" then
61
  local key = p
62
  if key == 17 or key == 200 then
63
 
64
   if nOption > 1 then
65
    nOption = nOption - 1
66
    drawMenu()
67
    drawFrontend()
68
   end
69
  elseif key == 31 or key == 208 then
70
  if nOption < 6 then
71
  nOption = nOption + 1
72
  drawMenu()
73
  drawFrontend()
74
end
75
elseif key == 28 then
76
    --End should not be here!!
77
break
78
end --End should be here!!
79
end
80
end
81
term.clear()
82
 
83
--Conditions
84
if nOption  == 1 then
85
shell.run(".FoxOS/.menu")
86
elseif nOption == 2 then
87
shell.run(".FoxOS/.newpaper")
88
elseif nOption == 3 then
89
shell.run(".FoxOS/.files")
90
elseif nOption == 4 then
91
shell.run(".FoxOS/.wgetlist")
92
elseif nOption == 5 then
93
shell.run(".FoxOS/.pastebin")
94
elseif nOption == 6 then
95
shell.run(".FoxOS/.console")
96
else
97
shell.run(".FoxOS/.what")
98
end