OpenDataSoft www.opendatasoft.com
Libérez-vos données et tenez la promesse de l'open data
Turtle (API) From ComputerCraft Wiki The Turtle API is used to work with your Turtles.
Key Color Turtles that can perform this White All Green Crafty Yellow Mining, Felling, Digging, Farming Red
Any tool
API Return
Method name
Description
Min version
boolean success
turtle.craft(number quantity)
Craft items using ingredients anywhere in the turtle's inventory and place results in the active slot. If a quantity is specified, it will craft only up to that many items, otherwise, it will craft as many of the items as possible.
boolean success
turtle.forward()
Try to move the turtle forward
boolean success
turtle.back()
Try to move the turtle backward
boolean success
turtle.up()
Try to move the turtle up
boolean success
turtle.down()
Try to move the turtle down
turtle.turnLeft()
Turn the turtle left
boolean success
turtle.turnRight()
Turn the turtle right
boolean success
turtle.select(number slotNum)
Make the turtle select slot slotNum (1 is top left, 16 (9 in 1.33 and earlier) is bottom right)
number count
turtle.getItemCount(number slotNum)
Counts how many items are in slot slotNum
number count
turtle.getItemSpace(number slotNum)
Counts how many remaining items you need to fill the stack in slot slotNum
boolean success
turtle.attack()
Attacks in front of the turtle.
1.4
boolean success
turtle.attackUp()
Attacks above the turtle.
1.4
boolean success
turtle.attackDown()
Attacks under the turtle.
1.4
boolean success
turtle.dig()
Breaks the block in front. With hoe: tills the dirt in front of it.
boolean success
turtle.digUp()
Breaks the block above. With hoe: tills the dirt above it.
boolean success
turtle.digDown()
Breaks the block below. With hoe: tills the dirt below it.
boolean success
turtle.place([string signText])
Places a block of the selected slot in front. Engrave signText on signs if provided.
boolean success
boolean
1.4
success
turtle.placeUp()
Places a block of the selected slot above
boolean success
turtle.placeDown()
Places a block of the selected slot below
boolean result
turtle.detect()
Detects if there is a block in front. Does not detect mobs.
boolean result
turtle.detectUp()
Detects if there is a block above
boolean result
turtle.detectDown()
Detects if there is a block below
boolean result
turtle.compare()
Detects if the block in front is the same as the one in the currently selected slot
boolean result
turtle.compareUp()
Detects if the block above is the same as the one in the currently selected slot
boolean result
turtle.compareDown()
Detects if the block below is the same as the one in the currently selected slot
boolean result
turtle.compareTo(number slot)
Compare the current selected slot and the given slot to see if the items are the same. Returns true if they are the same, false if not.
boolean success
turtle.drop([number count])
boolean success
turtle.dropUp([number count])
Drops all items in the selected slot, or specified, drops count items. [>= 1.4 only:] If there is a inventory on the side (i.e above the turtle) it will try to place into the inventory, returning false if the inventory is full.
boolean success
turtle.dropDown([number count])
Drops all items in the selected slot, or specified, drops count items. [>= 1.4 only:] If there is a inventory on the side (i.e below the turtle) it will try to place into the inventory, returning false if the inventory is full. If above a furnace, will place item in the top slot.
boolean success
turtle.suck()
Picks up an item stack of any number, from the ground or an inventory in front of the turtle, then 1.4 places it in the selected slot. If the turtle can't pick up the item, the function returns false.
boolean success
turtle.suckUp()
Picks up an item stack of any number, from the ground or an inventory above the turtle, then places it in the selected slot. If the turtle can't pick up the item, the function returns false.
1.4
boolean success
turtle.suckDown()
Picks up an item stack of any number, from the ground or an inventory below the turtle, then places it in the selected slot. If the turtle can't pick up the item, the function returns false.
1.4
boolean success
turtle.refuel([number quantity])
If the current selected slot contains a fuel item, it will consume it to give the turtle the ability to move. Added in 1.4 and is only needed in needfuel mode. If the current slot doesn't contain a fuel item, 1.4 it returns false. Fuel values for different items can be found at Turtle.refuel#Fuel_Values. If a quantity is specified, it will refuel only up to that many items, otherwise, it will consume all the items in the slot.
number fuel
turtle.getFuelLevel()
Returns the current fuel level of the turtle, this is the number of blocks the turtle can move. If turtleNeedFuel = 0 then it returns "unlimited".
boolean success
turtle.transferTo(number slot [, number quantity])
Transfers quantity items from the selected slot to slot. If quantity isn't specified, will attempt to 1.45 transfer everything in the selected slot to slot.
1.4
Drops all items in the selected slot, or specified, drops count items. [>= 1.4 only:] If there is a inventory on the side (i.e in front of the turtle) it will try to place into the inventory, returning false if the inventory is full.
Trivia: During the 1.4 beta, turtle.getFuelLevel() in softcore(that is now turtleneedsfuel = 0) returned 9000. Retrieved from "http://computercraft.info/wiki/index.php?title=Turtle_(API)&oldid=5833" Category: APIs This page was last modified on 17 July 2013, at 15:40. This page has been accessed 528,650 times.
1.4