|Is this the page you were looking for?|
This is for the turtle block/item. For the API, visit Turtle (API).
Turtles and Advanced Turtles are essentially robots, and were added in the 1.3 update. They have the ability to place, break and detect blocks, move around and drop items in their inventory via their access to the Turtle API. The programs they run are stored in their internal memory, or on floppy disks.
The 1.4 update was focused on turtles, and expanded their ability to use tools. Turtles are capable of using pickaxes, hoes, axes, shovels and swords. The update added "Crafty Turtles", which have the ability to craft using their inventory - and part of this upgrade saw the number of inventory slots in the Turtle raised to 16 from the previous 9 slot inventory. The 1.4 update also included a new fuel system for the turtles.
The 1.55 update added Advanced Turtles - made of gold, are able to display color, and have mouse input available through their display. Their exterior appearance is also of gold. They're just like Advanced Computers, but with a smaller screen.
Prior to 1.6, turtles had to have tools manually attached via crafting. As of that update, they are now also able to swap tools in and out of their inventory at will. That build also brought in caps to the arbitrarily large fuel values turtles could previously store - by default, they are now 20,000 units for regular turtles and 100,000 for advanced.
Turtles are submersible and lavaproof. As such, they are extremely useful for mining near bedrock, where heavy lava flows can prevent access to diamonds and other rare finds.
If you would like to know more about how to program them, have a look at the Turtle API.
Keep in mind that when turtles are 'mined', picked up, and placed somewhere else, they will not keep their programs unless they have been given a label. To do so, you simply need to type in "label set <labelName>" at the shell prompt.
Turtles do not have a built-in Disk Drive. As such, they need a Disk Drive placed beside them to access Floppy Disks. However, if the Turtle is of the Wireless family, the Disk Drive (and other peripherals) must be placed on a side other than the side the wireless modem is on. Any other peripherals, such as Monitors and Printers can be interacted using the peripheral API.
Turtles require fuel to operate - this means Turtles must be powered from any item that works in a regular furnace, like coal and lava. The turtle gains 0.6 "movement" per half second the fuel would have burnt in a furnace. The Turtle can move 1 block for each fuel count it has, for example, coal yields 80 block movements.
In this mode, Turtles use their internal Redstone Engine, and as such, they do not need to be re-charged, or receive any other form of external power. This is because Redstone continuously emits low levels of energy, and the Turtle's engine is very efficient. This mode can be turned on by editing ComputerCraft.cfg and setting to .
As of ComputerCraft 1.63 Turtles can be dyed using Dyes. It supports all 16 different colors, so you can have a green Farming Turtle harvesting some melons and a gray Mining Turtle gathering materials and mining ores.
Turtles equipped with a diamond hoe can till dirt so it can later be used for Farming. An example of a use for this would be using it to till, plant, and harvest your wheat farm and dropping any product in a chest for you.
Turtles crafted with a diamond pickaxe, diamond axe, or diamond shovel, can break blocks, chop wood, mine stone and ores, and even break dirt and gravel (depending on the tool you used on it). The tools equipped on the Turtle have no durability, and so can be used indefinitely without the need for any additional materials. When a Turtle breaks the block, the Turtle receives the item directly into it's inventory. Different tools yield different drops - for example, an axe can break anything, but it won't drop ores.
Turtles with a Crafting Table can craft items if they have the correct materials to do so, and all other slots outside the crafting-zone are empty.
Turtles equipped with a diamond sword can attack players and mobs. When a Turtle kills a mob it will leave the experience orbs on the ground, but add the loot to its inventory. Turtles can also attack with any tool, where the diamond axe is the second best after the diamond sword.
Turtles can interact with blocks that have inventories. This includes chests, furnaces, Printers and even blocks with inventories in other mods. (This means a turtle cannot interact with a player's inventory, unless you use a third party peripheral). Turtles can interact with such inventories by using turtle.suck, turtle.suckDown, turtle.suckUp (To retrieve the first item in the inventory. The turtle finds the first item by scanning the first row from left to right, then the second row from left to right, etc). Turtles can also place items inside inventories, by using turtle.drop, turtle.dropUp, turtle.dropDown, which places items on the first item slot available (Using the same system as the one described for retrieving items).
In special inventories, with just a few slots on the top or bottom - for example furnaces - you can specify which slot to place an item in by positioning the turtle in the corresponding location to the front face of the inventory. For example in a furnace, you would use a turtle at the bottom of the furnace for it to place fuel in the furnace, a turtle at the top to place objects to smelt, and a turtle to the right to retrieve the smelted objects (Note that you can do this with just 1 turtle moving around).
Just like a Computer, a Turtle can be used as a peripheral. You can find all Turtle peripheral functions here.
Note: NEI has been known to present the recipe for an advanced turtle as requiring a normal computer, somehow ignoring the actual recipe.
Turtles can be equipped with different peripherals and tools. A turtle can be crafted with any combination of tools and peripherals. Turtles may later use turtle.equipLeft() / turtle.equipRight() to add, remove or exchange tools in any combination.
The following tools can be equipped to a turtles: diamond pickaxe, diamond axe, diamond shovel, diamond hoe and diamond sword
The following peripherals can be equipped to a turtles: wireless modems, ender modems and crafting tables.
Diamond tools must be unused (i.e. not have a durability bar showing) an unenchanted to combine with a turtle.
Turtle recipe and examples for equipping a turtle with tools and peripherals (Note that any variants of the turtle can also be crafted with the Advanced Turtle):
You're browsing the GameFAQs Message Boards as a guest. Sign Up for free (or Log In if you already have an account) to be able to post messages, change how messages are displayed, and view media in posts.
i cant put in any custom commands, just "tunnel" and "excavate", though they're both useful i want more like strip mine and what not, but it wont let me do these, PS im on a server, how do i fix this
imma give you a hug this big <('__')>
you mean you cant just edit any program you want into them ?
The computers/turtles only come with a few programs by default. If you want a automatic strip mining program, you have to write the program yourself. You type "edit" and then the name of the program you wish to create. Now you are on a blank screen where you can type. This is where you write your program. Obviously, you won't be able to do anything unless you know LUA. http://en.wikipedia.org/wiki/Lua_%28programming_language%29
I really recommend learning LUA if you have any interest in computercraft. I've written about a dozen programs myself and I find it really fun. I've got turtle programs for automatic farms, automatic strip mining, more efficient excavations (better then they default one), automatic tree farms, a program that launches a GPS tower, iron door/password protected doors, etc etc. Probably my favorite mod of all now.
Sure you could just go onto the cc forums and copy/paste other peoples programs, but I find it much more enjoyable to write my own programs.
Like it or leave it. Hey, where are you going?
i type edit myfirstturtle
it loads up the normal edit screen (ctrl=save/print/exit)
i manually type the whole thing, save it
close it and attempt to run it, but its not there, i type list and its not in there either, i did it 2 times to make sure im saving it and boom still nothing
imma give you a hug this big <('__')>
ill do it manually, say this is the page i want to add
how do i add it in manually then run it?
imma give you a hug this big <('__')>
Your server is probably prohibiting of saving programs with computercraft. When you write and save a program in-game, you are writing to the servers hard drive a file. If the server prevents you from changing/adding files, then you won't be able to write programs in computercraft.
Like it or leave it. Hey, where are you going?
One thing to also keep in mind is you have to label your turtle in order to keep any programs saved after you break it. So if you're writing your program, saving it, then breaking the turtle, the program won't be there when you place it again.
It's pretty easy to label a turtle. Just type
label set Name
With Name being whatever you want. I realize that's probably not the problem, since you're not finding the program immediately after writing it, but I thought I'd bring it up just in case.
"Now when I tell you to ascend to a higher plane of consciousness, you say HOW HIGH SIR?" --Bucky Katt
Oh yeah, forgot about labeling. He just said he saved the program and immediately tried to run it and it wasn't there, so I just assumed it wasn't saving to begin with, but if he was picking up the turtle, then yeah, that would be the problem. Always label your turtles.
Like it or leave it. Hey, where are you going?
This reference is not a complete list of all the functions in ComputerCraft, but findBlock(string name) Spins the turtle around and stops if the turtle is facing a.
From ComputerCraft Wiki
Jump to: navigation, search
CraftOS Shell Programs
|Maps an alias string to a program.|
|Lists all loaded APIs.|
|Opens the specified script in a new multishell tab. Note: Added by ComputerCraft 1.6|
|Changes to the specified directory|
|Clears the terminal.|
|Copies a source file or folder to a destination|
|Deletes the specified file (in the same manner as rm).|
|Music box DJ - use for help.|
|Lists the mount location of the current directory, or the path specified.|
|Edits the file specified.|
|Ejects the disk on the side specified.|
|Exits the currently running shell session - if it is the only shell session, the computer will power off.|
|Opens the specified script in a new multishell tab, then switches to it. Note: Added by ComputerCraft 1.6|
|Minecraft Global Positioning tool. Use for help.|
|Help utility. Opens the specified topic, or the introduction if no topic is specified.|
|Returns the ID of the computer, or if a side is specified, the ID of the disk in the specified side.|
|Gets and sets the ID of the computer, or, the ID of a disk in a specified side. Use for help.|
|Lists the content of the current directory, or, the directory specified.|
|Interactive Lua interpreter at the shell.|
|Makes the directory at the path specified.|
|Redirects a specified program to a monitor on the specified side.|
|Moves a file or folder at a specified source path to the specified destination path.|
|Opens a new instance of multishell, running within the current multishell session. Note: Added by ComputerCraft 1.6|
|Allows the user to either retrieve a file from pastebin.com, run it directly after downloading, or upload a file from the computer/turtle.|
|Lists all programs on the system.|
|Reboots the Computer.|
|List redstone stats. Note: Removed in ComputerCraft 1.6|
|Redstone output pulse tool. Use for help. Note: Removed in ComputerCraft 1.6|
|Redstone output set tool. Use for help. Note: Removed in ComputerCraft 1.6|
|Controls the redstone output state(s) of the system. Note: Added by ComputerCraft 1.6|
|Configures the system to act as a rednet repeater. Note: Added by ComputerCraft 1.6|
|Returns the Minecraft time of day.|
|Returns the type of the object or file at the specified path.|
|Renames a file or directory.|
|Deletes the specified file (in the same manner as delete).|
|Opens another shell session. Runs a program if specified.|
|Powers off the Computer.|
Additional TurtleOS Shell Programs
|The turtle will, if it is able, craft an item from the contents of its inventory.|
|Initiates "get down" procedure.|
|The turtle will attempt to place a tool on its specified side. Note: Added by ComputerCraft 1.6|
|Digs a square-shaped quarry to bedrock, of width equal to that specified.|
|Moves the turtle.|
|Attempts to replenish the turtle's fuel supply with items from its inventory.|
|Digs a horizontal tunnel leading off in the direction the turtle is facing.|
|Causes the turtle to rotate.|
|Attempts to remove a tool from the turtle's specified side. Note: Added by ComputerCraft 1.6|
Orwell, on 21 December 2012 - 12:24 PM, said:
cmurtheepic, on 21 December 2012 - 07:40 PM, said:
Name, Mining Turtle. Type, Mobile computer. Stackable, Yes (64). Data Value, (diamond pick), (other pick). Source Mod, ComputerCraft.
In this reference, you’ll find short descriptions of every function used in this book. The functions are grouped by application programming interface (API), also known as a module. This reference is not a complete list of all the functions in ComputerCraft, but you can read about other available functions in the documentation that ComputerCraft provides at http://computercraft.info/wiki/Category:APIs.
If you want to learn more about Lua, you can use the Lua 5.1 Reference Manual, which is available online at https://www.lua.org/manual/5.1/. Note that ComputerCraft uses Lua 5.1, even though newer versions of Lua are available.
Some functions in this reference include italicized terms that indicate where parameters would go and what the data types of those parameters would be.
Turtles and in-game Minecraft computers have file systems similar to those your computer has. You can interact with these files using the fs API and the file’s name:
fs.delete(string filename) Deletes a file named filename
fs.exists(string filename) Returns true if a file named filename exists; otherwise returns false
The programs you write in this book can interact with the files loaded on a turtle or in-game computer but not with the files on the computer that is running Minecraft.
You wrote the hare API while reading this book. Unlike the other APIs listed in this reference, hare doesn’t come with ComputerCraft, so you must first run pastebin get wwzvaKuW hare from the CLI shell to download it. Each program you write that uses the hare API must include the code os.loadAPI('hare') in order for the program to call the hare module’s functions:
hare.buildFloor(number length,number width) Builds a floor length blocks long and width blocks wide using items in the turtle’s inventory.
hare.buildRoom(number length,number width,number height) Builds a room length blocks long, width blocks wide, and height blocks tall using items in the turtle’s inventory.
hare.buildWall(number length,number height) Builds a wall length blocks long and height blocks tall using items in the turtle’s inventory.
hare.countInventory() Returns the total number of items in all the turtle’s inventory slots.
hare.digUntilClear() Continues to mine the space in front of the turtle until the space contains no blocks. You use this function when gravel or sand could fall in front of the turtle as it mines the block in front of it.
hare.digUpUntilClear() Similar to hare.digUntilClear() except it clears the space above the turtle.
hare.findBlock(string name) Spins the turtle around and stops if the turtle is facing a block named name. If the turtle can’t find the block, the turtle ends up facing its original direction after the function code finishes running. Returns true if the block was found; otherwise returns false.
hare.selectAndPlaceDown() Selects a nonempty inventory slot and places the item in that slot beneath the turtle.
hare.selectEmptySlot() Selects an empty inventory slot. Returns true if a slot is found; otherwise returns false.
hare.selectItem(string name) Selects an inventory slot containing an item named name. Returns true if the item is found; otherwise returns false.
hare.sweepField(number length,number width,function sweepFunc) Moves the turtle over every space in a rectangular field length blocks long and width blocks wide, calling sweepFunc at each space.
When you use the io API, programs can display text on the screen and also accept text from the player via the keyboard. There are several functions in the io API, but the most important function to know is io.read():
io.read() When the player types a response and presses ENTER, this function returns the response as a string value.
The math API is part of Lua, and you can call its functions from non-ComputerCraft Lua programs. This API includes the following number and mathematics-related functions:
math.ceil(number num) Returns num rounded up.
math.floor(number num) Returns num rounded down.
math.random(number start,number end) Returns a random whole number between start and end, including start and end. The start and end arguments are optional. If no arguments are passed, the function returns a decimal point number between 0.0 and 1.0. If the start argument is not used, the function returns an integer between 1 and end.
The ComputerCraft operating system provides the following functions, which are useable by turtles and in-game computers:
os.getComputerLabel() Returns a string of the turtle’s label (that is, its name).
os.loadAPI(string filename) Loads the program named filename as a module so the current program can call its functions.
os.setComputerLabel(string/nil label) Sets the turtle’s label to label. If label is nil, the function erases the turtle’s label.
os.sleep(number time) Pauses the program for time number of seconds.
Turtles can run commands from the CLI the same way the player can run commands from the CLI. You can run a CLI command in a turtle program using the shell API:
shell.run(string command) Runs command as though the player entered the string at the CLI shell. Returns false if the command terminates because the command doesn’t exist, crashes, or calls error(); otherwise returns true.
The string API is part of Lua, and you can call its functions from non-ComputerCraft Lua programs. Although these functions weren’t featured in this book, I’ve included them here because they’re useful:
string.find(string haystack,string needle) Looks for the needle string inside the haystack string and returns two integers: the position where the needle string was found and where this string ends. For example, string.find('hello', 'el') returns 2 and 3, because 'el' is found at the second character in 'hello' and ends at the third character. If the needle string is not in the haystack string, the function returns nil. The needle string can also find text patterns, which are outside the scope of this book. You can learn more about text patterns at https://www.lua.org/manual/5.1/manual.html#5.4.1/.
string.sub(string bigstring,number start,number length) Returns a substring, or portion, of bigstring, starting at the start position and returning the next length characters. The length argument is optional. If length is not passed, the substring starts at start and continues to the end of bigstring. For example, string.sub('hello', 3, 2) returns 'll' and string.sub('hello', 2) returns 'ello'.
Using textutils, you can make programs display text one character at a time to create a fancy typewriter effect:
textutils.slowPrint(string text,number rate) Similar to print() except it writes the characters in text one character at a time. The rate argument is optional and specifies how many characters are printed per second.
The turtle API holds all the common functions that your programs could call to make a turtle perform some action. Let’s look at these functions in batches based on the actions the functions can trigger.
You can call functions to make turtles build by placing blocks. But the same function can also cause the turtle to perform other actions, depending on the item in the turtle’s current slot:
turtle.place() Performs an action with the item in the turtle’s current slot. For building blocks, this function places the block in the Minecraft world. However, if one of the special items listed in Table 1 is in the current slot, that item will be used in the way specified by Table 1. The function returns false if the turtle is unable to place the block or perform an action on the block.
turtle.placeDown() Similar to turtle.place() but performs the action on the space below the turtle.
turtle.placeUp() Similar to turtle.place() but performs the action on the space above the turtle.
Table 1: Special Items That the place Functions Can Use
Sets the armor on an armor stand.
Places the boat on water.
Dyes a sheep.
Collects lava or water. Can also collect milk from a cow.
Launches the fireworks.
Flint and steel
Sets fire to a flammable block or activates a Nether portal.
Places the minecart on tracks.
Saplings, flowers, or seeds
Plants the object in a dirt or grass block.
Shears a sheep and collects its wool.
Places a sign with text on it. To write text on the sign, pass the turtle function a string. For example, turtle.place('This\nis a\nsign.').
Spawns a mob.
Turtles use one unit of fuel each time they move, but they can’t move if they run out of fuel. For this reason, refueling the turtle and understanding its fueling functions are important:
turtle.getFuelLevel() Returns the amount of fuel the turtle currently has stored. Returns 'unlimited' if the ComputerCraft.cfg config file has disabled the fuel requirement.
turtle.getFuelLimit() Returns the maximum amount of fuel the turtle can store. For most turtles, the limit is 20,000 units; for other types of turtles, the limit is 100,000 units. Returns 'unlimited' if the ComputerCraft.cfg config file has disabled the fuel requirements.
turtle.refuel(number amount) Consumes amount of fuel items in the current slot. The amount argument is optional. If amount is not given, the function consumes all the items in the current slot by default.
Each turtle has an inventory with 16 numbered slots. You can use various inventory functions to make the turtle perform actions on its inventory. These functions often take a number to indicate which of the numbered slots to perform an action on.
turtle.compareTo(number slot) Returns true if the item in the current slot is the same as the item in slot; otherwise returns false.
turtle.drop(number amount) Drops amount items from the current slot into the space or container in front of the turtle. The amount argument is optional. If amount isn’t given, the function drops all the items in the current slot. Returns true if any items were dropped; otherwise returns false.
turtle.dropDown(number amount) Similar to turtle.drop() except this function drops items into the space or container below the turtle.
turtle.dropUp(number amount) Similar to turtle.drop() except this function drops items into the space or container above the turtle.
turtle.equipLeft() Unequips the tool, if any, on the turtle’s left side and equips the tool in the current slot. Returns true if equipped; otherwise returns false.
turtle.equipRight() Unequips the tool, if any, on the turtle’s right side and equips the tool in the current slot. Returns true if equipped; otherwise returns false.
turtle.getItemCount(number slot) Returns the number of items in slot. Uses the current slot if slot isn’t given.
turtle.getItemDetail(number slot) Returns a table value of information about the item in slot or returns nil if the slot is empty. Uses the current slot if slot isn’t given.
turtle.getItemSpace(number slot) Returns the amount of free space in slot. Uses the current slot if slot isn’t given.
turtle.getSelectedSlot() Returns the slot number (1 to 16) of the current slot.
turtle.select(number slot) Changes the current slot to slot, a number from 1 to 16.
turtle.suck(number amount) Takes amount items from the space or container in front of the turtle, sucking them up like a vacuum cleaner, and places them in either the current slot (if empty) or the first available empty slot. The amount argument is optional. If amount isn’t given, a full stack of items is taken. (A full stack is 64 for most items, although some items like eggs, snowballs, or empty buckets can only stack up to 16.) Returns true if any items were taken; otherwise returns false.
turtle.suckDown(number amount) Like turtle.suck() except this function takes items from the space or container below the turtle.
turtle.suckUp(number amount) Like turtle.suck() except this function takes items from the space or container above the turtle.
turtle.transferTo(number slot,number amount) Transfers amount items from the current slot to slot. The amount argument is optional. If amount isn’t given, the function attempts to transfer all items in the current slot to slot. Returns true if any items were transferred; otherwise returns false.
Turtles can move in any direction as long as the space they’re attempting to move to is not already occupied by another block. You can use the following functions to tell a turtle to move in various directions. All movement functions return true if the turtle was able to move; otherwise, they return false:
turtle.back() Moves the turtle backward one space
turtle.down() Moves the turtle down one space
turtle.forward() Moves the turtle forward one space
turtle.turnLeft() Turns the turtle to the left; doesn’t use fuel
turtle.turnRight() Turns the turtle to the right; doesn’t use fuel
turtle.up() Moves the turtle up one space
Turtles can examine blocks one space in front of, above, or below them using the following functions:
turtle.compare() Returns true if the block in front of the turtle is of the same type as the block in the current slot; otherwise returns false.
turtle.compareDown() Similar to turtle.compare() but compares the block below the turtle to the item in the current slot.
turtle.compareUp() Similar to turtle.compare() but compares the block above the turtle to the item in the current slot.
turtle.detect() Returns true if a block is in front of the turtle; otherwise returns false.
turtle.detectDown() Similar to turtle.detect() but checks the block below the turtle.
turtle.detectUp() Similar to turtle.detect() but checks the block above the turtle.
turtle.inspect() Returns two values: true and a table value with information about the block in front of the turtle. If no block is in front of the turtle, returns false.
turtle.inspectDown() Similar to turtle.inspect() but returns information about the block below the turtle.
turtle.inspectUp() Similar to turtle.inspect() but returns information about the block above the turtle.
Turtles can perform actions with the tools they have equipped, and there are corresponding tool-related functions for each action the turtle can perform. You can equip turtles with diamond pickaxes, shovels, axes, swords, hoes, and crafting benches to make the following functions available:
turtle.attack() If equipped with a sword, the turtle attacks anything in front of the turtle. Returns true if a mob was attacked; otherwise returns false if nothing was attacked.
turtle.attackDown() Similar to turtle.attack() but the turtle attacks the space below it.
turtle.attackUp() Similar to turtle.attack() but the turtle attacks the space above it.
turtle.craft(number amount) When you lay out items for a recipe in the turtle’s inventory, this function crafts amount number of items and puts them in the current slot. Requires the turtle to equip a crafting table. The amount argument is optional. If amount isn’t given, the function will craft as many items as possible. Returns true if something was crafted; otherwise returns false when no recipe matches the laid-out items.
turtle.dig() Mines or tills the block in front of the turtle. The turtle must be equipped with a pickaxe for this function to mine blocks. If the turtle has equipped a hoe, the function tills the block in front of the turtle. Returns true if something was mined or hoed; otherwise returns false.
turtle.digDown() Similar to turtle.dig() but mines or tills the block below the turtle.
turtle.digUp() Similar to turtle.dig() but mines the block above the turtle. Note that this function cannot till dirt blocks.
The following functions come with the Lua language, so you don’t need to type a module name before the function name when calling these functions:
error(string message) Terminates the program and displays message, if given. The message argument is optional.
exit() Exits the interactive shell. You can use this only while in the interactive shell.
print(string/number value) Displays value on the screen, followed by a newline. The value argument is optional. If no value is passed, the function only displays a newline.
of three major components: the Computer, Turtles, and the Peripherals that attach to both to extend The first and most basic component of ComputerCraft is the Computer. To start a new program, simply type edit followed by a file name.
ZologorJanuary 07, 2019 12:19 PM
I apologise, but, in my opinion, you are not right. Let's discuss. Write to me in PM, we will talk.
NikokinosJanuary 07, 2019 4:56 PM
In my opinion you are not right. I can prove it.
GoltigulJanuary 09, 2019 2:32 PM
I apologise, but it does not approach me.
MulabarJanuary 01, 2019 2:23 AM
I consider, that you commit an error. I can prove it. Write to me in PM.
MuktilarJanuary 04, 2019 10:21 AM
It agree, a remarkable idea