Mining Turtle Commands



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)
nativeThe builtin turtle API, without any generated helper functions.
forward()Source

Move the turtle forward one block.

Returns

  1. boolean Whether the turtle could successfully move.
  2. string | nil The reason the turtle could not move.
back()Source

Move the turtle backwards one block.

Returns

  1. boolean Whether the turtle could successfully move.
  2. string | nil The reason the turtle could not move.
up()Source

Move the turtle up one block.

Returns

Mining Turtle Commands
  1. boolean Whether the turtle could successfully move.
  2. string | nil The reason the turtle could not move.
down()Source

Move the turtle down one block.

Returns

  1. boolean Whether the turtle could successfully move.
  2. string | nil The reason the turtle could not move.
turnLeft()Source
Mining turtle commands logdotzip

Rotate the turtle 90 degress to the left.

Returns

  1. boolean Whether the turtle could successfully turn.
  2. string | nil The reason the turtle could not turn.
turnRight()Source

Rotate the turtle 90 degress to the right.

Returns

  1. boolean Whether the turtle could successfully turn.
  2. string | nil The reason the turtle could not turn.
dig([side])Source

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

  1. side?string The specific tool to use. Should be 'left' or 'right'.

Returns

  1. boolean Whether a block was broken.
  2. string | nil The reason no block was broken.
digUp([side])Source

Attempt to break the block above the turtle. See dig for full details.

Parameters

  1. side?string The specific tool to use.

Returns

  1. boolean Whether a block was broken.
  2. string | nil The reason no block was broken.
digDown([side])Source

Attempt to break the block below the turtle. See dig for full details.

Parameters

  1. side?string The specific tool to use.

Returns

  1. boolean Whether a block was broken.
  2. string | nil The reason no block was broken.
place([text])Source

Place a block or item into the world in front of the turtle.

Parameters

  1. text?string When placing a sign, set its contents to this text.

Returns

  1. boolean Whether the block could be placed.
  2. string | nil The reason the block was not placed.
placeUp([text])Source

Place a block or item into the world above the turtle.

Parameters

  1. text?string When placing a sign, set its contents to this text.

Returns

  1. boolean Whether the block could be placed.
  2. string | nil The reason the block was not placed.
placeDown([text])Source

Place a block or item into the world below the turtle.

Parameters

  1. text?string When placing a sign, set its contents to this text.

Returns

  1. boolean Whether the block could be placed.
  2. string | nil The reason the block was not placed.
drop([count])Source

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

  1. count?number The number of items to drop. If not given, the entire stack will be dropped.

Returns

  1. boolean Whether items were dropped.
  2. string | nil The reason the no items were dropped.

Throws

  • If dropping an invalid number of items.

See also

dropUp([count])Source

Drop the currently selected stack into the inventory above the turtle, or as an item into the world if there is no inventory.

Parameters

  1. count?number The number of items to drop. If not given, the entire stack will be dropped.

Returns

  1. boolean Whether items were dropped.
  2. string | nil The reason the no items were dropped.

Throws

  • If dropping an invalid number of items.

See also

dropDown([count])Source

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

  1. count?number The number of items to drop. If not given, the entire stack will be dropped.

Returns

  1. boolean Whether items were dropped.
  2. string | nil The reason the no items were dropped.

Throws

  • If dropping an invalid number of items.

See also

select(slot)Source

Change the currently selected slot.

The selected slot is determines what slot actions like drop or getItemCount act on.

Parameters

Turtle
  1. slotnumber The slot to select.

Returns

  1. true When the slot has been selected.

Throws

  • If the slot is out of range.

See also

getItemCount([slot])Source

Get the number of items in the given slot.

Parameters

  1. slot?number The slot we wish to check. Defaults to the selected slot.

Returns

  1. number The number of items in this slot.

Throws

  • If the slot is out of range.

getItemSpace([slot])Source

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

  1. slot?number The slot we wish to check. Defaults to the selected slot.

Returns

  1. number The space left in in this slot.

Throws

  • If the slot is out of range.

detect()Source

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

  1. boolean If there is a solid block in front.
