View difference between Paste ID: AV3gJSEs and biL5TYdc
SHOW: | | - or go back to the newest paste.
1
term.setBackgroundColor(colors.white)
2
term.clear()
3
4
modem = 4
5
6
-- Sistemo le funzioni per tutto
7
function header(text, color)
8
  term.setBackgroundColor(colors[color])
9
  term.setTextColor(colors.white)
10
  term.setCursorPos(1, 1)
11
  print(text)
12
end
13
14
function button(x, y, text, color, bkcolor)
15
  term.setBackgroundColor(colors[bkcolor])
16
  term.setTextColor(colors[color])
17
  term.setCursorPos(x, y)
18
  print(text)
19
end
20
21
function bkText(text, col, bkcol)
22
   term.setBackgroundColor(colors[bkcol])
23
   term.setTextColor(colors[col])
24
   print(text)
25
end
26
27
function text(text, color)
28
  term.setBackgroundColor(colors.white)
29
  term.setTextColor(colors[color])
30
  print(text)
31
end
32
33
function n(col)
34
  term.setBackgroundColor(colors.white)
35
  term.setTextColor(colors[col])
36
end
37
38
function popupPos(aa)
39
  term.setCursorPos(5, aa)
40
end
41
42
function popup(text, text1, text2, text3, text4, text5) --TEXT = MAX 15 - MM = MAX 15
43
  drawFilledBox(5, 2, 27, 9, colours.grey)
44
  term.setTextColor(colors.white)
45
  term.setCursorPos(5, 2)
46
  print("|---------------------|")
47
  term.setCursorPos(5, 3)
48
  print(text)
49
  popupPos(4)
50
  print(text1)
51
  popupPos(5)
52
  print(text2)
53
  popupPos(6)
54
  print(text3)
55
  popupPos(7)
56
  print(text4)
57
  popupPos(8)
58
  print(text5)
59
  term.setCursorPos(5, 9)
60
  print("|---------------------|")
61
end
62
63
local function drawPixelInternal(xPos, yPos)
64
    term.setCursorPos(xPos, yPos)
65
    term.write(" ")
66
end
67
68
local tColourLookup = {}
69
for n = 1, 16 do
70
    tColourLookup[string.byte("0123456789abcdef", n, n)] = 2 ^ (n - 1)
71
end
72
73
function drawFilledBox(startX, startY, endX, endY, nColour)
74
    if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~=
75
        "number" or type(endY) ~= "number" or
76
        (nColour ~= nil and type(nColour) ~= "number") then
77
        error("Expected startX, startY, endX, endY, colour", 2)
78
    end
79
 
80
    startX = math.floor(startX)
81
    startY = math.floor(startY)
82
    endX = math.floor(endX)
83
    endY = math.floor(endY)
84
 
85
    if nColour then term.setBackgroundColor(nColour) end
86
    if startX == endX and startY == endY then
87
        drawPixelInternal(startX, startY)
88
        return
89
    end
90
 
91
    local minX = math.min(startX, endX)
92
    if minX == startX then
93
        minY = startY
94
        maxX = endX
95
        maxY = endY
96
    else
97
        minY = endY
98
        maxX = startX
99
        maxY = startY
100
    end
101
 
102
    for x = minX, maxX do for y = minY, maxY do drawPixelInternal(x, y) end end
103
end
104
105
if fs.exists("modem") == false then
106
   v = 5
107
else
108
  file = fs.open("modem", "r")
109
  modem = file.readAll()
110
  file.close()
111
  filea = fs.open("side", "r")
112
  side = filea.readAll()
113
  filea.close()
114
  rednet.open(side)
115
  v = 0
116
end
117
118
while true do
119
if v == 0 then
120
121
term.clear()
122
header("                     GAUGLE                  [INFO]", "blue")
123
124
  text("\n\nBenvenuto su GAUGLE!\nIn questo browser potrai cercare roba bella!", "black")
125
  button(15, 7, "  CERCA QUALCOSA  ", "white", "green")
126
  button(15, 9, "  AGGIORNA GAUGLE ", "white", "orange")  
127
  button(15, 11, " REIMPOSTA GAUGLE ", "white", "orange") 
128
129
local event, tasto, x, y = os.pullEvent("mouse_click")
130
if y == 7 and x > 15 and x < 33 then
131
  v = 1
132
elseif y == 9 and x > 15 and x < 33 then
133
  shell.run("rm startup")
134-
  shell.run("pastebin get 7Pdn3tqd startup")
134+
  shell.run("pastebin get AV3gJSEs startup")
135
  shell.run("startup")
136
elseif y == 1 and x > 45 then
137
  v = 3
138
elseif y == 11 and x > 14 and x < 33 then
139
  v = 5
140
else
141
  shell.run("startup")
142
end
143
elseif v == 1 then
144
  term.setBackgroundColor(colors.white)
145
  term.clear()
146
  header("                     GAUGLE                        ", "blue")
147
  term.setCursorPos(10, 6)
148
  text("Vai al sito:", "black")
149
  term.setCursorPos(10, 7)
