Advertisement
Guest User

startup

a guest
Dec 4th, 2021
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.57 KB | None | 0 0
  1. term.setCursorPos(1, 1)
  2. term.setBackgroundColor(colors.white)
  3. term.clear()
  4.  
  5. -- Hack OS - v0.19
  6. -- By FoxWorn3365
  7.  
  8. maxw, maxh = term.getSize()
  9. local function drawPixelInternal(xPos, yPos)
  10.     term.setCursorPos(xPos, yPos)
  11.     term.write(" ")
  12. end
  13.  
  14. local tColourLookup = {}
  15. for n = 1, 16 do
  16.     tColourLookup[string.byte("0123456789abcdef", n, n)] = 2 ^ (n - 1)
  17. end
  18.  
  19. function drawFilledBox(startX, startY, endX, endY, nColour)
  20.     if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~=
  21.         "number" or type(endY) ~= "number" or
  22.         (nColour ~= nil and type(nColour) ~= "number") then
  23.         error("Expected startX, startY, endX, endY, colour", 2)
  24.     end
  25.  
  26.     startX = math.floor(startX)
  27.     startY = math.floor(startY)
  28.     endX = math.floor(endX)
  29.     endY = math.floor(endY)
  30.  
  31.     if nColour then term.setBackgroundColor(nColour) end
  32.     if startX == endX and startY == endY then
  33.         drawPixelInternal(startX, startY)
  34.         return
  35.     end
  36.  
  37.     local minX = math.min(startX, endX)
  38.     if minX == startX then
  39.         minY = startY
  40.         maxX = endX
  41.         maxY = endY
  42.     else
  43.         minY = endY
  44.         maxX = startX
  45.         maxY = startY
  46.     end
  47.  
  48.     for x = minX, maxX do for y = minY, maxY do drawPixelInternal(x, y) end end
  49. end
  50.  
  51. function clear()
  52.     sfondo(colors.black)
  53.     term.clear()
  54.     term.setCursorPos(1, 1)
  55. end
  56.  
  57. function clearRed()
  58.     sfondo(colors.red)
  59.     term.clear()
  60.     term.setCursorPos(1, 1)
  61. end
  62.  
  63. function titolo(testo)
  64.     drawFilledBox(1, 1, maxw, 1, colors.orange)
  65.     term.setCursorPos((maxw - #testo) / 2, 1)
  66.     term.setTextColor(colors.white)
  67.     term.write(testo)
  68. end
  69.  
  70. function alarm(testo, colore, y)
  71.     drawFilledBox(1, y, maxw, y, colors[colore])
  72.     term.setCursorPos((maxw - #testo) / 2, y)
  73.     term.setTextColor(colors.white)
  74.     term.write(testo)
  75.     no()
  76. end
  77.  
  78.  
  79. function bottone(color, text, x, y)
  80.    term.setBackgroundColor(colors[color])
  81.    term.setTextColor(colors.white)
  82.    term.setCursorPos(x, y)
  83.    print(text)
  84. end
  85.  
  86. function no()
  87.    term.setBackgroundColor(colors.white)
  88.    term.setTextColor(colors.black)
  89. end
  90.  
  91. if fs.exists(".localConf") == false then
  92.   titolo("Hack OS - Installazione")
  93.   term.setBackgroundColor(colors.white)
  94.   term.setTextColor(colors.black)
  95.   print("\n\nInserisci il tuo nome:")
  96.   name = read()
  97.   print("\nInserisci la cartella di HackOS:")
  98.   dir = read()
  99.   print("\nInserisci la password (vuoto per non usarla)")
  100.   pass = read()
  101.   term.setTextColor(colors.green)
  102.   print("\nFatto! Premi un tasto qualsiasi")
  103. end
  104.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement