I have been working on a program to make a turtle mine for me. Here it is: local depth = 0 local isJunk = true function fuel if turtle.getFuelLevel < 20 then turtle.select(16). A turtle is similar to a Computer but it has movement capabilities. This is not particularly useful but its main appeal is that you can upgrade it to a much more useful turtle. After upgrading to a turtle like the Mining Turtle, the commands 'excavate' (mines a certain area down, such as excavate 3 will mine a 3x3 block going down) and 'tunnel' (mines a 3 wide, 2 high tunnel) are very useful. A Mining Turtle is the same as a Turtle, only now you can use it to do your mining for you. A great place to get started with this is right click on the Mining Turtle once placed to open the GUI. Type in excavate then a number (e.g excavate 3). By typing excavate 3, you are telling it to mine 3x3. Below is a table that describes the turtle commands needed to begin. To see the complete set of turtle commands go to the official Python 3.1 turtle page. Turtle commands The commonly used commands available in turtle are given below. Click on any command to learn more about it. Turtle actions are defined by an API, a set of specific action commands to put the turtle in motion. Simple tasks may be written to make the Turtle dig a shaft, place torches and ladders, dig tunnels and bridges across lava and so much more, the possibilities of use are endless. We hope the Player will enjoy this remarkable utility companion.
The turtle API allows you to control your turtle.
forward() | Move the turtle forward one block. |
---|---|
back() | Move the turtle backwards one block. |
up() | Move the turtle up one block. |
down() | Move the turtle down one block. |
turnLeft() | Rotate the turtle 90 degress to the left. |
turnRight() | Rotate the turtle 90 degress to the right. |
dig([side]) | Attempt to break the block in front of the turtle. |
digUp([side]) | Attempt to break the block above the turtle. |
digDown([side]) | Attempt to break the block below the turtle. |
place([text]) | Place a block or item into the world in front of the turtle. |
placeUp([text]) | Place a block or item into the world above the turtle. |
placeDown([text]) | Place a block or item into the world below the turtle. |
drop([count]) | Drop the currently selected stack into the inventory in front of the turtle, or as an item into the world if there is no inventory. |
dropUp([count]) | Drop the currently selected stack into the inventory above the turtle, or as an item into the world if there is no inventory. |
dropDown([count]) | Drop the currently selected stack into the inventory in front of the turtle, or as an item into the world if there is no inventory. |
select(slot) | Change the currently selected slot. |
getItemCount([slot]) | Get the number of items in the given slot. |
getItemSpace([slot]) | Get the remaining number of items which may be stored in this stack. |
detect() | Check if there is a solid block in front of the turtle. |
detectUp() | Check if there is a solid block above the turtle. |
detectDown() | Check if there is a solid block below the turtle. |
compare() | |
compareUp() | |
compareDown() | |
attack([side]) | Attack the entity in front of the turtle. |
attackUp([side]) | Attack the entity above the turtle. |
attackDown([side]) | Attack the entity below the turtle. |
suck([count]) | Suck an item from the inventory in front of the turtle, or from an item floating in the world. |
suckUp([count]) | Suck an item from the inventory above the turtle, or from an item floating in the world. |
suckDown([count]) | Suck an item from the inventory below the turtle, or from an item floating in the world. |
getFuelLevel() | |
refuel([count]) | |
compareTo(slot) | |
transferTo(slot[, count]) | |
getSelectedSlot() | Get the currently selected slot. |
getFuelLimit() | |
equipLeft() | |
equipRight() | |
inspect() | Get information about the block in front of the turtle. |
inspectUp() | Get information about the block above the turtle. |
inspectDown() | Get information about the block below the turtle. |
getItemDetail([slot[, detailed]]) | Get detailed information about the items in the given slot. |
craft(limit) | |
native | The builtin turtle API, without any generated helper functions. |
Move the turtle forward one block.
Returns
- boolean Whether the turtle could successfully move.
- string | nil The reason the turtle could not move.
Move the turtle backwards one block.
Returns
- boolean Whether the turtle could successfully move.
- string | nil The reason the turtle could not move.
Move the turtle up one block.
Returns
- boolean Whether the turtle could successfully move.
- string | nil The reason the turtle could not move.
Move the turtle down one block.
Returns
- boolean Whether the turtle could successfully move.
- string | nil The reason the turtle could not move.
Rotate the turtle 90 degress to the left.
Returns
- boolean Whether the turtle could successfully turn.
- string | nil The reason the turtle could not turn.
Rotate the turtle 90 degress to the right.
Returns
- boolean Whether the turtle could successfully turn.
- string | nil The reason the turtle could not turn.
Attempt to break the block in front of the turtle.
This requires a turtle tool capable of breaking the block. Diamond pickaxes (mining turtles) can break any vanilla block, but other tools (such as axes) are more limited.
Parameters
- side?string The specific tool to use. Should be 'left' or 'right'.
Returns
- boolean Whether a block was broken.
- string | nil The reason no block was broken.
Attempt to break the block above the turtle. See dig for full details.
Parameters
- side?string The specific tool to use.
Returns
- boolean Whether a block was broken.
- string | nil The reason no block was broken.
Attempt to break the block below the turtle. See dig for full details.
Parameters
- side?string The specific tool to use.
Returns
- boolean Whether a block was broken.
- string | nil The reason no block was broken.
Place a block or item into the world in front of the turtle.
Parameters
- text?string When placing a sign, set its contents to this text.
Returns
- boolean Whether the block could be placed.
- string | nil The reason the block was not placed.
Place a block or item into the world above the turtle.
Parameters
- text?string When placing a sign, set its contents to this text.
Returns
- boolean Whether the block could be placed.
- string | nil The reason the block was not placed.
Place a block or item into the world below the turtle.
Parameters
- text?string When placing a sign, set its contents to this text.
Returns
- boolean Whether the block could be placed.
- string | nil The reason the block was not placed.
Drop the currently selected stack into the inventory in front of the turtle, or as an item into the world if there is no inventory.
Parameters
- count?number The number of items to drop. If not given, the entire stack will be dropped.
Returns
- boolean Whether items were dropped.
- string | nil The reason the no items were dropped.
Throws
If dropping an invalid number of items.
See also
Drop the currently selected stack into the inventory above the turtle, or as an item into the world if there is no inventory.
Parameters
- count?number The number of items to drop. If not given, the entire stack will be dropped.
Returns
- boolean Whether items were dropped.
- string | nil The reason the no items were dropped.
Throws
If dropping an invalid number of items.
See also
Drop the currently selected stack into the inventory in front of the turtle, or as an item into the world if there is no inventory.
Parameters
- count?number The number of items to drop. If not given, the entire stack will be dropped.
Returns
- boolean Whether items were dropped.
- string | nil The reason the no items were dropped.
Throws
If dropping an invalid number of items.
See also
Change the currently selected slot.
The selected slot is determines what slot actions like drop or getItemCount act on.
Parameters
- slotnumber The slot to select.
Returns
- true When the slot has been selected.
Throws
If the slot is out of range.
See also
Get the number of items in the given slot.
Parameters
- slot?number The slot we wish to check. Defaults to the selected slot.
Returns
- number The number of items in this slot.
Throws
If the slot is out of range.
Get the remaining number of items which may be stored in this stack.
For instance, if a slot contains 13 blocks of dirt, it has room for another 51.
Parameters
- slot?number The slot we wish to check. Defaults to the selected slot.
Returns
- number The space left in in this slot.
Throws
If the slot is out of range.
Check if there is a solid block in front of the turtle. In this case, solid refers to any non-air or liquid block.
Returns
- boolean If there is a solid block in front.
Check if there is a solid block above the turtle. In this case, solid refers to any non-air or liquid block.
Returns
- boolean If there is a solid block in front.
Check if there is a solid block below the turtle. In this case, solid refers to any non-air or liquid block.
Returns
- boolean If there is a solid block in front.
Returns
- any...
Returns
- any...
Returns
- any...
Attack the entity in front of the turtle.
Parameters
- side?string The specific tool to use.
Returns
- boolean Whether an entity was attacked.
- string | nil The reason nothing was attacked.
Attack the entity above the turtle.
Parameters
- side?string The specific tool to use.
Returns
- boolean Whether an entity was attacked.
- string | nil The reason nothing was attacked.
Attack the entity below the turtle.
Mining Turtle Commands Logdotzip
Parameters
- side?string The specific tool to use.
Returns
- boolean Whether an entity was attacked.
- string | nil The reason nothing was attacked.
Suck an item from the inventory in front of the turtle, or from an item floating in the world.
This will pull items into the first acceptable slot, starting at the currently selected one.
Parameters
- count?number The number of items to suck. If not given, up to a stack of items will be picked up.
Returns
- boolean Whether items were picked up.
- string | nil The reason the no items were picked up.
Throws
If given an invalid number of items.
Suck an item from the inventory above the turtle, or from an item floating in the world.
Parameters
- count?number The number of items to suck. If not given, up to a stack of items will be picked up.
Returns
- boolean Whether items were picked up.
- string | nil The reason the no items were picked up.
Throws
If given an invalid number of items.
Suck an item from the inventory below the turtle, or from an item floating in the world.
Parameters
- count?number The number of items to suck. If not given, up to a stack of items will be picked up.
Returns
- boolean Whether items were picked up.
- string | nil The reason the no items were picked up.
Throws
If given an invalid number of items.
Returns
- any
Parameters
- count?number
Returns
- any...
Parameters
- slotnumber
Returns
- any...
Parameters
- slotnumber
- count?number
Returns
- any...
Get the currently selected slot.
Returns
- number The current slot.
See also
Returns
- any
Returns
- any...
Returns
- any...
Get information about the block in front of the turtle.
Returns
- boolean Whether there is a block in front of the turtle.
- table | string Information about the block in front, or a message explaining that there is no block.
Get information about the block above the turtle.
Returns
- boolean Whether there is a block above the turtle.
- table | string Information about the above below, or a message explaining that there is no block.
Get information about the block below the turtle.
Returns
- boolean Whether there is a block below the turtle.
- table | string Information about the block below, or a message explaining that there is no block.
Get detailed information about the items in the given slot.
Parameters
- slot?number The slot to get information about. Defaults to the selected slot.
- detailed?boolean
Whether to include 'detailed' information. When true the method will contain much
Returns
- nil | table Information about the given slot, or nil if it is empty.
Throws
If the slot is out of range.
Usage
Print the current slot, assuming it contains 13 dirt.
Parameters
- limit
The builtin turtle API, without any generated helper functions.
Generally you should not need to use this table - it only exists forbackwards compatibility reasons.
Computercraft Turtle Mining Commands
Turtle graphics with turtle
Python has a library called turtle
that is part of the standard python installation. To use it, you need only type: from turtle import *
import turtle
In the turtle
package when you run a program with turtle commands, a special window will open where the drawing will take place.
Example turtle Code to Draw a Star
Turtle Star
Complete turtle reference!
Below is a table that describes the turtle commands needed to begin.To see the complete set of turtle
commands go to the official Python 3.1 turtle page.
Turtle commands
The commonly used commands available inturtle
are given below. Click on any command to learn more about it. degrees() | radians() | reset() |
clear() | tracer(flag) | forward(distance) |
backward(distance) | left(angle) | right(angle) |
up() | down() | width(width) |
color(*args) | begin_fill() | end_fill() |
setheading(angle) | window_width() | window_height() |
position() | setx(xpos) | sety(ypos) |
goto(x,y) | heading() |
degrees()
Sets the angle input method to degrees. All following angle inputs are assumed to be degree measures. This is the default setting.radians()
Sets the angle input method to radians. All following angle inputs are assumed to be radian measures.reset()
Resets everything to the default values, and clears the canvas. After a call toreset
, the canvas will be in exactly the same state as it was when the import command was called: you will have a blank canvas will the turtle (colored black with fill set to unfilled) pointing to the right at the center (heading = 0.0). clear()
Erases the entire canvas and redraws the turtle. Does not move the turtle.tracer(n=None, delay=None)
Turns turtle animation on/off and set delay for update drawings.If non-negative integer n is given, only each n-th regular screen update is performed. Can be used to accelerate the drawing of complex graphics. When called without arguments, returns the currently stored value of n. Second argument sets delay value (see delay()).
Turning the turtle off makes the turtle disappear and makes drawing MUCH faster. Drawing commands are still executed without the turtle, and lines are still drawn when the turtle is moved. Use up
and down
to turn drawing on and off, or just use the setx
, sety
, or goto
functions to move without drawing.
forward(distance)
Moves the turtle forwarddistance
, drawing a line behind the turtle. The line will be drawn even if the turtle is turned off. Turtle Tutorial - ComputerCraft Wiki
backward(distance)
Moves the turtle backwarddistance
, drawing a line along the path taken. The line will be drawn even if the turtle is turned off. left(angle)
Turns the turtle left byangle
. If degrees
has been called (the default), angle
will be used as a degree measure; if radians
has been called, angle
will be interpreted as a measure in radians. right(angle)
Turns the turtle right byangle
. If degrees
has been called (the default), angle
will be used as a degree measure; if radians
has been called, angle
will be intrepreted as a measure in radians. up()
Stops all drawing. Untildown
is called, nothing will be drawn to the screen. Cursor movement will still take effect, however. Computercraft Mining Turtle Commands
down()
Resumes drawing after a call toup
. Commands between the up
and down
statements will not be drawn, but commands after the down
statement will appear as normal. width(width)
Sets the width of the line drawn using theforward
and backward
commands. Mining Turtle Commands 1.8
color(*args)
Changes the current color. The current color is used for drawing lines usingforward
and backward
, as well as for filling shapes when end_fill()
is called after begin_fill()
. The color can be given as a single color string (as in color('blue')
, color('chocolate')
, color('peru')
, color('#a0df00')
, or color('#1dead1')
). A three-tuple of rgb float values (as in color((0.1,0.5,0.9))
or color((95/255., 12/255., 9/255.))
) can be used. Mining Turtle Commands 1.9
begin_fill()
Used to fill shapes. First, callbegin_fill()
, then proceed to draw the outline of the shape to be filled. After the shape is done, call end_fill()
. A line will be drawn from the current turtle position to the position of the turtle when the begin_fill()
command was called, and the resulting polygon will be filled with the current color (the color of exterior lines will also be changed). If any interior angle in the resulting polygon is greater than 180°, however, the resulting filled polygon will only include the first two line segments after the begin_fill()
statement, forming a triangle.