←  Turtle Programs

ComputerCraft | Programmable Computers for Minecraft

»

Shape Builder

Aeolun's Photo Aeolun 01 Feb 2013

So, I needed a turtle script that would help me build the stuff that I personally always found damn annoying to build, I looked around here a bit, but the only thing that I could find to build simple stuff (I do not want advanced tower building) was a rather unworkable script that someone posted here a while ago.

I took it upon myself to fix it, but left their original credits in the code.

http://pastebin.com/zkb4FY4L

I now also added the sphere dome builder that posted here: http://www.computerc...d-dome-builder/

It builds:
- Lines
- Rectangles (or squares, as a convenience method)
- Circles
- Walls
- Floors (or roofs)
- Rooms (combines walls, floors and roof)
- Stairs
- Domes
- Cylinders
- Pyramids (hollow or filled)

It is extremely basic, though it does try to take into account fuel levels and the amount of blocks left available to built with (that is, if it runs out of either, it will stop, and patiently wait until you come to refuel or refill it, then continue).

If I write it builds a line, it probably does exactly what you imagine it does :P but for those whom want to see what it does, here are some screenshots: http://min.us/mmS6gwT0ydSRf

One thing to note is that it always takes the block UNDER it as the starting point, and always builds from left to right, and from front to back. So if you tell it to build a room 6 wide and 6 deep, the left wall will be at the starting point, and the right wall 6 blocks to the right of that.
I try to make everything consistent, please let me know if it does something weird.

You can use it with both normal and mining turtles. Mining turtles have the added benefit that they smash whatever is in the way of what they are building, normal turtles may just give up if something is in the way.

Do not expect it to restart gracefully if the chunk unloads, or if your server reboots. I do not generally expect people to build while they are not around so I didn't bother for now.
Quote

Mailmanq!'s Photo Mailmanq! 01 Feb 2013

Good, finally I don't have to keep making a script for something like this when I need it. Also, do you think you could add circles?
Quote

Cranium's Photo Cranium 01 Feb 2013

Next you need more shapes. Cylinders, pyramids, spheres....
Good job so far though!
Quote

xInDiGo's Photo xInDiGo 01 Feb 2013

this is pretty nice! i was using this sphere/dome builder to make my domes, but more shapes would be great! having one program to do them all would be very nice :]

perhaps a Pyramid (either hollow or not) would be good to add too!

i also like that you defined where it starts and which direction it builds. in my experience it takes a few tries to get the turtle to build right where you want it so this helps!
Quote

ughzug's Photo ughzug 02 Feb 2013

can you add hexagons?
Quote

theoriginalbit's Photo theoriginalbit 02 Feb 2013

I say screenshots ;)

Good job though. More shapes would be good :)
Quote

Aeolun's Photo Aeolun 02 Feb 2013

Screenshots added, more shapes added (most requested, I forgot sphere, and need some more time to calculate hexagons ;) ).

I've used the spherebuilder script posted by xInDiGo. No sense in making it myself if it already exists and works perfectly.
Quote

Shnupbups's Photo Shnupbups 02 Feb 2013

Coolio, turtle slaves can build me a 6 room house while I be lazy and do other stuffs.
Quote

ughzug's Photo ughzug 02 Feb 2013

thanks man take your time
Quote

maniacpsycho's Photo maniacpsycho 08 Feb 2013

script errors if you have easy mode enabled (no refuelling)
Quote

MacDaddyPro's Photo MacDaddyPro 09 Feb 2013

This is great. Thanks for making it.

This is what I have used it so far and it worked great.

Cylinder = Worked great..

Pyramids = Worked great.

Walls = Worked great.

Walls = Bugged. The floor and the celling go one way and the room goes the other.

I am going to go test all the others right now.

Again. Thanks for this! I think it is great. Ill get back after I test all the rest of the shapes.

B)
Quote

MacDaddyPro's Photo MacDaddyPro 09 Feb 2013

Just some info when you build a room. If it is even it seems to work 5 x 5 x 5

But if you build a 12 x 8 x 7 it puts the roof and floor in the wrong way.

back to testing.

thanks again.
Quote

MacDaddyPro's Photo MacDaddyPro 09 Feb 2013

Bug in platform.

When it runs out of blocks in slot 1 it uses the blocks it picks up.
Quote

xInDiGo's Photo xInDiGo 11 Feb 2013

few things i noticed.

it doesn't handle sand or gravel very well, and when it starts picking up junk blocks in its first slot it will place those blocks as part of the shape
Quote

Ritchie's Photo Ritchie 22 Feb 2013

I love this program, thank you so much! I find it difficult to build more complex structures though, such as stacked cylinders and domes of different sizes because I can't seem to figure out (try as I might) where to place the turtle to have the center points of stacked structures line up, especially since it uses radius not diameter but seems to change the radius so that the diameter always comes out to an odd number.

It really just becomes hard for us more creative types, I assume there's math involved.

My request is that you change it or add the option to start building from the center block so that turtle placement is a snap.

-Ritchie
Quote

Hitorikirino's Photo Hitorikirino 25 Feb 2013

Every time I try to run this program I am getting an error. It will place one block directly below it and then give the error before it moves. The error is "shape:28: attempt to compare number with string expected, got number".
Quote

solaris187's Photo solaris187 28 Feb 2013

Your calculations for the starting point of a circle seem to be off. I place the turtle down and tell it to build a circle of size X. It actually moves first to the right X before it constructs the circle. This make is very difficult since the starting point is not even in the circle or part of it in some way. Is this a bug?
Quote

Keridos's Photo Keridos 04 Mar 2013

For the circle/dome the center is radius blocks to the right and forward from the starting point of the turtle.

Nice work, please update and add sphere and hexagon. Loving this already.

/edit: The room wall calculation is wrong, it starts the first wall correct but then continues to build the to the left side instead of to the right side. So one of the walls is right, the other three are not in their correct positions.
Quote

Keridos's Photo Keridos 07 Mar 2013

Fixed the room building code (problem was the turtle built like it was on the starting position after building the floor, but that only works fine for rooms with uneven side length values).
The other code is unchanged.
/edit: Updated the paste again, now should be able to build spheres. (updated now, pastebin finally up)

http://pastebin.com/RAHj4r2K

Another idea: It may make sense to make this project communitydriven, so hosting it on Github might be a good idea. Makes modifying and managing it far easier. So fixes like mine could be merged into the project without changing the Opening Post too much. And of course a versatile shape builder could be more useful than like 5 small ones.
Edited by Keridos, 07 March 2013 - 04:34 PM.
Quote

Paksarra's Photo Paksarra 12 Mar 2013

View PostHitorikirino, on 25 February 2013 - 08:04 AM, said:

Every time I try to run this program I am getting an error. It will place one block directly below it and then give the error before it moves. The error is "shape:28: attempt to compare number with string expected, got number".

This is probably because you have fuel disabled. I'm getting the same error for any program that checks fuel, and my server's admins are 2 to 1 against turning fuel back on for compatibility I am not happy with them.
Quote