This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
dustpuppy's profile picture

Turtle Control and chest inventory system

Started by dustpuppy, 13 October 2012 - 01:10 PM
dustpuppy #1
Posted 13 October 2012 - 03:10 PM
Hi,
when i started 3 weeks ago with CC and lua, i just wanted to get a bit work done by the turtles. That's where i am now :-)

Most people do an inventory system, that works internal in the turtle. My idea was now to get turtles to know, where they can find items.
The system is very easy. You can send a turtle to a chest. It will suck out one item and ask you for the id. The id is the same then in MC it selft. The information will be saved by an inventory server. Now every turtle/computer can find the item.
I've made some small commands for using this information. Possible someone want's combinate this with turtle internal inventory system.

Setup
SpoilerUnzip the files in the CC directory, or move the files in the archive to the needed places by hand.
U HAVE TO HAVE GPS HOSTS RUNNING!
After booting the computer or turtle just call automode. It will open the modem if it's a computer or setup the turtle. A turtle first will suck fuel out off a chest in front and refuel. If You don't have a chest in front, then you have to refuel it and call the command "facing set" to get turtle knowing the direction (north,south,east,west).
Best way is to make a "turtle park space" which could look like this ;-)
http://www.carr-ireland....e-parkspace.png
After caling automode you still can use the turtle itselft like allways and also use it with a remote computer.
Important is that you setup one computer with a disk drive and a modem. Put an empty floppy into the drive and start "inventory_server".

The commands
Spoilerfacing - is used for set or get the facing of a turtle
sethome - Set the actual position of the turtle as it's home
goto - sends the turtle to a gps position
gohome - send the turtle back to it's home
get_inventory - turtle will move to the position, and check for a chest. If found it will ask you for the items id.
load - the turtle moves to the item chest and loads the given ammount of stacks.
unload - if the turtle before got an item out of a chest, it will bring it back to this.
find - prints position of an item chest.
deliver - tells the turtle to deliver an item from a chest to a given position.
move_item - turtle moves an item from one place to another.
clearrow - turtle clears up a row of lenght and width
digrow - turtle digs one row of lenght and width
basewall - turtle builds a simple wall
use_turtle - This will be used to control a turtle in automode with a remote computer
satelite - will build up a gps and inventory server satelite system

Some of the original programs are changed, like go and turn.
I am open for more ideas and how i can make it better.
ChunLing #2
Posted 13 October 2012 - 03:43 PM
Looks interesting. I shifted away from API development because I wanted a program that was more portable, but really a lot of what I would like to eventually do is more of an API job.

I think that with enough flexibility in the API, the coordination of turtles can be handled more easily by a central computer that controls several turtles remotely.
dustpuppy #3
Posted 17 October 2012 - 06:39 PM
Here a little video. Sorry for the uncut lenght and no sound, but i am lazy :-)
http://www.youtube.com/watch?v=YiluIuvUc2M&feature=youtu.be
Ralnick #4
Posted 19 October 2012 - 06:40 PM
nice idea. are the commands able to be sent from a central location like from the pc in a command center?
dustpuppy #5
Posted 19 October 2012 - 06:49 PM
Turtles can be controlled from every computer with a modem in range.
The inventory server it self is high enough to cover a bigger place.
ChunLing #6
Posted 19 October 2012 - 07:22 PM
You could use a relay system, I have a program that allows a GPS host to also act as a relay. It's still kinda primitive cause I've been working on PDA input for my remote control program, but it works.
Ralnick #7
Posted 22 October 2012 - 05:57 AM
nice work.. works nicely with other programs I am using for, remote control. sending commands remotely is nice for get_inventory, deliver and so forth.

thanks for the work you put into this


edit: hmm i guess the remote option is not working as good as i first thought. the program automode is required to be running for some of the other sub programs to work correctly


[indent=1]now for someone to come up with a way for 2 programs to run at the same time. but i am guessing the mod might not have that option in it[/indent]
74kumi #8
Posted 19 January 2013 - 08:09 PM
This is what im working on, its using your code as a basis but on a much bigger scale. Im running Feed the beast mindcrack pack v7.
xInDiGo #9
Posted 27 February 2013 - 06:10 AM
been playing around with this. seems pretty interesting! one question, is there a way to make it so that i can type in a word instead of a number to load materials? with so many numbers it could be hard to remember which is which!

i'm having trouble with controlling a turtle with another computer. i used automode on the turtle, and when i go to the computer and type "use_turtle 0 deliver 1 return" nothing seems to happen.

am i doing this wrong?

::edit::

i was using deliver when i should of been using load. deliver works fine too!