Noobular

Control Panel [CC]

Jun 3rd, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.67 KB | None | 0 0
  1. ------------------------------
  2. -- Created By:              --
  3. --      Noobular            --
  4. -- Creation Date:           --
  5. --      June 03, 2018       --
  6. -- Last Update:             --
  7. --      June 03, 2018       --
  8. -- Details:                 --
  9. --       4 tall, 7 wide     --
  10. ------------------------------
  11.  
  12. function textSetBase()
  13.     m.setBackgroundColor(colors.black)
  14.     m.setTextColor(colors.white)
  15.     m.setTextScale(1.2)
  16. end
  17.  
  18. function textSetStatus()
  19.     m.setBackgroundColor(colors.blue)
  20.     m.setTextColor(colors.white)
  21.     m.setTextScale(1.2)
  22. end
  23.  
  24. function textSetNav()
  25.     m.setBackgroundColor(colors.blue)
  26.     m.setTextColor(colors.black)
  27.     m.setTextScale(1.2)
  28. end
  29.  
  30. function fixscreen()
  31.     for i=2,25 do
  32.         m.setBackgroundColor(colors.black)
  33.         m.setCursorPos(1,i)
  34.         m.write("                                                  ")
  35.     end
  36. end
  37.  
  38. function NavigationBar()
  39.     writeHeight = 1
  40.     if m then
  41.         textSetNav()
  42.         m.setCursorPos(1,writeHeight)
  43.         m.write("                                                                                    ")
  44.         m.setCursorPos(1,writeHeight)
  45.         m.write("N00B.OS - By Noobular")
  46.         m.setBackgroundColor(colors.black)
  47.     end
  48. end
  49.  
  50. function drawcolumn(xpos,color)
  51.     if m then
  52.         for i=1,25 do
  53.             m.setBackgroundColor(color)
  54.             m.setCursorPos(xpos, i)
  55.             m.write(" ")
  56.             m.setBackgroundColor(colors.black)
  57.         end
  58.     end
  59. end
  60.  
  61. function drawheader(x,y,bgcolor,txtcolor,text)
  62.     m.setBackgroundColor(bgcolor)
  63.     m.setTextColor(txtcolor)
  64.     m.setCursorPos(x,y)
  65.     m.write(text)
  66.     m.setBackgroundColor(colors.black)
  67. end
  68.  
  69. function drawgui()
  70.     NavigationBar()
  71.     updateStatus("Idle...")
  72.     fixscreen()
  73.  
  74.     drawheader(3,2,colors.purple,colors.white,"Machines")
  75.     drawheader(25,2,colors.purple,colors.white,"Most Items")
  76.     drawheader(49,2,colors.purple,colors.white,"Lowest Items")
  77.  
  78.     drawcolumn(1,colors.blue)
  79.     drawcolumn(23,colors.blue)
  80.     drawcolumn(47,colors.blue)
  81.     drawcolumn(71,colors.blue)
  82. end
  83.  
  84. function updateStatus(status)
  85.     writeHeight = 26
  86.     if m then
  87.         textSetStatus()
  88.         m.setCursorPos(1,writeHeight)
  89.         m.write("                                                                                    ")
  90.         m.setCursorPos(1,writeHeight)
  91.         m.write("Status: "..status)
  92.     end
  93. end
  94.  
  95. function setPeripherals()
  96.     m = peripheral.find("monitor")      -- display
  97.     s = peripheral.find("powered_tile") -- storage
  98.  
  99.     if m then
  100.         m.clear()
  101.         drawgui()
  102.     end
  103.  
  104.     if s then
  105.         updateStatus("ME System Found...")
  106.         storage = s.getAvaliableItems()
  107.     end
  108. end
  109.  
  110. function showItems()
  111.     for i=0, #storage do
  112.         m.setCursorPos(48,i+1)
  113.         print(storage[i]["name"] .. " = " .. storage[i]["qty"])
  114.     end
  115. end
  116.  
  117. function startup()
  118.     setPeripherals()
  119.     showItems()
  120. end
  121.  
  122.  
  123. startup()
Add Comment
Please, Sign In to add comment