Jump to content




Schematic builder

turtle

43 replies to this topic

#1 joebodo

  • Members
  • 69 posts

Posted 31 March 2014 - 03:31 AM

Schematic builder v0.03

Posted Image

Builds structures using schematic files (schematics can be downloaded from sites such as http://www.planetminecraft.com).

Should work with any modpack since you can substitute any block in the schematic for another block.

Automatically resupplies from either a chest or an Applied Energistics system. If using AE, the builder will automatically request crafting for items as needed.



Requirements
Minecraft 1.6.4
ComputerCraft 1.5x (possibly 1.58)
Open Peripherals (a somewhat recent version)
Advanced mining turtle

Install
> pastebin get WiqSUzZx setup

You can test using Posted Image chicken.zip 452bytes 0 downloads (credit for schematic: Awesomness)

Setup
Place a turtle on top of either a chest or an AE block (cable is enough). If substituting items, you will need to place a chest behind the turtle.
Place 2 pistons in slot 16 (if not present, the turtle will ask for them when/if needed)

Posted Image Posted Image Posted Image

Running the program
> builder.lua <filename>

Helpful tips
A good source for schematics is http://www.planetminecraft.com
After downloading a schematic, you will need to extract the contents of the schematic (a .schematic file is a gzip of the actual schematic).

Upon starting a new build, go to the supplies page and ensure that all the items listed are valid. Replace any blocks as needed. You can toggle between the full list and showing just items that do not have enough stock. Replace water blocks with ice (or something that the turtle can place). For most of the double slab types (ie. double spruce slab), you will need to substitute the appropriate plank.

The turtle cannot place pistons up or down correctly. If an up or down piston is in the build, it will pause for a few seconds and you can wrench it into the correct orientation. Additionally, the turtle requires a piston to place certain blocks. You will need to wrench the piston downwards when asked on each level that the turtle requires a piston (once placed on the level, it will move it around as needed).

At any time, you can break the turtle and place it back in the starting position. It will resume where it left off.

If you don't like the building, you can change to destroy mode and the turtle will tear it down :).

I included a log viewer program. The viewer can use monitors if attached, but the best setup is to place a computer on top of a terminal glasses bridge and have the log displayed on the HUD.

Changes:
Spoiler

Attached Thumbnails

  • Attached Image: builder.jpg
  • Attached Image: supplies.jpg
  • Attached Image: substitute.jpg

Attached Files


Edited by joebodo, 13 April 2014 - 09:25 PM.


#2 dragontox

  • Members
  • 9 posts

Posted 31 March 2014 - 08:13 PM

Thanks for the awesome script. I am really amazed by it. I only have one issue. Everytime i run the setup. It says
Extracting: builderapi.lua
Extracting: schematic.lua
io:100: out of space

#3 joebodo

  • Members
  • 69 posts

Posted 31 March 2014 - 11:49 PM

View Postdragontox, on 31 March 2014 - 08:13 PM, said:

Thanks for the awesome script. I am really amazed by it. I only have one issue. Everytime i run the setup. It says
Extracting: builderapi.lua
Extracting: schematic.lua
io:100: out of space

I believe the default limit for computercraft is 1MB. You must have a few files already on the turtle. You can change the limit in the ComputerCraft.cfg file (and restarting).

#4 dragontox

  • Members
  • 9 posts

Posted 01 April 2014 - 05:32 PM

Oh my bad lol I thought i had expanded the limit a long time ago
Thanks for the answer

Edit: I cannot get this to work, it just calls back no program found after extracting the packages

Edited by dragontox, 01 April 2014 - 06:14 PM.


#5 joebodo

  • Members
  • 69 posts

Posted 03 April 2014 - 08:00 AM

View Postdragontox, on 01 April 2014 - 05:32 PM, said:

Oh my bad lol I thought i had expanded the limit a long time ago
Thanks for the answer

Edit: I cannot get this to work, it just calls back no program found after extracting the packages

Ugh, it's missing the setup part that just says to run builder.lua <filename>
So, you should be good to go with what you have. I just tested it on another modpack and it seems to be working fine. I'll upload a new version soon(ish).

Let me know how it goes - I'm very interested.

Thanks

(here's my setup)
Posted Image

Edited by joebodo, 03 April 2014 - 08:10 AM.


#6 dragontox

  • Members
  • 9 posts

Posted 03 April 2014 - 06:24 PM

I tested it today and it seemed to not recognize the me under it I copied the same exact setup with the same schem but it didn't work out i also attempted it with a chest instead of ME systems

Thanks

#7 Amdusias

  • Members
  • 10 posts

Posted 03 April 2014 - 07:13 PM

Wow this really looks awesome!
One question: does this work on a server?

#8 joebodo

  • Members
  • 69 posts

Posted 03 April 2014 - 08:42 PM

View PostAmdusias, on 03 April 2014 - 07:13 PM, said:

Wow this really looks awesome!
One question: does this work on a server?

Yes - works on a server (was just on one today). You need a way to get the binary schematics to the turtle though.

View Postdragontox, on 03 April 2014 - 06:24 PM, said:

I tested it today and it seemed to not recognize the me under it I copied the same exact setup with the same schem but it didn't work out i also attempted it with a chest instead of ME systems

Thanks

For an ME system, it detects if the peripheral below has the getAvailableItems method. This pretty much tells if it's a version of OpenPeripherals for 1.6.4 (1.5 did not have this method).

function MEProvider:isValid()
  local mep = peripheral.wrap('bottom')
  return mep and mep.getAvailableItems and mep.getAvailableItems()
end

For a chest, it looks for the getAllStacks method.

function ChestProvider:isValid()
  local chest = peripheral.wrap('bottom')
  return chest and chest.getAllStacks
end

What version of OpenPeripherals are you using (or what modpack)?

#9 dragontox

  • Members
  • 9 posts

Posted 04 April 2014 - 02:43 PM

OpenPeripheral-0.2.1-preview8 on a 1.6.4 server running the direwolf pack and some other mods

#10 dragontox

  • Members
  • 9 posts

Posted 05 April 2014 - 12:12 AM

I updated openperipherals and that stuff is working fine. Only after clicking begin and letting it run to 100% it goes out places the first block and then spits out the error
apis.lua:364: Unable to open /easy.progress
easy being the schematic name any ideas on what's causing this?

ps it also seems to crash when adding none vanilla blocks to the me system

Edited by dragontox, 05 April 2014 - 12:14 AM.


#11 joebodo

  • Members
  • 69 posts

Posted 05 April 2014 - 05:22 AM

View Postdragontox, on 05 April 2014 - 12:12 AM, said:

I updated openperipherals and that stuff is working fine. Only after clicking begin and letting it run to 100% it goes out places the first block and then spits out the error
apis.lua:364: Unable to open /easy.progress
easy being the schematic name any ideas on what's causing this?

ps it also seems to crash when adding none vanilla blocks to the me system

For now, try placing the schematic in a subdirectory (like /schematics/easy). I'll upload a fix for it shortly (i have a bunch of optimizations done).

I've done replacements before with a mod's custom nether bricks before without a problem. I'll try a few other blocks. If you see the error again, see if prints out the line number. Thx (and sorry for all the issues - you seem to be the guinea pig)

#12 dragontox

  • Members
  • 9 posts

Posted 05 April 2014 - 11:36 AM

Okay I will do that.

Thank for the reply and It's okay you have put a lot of work into this script and created something awesome, The least I can do is tell you about the bugs.

Edit:
I also attempted to do the chicken schematic in both the sub folder and without it and it seems to not create the progress file at all.

Edited by dragontox, 05 April 2014 - 01:47 PM.


#13 joebodo

  • Members
  • 69 posts

Posted 06 April 2014 - 05:47 AM

View Postdragontox, on 05 April 2014 - 11:36 AM, said:

Okay I will do that.

Thank for the reply and It's okay you have put a lot of work into this script and created something awesome, The least I can do is tell you about the bugs.

Edit:
I also attempted to do the chicken schematic in both the sub folder and without it and it seems to not create the progress file at all.

I uploaded a new version with a bunch of optimizations (I updated the original post but forgot to increment the version number in the code - still says 0.01). I haven't been able to reproduce the issue with the progress file though. I normally name my files without an extension and place them either in a subfolder or the root folder. The last one I ran, I used the following command (the file was not in a subdirectory):

builder.lua modernhouse

Someone on Cranium's server grabbed a screenshot and sent me the link:
Posted Image

Edited by joebodo, 06 April 2014 - 05:49 AM.


#14 dragontox

  • Members
  • 9 posts

Posted 10 April 2014 - 04:39 PM

The update did fix some issues, but not all

Edited by dragontox, 10 April 2014 - 07:51 PM.


#15 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 10 April 2014 - 05:07 PM

How did you get the .schematic downloaded to the server? And extract it?
I'd like to know how that was done, because it would really go well with your program, not having to use FTP access to upload the files to the server. If you wrote that, it would be great to add to the program, so it can extract .schematic files directly.

#16 WilberP

  • New Members
  • 2 posts

Posted 10 April 2014 - 06:25 PM

Also had problems to Setup extract the files on my server, my first time messing with Lua, but did find out "file.close" on the extractTableFile function wasn't really working. Even so was able to "manually" extract the files but then Turtle was complaining didn't had a chest bellow. Couldn't find solution to this but found later checking MCP+ \ Forge logs that ComputerCraft was having problems with OpenModsLib:

[OpenMods] Integration module 'ComputerCraft' failed during operation 'init' and will be disabled

Downgraded ComputerCraft from 1.62 to 1.58 and that fixed the OpenModsLib problem (chest was found by the turtle) and also Setup worked as expected and properly extracted files but now i'm having issues with Turtle complain that path is always blocked when begin building.


Edit:

really new with this.. after setup GPS it start build without problems.

Edited by WilberP, 10 April 2014 - 07:53 PM.


#17 dragontox

  • Members
  • 9 posts

Posted 10 April 2014 - 07:50 PM

I have the same issue as wilderP although this occured to me after placing 3000 thousand blocks.
During the building I also noticed a few things if he cannot place blocks down he ignored them if a path infront him is blocked he will break the block but not replace the block under it. You already said you tested this on a server, but if you want to test it into more details feel free to join in and do as you please

#18 joebodo

  • Members
  • 69 posts

Posted 10 April 2014 - 08:40 PM

View PostWilberP, on 10 April 2014 - 06:25 PM, said:

Also had problems to Setup extract the files on my server, my first time messing with Lua, but did find out "file.close" on the extractTableFile function wasn't really working. Even so was able to "manually" extract the files but then Turtle was complaining didn't had a chest bellow. Couldn't find solution to this but found later checking MCP+ \ Forge logs that ComputerCraft was having problems with OpenModsLib:

[OpenMods] Integration module 'ComputerCraft' failed during operation 'init' and will be disabled

Downgraded ComputerCraft from 1.62 to 1.58 and that fixed the OpenModsLib problem (chest was found by the turtle) and also Setup worked as expected and properly extracted files but now i'm having issues with Turtle complain that path is always blocked when begin building.


Edit:

really new with this.. after setup GPS it start build without problems.

I'll put in the requirements that it's 1.58 only - I don't think OpenPeripherals has caught up to the latest version of CC yet.

A GPS is not required - not really sure why that changed anything!

View PostCranium, on 10 April 2014 - 05:07 PM, said:

How did you get the .schematic downloaded to the server? And extract it?
I'd like to know how that was done, because it would really go well with your program, not having to use FTP access to upload the files to the server. If you wrote that, it would be great to add to the program, so it can extract .schematic files directly.

I base64'd the file and transferred it using http.get. I then decoded the base64 file on the turtle. I agree it would be nice to include a download program. I don't know how people are getting binaries currently on servers (if they are at all) - I would like recommendations or some pointers if anyone is doing this. If I cannot find something existing, I'll go ahead and post what I use.

View Postdragontox, on 10 April 2014 - 07:50 PM, said:

I have the same issue as wilderP although this occured to me after placing 3000 thousand blocks.

Which issue?

View Postdragontox, on 10 April 2014 - 07:50 PM, said:

During the building I also noticed a few things if he cannot place blocks down he ignored them if a path infront him is blocked he will break the block but not replace the block under it.

The program will not clear areas - you will need to make sure the area is cleared beforehand. The turtle would have to traverse to every block in the area otherwise.

View Postdragontox, on 10 April 2014 - 07:50 PM, said:

You already said you tested this on a server, but if you want to test it into more details feel free to join in and do as you please

I would like more details - is that what you mean?

#19 joebodo

  • Members
  • 69 posts

Posted 10 April 2014 - 08:46 PM

Bear in mind this is a very early release of the program (and it's a monster at almost 5,000 lines). The next big change that I will be making is to redo the way substitutions are done. Right now you have to put the sub'd block into the turtle - I will change it to a list of all available items in your chest or AE system. You will just need to select the appropriate replacement block.

I did find a pretty big bug that occurs when you try to begin the build. The program could hang and cause the turtle to reboot during the calculations. I should have these changes in by tomorrow (hopefully)

#20 WilberP

  • New Members
  • 2 posts

Posted 11 April 2014 - 08:05 AM

Quote

A GPS is not required - not really sure why that changed anything!

Could be me being a noob, i have just now start using ComputerCraft and since Turtle was not building, complaining that was blocked, i had no idea how it would get to the start position, doing a GPS network and applied the "gps locate" on the turtle it start working.

Me and my friends sure loving the program in my server so we really thankful for this program even if it's a early release, it's a great work.

Something we notice it's that without world anchors is pretty annoying to restart build since it requires a chest (of course everyone start doing big schematics), so turtle need to be move to the starting position, maybe start from where is at moment if exist the progress file and bypass the Chest check?

Also didn't figure exactly where it start build the schematic from the start position, does it consider the block in front of turtle as the left down corner of the schematic or it give some spaces before doing it?

Turtle also destroy what it finds while on path to the building, any chance if is given the starting position to build and place the chest area above the building it will not damage the surroundings and allow precision building of schematics next to each others?

Also only the bellow chest is small for bigger buildings, need to check more about this ComputerCraft to see if already exist ways to "present" more chest to the turtle..





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users