This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
DonMegel's profile picture

AE2 Storage Space?

Started by DonMegel, 27 July 2016 - 02:11 PM
DonMegel #1
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)
DonMegel #2
Posted 29 July 2016 - 03:17 AM
Was there some important bit of information I omitted?
Lyqyd #3
Posted 29 July 2016 - 05:40 PM
It appears that your post has the relevant information needed to answer your question. I don't have much familiarity with interfacing AE2 and ComputerCraft, so I can't offer anything useful to answer your question. What other methods are provided by the peripheral?
Stekeblad #4
Posted 01 August 2016 - 09:32 AM
Is their not a "getBytesAvailable" function? Maybe not exactly what you are trying to get but from that you could calculate if you can throw 1, 10 or 100 stacks in to the system.
Stekeblad #5
Posted 02 August 2016 - 11:51 AM
I tried and did not find a getBytesAvailable or something similar. You can try wrap a ME Drive as a peripheral and try to do something with the functions you get from it. Maybe I try it myself later.