Difference between revisions of "Turtle (API)"
From ComputerCraft Wiki
Line 106: | Line 106: | ||
|- | |- | ||
|[[turtle.drop]]( [count] ) | |[[turtle.drop]]( [count] ) | ||
− | |Drops all items in the selected slot, or if [count] is specified, drops that many items. If there is a inventory on the side it will try to place into the inventory, returning false if the inventory is full. | + | |Drops all items in the selected slot, or if [count] is specified, drops that many items.<br />If there is a inventory on the side it will try to place into the inventory, returning false if the inventory is full. |
| | | | ||
|- | |- | ||
Line 114: | Line 114: | ||
|- | |- | ||
|[[turtle.refuel]]() | |[[turtle.refuel]]() | ||
− | |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 hardcore turtle mode. If the current slot doesn't contain a fuel item, it yields false. | + | |If the current selected slot contains a fuel item, it will consume it to give the turtle the ability to move.<br />Added in 1.4 and is only needed in hardcore turtle mode. If the current slot doesn't contain a fuel item, it yields false. |
| 1.4 | | 1.4 | ||
|- | |- | ||
|[[turtle.getFuelLevel]]() | |[[turtle.getFuelLevel]]() | ||
− | |Returns the current fuel level of the turtle, this is the number of blocks the turtle can move. In softcore turtle mode it yields "unlimited". | + | |Returns the current fuel level of the turtle, this is the number of blocks the turtle can move.<br />In softcore turtle mode it yields "unlimited". |
| 1.4 | | 1.4 | ||
|} | |} |
Revision as of 14:29, 28 July 2012
The Turtle API is used to work with your Turtles.
Method name | Description | Min version |
---|---|---|
turtle.forward() | Let the Turtle move forward | |
turtle.back() | Let the Turtle move back | |
turtle.up() | Let the Turtle move up | |
turtle.down() | Let the Turtle move down | |
turtle.turnLeft() | The Turtle turns left | |
turtle.turnRight() | The Turtle turns right | |
turtle.select( slotNum ) | The Turtle selects the given Slot (1 is top left, 16 is bottom right) | |
turtle.getItemCount( slotNum ) | Counts how many items are in the given Slot | |
turtle.getItemSpace( slotNum ) | Counts how many items you need to fill the stack in the given Slot | |
turtle.dig() | Breaks the Block in front | |
turtle.attack() | Attacks in front of the turtle. | 1.4 |
turtle.attackDown() | Attacks under the turtle. | 1.4 |
turtle.attackUp() | Attacks over the turtle. | 1.4 |
turtle.digUp() | Breaks the Block above | |
turtle.digDown() | Breaks the Block below | |
turtle.place() | Places a Block of the first available slot in front | |
turtle.placeUp() | Places a Block of the first available slot above | |
turtle.placeDown() | Places a Block of the first available slot below | |
turtle.detect() | Detects if there is a Block in front | |
turtle.detectUp() | Detects if there is a Block above | |
turtle.detectDown() | Detects if there is a Block below | |
turtle.compare() | Detects if the block in front is the same as the one in the first available slot | |
turtle.compareUp() | Detects if the block above is the same as the one in the first available slot | |
turtle.compareDown() | Detects if the block below is the same as the one in the first available slot | |
turtle.compareTo( [slot] ) | Compare the current selected slot and the given slot to see if the items are the same, yields true if they are the same, and false if not. | 1.4 |
turtle.drop( [count] ) | Drops all items in the selected slot, or if [count] is specified, drops that many items. If there is a inventory on the side it will try to place into the inventory, returning false if the inventory is full. |
|
turtle.suck() | Picks up an item from the ground or an inventory at the side, if the turtle can't pickup the item the function yields false. | 1.4 |
turtle.refuel() | 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 hardcore turtle mode. If the current slot doesn't contain a fuel item, it yields false. |
1.4 |
turtle.getFuelLevel() | Returns the current fuel level of the turtle, this is the number of blocks the turtle can move. In softcore turtle mode it yields "unlimited". |
1.4 |
Trivia: During the 1.4 beta, turtle.getFuelLevel() in softcore returned 9000.