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

[1.4.1] Ability to pick chest slot

Started by matejdro, 28 July 2012 - 12:46 PM
matejdro #1
Posted 28 July 2012 - 02:46 PM
Ability to suck items from/to chest is nice. But it's only sequential. It would be nice if we could pick up any items from the chest.

These commands would be nice



turtle.dropInto(chestSlot)
turtle.dropInto(chestSlot, amount)

It will drop item from selected turtle slot into specified chest slot. If that slot is already full, it would return false, otherwise true.

turtle.suckFrom(chestSlot)
turtle.suckFrom(chestSlot, amount)

Similar to above command, this one would suck item from specified chest slot into currently selected turtle slot.

turtle.getChestItemCount(chestSlot)

That command will simply give you amount of items in specified slot in chest.

turtle.getChestItemSpace(chestSlot)

This command will tell you, how many items are needed to fill the specified inventory slot.

turtle.compareToChest(chestSlot)

This will detect if item in turtle's selected slot is the same as in chest's specified slot.

turtle.getChestSize()

This will return amount of slots that chest have.


I think this would make chests interactions much more useful.
Pinkishu #2
Posted 28 July 2012 - 03:02 PM
Yeah, those would be very useful :3
Xfel #3
Posted 28 July 2012 - 03:03 PM
That's definetely necessairy. And that's why it will be in the next version of ARP…
xuma202 #4
Posted 28 July 2012 - 03:11 PM
Yes great idea. You could also have only 2 functions instead of

turtle.dropInto(chestSlot)
turtle.dropInto(chestSlot, amount)

It will drop item from selected turtle slot into specified chest slot. If that slot is already full, it would return false, otherwise true.

turtle.suckFrom(chestSlot)

turtle.suckFrom(chestSlot, amount)

Use:

turtle.swap(turtle.slot(2), chest.slot(7))

Will swap slot 2 of the turtles inventory with slot 7 oft the chests inventory.

turtle .split(turtle.slot(3), 9, turtle.slot(5))

Will put 9 items from turtles inventory slot 3 to turtles inventory slot 5.
Pinkishu #5
Posted 28 July 2012 - 03:13 PM
Thats a weird syntax lol
matejdro #6
Posted 28 July 2012 - 03:26 PM
It's not bad idea. But it would be great if we keep all of them (dropInto, suckFrom and swap). And this might be better syntax?

turtle.swap(chestSlot)

(turtle slot is already selected, so there is no need to specify it again).

Also, your split function does the same than mine turtle.dropInto(chestSlot, amount)
xuma202 #7
Posted 28 July 2012 - 03:32 PM
Oh yes that's right but what about swapping/splitting slots turtle/chest internal.

@Pinkishu: might be weird syntax but my intention was breaking this down into the most basic operations.
matejdro #8
Posted 28 July 2012 - 03:41 PM
Yeah split command might be useful for splitting items between two turtle slots.
xuma202 #9
Posted 28 July 2012 - 03:48 PM
And swapping turtle slots is useless yes. But swapping chest slots might not. And the split command would also be necessary if you don't want to move a whole stack.
Lettuce #10
Posted 14 August 2012 - 08:07 AM
This would add so much funtionality, one could make a mining turtle give its inventory to a warehouse turtle, with a couple of rednet control computers for requests… you could make mining completely automated. No more manually emptying chests, just tell it to mine, and build an epic castle.
Nothing quite like using technology so you have time in the day for medieval architecture.

However, to keep the API count down, how about:
turtle.drop(1,3)that drops items from the turtle's slot 1 into the chest's slot 3, and
turtle.suck(1,3) to retrieve items from the chest's slot 3 into the turtle's slot 1? (second parameter always applies to chests)

Because suckFrom/dropInto would only apply to chests/other turtles, when they can be substituted by a second parameter. The others though, like getChestItemCount, would be fantastic, and good additional API's.
BigSHinyToys #11
Posted 14 August 2012 - 08:39 AM
I approve +1
This would definitely make inventory management much easer / more affective.
example a turtle doesn't know what it is holding goes to a chest with items in it and compares it to all of the turtle discovers it is gold goes to gold chest deposits.
Sebra #12
Posted 14 August 2012 - 08:13 PM
I think real minimum is second argument to drop & suck functions. No real need for swap or split.

turtle.drop[up/down](num,slot) - if slot is nil try to drop to any slot or world, else only to designated slot
…………………………………………..if num is nil all items from selected slot moves, else designated number
…………………………………………..returns "true" if success, else "false","reason"
turtle.suck[up/down](num,slot) - the same but other direction
Xfel #13
Posted 14 August 2012 - 08:17 PM
Look at athe arp peripheral mod. It can do it.
GopherAtl #14
Posted 19 August 2012 - 01:12 AM
Not absolutely necesssary perhaps, but split and swap commands working just within the turtle's inventory would be incredibly helpful in using the new crafty turtles. yes, you can achieve the same as split or suck by dropping, selecting a slot, and sucking back up, but this is inelegant and also potentially error-prone if multiple turtles are operating in the same area.