Jackson_Pike icon

ME Status

Jackson_Pike | PRO | 06/18/16 12:44:55 AM UTC | 0 ⭐ | 379 👁️ | Never ⏰ | []
Lua |

2.29 KB

|

None

|

0 👍

/

0 👎

 
 
----ME Status Program---Jackson_Pike----Connect wired modem to computer, ME controller, and Monitor
-- I also reccommend a 5x4 monitor. (4 tall)
---Changes------
--12/3/2016--Added automatic peripheral wrapping
function getControl()
 local names = peripheral.getNames()
 local i, name
 for i, name in pairs(names) do
  if peripheral.getType(name) == "appeng_me_tilecontroller" then
   return peripheral.wrap(name)
  else
 
  end
 end
end
function getMonitor()
 local names = peripheral.getNames()
 local i, name
 for i, name in pairs(names) do
  if peripheral.getType(name) == "monitor" then
   return peripheral.wrap(name)
  else
 
  end
 end
end
-------Wrapping Peripherals--------------------------
control = getControl()
mon = getMonitor()
mon.setBackgroundColor(colors.black)
mon.clear()
    function Draw_Line(xPos, yPos, length)
        mon.setCursorPos(xPos, yPos)
        mon.setBackgroundColor(colors.purple)---Change to Desired Color
        mon.write(string.rep(" ", length))
    end
while true do
monX, monY = mon.getSize() ---- Getting Size of Monitor
-----------------------------------------------------
mon.setBackgroundColor(colors.black)
-------------------------Defining Variables----------------
BUsed = control.getUnusedBytes()-----Methods Error, actually returns Used Bytes
BFree = control.getFreeBytes()
BTotal = control.getTotalBytes()
EnergyStored = control.getEnergyStored("appeng_me_tilecontroller_0")-----Change based on your number
EnergyFinal = EnergyStored / 2
--pollCraft = control.getJobList()--I hope to add later. Get's items crafting in MAC
BUsedDecimal = BUsed / BTotal
BFreeDecimal = BFree / BTotal
BUsedPercent = BUsedDecimal * 100
BFreePercent = BFreeDecimal * 100
UsedOutput = math.floor(BUsedPercent)----Rounds
--------------------End Variables---------------------------------
mon.setBackgroundColor(colors.white)
mon.clear()
Draw_Line(1, 1, monX)
Draw_Line(1, monY, monX)
mon.setTextColor(colors.black)
mon.setCursorPos(monX/2-4.5, 1)
mon.write("ME Status")
mon.setBackgroundColor(colors.white)
mon.setCursorPos(1,3)
mon.write("Storage Used: "..BUsed.."/"..BTotal.."("..UsedOutput.."%)")
mon.setCursorPos(1,4)
mon.write("Energy Stored: "..EnergyFinal.." AE")
sleep(1)
end
-------Please report bugs, and feel free to suggest things.

Comments