Jump to content




Sensor turtles and inventory sensors OpenCCSensors.


6 replies to this topic

#1 g1eagle

  • Members
  • 6 posts

Posted 29 June 2013 - 12:45 PM

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.

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,462 posts

Posted 29 June 2013 - 02:13 PM

Split into new topic.

Is the sensor card in slot 16?

#3 g1eagle

  • Members
  • 6 posts

Posted 30 June 2013 - 02:38 AM

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

#4 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,462 posts

Posted 30 June 2013 - 03:04 AM

Please post the code you're using.

#5 g1eagle

  • Members
  • 6 posts

Posted 30 June 2013 - 10:37 AM

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?

#6 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,462 posts

Posted 30 June 2013 - 12:52 PM

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.

#7 g1eagle

  • Members
  • 6 posts

Posted 30 June 2013 - 02:04 PM

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





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users