Question about programming mining turtles.

  • 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

Jjamesz007

New Member
Jul 29, 2019
4
0
0
I have a quick question...
I have some mining turtles, and was wondering if I could make a program that would make the mining turtle mine for a bit then empty it's contents into a chest. After this, I would like to make it recharge using a charging station from miscperipherals.
Thank you. I would appreciate it if you guys could give the actual program in your comment.
Thanks again.
 

lukasni

New Member
Jul 29, 2019
19
0
0
Basically two ways to go about it. You can either use the gps program (nice guide can be found here) or make the turtle plot its own position in a 3D grid.

If you're not too big into programming I'd suggest getting a gps goto program on the CC forums or from some other source, but if you're up for a challenge, plotting your own coordinate grid can be very powerful and allows for very efficient handling of your turtle.
 
  • Like
Reactions: Jjamesz007

Jjamesz007

New Member
Jul 29, 2019
4
0
0
Basically two ways to go about it. You can either use the gps program (nice guide can be found here) or make the turtle plot its own position in a 3D grid.

If you're not too big into programming I'd suggest getting a gps goto program on the CC forums or from some other source, but if you're up for a challenge, plotting your own coordinate grid can be very powerful and allows for very efficient handling of your turtle.
How would I go about doing that? The coordinate grid thing..
 

Peppe

New Member
Jul 29, 2019
836
0
1
You can check the computer craft forum for completed automated systems. What you are asking for isn't something you just toss together in a few lines of code. I haven't used the misc peripherals charging, but i though it was just the output side of an MFE.

The default excavate program does just about all the things you ask for, though it does not mine in the most efficiency manner the turtles are stupid cheap, so you can just run multiples of them. The excavate program mines from the start point in a square the size you specify down to bedrock. Whenever it is low on fuel or full of items it returns to its start location and dumps its items (if a chest is there then the items go in the chest).

If you had an MFE -- or whatever charges them to one of the free sides when it returns to the chest, then it would charge up the turtle a little on each trip back to the chest. The default excavate program also calculates how much fuel it needs to do the job left and should return to the chest and wait for fuel if its fuel is ever too low.

Turtles won't know their location unless you make a GPS system (usually 4 computers up near the sky limit in a central chunk you will be working in). Then the turtle can get its location from the GPS computers. Then you can tell it to go to a certain location using the minecraft coordinates.

There are other ways to maintain location more manually, or relative to where the turtle is placed. Like you write your programs to consider where the turtle was placed 0,0,0 and then any move you make or important places you reference from that 0,0,0 place. Picking up the turtle and placing it would break the relative location though.
 
  • Like
Reactions: Jjamesz007

ttech

New Member
Jul 29, 2019
35
0
0
I do not a have a program with this function in it, but I know you can do it. You will have to create a GPS Tower with computers for the turtle to be able to triangulate its location based on the gps tower. Direwolf 20 has done this in some of his past videos. The links below is some information of what you will need to know to make the programing. I would take a look at the last one. It has a video with it...

http://computercraft.info/wiki/Gps_(program)
http://computercraft.info/wiki/Rednet_Tutorial
http://computercraft.info/wiki/Gps_(API)
http://computercraft.info/wiki/Turtlemove_(Custom_API)
http://www.computercraft.info/forum...s/page__hl__+global++positions__fromsearch__1
 
  • Like
Reactions: Jjamesz007

lukasni

New Member
Jul 29, 2019
19
0
0
As for the coordinate grid: Basically, you'll give the turtle an origin point, for example the charging station. From then on, you'll have to record every movement of the turtle so it can find its way back to the origin.

One way of doing that is to override the movement functions to record the new location to a permanent storage file or report it to a server using rednet, which will keep track of the turtle.

Either way, you can't pick up the turtle after that or it has no way of knowing where it is. Mainly because of that, i wouldn't recommend relying completely on that system.

I am working on a turtle networking system that will use GPS in combination with a custom pathfinding/recording tool to track turtles and keep their location stored on a central server. That way, if they ever get off track, the server can tell them where the closest known waypoint is and the turtle will try to navigate to that waypoint.

This is all way past a simple mine and return script though its intended for a Base that revoves around the turtle automation, with paths laid out for the turtles to move around, for your mining turtle you'll probably be best off using one of the many movement APIs out there. Computercraft.info is a great source for finding out how to do just that.
 

slay_mithos

New Member
Jul 29, 2019
1,288
0
0
Hell, with all the "peripherical" mods that can be added, I don't think there is much that a turtle can't do...

@lukasni: your posts contain good deal of nice informations, but you really need to add some spacing, it is kind of hard to retrieve all informations from a compact wall of text.

Anyway, for anything related to programing turtles, the best place is either the LUA sites (to learn the language), or the ComputerCraft forums and wikis to get your hand on a lot of information, either to program or to get and use other people's programs.

Edit: also, please do not write too much files as part of the programs, as it can become quite crazy rapidly on servers, or even on single player.
 

lukasni

New Member
Jul 29, 2019
19
0
0
OT: Aye, sorry about the formatting on that post, I was typing it on my mobile, makes me sloppy ;) Cleaning it up now.