Help with a newb Computercraft question

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

Servillo

New Member
Jul 29, 2019
35
0
0
In my new world, I wanted to give Computercraft and Turtles a shot. I sat down and watched DireWolf20's Computercraft tutorial series, which was a great refresher on how to program, and dove right in. First thing I tried to do was write a very, very simple refuel program to cycle through buckets of lava, and it worked great.

However, if I mined my turtle to move it elsewhere, or shut my turtle down, the program vanished. Clearly I am missing something that I either missed during the tutorials, or haven't seen at all with regards to saving programs. Do I need to save them in a particular folder? Can I only save programs to a floppy? I didn't have much time last night to really test anything out, so I figured I'd post here while I was at work and see if I can get any solutions here to work tonight.

Thanks.
 

Dafuq?

New Member
Jul 29, 2019
193
0
0
You have to give your turtle a label like this:

Code:
label set <name>

so you could do for example:
Code:
label set miningturtle

That way it will save the programs, fuel state etc... For more info search google for computercraft labels.
 

jnads

New Member
Jul 29, 2019
248
0
0
First thing I tried to do was write a very, very simple refuel program to cycle through buckets of lava, and it worked great.

There's a better command 'refuel all', that will already do this.

And yes, name your turtles to save their state (and not spam your server with new computer IDs).
 

Servillo

New Member
Jul 29, 2019
35
0
0
Excellent, thanks. And yeah, I figured there were better programs, but it was something simple I wanted to start with to try and implement.
 

MilConDoin

New Member
Jul 29, 2019
1,204
0
0
Another thing:
If you want your program to autorun each time the turtle gets loaded (Restarting Minecraft, chunkloading issues), name that program "startup".
 

jnads

New Member
Jul 29, 2019
248
0
0
Another thing:
If you want your program to autorun each time the turtle gets loaded (Restarting Minecraft, chunkloading issues), name that program "startup".
Better is to use shell.run("your_program") in the startup file than renaming.

This way you can include conditions such as detecting if a redstone signal is present on whether or not to auto-execute your program (as in the case of, say, XP Farms).

Otherwise, if you ever do any os.eventpull() functions, you can effectively override the CTRL+T program terminate (perhaps accidentally), and effectively prevent you from ever being able to stop your Turtle from executing [defective] code.