←  Ask a Pro

ComputerCraft | Programmable Computers for Minecraft

»

Sensor turtles and inventory sensors OpenC...

g1eagle's Photo g1eagle 29 Jun 2013

I hope I'm doing this correctly..
I'm trying to use a sensor turtle but I'm unable to get it to reconise a sensor card, and there seems to be almost no information on how one would go about getting the turtle to do such...


Also can you use a inventory sensor to tell the name of the item in an inventory? I can get it to pull up the name of the inventory but I can not figure out how to get the individual items in said inventory.
Quote

Lyqyd's Photo Lyqyd 29 Jun 2013

Split into new topic.

Is the sensor card in slot 16?
Quote

g1eagle's Photo g1eagle 30 Jun 2013

Yes the sensor card is in slot 16.
But it returns nil when I try and pull information from it.
Quote

Lyqyd's Photo Lyqyd 30 Jun 2013

Please post the code you're using.
Quote

g1eagle's Photo g1eagle 30 Jun 2013

os.loadAPI("ocs/apis/sensor")
mySensor = sensor.wrap("left")
targets = mySensor.getTargets()

for k, v in pairs(targets) do
print(mySensor.getTargetDetails(k))
end


Though I figured out that problem.. I had a capital letter where it didn't belong...

The other issue of how do we get the slot information?
Quote

Lyqyd's Photo Lyqyd 30 Jun 2013

You use the Slots table contained in the table that getTargetDetails returns.

Try running ocs/programs/sensorview to see what is available for the targets.
Quote

g1eagle's Photo g1eagle 30 Jun 2013

Thanks for the help.
I figured it out.. this can be marked as solved..
Quote