Request Computercraft

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here

Reddis

New Member
Jul 29, 2019
397
2
0
If a person wanted to attempt to learn Computercraft for automation purposes, but doesn't know the first thing about programming, what resources would you suggest they look at?
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,799
248
The computer craft wiki was already mentioned, but here are some more links.
http://www.lua.org/pil/1.1.html
This is a nice tutorial. Though, I never used it to learn programming I still use the parts about the more complex pieces.
It does however assume you installed lua instead of using computer craft. As such, certain things may not work (dofile is missing in computercraft for example). The differences are however minor.

http://www.computercraft.info/forums2/
A link to the computercrafts forum is of course not allowed to be missing. It has an entire section for tutorials, some directly programming related other just about apis and other about tools you can use. You can also get some programs here.
https://stackoverflow.com
https://stackoverflow.com
A site where you can ask questions about programming. It has both a lua tag as well as a computercraft tag. Note though that it is VERY much advised to search first before asking as there is a VERY good chance your question(s) where already asked.

Also, maybe give computercraft edu a look. It allows you to both write programs normally or write them using a drag and drop interface. This should reduce the amount of syntax errors you get.

Some other tips: Don't use normal computers to write your scripts. Instead use either an advanced computer or even better an external editor that you like. Both will give certain words that are part of the language a different color, making it very easy to spot if you typed something wrong. There are also some other editors for computercraft that have some extra features over the normal edit command.

If you want to use an external editor and are not on a server you can access the scripts you make while the game is running. I do recommend to make sure the computer/turtle is not doing anything though.
I believe you can find your scripts in
Code:
{your save}/computercraft/{computerId}/
If I'm wrong it should at least give you a direction on where too look. Note that a computer only gets a folder if it actually has something saved. Also, I believe an empty file will not count.

External editors that I used and though I may not use them currently they all served me well. Pick one you like
Notepad++
sublime
scite (This was when it came bundled with lua for windows and as such had been preconfigured specifically for lua.)
gedit with plugins (on linux at least, not sure how well it is on windows)
geany
 
C

Citron

Guest
If I'm wrong it should at least give you a direction on where too look. Note that a computer only gets a folder if it actually has something saved. Also, I believe an empty file will not count.
Complement:
You can get the Computer's ID by tipping "id" on it (see http://www.computercraft.info/wiki/Id).
You can set a label to keep your programs in the computer when you break it with "label set <label>" (see http://www.computercraft.info/wiki/Label).

When a computer is labelled, you can find its programs in {your save}/computercraft/{computerLabel}/

EDIT : Wrong info!
When a computer is labelled, it will keep his ID and the programs will be kept in {your save}/computercraft/{computerId}/
 
Last edited:
  • Like
Reactions: lenscas

Reddis

New Member
Jul 29, 2019
397
2
0
What are you trying to do with it?
Simply learn the pack. I try to learn a new mod on every playthrough and computercraft is one that has always intimidated me. Ive heard the mod can do some neat things like automatically turn on and of power generators based on certain condition.

Thanks for all the tips guys.
 

ShneekeyTheLost

Too Much Free Time
Dec 8, 2012
3,728
3,004
333
Lost as always
If a person wanted to attempt to learn Computercraft for automation purposes, but doesn't know the first thing about programming, what resources would you suggest they look at?
Well, you could do what everyone else seems to do and just download someone else's program and copypasta it. I mean, it's not THAT hard, and you can find CC programs for nearly any task with a simple google search, although the CC forums have a good repository for them.

Of course, that's one of my big problems with the mod... but hey, if you want the benefits of programming without bothering to learn how to code (even in something as high-level and simplistic as LUA), the option is there.
 

Henry Link

Popular Member
Dec 23, 2012
2,601
553
128
USA - East Coast
@ShneekeyTheLost Copying and using someone else's code is also a way to learn CC as well. Initially that is how I learned. I used Direwolf's mystcraft dialer in the 1.4 & 1.5 era. But, I found his touch screen API to be useful for other purposes (mob farm controls mostly). But it didn't meet all my needs so not only did I write my mob farm control to use his API. I also added more routines to his API to give me the additional functions I needed.