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

9 by 9 House (with modifications!)

Started by ProfessorPhysicz, 29 December 2012 - 05:49 PM
ProfessorPhysicz #1
Posted 29 December 2012 - 06:49 PM
This is my first real program I have made using Lua on ComputerCraft turtles. I hope you like it. I was inspired by Direwolf20's 9 by 9 constructing turtle, however I wanted a program that would clear out the whole area first and one that built a the house six blocks tall, opposed to five because it frankly allows for more room to place blocks. Hope you find it useful!

DOWNLOAD: http://www.pastebin.com/5qgPJ5cB

The turtle starts in the front, bottom, right corner of the house, it ends in the middle of the floor. The items needed are outlined in the code, but to recap they are…

Slot 1–Walls (64x)
Sot 2–Walls (64x)
Slot 3–Walls (64x)
Slot 4– Flooring (49x)
Slot 5– Ceiling: excluding glass (33x)
Slot 6– Glass (16x)

[attachment=834:Screen Shot 2012-12-28 at 11.45.22 PM.png]

Know Issues: Just don't stand in front of the turtle and you should be alright :P/> (also the code could be simplified, but it works well as is)

[attachment=835:Screen Shot 2012-12-28 at 11.45.10 PM.png]

Sorry if the photos are small. I don't have anything I can enlarge them with…just click on them and they should enlarge (hopefully!) :huh:/>

Post below if you have any problems/find any bugs. I'll do my best to fix it quickly!
Dusty_Rebel #2
Posted 05 January 2013 - 05:37 PM
Nice Job!
Someguy123 #3
Posted 06 January 2013 - 04:29 AM
Seems to work pretty well, I love it since it clears the area unlike most other building scripts, this saves me from having to do it.
One problem: it needs to handle out of fuel better, I caught it just spinning around like mad because it was out of fuel and it didn't handle it properly, so I had to refuel it by hand and reset the turtle to its starting point.
Another issue is that it loves to waste fuel, it'll start building one row of the wall, then to go up, it actually flies all the way back to the start of the wall THEN goes up, which is a lot more wasteful than just going up where it ended then build the wall.
EDIT: OH LAWD WHAT IS THIS DOING? This seems to be a bit… misaligned?
civilwargeeky #4
Posted 11 January 2013 - 11:12 AM
Hey, just a tip: If you want the turtle to move even if someone stands in front of it, just do
while not turtle.forward() do end 
Then it will just keep trying to move until it does.
shiphorns #5
Posted 04 February 2013 - 12:20 PM
Hey, just a tip: If you want the turtle to move even if someone stands in front of it, just do
while not turtle.forward() do end 
Then it will just keep trying to move until it does.

I would recommend this minor change:
while not turtle.forward() do
  sleep(0.5)
end 

It's not necessary to check every tick, it just uses up server resources. Also, turtles with tools can attack, and inside this loop is a good place to try that if you want your turtle to knock players or mobs out of its way (and deal damage) in survival mode.
marstone #6
Posted 19 March 2013 - 12:44 PM
Seems to work pretty well, I love it since it clears the area unlike most other building scripts, this saves me from having to do it.
One problem: it needs to handle out of fuel better, I caught it just spinning around like mad because it was out of fuel and it didn't handle it properly, so I had to refuel it by hand and reset the turtle to its starting point.
Another issue is that it loves to waste fuel, it'll start building one row of the wall, then to go up, it actually flies all the way back to the start of the wall THEN goes up, which is a lot more wasteful than just going up where it ended then build the wall.
EDIT: OH LAWD WHAT IS THIS DOING? This seems to be a bit… misaligned?

problem is that the turtle clears an area big anough for the building, but runs above it when placing the blocks so can run into things and get out of line. When I ran it, it ran into leaves from a tree, then put the following pieces in the wrong place. Going to just add a dig() command while it is running to a new location and should fix the problem. But like the program as a whole, thanks.