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

[Remove] 11X11 House Builder!

Started by RandomShovel, 18 November 2012 - 02:58 AM
RandomShovel #1
Posted 18 November 2012 - 03:58 AM
Hello! This is a program I've made, it makes a 11 x 11 sized house! Thus far, there are 3 codes.
  • One makes a 11 x 11 sized house, without decorations!
  • One makes a 11 x 11 sized house, with decorations!
  • One makes a 11 x 11 sized house, but can do decorations, or no decorations!
:D/>

Pictures?
SpoilerHere's a view of the roof and the inside:
Spoiler

Here's the front of the house:
Spoiler


It's code is lengthy, because i'm new to lua, and I don't know of a shorter way of writing it. If you like the code, here is the pastebin link.

The codes:
Spoiler

No Decorations:
http://pastebin.com/5HzEjGEy

*New


With Decorations:
http://pastebin.com/UkuFVQci
*Fixed furnace


Picker Code: *Fixed!
http://pastebin.com/5F1d33EG

User Submitted:
http://pastebin.com/eBQmXtqB


Change log:
Spoiler

Version 2.0
-Windows are made with the walls now
-Rewrote code
-Decor/Plain house feature
-Doorway is made with the walls now
Note: Still isn't finished! Add your comments about
the previous versions! Most importantly fixes,
and bugs.

Version 1.1
-Fixed program problem with foliage.
-Added labels to code strips
-Added version numbers

Version 1.1 ( Ish )
-Fixed experimental code
-Foliage causes problems
-Experimental code has no labels



Upcoming Features:
Spoiler

-Try to fix experimental code
-Try to shorten code to something functional, yet smaller
-A user submitted code

-Windows are made with the walls
-Rewritten code… Hopefully turns out better than this one :unsure:/>
-Almost finished


If someone wants to edit it, post the edit to this post.

Your welcomed to look at this code and fix. As I said before I am somewhat new to lua, and am still getting used to new stuff. Hateful posts are not welcomed, and I will not take them lightly! If you do edit this code, or fix it, you MUST post it in the forum! Note: The change log is about the post, and the code. It will always be about both!

Thank you for looking at this post, have a nice day :)/> !
yamidarkstar #2
Posted 26 November 2012 - 08:54 PM
for some reason it builds the house frame for me then does the decorations and windows next to the house instead of part of it
RandomShovel #3
Posted 26 November 2012 - 09:43 PM
That's odd. It works for me, i can't test or fix this because my computer is broken. What version of minecaft are you using? Was there anything blocking it's way at any point?
yamidarkstar #4
Posted 02 December 2012 - 05:14 AM
I'm using 1.4.5 and was building on a superflat map to test it out
Ikkalyzte #5
Posted 02 December 2012 - 06:35 PM
Direwolf fan? :D/>
Anyway, if you're looking to clean up the code, use "for" loops. It seems you're already familiar with them, so just use them whenever possible.
Also, you seem to have unnecessary functions. Instead of having two "row" functions, you could use implement them in the "floor" function, just having it do it all at once.
Finally, your slot selection is pretty interesting… you could replace all the functions that select the same type of block with a single one. Do you know how to pass arguments yet?

Anyway, good start. Keep learning. It'll get cleaner :)/>
RandomShovel #6
Posted 03 December 2012 - 04:04 AM
Thank you for that note, when I can test these edits i'll post the new code. As for the decorations not being in the house, the code is the same as when it worked for me. I even made some of the code in 1.4.5 and 1.2.5
Expenox #7
Posted 09 December 2012 - 12:01 PM
Nice, always nice to see new turtle programs!
RandomShovel #8
Posted 16 December 2012 - 03:32 PM
Finally, your slot selection is pretty interesting… you could replace all the functions that select the same type of block with a single one. Do you know how to pass arguments yet?

After a few rereads, I understood what you were saying, and I put them in 1 function per block.
RandomShovel #9
Posted 16 December 2012 - 03:51 PM
for some reason it builds the house frame for me then does the decorations and windows next to the house instead of part of it

I tested this and it works fine, I can't find a problem like this.
Dusty_Rebel #10
Posted 05 January 2013 - 05:40 PM
Love It!
RandomShovel #11
Posted 06 January 2013 - 05:22 AM
Love It!

Thanks!
thetravis0916 #12
Posted 08 January 2013 - 05:34 AM
I love it but mine got off some is it because of the grass?
RandomShovel #13
Posted 08 January 2013 - 02:08 PM
I love it but mine got off some is it because of the grass?

Yes, that is something I forgot to check on… It will be fixed soon [ Already fixing ( Will be released before today ends (( Well for me that is )) )]

Update: House with decorations isn't freaking out over grass anymore, reduced the wait time on the floor, and a bit of work to fix the Non-Decor. program. That's just comparing the codes though then testing :)/>. Delete the old one, and use the new ones.
lokilotus #14
Posted 19 January 2013 - 10:42 PM
Hey,

2 things…

1) I edited the decorated code so it asks you whether or not you would like to continue when starting up, and it waits for user input to start- will put code in a pastebin for you. :)/>

2) Where should the turtle start, e.g. top left at the front of the house nearest the door, bottom right on the right hand side (when facing the door) ETC? the OP doesn't make it clear.

Thanks!

-Loki

Code Pastebin: http://pastebin.com/eBQmXtgB
RandomShovel #15
Posted 20 January 2013 - 10:46 AM
Hey,

2 things…

1) I edited the decorated code so it asks you whether or not you would like to continue when starting up, and it waits for user input to start- will put code in a pastebin for you. :)/>