detectUp()Source

Check if there is a solid block above the turtle. In this case, solid refers to any non-air or liquid block.

Returns

  1. boolean If there is a solid block in front.
detectDown()Source

Check if there is a solid block below the turtle. In this case, solid refers to any non-air or liquid block.

Returns

  1. boolean If there is a solid block in front.
compare()Source

Returns

  1. any...
compareUp()Source

Returns

Mining turtle commands minecraft
  1. any...
compareDown()Source

Returns

  1. any...
Mining
attack([side])Source

Attack the entity in front of the turtle.

Parameters

  1. side?string The specific tool to use.

Returns

  1. boolean Whether an entity was attacked.
  2. string | nil The reason nothing was attacked.
attackUp([side])Source

Attack the entity above the turtle.

Parameters

  1. side?string The specific tool to use.

Returns

  1. boolean Whether an entity was attacked.
  2. string | nil The reason nothing was attacked.
attackDown([side])Source

Attack the entity below the turtle.

Mining Turtle Commands Logdotzip

Parameters

  1. side?string The specific tool to use.

Returns

  1. boolean Whether an entity was attacked.
  2. string | nil The reason nothing was attacked.
suck([count])Source

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

  1. count?number The number of items to suck. If not given, up to a stack of items will be picked up.

Returns

  1. boolean Whether items were picked up.
  2. string | nil The reason the no items were picked up.

Throws

  • If given an invalid number of items.

suckUp([count])Source

Suck an item from the inventory above the turtle, or from an item floating in the world.

Parameters

  1. count?number The number of items to suck. If not given, up to a stack of items will be picked up.

Returns

  1. boolean Whether items were picked up.
  2. string | nil The reason the no items were picked up.

Throws

  • If given an invalid number of items.

suckDown([count])Source

Suck an item from the inventory below the turtle, or from an item floating in the world.

Parameters

  1. count?number The number of items to suck. If not given, up to a stack of items will be picked up.

Returns

  1. boolean Whether items were picked up.
  2. string | nil The reason the no items were picked up.

Throws

  • If given an invalid number of items.

getFuelLevel()Source

Returns

  1. any
refuel([count])Source

Parameters

  1. count?number

Returns

  1. any...
compareTo(slot)Source

Parameters

  1. slotnumber

Returns

  1. any...
transferTo(slot[, count])Source

Parameters

  1. slotnumber
  2. count?number

Returns

  1. any...
getSelectedSlot()Source

Get the currently selected slot.

Returns

  1. number The current slot.

See also

getFuelLimit()Source

Returns

  1. any
equipLeft()Source

Returns

  1. any...
equipRight()Source

Returns

  1. any...
inspect()Source

Get information about the block in front of the turtle.

Returns

  1. boolean Whether there is a block in front of the turtle.
  2. table | string Information about the block in front, or a message explaining that there is no block.
inspectUp()Source

Get information about the block above the turtle.

Returns

  1. boolean Whether there is a block above the turtle.
  2. table | string Information about the above below, or a message explaining that there is no block.
inspectDown()Source

Get information about the block below the turtle.

Returns

  1. boolean Whether there is a block below the turtle.
  2. table | string Information about the block below, or a message explaining that there is no block.
getItemDetail([slot[, detailed]])Source

Get detailed information about the items in the given slot.

Parameters

  1. slot?number The slot to get information about. Defaults to the selected slot.
  2. detailed?boolean

    Whether to include 'detailed' information. When true the method will contain much

Returns

  1. 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.

craft(limit)Source

Parameters

  1. limit
nativeSource

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 * or import turtle You can type this right in the python interpreter to experiment with turtle graphics or, better yet, include this line at the top of your program and then use turtle drawing commands in your program!

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

Turtle can draw intricate shapes using programs that repeat simple moves. The code to draw the above 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 in turtle 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 to reset, 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 forward distance, 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 backward distance, 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 by angle. 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 by angle. 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. Until down 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 to up. 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 the forward and backward commands.

Mining Turtle Commands 1.8

color(*args)

Changes the current color. The current color is used for drawing lines using forward 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, call begin_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.