View difference between Paste ID: gg4ERFwJ 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")
29+
30
elseif nOption == 5 then
31
   term.write("Console")
32-
elseif nOption == 6 then
32+
33
end
34
 
35
end
36
 
37
--GUI
38
term.clear()
39
local function drawFrontend()
40
   printCentered( math.floor(h/2) - 3, "")
41
   printCentered( math.floor(h/2) - 2, "Utilità" )
42
   printCentered( math.floor(h/2) - 1, "")
43-
   printCentered( math.floor(h/2) - 2, "UtilitåA0" )
43+
44
   printCentered( math.floor(h/2) + 1, ((nOption == 2) and "> Nuovo Foglio") or "Nuovo Foglio" )
45
   printCentered( math.floor(h/2) + 2, ((nOption == 3) and "> Visualizza i File") or "Visualizza i File" )
46
   printCentered( math.floor(h/2) + 3, ((nOption == 4) and "> Importa un Pastebin") or "Importa un Pastebin" )
47
   printCentered( math.floor(h/2) + 4, ((nOption == 5) and "> Usa la Console") or "Usa la Console" )
48-
   printCentered( math.floor(h/2) + 3, ((nOption == 4) and "> Visualizza Pacchetti WGet") or "Visualizza Pacchetti WGet" )
48+
49-
   printCentered( math.floor(h/2) + 4, ((nOption == 5) and "> Importa un Pastebin") or "Importa un Pastebin" )
49+
50-
   printCentered( math.floor(h/2) + 5, ((nOption == 6) and "> Usa la Console") or "Usa la Console" )
50+
51
drawMenu()
52
drawFrontend()
53
 
54
while true do
55
 sleep(0.1)
56
 local e,p = os.pullEvent()
57
 if e == "key" then
58
  local key = p
59
  if key == 17 or key == 200 then
60
 
61
   if nOption > 1 then
62
    nOption = nOption - 1
63
    drawMenu()
64
    drawFrontend()
65
   end
66
  elseif key == 31 or key == 208 then
67
  if nOption < 5 then
68
  nOption = nOption + 1
69
  drawMenu()
70-
  if nOption < 6 then
70+
71
end
72
elseif key == 28 then
73
    --End should not be here!!
74
break
75
end --End should be here!!
76
end
77
end
78
term.clear()
79
 
80
--Conditions
81
if nOption  == 1 then
82
shell.run(".FoxOS/.menu")
83
elseif nOption == 2 then
84
shell.run(".FoxOS/.newpaper")
85
elseif nOption == 3 then
86
shell.run(".FoxOS/.files")
87
elseif nOption == 4 then
88
shell.run(".FoxOS/.pastebin")
89
elseif nOption == 5 then
90
shell.run(".FoxOS/.console")
91-
shell.run(".FoxOS/.wgetlist")
91+
92
shell.run(".FoxOS/.what")
93
end