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

Differentiate between peripherals in inventory

Started by tmt, 31 October 2016 - 07:06 AM
tmt #1
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
Bomb Bloke #2
Posted 31 October 2016 - 10:15 AM
d.damage should hold the values you're after.
tmt #3
Posted 31 October 2016 - 06:29 PM
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!