150
  url = read()
151
if url == "gaugle://info" then
152
   v = 3
153
elseif url == "gaugle://mail?rtoken=rednet_TEXT_833jdjdu_B" then
154
  v = 10
155
else
156
  v = 2
157
end
158
elseif v == 2 then
159
        term.clear()
160
 
161
  msg = ""
162
  
163
  rednet.send(4, url, "ModemMessage")
164
  ip, msg, ptrc = rednet.receive("ModemReceive")
165
  
166
167
  if msg == "ERROR_404" then
168
  term.setBackgroundColor(colors.white)
169
  term.clear()
170
  header("[HOME]                GAUGLE             [RESEARCH]", "blue")
171
  text("http://"..url, "gray")
172
  text("\nERRORE 404 - Pagina non trovata", "red")
173
  elseif msg == nil then
174
  term.setBackgroundColor(colors.white)
175
  term.clear()
176
  header("[HOME]                GAUGLE             [RESEARCH]", "blue")
177
  text("http://"..url, "gray")
178
  text("\nERRORE 500 - Il server ha impiegato troppo tempo a rispondere", "red")
179
  else
180
  term.setBackgroundColor(colors.white)
181
  term.clear()
182
  header("[HOME]                GAUGLE             [RESEARCH]", "blue")
183
  text("http://"..url, "gray")
184
  text("\n"..msg, "black")
185
  end
186
  local event, button, x, y = os.pullEvent("mouse_click")
187
    if y == 1 and x < 7 then
188
     v = 0
189
    elseif y == 1 and x > 43 then
190
       drawFilledBox(5, 7, 37, 10, colours.grey)
191
       term.setCursorPos(6, 8)
192
       bkText("Cerca qualcosa:", "white", "gray")
193
       drawFilledBox(6, 9, 35, 9, colours.blue)
194
       term.setCursorPos(6, 9)
195
       url = read()
196
       if url == "gaugle://info" then
197
           v = 3
198
       else
199
           v = 2
200
       end
201
       term.clear()
202
    end
203
  elseif v == 3 then
204
   term.setBackgroundColor(colors.white)
205
   term.clear()
206
   header("[HOME]                GAUGLE                       ", "blue")
207
   text("gaugle://info", "gray")
208
   text("\n\nGAUUUGLE!\n\nMade by: FoxWorn3365\nVersion: v1.0.3E [RELASE 05]\n\nConfiguration Information:\nType: WIRELESS_2.0\nModem IP: 144.91.97."..modem.."\nModem side: "..side, "black")
209
   local event, button, x, y = os.pullEvent("mouse_click")
210
   if y == 1 and x < 10 then
211
      v = 0
212
    end
213
 elseif v == 5 then
214
   term.setBackgroundColor(colors.white)
215
   term.clear()
216
   header("[INST]                GAUGLE                       ", "blue")
217
   text("\n\nInstallazione di GAUGLE", "black")
218
   text("\nInserisci l'ID del Modem WIFI:", "black")
219
   local mdwifi = read()
220
   text("\n\nPerfetto, ora inserisci il lato dove e' presente il wm:", "black")
221
   local mdside = read()
222
   local f = fs.open("modem", "w")
223
   f.writeLine(mdwifi) 
224
   f.close()
225
   local fa = fs.open("side", "w")
226
   fa.writeLine(mdside) 
227
   fa.close()
228
   -- Confermo la creazione
229
   shell.run("reboot")
230
 elseif v == 10 then
231
     term.setBackgroundColor(colors.white)
232
     term.clear()
233
     header("[HOME]                GAUGLE             [  MAIL  ]", "blue")
234
     text("gaugle://mail", "gray")
235
     text("\nBenvenuto nella casella MAIL di GAUGLE!", "black")
236
     button(15, 6, " INVIA UNA EMAIL ", "white", "blue")
237
     button(15, 8, "  LE TUE EMAIL   ", "white", "blue")
238
     local event, button, x, y = os.pullEvent("mouse_click")
239
        if y == 6 and x > 15 and x < 32 then
240
            v = 15
241
         elseif y == 8 and x > 15 and x < 32 then
242
            v = 12
243
         elseif y == 1 and x < 7 then
244
            v = 0
245
         end
246
  elseif v == 15 then
247
        term.setBackgroundColor(colors.white)
248
        term.clear()
249
        header("[HOME]                GAUGLE             [  MAIL  ]", "blue")
250
        text("gaugle://mail#send", "gray")
251
        text("\n\nInvia un'email!", "black")
252
        text("\n\nInserisci il destinatario:", "blue")
253
        term.setCursorPos(3, 9)
254
        print("@mail.com")
255
        term.setCursorPos(1, 9)
256
        to = read()
257
        print(to)
258
        text("\n\nInserisci il Messaggio:", "blue")
259
        mam = read()
260
        print(mam)
261
        text("Inviato "..mam.." a "..to.."@mail.com", "green")
262
        rednet.send(to, mam)
263
        os.pullEvent("mouse_click")
264
        v = 10
265
  end
266
  end
267