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

Tower - builds huge round or square towers

Started by demonpants, 24 September 2012 - 10:26 PM
demonpants #1
Posted 25 September 2012 - 12:26 AM
I wrote a rather complicated Turtle program that can be used to build parapets, towers, rooms, and the like. The bells and whistles are still in progress, like adding roofs, crenellations, etc. automatically. For now, just have the turtle build different levels at different widths to get interesting effects. I figured for now I'd include it as-is because it's still quite useful. I for example used it to build a massive castle, screenshotted below:





I'll include more screenshots later of other structures.

I recommend downloading the lua file, naming it "tower" and then dropping it into ComputerCraft/lua/rom/programs/turtle . However, I've also pasted the source code below.

I've written separate moveTo, turnTo, buildCircle, and buildSquare programs that I have used tower to call, but this version simply has all that code included in functions.

If the turtle runs out of items or for some reason isn't able to build a particular block (like a mob or player gets in his way) then he will move back to the center where he started before he turns off. This is so you can fix the problem and then turn him back on and he'll continue where he left off (provided you give him the same diameter value and account for height already built). In general for extremely large structures you'll need to babysit the turtles a bit but for most purposes they will do just fine. They have a bit of functionality for digging out blocks that are in their way, but for the most part they won't do this yet. Make sure they have an empty area to work in first.

USAGE:

tower #diameter #height square|round

Pastebin

[attachment=481:tower.zip]
nicolasx #2
Posted 09 November 2012 - 03:58 PM
This thing is flipping awesome. I had a mage tower on my multiplayer server I built a bit too small. Now I can build as many as I want in any size. I knew there must be a better way.
ichinose87 #3
Posted 18 November 2012 - 01:19 PM
I want to use this on a server im on but when i try pasting it into a program it only pastes the first line. Any help?
Rihlsul #4
Posted 03 January 2013 - 05:00 PM
Thank you, looks excellent! :D/>
Deor #5
Posted 05 January 2013 - 12:54 AM
Very nice, just playing with it now! Can you give a bit more info on how the roof parameters work?

Ichinose, if your server has HTTP enabled you can do the following:
 /rom/programs/http/pastebin get KFVnXPZ1 tower

This will grab the code from the pastebin post linked above and save it to a file called 'tower'
Rihlsul #6
Posted 05 January 2013 - 07:37 AM
Sadly, looks like:

The bells and whistles are still in progress, like adding roofs, crenellations, etc. automatically.

is still the current status. The roof functions are empty, waiting for love. To get something like the screenshot, it seems you have to do:

tower 9 10
-- wait until the turtle completes then
tower 11 3
-- optionally then move the turtle down 2-3, then
tower 5 5 
-- ^ for a spire type thing inside it
demonpants #7
Posted 06 July 2013 - 07:34 PM
Hey guys, really glad you've found this useful. Also sorry that I didn't ever add any of those features that I promised. As Rihlsul mentioned, to do what I did above you can play around with sizes until you've got what you want.
Niseg #8
Posted 07 July 2013 - 03:33 AM
I thought versatile shape builder could do this already. It's still an interesting implementation - I thought about making a similar one that calculate all the points before building like in your script and then making an optimal build function . I've found a way to find points in real time and thought about making a new build function and also add general polygon with a "phase" variable to spin them.

I still like the midpoint algorithm you used. I looked it up and it seem to be doable with my current build function . I think I'll implement the ellipse function instead because a circle is a special case of an ellipse.

I'm thinking of different ways to improve your script but I hit the wall in a few ways. an iterative function for an ellipse might work but you have to somehow reverse the coordinates . I think there could be a way to avoid the sort but if it works there isn't a point to fix it.

In terms of session persistence and obstacles you can make the script a little more stubborn about movement and placement . You can also use a combination of fuel and block count to figure out where you are . be aware that using files for session persistence is quiet a gamble on servers .
Zedikia #9
Posted 14 August 2013 - 01:44 PM
Not sure if you are still supporting this, but when I try the tower program I get:

"Failed to reach the destination, giving up."

ideas?