9551

frame API

Jun 20th, 2021 (edited)
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.77 KB | None | 0 0
  1. -------frame API by elektrobom1---------
  2. local function frame(monitor, pos1, pos2, length, height, color3, color1, thicc)
  3.     local m = peripheral.wrap(monitor)
  4.     local oldcol = m.getBackgroundColor()
  5.     local oldcol1 = m.getTextColor()
  6.     m.setBackgroundColor(colors[color1])
  7.     fill(monitor, pos1 - 1, pos2 - height, length, height * 2)
  8.     m.setBackgroundColor(oldcol)
  9.     xm = m.getBackgroundColor()
  10.     xb = m.getTextColor()
  11.     m.setTextColor(xm)
  12.     m.setBackgroundColor(xb)
  13.     m.setCursorPos(pos1 - 1, pos2 - height)
  14.     if thicc then
  15.         m.setBackgroundColor(colors[color3])
  16.         m.setTextColor(colors[color3])
  17.         m.write(string.rep("\x83", length + 1)) --\143
  18.         m.setTextColor(xb)
  19.         m.setBackgroundColor(xm)
  20.     else
  21.         m.write("\159" .. string.rep("\143", length - 1)) --\x83
  22.         m.setTextColor(xb)
  23.         m.setBackgroundColor(xm)
  24.         m.write("\144")
  25.     end
  26.     m.setCursorPos(pos1 - 1, pos2 + height)
  27.     if thicc then
  28.         m.setBackgroundColor(colors[color3])
  29.         m.setTextColor(colors[color3])
  30.         m.write(string.rep("\x8c", length + 1)) --\131
  31.     else
  32.         m.write("\130" .. string.rep("\131", length - 1) .. "\129") --\x8c
  33.     end
  34.     for i = 0, (height * 2) - 2 do
  35.         if not thicc then
  36.             m.setTextColor(xm)
  37.             m.setBackgroundColor(xb)
  38.         end
  39.         m.setCursorPos(pos1 - 1, (pos2 + i) - (height) + 1)
  40.         if thicc then
  41.             m.setBackgroundColor(colors[color3])
  42.         end
  43.         m.write("\x95")
  44.         m.setCursorPos((pos1 - 2) + (length + 1), (pos2 + i) - (height) + 1)
  45.         if not thicc then
  46.             m.setTextColor(xb)
  47.             m.setBackgroundColor(xm)
  48.         end
  49.         m.write("\x95")
  50.     end
  51. end
  52.  
  53. return { frame = frame }
Add Comment
Please, Sign In to add comment