Posted 27 July 2016 - 04:11 PM
So I would like to display the amount of space remaining in my 2 ME Drive racks on a monitor. I used code from http://www.computercraft.info/forums2/index.php?/topic/27082-calculating-bytes-in-a-ae2-storage-cell-on-cc/ as a base but I have run into a snag. When I run ‘getAvailableItems’ it is looking into my storage drawers as well (I have a set of Storage Drawers to take some of the weight of off the AE2 cells). This throws off my AE2 math. Is there a better way to tell how much space I have left in my AE2 system? If not, how can I fix this?
I am running version rv3-beta-6 of AE2 and 1.75 of ComputerCraft. My server is running Jurassic World Revelations 1.7.10. I have a Storage Interface attached to an Advanced Computer that I am using to interact with the AE2 network. I am new to LUA so please be gentle.
Code:
tpm = peripheral.wrap("left")
mon1 = peripheral.wrap("top")
k64 = "65536"
list = tpm.getAvailableItems()
totalUsed = 0 –totalSize
for number, item in pairs(list) do
totalUsed = totalUsed + 512 + item.size / 8
totalSize2 = number
end
freeSpace = k64 – totalUsed
mon1.clear()
mon1.setCursorPos(1,1)
mon1.write(“Total Bytes: “)
mon1.setCursorPos(10,1)
mon1.write(k64)
mon1.setCursorPos(1,2)
mon1.write(“Used Bytes: “)
mon1.setCursorPos(10,2)
mon1.write(totalUsed)
mon1.setCursorPos(1,3)
mon1.write(“Space Remaining: “)
mon1.setCursorPos(10,3)
mon1.write(freeSpace)
I am running version rv3-beta-6 of AE2 and 1.75 of ComputerCraft. My server is running Jurassic World Revelations 1.7.10. I have a Storage Interface attached to an Advanced Computer that I am using to interact with the AE2 network. I am new to LUA so please be gentle.
Code:
tpm = peripheral.wrap("left")
mon1 = peripheral.wrap("top")
k64 = "65536"
list = tpm.getAvailableItems()
totalUsed = 0 –totalSize
for number, item in pairs(list) do
totalUsed = totalUsed + 512 + item.size / 8
totalSize2 = number
end
freeSpace = k64 – totalUsed
mon1.clear()
mon1.setCursorPos(1,1)
mon1.write(“Total Bytes: “)
mon1.setCursorPos(10,1)
mon1.write(k64)
mon1.setCursorPos(1,2)
mon1.write(“Used Bytes: “)
mon1.setCursorPos(10,2)
mon1.write(totalUsed)
mon1.setCursorPos(1,3)
mon1.write(“Space Remaining: “)
mon1.setCursorPos(10,3)
mon1.write(freeSpace)