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

Define the chest

Started by Rameron, 04 April 2014 - 05:27 AM
Rameron #1
Posted 04 April 2014 - 07:27 AM
Hello!

Tell me, please, how I can to detect exactly the chest (or any another storage) in front of/above/below turtle?

Thanks.
CometWolf #2
Posted 04 April 2014 - 04:15 PM
use peripheral.getType(side) and compare it to whatever peripheral you're looking for. Keep in mind however that a chest is not considered a peripheral, unless you have openP installed. If you don't you'll have to have a chest in the turtle's inventory, then use turtle.compare(slotNum).
Lyqyd #3
Posted 04 April 2014 - 05:36 PM
turtle.compare uses the currently selected slot. You're thinking of turtle.compareTo, which is used to compare two inventory slots.
Bomb Bloke #4
Posted 04 April 2014 - 07:25 PM
Or rather, he's thinking of turtle.compare() but has the usage wrong - but that's indeed the function Rameron would be using in that instance.