←  Ask a Pro

ComputerCraft | Programmable Computers for Minecraft

»

Setting up a Gate Reading Mining turtle to...

Saberwolfcdw's Photo Saberwolfcdw 15 Sep 2013

Title: Setting up a Gate Reading Mining turtle to read a BC Tank or Railcraft Iron Tank level and place a BC Pipe when tank is full/empty.

Wanting to do it in a loop so it'll place the pipe when the tank not full and remove when it is. Very New to computer craft and I have built the turtle but I stink bad at programming. Just a little direction would be nice. Need to know how to wrap the gate, set the gate to read the tank and so on.

Thanks.
Quote

Lyqyd's Photo Lyqyd 15 Sep 2013

Split into new topic.
Quote

plazter's Photo plazter 16 Sep 2013

Do you have Any kind of code your self yet? :)
Quote

BigTwisty's Photo BigTwisty 16 Sep 2013

Wrap the gate with
reader = peripheral.wrap("right")

It might be left, you'll have to look at the turtle to see what side the gate reader is on.

The commands for the wrapped gate reader are like this:
state = reader.get()
if state["val"] then ...

Replace val with the gate code you want to check. You can get the gate codes by placing a gate on a pipe next to what you are reading and clicking through the available gate codes.

I'll leave the looping and the rest to you, as that will be a good learning excercise for you.
Quote