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

Turtle Inventory

Started by KingofGamesYami, 15 April 2014 - 11:07 PM
KingofGamesYami #1
Posted 16 April 2014 - 01:07 AM
Is it possible to find out what a turtle has selected? eg. slot_1 = "stone" OR slot_1 = 1 –Item ID
If not purely through cc, are there any CC addons that would allow this, or other mods that would allow this in any manner (if I have to send the items to different inventories I will)
Edited on 15 April 2014 - 11:07 PM
CometWolf #2
Posted 16 April 2014 - 01:12 AM
using openP you could either dump the item into a chest and use the chest as a peripheral, or get a narcisitic turtle which can read it's own inventory like a chest peripheral. There's no vanilla cc way of getting item IDs, but you can use turtle.compareTo() to compare blocks in the turtle's inventory.
apemanzilla #3
Posted 16 April 2014 - 02:26 PM
You could override the turtle.select function:

local selected=1
local old.select = turtle.select
function turtle.select(slot)
  old.select(slot)
  selected = slot
end

function turtle.getSelected()
  return selected
end
Lyqyd #4
Posted 16 April 2014 - 03:50 PM
You didn't read the original post very carefully. He wants to be able to determine exactly what is in each slot rather than simply which slot is selected.
dan200 #5
Posted 16 April 2014 - 04:00 PM
also, turtle.getSelectedSlot() was added in 1.6!
apemanzilla #6
Posted 16 April 2014 - 04:56 PM
You didn't read the original post very carefully. He wants to be able to determine exactly what is in each slot rather than simply which slot is selected.
Yes, but I don't think Open Peripheral narcissistic turtles can check their own selected slot, so I was providing a function to check the selected slot.
also, turtle.getSelectedSlot() was added in 1.6!
…although it's now obsolete :P/>
Edited on 16 April 2014 - 02:56 PM
KingofGamesYami #7
Posted 16 April 2014 - 11:36 PM
using openP you could either dump the item into a chest and use the chest as a peripheral, or get a narcisitic turtle which can read it's own inventory like a chest peripheral. There's no vanilla cc way of getting item IDs, but you can use turtle.compareTo() to compare blocks in the turtle's inventory.
So, how would I code that? There is no documentation of openP online, and very little in game (that I found)
also, turtle.getSelectedSlot() was added in 1.6!
I've been using this.
apemanzilla #8
Posted 17 April 2014 - 01:40 PM
using openP you could either dump the item into a chest and use the chest as a peripheral, or get a narcisitic turtle which can read it's own inventory like a chest peripheral. There's no vanilla cc way of getting item IDs, but you can use turtle.compareTo() to compare blocks in the turtle's inventory.
So, how would I code that? There is no documentation of openP online, and very little in game (that I found)
also, turtle.getSelectedSlot() was added in 1.6!
I've been using this.
Step 1: Craft a "Duck Antenna"
Step 2: Attach duck antenna to turtle
Step 3: Note the side it is attached on
Step 4: Run the program "openp/docs left" (or right)
Step 5: If you want more info on a listed function, run "openp/docs left method" (or whatever it is)