View difference between Paste ID: Sk5iCSTG and sdariXHn
SHOW: | | - or go back to the newest paste.
1
-- Posizione del Modem
2
mSide = "bottom"
3
4
term.setBackgroundColor(colors.white)
5
term.clear()
6
7
-- Sistemo le funzioni per tutto
8
function header(text, color)
9
  term.setBackgroundColor(colors[color])
10
  term.setTextColor(colors.white)
11
  term.setCursorPos(1, 1)
12
  print(text)
13
end
14
15
function button(x, y, text, color, bkcolor)
16
  term.setBackgroundColor(colors[bkcolor])
17
  term.setTextColor(colors[color])
18
  term.setCursorPos(x, y)
19
  print(text)
20
end
21
22
function bkText(text, col, bkcol)
23
   term.setBackgroundColor(colors[bkcol])
24
   term.setTextColor(colors[col])
25
   print(text)
26
end
27
28
function text(text, color)
29
  term.setBackgroundColor(colors.white)
30
  term.setTextColor(colors[color])
31
  print(text)
32
end
33
34
function n(col)
35
  term.setBackgroundColor(colors.white)
36
  term.setTextColor(colors[col])
37
end
38
39
function popupPos(aa)
40
  term.setCursorPos(5, aa)
41
end
42
43
function popup(text, text1, text2, text3, text4, text5) --TEXT = MAX 15 - MM = MAX 15
44
  drawFilledBox(5, 2, 27, 9, colours.grey)
45
  term.setTextColor(colors.white)
46
  term.setCursorPos(5, 2)
47
  print("|---------------------|")
48
  term.setCursorPos(5, 3)
49
  print(text)
50
  popupPos(4)
51
  print(text1)
52
  popupPos(5)
53
  print(text2)
54
  popupPos(6)
55
  print(text3)
56
  popupPos(7)
57
  print(text4)
58
  popupPos(8)
59
  print(text5)
60
  term.setCursorPos(5, 9)
61
  print("|---------------------|")
62
end
63
64
local function drawPixelInternal(xPos, yPos)
65
    term.setCursorPos(xPos, yPos)
66
    term.write(" ")
67
end
68
69
local tColourLookup = {}
70
for n = 1, 16 do
71
    tColourLookup[string.byte("0123456789abcdef", n, n)] = 2 ^ (n - 1)
72
end
73
74
function drawFilledBox(startX, startY, endX, endY, nColour)
75
    if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~=
76
        "number" or type(endY) ~= "number" or
77
        (nColour ~= nil and type(nColour) ~= "number") then
78
        error("Expected startX, startY, endX, endY, colour", 2)
79
    end
80
 
81
    startX = math.floor(startX)
82
    startY = math.floor(startY)
83
    endX = math.floor(endX)
84
    endY = math.floor(endY)
85
 
86
    if nColour then term.setBackgroundColor(nColour) end
87
    if startX == endX and startY == endY then
88
        drawPixelInternal(startX, startY)
89
        return
90
    end
91
 
92
    local minX = math.min(startX, endX)
93
    if minX == startX then
94
        minY = startY
95
        maxX = endX
96
        maxY = endY
97
    else
98
        minY = endY
99
        maxX = startX
100
        maxY = startY
101
    end
102
 
103
    for x = minX, maxX do for y = minY, maxY do drawPixelInternal(x, y) end end
104
end
105
106
-- Attivo MERDGOOGLE
107
local modem = peripheral.wrap(mSide)
108
modem.setListening(80, true)
109
110
v = 0
111
while true do
112
if v == 0 then
113
114
term.clear()
115
header("                     GAUGLE                  [INFO]", "blue")
116
117
  text("\n\nBenvenuto su GAUGLE!\nIn questo browser potrai cercare roba bella!", "black")
118
  button(15, 7, "  CERCA QUALCOSA  ", "white", "green")
119
  button(15, 9, "  AGGIORNA GAUGLE ", "white", "orange")  
120
121
local event, tasto, x, y = os.pullEvent("mouse_click")
122
if y == 7 and x > 15 and x < 33 then
123
  v = 1
124
elseif y == 9 and x > 15 and x < 33 then
125
  shell.run("rm startup")
126
  shell.run("pastebin get RCGKxMdS startup")
127
  shell.run("startup")
128
elseif y == 1 and x > 45 then
129
  v = 3
130
else
131
  shell.run("startup")
132
end
133
elseif v == 1 then
134
  term.setBackgroundColor(colors.white)
135
  term.clear()
136
  header("                     GAUGLE                        ", "blue")
137
  term.setCursorPos(10, 6)
138
  text("Vai al sito:", "black")
139
  term.setCursorPos(10, 7)
140
  url = read()
141
if url == "gaugle://info" then
142
   v = 3
143
else
144
  v = 2
145
end
146
elseif v == 2 then
147
        term.clear()
148
 
149
  
150
  modem.sendChannel(80, url)
151
  
152
  local event, side, id, chn, msg = os.pullEvent("lan_message")
153
154
  if msg == "ERROR_404" then
155
  term.setBackgroundColor(colors.white)
156
  term.clear()
157
  header("[HOME]                GAUGLE             [RESEARCH]", "blue")
158
  text("http://"..url, "gray")
159
  text("\nERRORE 404 - Pagina non trovata", "red")
160
  else
161
  term.setBackgroundColor(colors.white)
162
  term.clear()
163
  header("[HOME]                GAUGLE             [RESEARCH]", "blue")
164
  text("http://"..url, "gray")
165
  text("\n"..msg, "black")
166
  end
167
  local event, button, x, y = os.pullEvent("mouse_click")
168
    if y == 1 and x < 7 then
169
     v = 0
170
    elseif y == 1 and x > 43 then
171
       drawFilledBox(5, 7, 37, 10, colours.grey)
172
       term.setCursorPos(6, 8)
173
       bkText("Cerca qualcosa:", "white", "gray")
174
       drawFilledBox(6, 9, 35, 9, colours.blue)
175
       term.setCursorPos(6, 9)
176
       url = read()
177
       if url == "gaugle://info" then
178
           v = 3
179
       else
180
           v = 2
181
       end
182
       term.clear()
183
    end
184
  elseif v == 3 then
185
   term.setBackgroundColor(colors.white)
186
   term.clear()
187
   header("[HOME]                GAUGLE                       ", "blue")
188
   text("gaugle://info", "gray")
189
   text("\n\nGAUUUGLE!\n\nMade by: FoxWorn3365\nVersion: v1.0.3C [RELASE 05]", "black")
190
   local event, button, x, y = os.pullEvent("mouse_click")
191
   if y == 1 and x < 10 then
192
      v = 0
193
    end
194
  end
195
  end
196