Hi, I would like to write a program that prints a mekanism dynamic tank level onto a monitor but I can't figure out how to get the thing to read the tank level. First of all, what item(s) should I use, and second of all, what would my code look like?
Thanks in advance
Very Confused
Started by ApacheChief, Dec 07 2013 01:02 PM
3 replies to this topic
#1
Posted 07 December 2013 - 01:02 PM
#2
Posted 07 December 2013 - 07:28 PM
Currently it depends on whether or not the Mekanism developer has added support for tank information. If he hasn't, but you've got OpenPeripheral installed, then that should pick up that it's a tank (if the dev made it right).
In either case you'd need to connect the computer to the tank in any of the ways ComputerCraft gives us, be it network cables, or sitting it directly beside it.
Once you've done that inspect the interaction you have available to you with
this will output various different methods you can call on the tank using peripheral.call, one of these (if there is support) should get you the tanks information.
In either case you'd need to connect the computer to the tank in any of the ways ComputerCraft gives us, be it network cables, or sitting it directly beside it.
Once you've done that inspect the interaction you have available to you with
for i,v in ipairs(peripheral.getMethods("[side or name]") do
print(v)
end
making sure to replace [side or name] with the side of the computer the tank is on, or the name of the tank on the network.this will output various different methods you can call on the tank using peripheral.call, one of these (if there is support) should get you the tanks information.
#3
Posted 08 December 2013 - 11:22 AM
theoriginalbit, on 07 December 2013 - 07:28 PM, said:
Currently it depends on whether or not the Mekanism developer has added support for tank information. If he hasn't, but you've got OpenPeripheral installed, then that should pick up that it's a tank (if the dev made it right).
In either case you'd need to connect the computer to the tank in any of the ways ComputerCraft gives us, be it network cables, or sitting it directly beside it.
Once you've done that inspect the interaction you have available to you with
this will output various different methods you can call on the tank using peripheral.call, one of these (if there is support) should get you the tanks information.
In either case you'd need to connect the computer to the tank in any of the ways ComputerCraft gives us, be it network cables, or sitting it directly beside it.
Once you've done that inspect the interaction you have available to you with
for i,v in ipairs(peripheral.getMethods("[side or name]") do
print(v)
end
making sure to replace [side or name] with the side of the computer the tank is on, or the name of the tank on the network.this will output various different methods you can call on the tank using peripheral.call, one of these (if there is support) should get you the tanks information.
Perfect. I get:
listMethods
getInvName
getStackInSlot
getSizeInventory
I'm assuming that I should be using getSizeInventory. Do I still have to use peripheral.wrap()?
#4
Posted 08 December 2013 - 05:37 PM
ApacheChief, on 08 December 2013 - 11:22 AM, said:
Perfect. I get:
listMethods
getInvName
getStackInSlot
getSizeInventory
I'm assuming that I should be using getSizeInventory.
listMethods
getInvName
getStackInSlot
getSizeInventory
I'm assuming that I should be using getSizeInventory.
- The Mekanism developer hasn't added ComputerCraft support for that block, and OpenPeripheral is picking it up instead
- The Mekanism developer hasn't implemented the tank correct and it means that OpenPeripheral only sees it as an inventory, not a tank
If OpenPeripheral saw it as a tank with liquids it would provide you with the function getTankInfo.
ApacheChief, on 08 December 2013 - 11:22 AM, said:
Do I still have to use peripheral.wrap()?
When you use peripheral.wrap, it actually does the peripheral.call on the peripheral, meaning that this
local chest = peripheral.wrap("chest")
print(chest.getInvName())
and thisprint(peripheral.call("chest", "getInvName"))
pretty much the same
Edited by theoriginalbit, 08 December 2013 - 05:37 PM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











