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

Railcraft Iron Tank Peripheral

Started by zhopia, 24 July 2014 - 09:34 PM
zhopia #1
Posted 24 July 2014 - 11:34 PM
Completely new to computercraft but I'm assuming that in order to read the amount in an iron/steel tank from railcraft that I need to use the wireless modem and computer. I don't know any commands but I'm trying to create a program that emits a redstone signal if the level goes below a certain number. Anyone know how I could do this?
Cranium #2
Posted 25 July 2014 - 12:13 AM
Well, on its own, you cannot detect fluids from Iron Tanks with just ComputerCraft. You'll need a peripheral like OpenPeripheral. With that, there's some functions you can use to wrap the tanks as a peripheral, and get the fluid levels. You wouldn't use a wireless modem, you'd either connect the computer right next to the tank, or you'd connect it via a wired modem network.
Bomb Bloke #3
Posted 25 July 2014 - 04:41 AM
Er, you'll need a peripheral mod like OpenPeripheral. With that in place, you'll find that many more blocks can be treated as peripherals than you can use under vanilla ComputerCraft.

As to the how:

http://www.computercraft.info/forums2/index.php?/topic/15062-peripheral-basics/

http://www.computercraft.info/forums2/index.php?/topic/13063-mc-16x-openperipheral/
Edited on 25 July 2014 - 02:45 AM
zhopia #4
Posted 27 July 2014 - 02:58 PM
Okay, several questions now that I've messed around a little.
Does it matter where the modem is as long as it's touching the tank?
Why wouldn't a wireless modem work?
I used the openperipheral link you posted Bomb Bloke but I can't access the script in-game and the online documentation has been pulled down (https://raw.githubusercontent.com/OpenMods/OpenPeripheral/master/lua/openperipheral/lua/docs). So where can I find the peripheral commands (so I can find the amount stored, capacity, and other things related)?
Carrots084 #5
Posted 27 July 2014 - 07:38 PM
A wireless modem wouldn't work, because even through a mod like OpenPeripherals, the Iron Tank simply doesn't output information. You're using ComputerCraft and OpenPeripherals to read the data that a mod like WAILA would read. You're reading data that's there, but not output.

You should be able to place the wired modem anywhere on the tank. I recommend the peripherals tutorial by TOBIT: http://www.computercraft.info/forums2/index.php?/topic/15062-peripheral-basics/ and then using the knowledge you gain to write your own code for your problem.
zhopia #6
Posted 28 July 2014 - 04:38 PM
Carrots, that's the same exact link Bomb Bloke posted. Do you know the answers that I'm asking for? Like I said, the methods for the iron tank peripheral is different than the link you keep posting. There simply isn't documentation on the syntax I need to use.
KingofGamesYami #7
Posted 28 July 2014 - 04:50 PM
1. Not as far as I know
2. Wireless modems DO NOT operate the same as wired modems. You can use the modem api on both, as well as rednet, but wireless modems cannot wrap peripherals.
3. The only way to obtain documentation for openperipherals is to get it ingame, using openp/docs <peripheral_name> The reason being, the commands change frequently.
Additionally, you can also use peripheral.getMethods( "name" ) to list the peripherals syntax. I never code for openP because of the lack of documentation.
Lyqyd #8
Posted 28 July 2014 - 08:51 PM
You may have to place the wired modem on a tank valve specifically.
zhopia #9
Posted 28 July 2014 - 09:32 PM
Well update on the situation: This is certainly harder than vanilla computercraft. The modem does have to been on the valve and many of the call/wrap/get peripherals is hard to apply. I've read a lot of other threads about using monitors and am currently trying to apply those commands. Thanks everyone.
Cranium #10
Posted 28 July 2014 - 10:18 PM
As far as I'm aware, the method to get the tank info is getTankInfo(slot). You can use getTankInfo("unknown") if you don't know what to put in the parentheses.

Not too long ago, I had theoriginalbit help me out writing a monitoring program. Perhaps you can adapt it to your needs?