FoxWorn3365

mkqlv2

Nov 15th, 2025 (edited)
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. term.setBackgroundColor(colors.white)
  2. term.clear()
  3.  
  4. local qlv = paintutils.loadImage("qlv")
  5. paintutils.drawImage(qlv, 2, 1)
  6.  
  7. local h = fs.open("qlvdata", "r")
  8. data = textutils.unserialize(h.readAll())
  9. h.close()
  10.  
  11. local function drawPixelInternal(xPos, yPos)
  12.     term.setCursorPos(xPos, yPos)
  13.     term.write(" ")
  14. end
  15.  
  16. local tColourLookup = {}
  17. for n = 1, 16 do
  18.     tColourLookup[string.byte("0123456789abcdef", n, n)] = 2 ^ (n - 1)
  19. end
  20.  
  21. function drawFilledBox(startX, startY, endX, endY, nColour)
  22.     if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~=
  23.         "number" or type(endY) ~= "number" or
  24.         (nColour ~= nil and type(nColour) ~= "number") then
  25.         error("Expected startX, startY, endX, endY, colour", 2)
  26.     end
  27.  
  28.     startX = math.floor(startX)
  29.     startY = math.floor(startY)
  30.     endX = math.floor(endX)
  31.     endY = math.floor(endY)
  32.  
  33.     if nColour then term.setBackgroundColor(nColour) end
  34.     if startX == endX and startY == endY then
  35.         drawPixelInternal(startX, startY)
  36.         return
  37.     end
  38.  
  39.     local minX = math.min(startX, endX)
  40.     if minX == startX then
  41.         minY = startY
  42.         maxX = endX
  43.         maxY = endY
  44.     else
  45.         minY = endY
  46.         maxX = startX
  47.         maxY = startY
  48.     end
  49.  
  50.     for x = minX, maxX do for y = minY, maxY do drawPixelInternal(x, y) end end
  51. end
  52.  
  53. for k, v in ipairs(data) do
  54.   drawFilledBox(1, 1, 50, 1, colors.white)
  55.   term.setCursorPos(3, 1)
  56.   term.setTextColor(colors.black)
  57.   term.setBackgroundColor(colors.white)
  58.   term.write(v.name)
  59.  
  60.   local ev, bt, x, y = os.pullEvent("mouse_click")
  61.  
  62.   data[k].position = {x=x,y=y}
  63.   term.setBackgroundColor(colors.blue)
  64.   term.setCursorPos(x, y)
  65.   term.write(" ")
  66. end
  67.  
  68. local h2 = fs.open("qlvdata-published", "w")
  69. h2.write(textutils.serialize(data))
  70. h2.close()
  71.  
  72. print("\n\nDONEEEEE")
Advertisement
Add Comment
Please, Sign In to add comment