Jump to content




Differentiate between peripherals in inventory


  • You cannot reply to this topic
2 replies to this topic

#1 tmt

  • New Members
  • 2 posts

Posted 31 October 2016 - 08:06 AM

I have a turtle script that's attempting to automate building a computer system. The turtle needs a number of items in its inventory for this build, two of which are disk drives and modems.

But when the turtle queries its inventory, looking for the needed items:

turtle.select( slot_being_looked_at )
d = turtle.getItemDetail()
print( d.name )

...I'm getting
ComputerCraft:CC-Peripheral
for both the modem and the drive. Obviously those two items are not interchangeable for the system I'm trying to build, so I still need to be able to tell them apart.

I can attempt to equip both in the turtle's empty side; the modem will be equippable but the drive will not, but this seems pretty hokey to me.

Am I missing some way to correctly identify these two items when they're in the turtle's inventory?

Thanks,
tmt

#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 31 October 2016 - 10:15 AM

d.damage should hold the values you're after.

#3 tmt

  • New Members
  • 2 posts

Posted 31 October 2016 - 06:29 PM

View PostBomb Bloke, on 31 October 2016 - 10:15 AM, said:

d.damage should hold the values you're after.

Huh, sure enough. Thanks BB -- since neither of the things I'm looking at is a weapon it didn't occur to me to look there.

Appreciate it!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users