Deep Storage Unit and Open Peripherals + 1 other question

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

casilleroatr

New Member
Jul 29, 2019
1,360
0
0
Hello,

I was hoping to make a computer program whereby a computer would scan 4 adjacent dsus and collate the data into a table and return that to a central computer which could use the data from many of these computers to give me a detailed breakdown of my storage. I used the getStackInSlot method on the DSU and it only returned data about the contents of the slot where you draw stuff out (in hindsight, this is predictable). I was however hoping that it would be able to say how much was in the entire DSU. Is this possible with openperipheral or any other mod?

Also, is it possible for a turtle to scan its own inventory like it does to others with the getStackInSlot command?

Thank you in advance for any responses.
 

Niels Henriksen

New Member
Jul 29, 2019
502
0
1
The turtle can scan its own inventory. You just need to select the slot you want to look in.

About the DSU then try .getSizeInventory() to get the amount of inventoryspaces. I think there is at least 3 spaces you can read.
 
  • Like
Reactions: casilleroatr

casilleroatr

New Member
Jul 29, 2019
1,360
0
0
About the DSU then try .getSizeInventory() to get the amount of inventoryspaces. I think there is at least 3 spaces you can read.


Thanks.

I know that you can get the size of the inventory. But what I want to know is, is there a method that will reveal the contents of the dsu.

2013-10-16_15.15.04.png

That includes the 512 under the Stored: label + the 64 that is in the actual slot.

What I want in this instance is for the computer to read 576 blocks of iron.

This is what happens when I run getStackInSlot on (I think slot 2).

2013-10-16_15.15.06.png

Its good, but It doesn't quite do what I want it to do. But if anyone knows of a workaround I will gladly hear it.

----
The turtle can scan its own inventory. You just need to select the slot you want to look in.

Can you elaborate on this please. Or are you referring to the turtle.getItemCount(slot) method. If so, I would like a method that can also return the name of the item in that slot.

--
By the way, I forgot to add in my opening post what mod pack I am using. It is a custom pack that differs slightly from unleashed. It is somewhere in between unleashed and resonant rise. Computercraft related mods I have include

ComputerCraft 1.53
Immibis's Peripherals 55.0.2
MiscPeripherals 3.2
OpenCCSensors 1.5.2.0
OpenPeripheral 0.1.9

I am not closed to the idea of adding/updating mods and I am free to do so because I play single player.
 

Drkevlar

New Member
Jul 29, 2019
47
0
0
I wrote a small test program to see what OpenPeripherals returned:

Code:
local function getChestContent(chest)
  local size = chest.getSizeInventory() - 1
  local data = {}
  for i = 0, size do
    table.insert(data, chest.getStackInSlot(i))
  end
  return data
end
 
local chest = peripheral.wrap("front")
local chestContent = getChestContent(chest)
 
for index, item in pairs(chestContent) do
  print("Found item " .. item.name .. ": " .. item.qty)
end

Returns one stack of 64 cobble on a DSU filled with 500+ cobblestone.

Seems like OPH does not fully support the DSUs (yet).

Edit:
I would like a method that can also return the name of the item in that slot.

I would suggest using a buffer chest for this. You can read items from adjacent chests but not the turtle itself. Once you have identified the item you can use turtle.suck or chest.pushIntoSlot
 
  • Like
Reactions: casilleroatr

casilleroatr

New Member
Jul 29, 2019
1,360
0
0
I wrote a small test program to see what OpenPeripherals returned:

...


I did pretty much the same thing as you and got the same result. I also tested a slightly modified version of the same program on FZ barrels too. They seem to have the same problem and also can only be read from the top (possibly bottom as well but not the sides).

If I can't scan DSUs directly I am going to look into the methods associated with applied energistics (I usually hook the DSUs up with storage buses anyway). I think there are some good storage monitoring methods out there for AE so hopefully I will still be able to complete my project.

However, I am still very interested to know if I can get a turtle to do getStackInSlot() on itself, or something to the same effect.
 

Drkevlar

New Member
Jul 29, 2019
47
0
0
However, I am still very interested to know if I can get a turtle to do getStackInSlot() on itself, or something to the same effect.

We need peripheral.wrap("self") :)

Also check my edit on the post before this one, sorry about the late edit.
 
  • Like
Reactions: casilleroatr

casilleroatr

New Member
Jul 29, 2019
1,360
0
0
Hey, don't worry about the late edit. I am hardly going to complain seeing as how you are helping me :).

The buffer chest is something I have considered and you are probably right in suggesting it. Do you have to use cardinal directions for the chest.pushIntoSlot() like functions. I don't know how to control for that if it is a turtle that moves around a lot and could be facing any direction when it places the buffer chest. It would probably be ok in most situations though to simply place the chest above or below. I need to get my head around GPS too that will probably help in orientation.
 

IndyDev13

Member
Jul 29, 2019
4
0
10
Hey, don't worry about the late edit. I am hardly going to complain seeing as how you are helping me :).

The buffer chest is something I have considered and you are probably right in suggesting it. Do you have to use cardinal directions for the chest.pushIntoSlot() like functions. I don't know how to control for that if it is a turtle that moves around a lot and could be facing any direction when it places the buffer chest. It would probably be ok in most situations though to simply place the chest above or below. I need to get my head around GPS too that will probably help in orientation.


The Cardinal system is relative to the peripheral. If you have a turtle and on the right side (at the beginning) and if the turns turns 180 the pushIntoSlot() would still use the same direction. ie

The turtle is west of the chest peripheral and the turtle turns around it will still be west of the chest.
 
  • Like
Reactions: casilleroatr