Jump to content




Turtle Inventory


7 replies to this topic

#1 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 16 April 2014 - 12: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 by KingofGamesYami, 16 April 2014 - 12:07 AM.


#2 CometWolf

  • Members
  • 1,283 posts

Posted 16 April 2014 - 12: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.

#3 apemanzilla

  • Members
  • 1,421 posts

Posted 16 April 2014 - 01: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


#4 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 16 April 2014 - 02: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.

#5 dan200

  • Administrators
  • 542 posts
  • LocationCambridge, England

Posted 16 April 2014 - 03:00 PM

also, turtle.getSelectedSlot() was added in 1.6!

#6 apemanzilla

  • Members
  • 1,421 posts

Posted 16 April 2014 - 03:56 PM

View PostLyqyd, on 16 April 2014 - 02:50 PM, said:

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.

View Postdan200, on 16 April 2014 - 03:00 PM, said:

also, turtle.getSelectedSlot() was added in 1.6!
...although it's now obsolete :P

Edited by apemanzilla, 16 April 2014 - 03:56 PM.


#7 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 16 April 2014 - 10:36 PM

View PostCometWolf, on 16 April 2014 - 12:12 AM, said:

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)

View Postdan200, on 16 April 2014 - 03:00 PM, said:

also, turtle.getSelectedSlot() was added in 1.6!
I've been using this.

#8 apemanzilla

  • Members
  • 1,421 posts

Posted 17 April 2014 - 12:40 PM

View PostKingofGamesYami, on 16 April 2014 - 10:36 PM, said:

View PostCometWolf, on 16 April 2014 - 12:12 AM, said:

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)

View Postdan200, on 16 April 2014 - 03:00 PM, said:

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)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users