Guest User

startup

a guest
Sep 23rd, 2021
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.11 KB | None | 0 0
  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
  104.    v = 5
  105. else
  106.   shell.run(".settings")
  107.   v = 0
  108.   rednet.open(side)
  109. end
  110.  
  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.   button(15, 11, " REIMPOSTA GAUGLE ", "white", "orange")
  121.  
  122. local event, tasto, x, y = os.pullEvent("mouse_click")
  123. if y == 7 and x > 15 and x < 33 then
  124.   v = 1
  125. elseif y == 9 and x > 15 and x < 33 then
  126.   shell.run("rm startup")
  127.   shell.run("pastebin get 7Pdn3tqd startup")
  128.   shell.run("startup")
  129. elseif y == 1 and x > 45 then
  130.   v = 3
  131. elseif y == 11 and x > 14 and x < 33 then
  132.   v = 5
  133. else
  134.   shell.run("startup")
  135. end
  136. elseif v == 1 then
  137.   term.setBackgroundColor(colors.white)
  138.   term.clear()
  139.   header("                     GAUGLE                        ", "blue")
  140.   term.setCursorPos(10, 6)
  141.   text("Vai al sito:", "black")
  142.   term.setCursorPos(10, 7)
  143.   url = read()
  144. if url == "gaugle://info" then
  145.    v = 3
  146. elseif url == "gaugle://mail?rtoken=rednet_TEXT_833jdjdu_B" then
  147.   v = 10
  148. else
  149.   v = 2
  150. end
  151. elseif v == 2 then
  152.         term.clear()
  153.  
  154.  
  155.   rednet.send(modem, url)
  156.   local ip, msg, ptrc = rednet.receive()
  157.  
  158.  
  159.   if msg == "ERROR_404" then
  160.   term.setBackgroundColor(colors.white)
  161.   term.clear()
  162.   header("[HOME]                GAUGLE             [RESEARCH]", "blue")
  163.   text("http://"..url, "gray")
  164.   text("\nERRORE 404 - Pagina non trovata", "red")
  165.   else
  166.   term.setBackgroundColor(colors.white)
  167.   term.clear()
  168.   header("[HOME]                GAUGLE             [RESEARCH]", "blue")
  169.   text("http://"..url, "gray")
  170.   text("\n"..msg, "black")
  171.   end
  172.   local event, button, x, y = os.pullEvent("mouse_click")
  173.     if y == 1 and x < 7 then
  174.      v = 0
  175.     elseif y == 1 and x > 43 then
  176.        drawFilledBox(5, 7, 37, 10, colours.grey)
  177.        term.setCursorPos(6, 8)
  178.        bkText("Cerca qualcosa:", "white", "gray")
  179.        drawFilledBox(6, 9, 35, 9, colours.blue)
  180.        term.setCursorPos(6, 9)
  181.        url = read()
  182.        if url == "gaugle://info" then
  183.            v = 3
  184.        else
  185.            v = 2
  186.        end
  187.        term.clear()
  188.     end
  189.   elseif v == 3 then
  190.    term.setBackgroundColor(colors.white)
  191.    term.clear()
  192.    header("[HOME]                GAUGLE                       ", "blue")
  193.    text("gaugle://info", "gray")
  194.    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")
  195.    local event, button, x, y = os.pullEvent("mouse_click")
  196.    if y == 1 and x < 10 then
  197.       v = 0
  198.     end
  199.  elseif v == 5 then
  200.    term.setBackgroundColor(colors.white)
  201.    term.clear()
  202.    header("[INST]                GAUGLE                       ", "blue")
  203.    text("\n\nInstallazione di GAUGLE", "black")
  204.    text("\nInserisci l'ID del Modem WIFI:", "black")
  205.    local mdwifi = read()
  206.    text("\n\nPerfetto, ora inserisci il lato dove e' presente il wm:", "black")
  207.    local mdside = read()
  208.    local f = fs.open(".settings", "w")
  209.    f.writeLine("modem = "..mdwifi)
  210.    f.writeLine("side = '"..mdside.."'")
  211.    f.close()
  212.    -- Confermo la creazione
  213.    shell.run("startup")
  214.  elseif v == 10 then
  215.      term.setBackgroundColor(colors.white)
  216.      term.clear()
  217.      header("[HOME]                GAUGLE             [  MAIL  ]", "blue")
  218.      text("gaugle://mail", "gray")
  219.      text("\nBenvenuto nella casella MAIL di GAUGLE!", "black")
  220.      button(15, 6, " INVIA UNA EMAIL ", "white", "blue")
  221.      button(15, 8, "  LE TUE EMAIL   ", "white", "blue")
  222.      local event, button, x, y = os.pullEvent("mouse_click")
  223.         if y == 6 and x > 15 and x < 32 then
  224.             v = 15
  225.          elseif y == 8 and x > 15 and x < 32 then
  226.             v = 12
  227.          elseif y == 1 and x < 7 then
  228.             v = 0
  229.          end
  230.   elseif v == 15 then
  231.         term.setBackgroundColor(colors.white)
  232.         term.clear()
  233.         header("[HOME]                GAUGLE             [  MAIL  ]", "blue")
  234.         text("gaugle://mail#send", "gray")
  235.         text("\n\nInvia un'email!", "black")
  236.         text("\n\nInserisci il destinatario:", "blue")
  237.         term.setCursorPos(3, 9)
  238.         print("@mail.com")
  239.         term.setCursorPos(1, 9)
  240.         to = read()
  241.         print(to)
  242.         text("\n\nInserisci il Messaggio:", "blue")
  243.         mam = read()
  244.         print(mam)
  245.         text("Inviato "..mam.." a "..to.."@mail.com", "green")
  246.         rednet.send(to, mam)
  247.         os.pullEvent("mouse_click")
  248.         v = 10
  249.   end
  250.   end
  251.      
Advertisement
Add Comment
Please, Sign In to add comment