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