2) Where should the turtle start, e.g. top left at the front of the house nearest the door, bottom right on the right hand side (when facing the door) ETC? the OP doesn't make it clear.

Thanks!

-Loki

Code Pastebin: http://pastebin.com/eBQmXtgB

Thanks! Mind if I were to add this to the post? The turtle starts the house at the lower left, at the front of the house.
lokilotus #16
Posted 22 January 2013 - 01:24 AM
Hey,

2 things…

1) I edited the decorated code so it asks you whether or not you would like to continue when starting up, and it waits for user input to start- will put code in a pastebin for you. :)/>

2) Where should the turtle start, e.g. top left at the front of the house nearest the door, bottom right on the right hand side (when facing the door) ETC? the OP doesn't make it clear.

Thanks!

-Loki

Code Pastebin: http://pastebin.com/eBQmXtgB

Thanks! Mind if I were to add this to the post? The turtle starts the house at the lower left, at the front of the house.

Yeah, that's cool :)/> It's not the cleanest edit I've done (not that I've done many) but it gets the job done :D/> I found that too, except my turtle decided to build like it was outset one block… More testing on my end needed for proper placement methinks. I'll have a look at it today and see if I can determine anything funky up with the code. :)/>
RandomShovel #17
Posted 22 January 2013 - 04:15 AM
Hey,

2 things…

1) I edited the decorated code so it asks you whether or not you would like to continue when starting up, and it waits for user input to start- will put code in a pastebin for you. :)/>

2) Where should the turtle start, e.g. top left at the front of the house nearest the door, bottom right on the right hand side (when facing the door) ETC? the OP doesn't make it clear.

Thanks!

-Loki

Code Pastebin: http://pastebin.com/eBQmXtgB

Thanks! Mind if I were to add this to the post? The turtle starts the house at the lower left, at the front of the house.

Yeah, that's cool :)/> It's not the cleanest edit I've done (not that I've done many) but it gets the job done :D/> I found that too, except my turtle decided to build like it was outset one block… More testing on my end needed for proper placement methinks. I'll have a look at it today and see if I can determine anything funky up with the code. :)/>

Well, until it's fix, it won't be posted. That's all I can say. Possibly finish the experimental code since I'm bored xD.
lokilotus #18
Posted 23 January 2013 - 05:40 AM
That's cool, my game's lagging out a lot with my texture pack ATM- will have to switch to vanilla textures for now. Will have something done by tonight hopefully, a good way to relax after my Chemistry Exam :D/>



EDIT 1, 23/01/13: Ok. Test 1 conclusion: Weird program is weird. Then again, it did make a nice art deco design. Then again, was not creeper-proof or habitable in any way. More tests needed.
Edited on 24 January 2013 - 05:09 AM
lokilotus #19
Posted 26 January 2013 - 02:24 AM
Alright. This time it worked perfectly. Odd. I haven't changed a thing within the code, except added the yes/no functionality… So weird. I think the base program in general needs more testing. Hmm. I'll see if I can spot anything,
dissy #20
Posted 24 February 2013 - 07:16 AM
I've noticed a couple problems, and a couple places where it could be improved.

First, documentation! Probably the worst was the turtle inventory needs. What's listed in the post here, what the program requests, and what the program actually ends up using are all different - specifically for the "decor" parts.

Which leads to the first problem. Of course I simply placed the turtle on the ground and started to run it. It was not stated the turtle must be one block above the ground, or that you must dig out a 11x11x1 "plot" for it to build in.
Instead, it started to dig up dirt blocks to make room for the floor, however the turtle also picked up these dirt blocks and once the first slot was empty that is where they went. It then proceeded to build part of the floor out of dirt.

Then, it built solid walls using slots 3-6, finished the house, and after placing some furniture it went back inside to dig back out the walls it just placed to make windows. I should note the turtle stopped just before placing the ceiling blocks to request I add in more blocks… Only to later obtain the blocks it needed from the walls it shouldn't have placed.

Then the block pickup problem happened, and instead of placing glass for the windows, it was placing the blocks it just broke out of the walls a moment before…

I would suggest that when building the walls, simply leave the gaps open for where the windows will go. This way it won't need refilling to build the ceiling, and won't need to do 3x the work (place wall, break wall, place glass)

Another suggestion is to first display a message about fueling up, say "If your turtle needs fuel, place X coal in slot 1 and hit enter to refuel"
Upon hitting enter, it uses the full stack in slot 1 to fuel.
Then clear the screen and prompt to fill it with blocks, with a "Hit enter to begin" message at the end so the turtle doesn't run off and out of reach while you are still filling it up with blocks.

The only thing I can think of for the dropped block pickup problem would be to keep track of the slot number its on and not move backwards.
What I mean is, for example floors are slots 1-2. Once it uses up slot 1 and moves to slot 2, blocks it picks up will end up in slot 1. Once it moved to slot 2, it shouldn't go back to slot 1 even if there are now blocks in it. Same with the walls in 3-6 and glass in 7-9.
I wish turtles had better inventory management built in ;}

Despite the few small issues, this program is still great and has a lot of potential. Thank you, and good work!
lokilotus #21
Posted 28 February 2013 - 07:02 AM
Another suggestion is to first display a message about fuelling up, say "If your turtle needs fuel, place X coal in slot 1 and hit enter to refuel"
Upon hitting enter, it uses the full stack in slot 1 to fuel.
Then clear the screen and prompt to fill it with blocks, with a "Hit enter to begin" message at the end so the turtle doesn't run off and out of reach while you are still filling it up with blocks.

Which is exactly what I tried to put in, but it's not up yet as the code's buggy- and I haven't managed to fix the rest of it so the original poster won't put it up in the OP- but it IS up in my original post. :)/>