Lately I've noticed that a lot of the same questions are being asked over and over… and over again. So I've made this to hopefully stop the 'spam' so that the real questions can shine :)/>/>
Q: My turtle is not moving! Why?
Spoiler
Turtles require fuel. That means anything you can burn in a furnace, you can use as fuel for the turtle. Use the built-in program "refuel [amount]" to refuel your turtle, or use the function turtle.refuel() to do so manually in a program. NOTE: if you do it manually with the function, the slot which contains the fuel must first be selected with turtle.select(slot).Alternatively you can disable this option in the CCTurtle.cfg config file.
Q: Events. How do I use them and/or what are they?
Spoiler
An event is, essentially, anything that happens which ComputerCraft deems worthy to notify the user of (for example, key presses or redstone signal changes). You can detect these events by calling the os.pullEvent([event]) function. For example, if I wanted to pull a key press, I could write os.pullEvent("key") and only key presses would be detected. You could also leave the area inside the parentheses blank, and then distinguish different events later. Further details can be found on the wiki.Q: Where do I put programs I download?
Spoiler
Put them in .minecraft/mods/ComputerCraft/lua/rom/programs/Q: What are peripherals and how do I use them?
Spoiler
Peripherals are, at the most basic level, addons for computercraft which extend its functionality in some shape or form. An example of this is the printer peripheral. To access the functions of peripherals, you must first 'wrap' them by calling peripheral.wrap([side]). There is more info at the wiki.Q: How do I make an api?
Spoiler
Write a program with functions such as this one:
function sayHi()
print('Hi!')
end
Save that file to .minecraft/mods/ComputerCraft/lua/rom/apis/ or load it with os.loadAPI(filename)Access the functions in the api with filename.function(). For the example above if I saved it as exampleAPI, I could access it by writing 'exampleAPI.sayHi()'.
Q: How can I detect mouse clicks?
Spoiler
Use os.pullEvent("mouse_click"). This returns the mouse button that was pressed, and the x and y coordinates of the mouse_click event.Q: Can I start a computer/turtle remotely?
Spoiler
Depends on what you mean by remotely. You can do it with peripherals if you have another turtle or computer right next to the one you want to start. But at this point in time you can't turn on a turtle or computer from a distance.Q: How do I write to files or how do I read from files?
Spoiler
There is in fact a computercraft wiki. A very useful tool if you do not know how to use something. The relevant link for file access is here.Q: My file writing program is writing everything on the same line. How do I fix this?
Spoiler
Two methods: one is to use fs.writeLine() rather than fs.write(). Another is to use fs.write(string.."\n"). The "\n" signifies that you would like to start a new line. This can be useful if you wanted to break a string in the middle and write the second half to the next line.Q: How do I write a program that will accept arguments such as "excavate 3"?
Spoiler
At the beginning of your program, create a variable like this:
tArgs = {...}
That will take any arguments given to the program and put them in the table tArgs.Q: Programs that access the (real) internet are not working
Spoiler
Did you check the config file to enable HTTP api? Yes? You have another problem and you should feel free to ask. No? Well I would suggest you do that by going to your .minecraft/config folder and opening mod_ComputerCraft.cfg and editing the line that says "enableAPI_http=0" to "enableAPI_http=1".Q: If I'm playing on a server and I want a program how can I get that without typing the whole thing out?
Spoiler
If the server has http enabled, usepastebin get <code> <name of downloaded code file>
If it doesn't there are some handy utilities such as this one or this one that will type them out for you. Or you could just ask the server owner to upload the file for you. They're generally pretty nice guys ;)/>/>Q: How can I get the ID of an item?
Spoiler
Short answer: you can't with just default computercraft. Long answer: You can download something such as OpenCCSensors and have it do the dirty work for you, or you can do it the hardcore way and just do it by of comparing items. Nitrogenfingers has written a great tutorial to help you do this.Q: How can I save tables to a file and then load that table later?
Spoiler
Use textutils.serialize(table) and textutils.unserialize(string). Write the string returned by textutils.serialize(table) to a file and then retrieve it later and use it in textutils.unserialize(string). Awesome huh?Q: How do I use printers in my code?
Spoiler
Printers are peripherals, meaning that you have to "wrap" them before you can access any of their functions. Once you have wrapped the printer, you can then use any of its 9 functions. The functions and their usage can be found at the wiki.Q: I'm having trouble with basic lua knowledge such as while loops or for loops
Spoiler
Google is your friend, my friend. Type 'lua ' + basic problem you are having trouble with. For example: "Lua while loops" will give you this excellent tutorial.Q:How do I use monitors?
Spoiler
Monitors work much like printers in that they are peripherals and you must wrap them first before usage. Their functions are outlined at the wiki.Q: I'm getting this error…
Spoiler
Before you ask how to fix your error, try checking this and seeing if your error is listed there. If not, keep reading.Q: My question is not answered here… What do I do?
A: First, check out the CC wiki. If your question is not answered there, read this AND check through the first three pages of the Ask a Pro/Tutorials forums. If you question remains unanswered, come and ask on Ask a Pro. People are always willing to help, and don't be afraid of sounding 'stupid'. We all have to go through the same learning process as you, so please, ask away… Unless of course your question is answered in the list above. In which case, please don't ask :)/>/>
If anyone has suggestions or problems with this post, please tell me!