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

Lyqyd's Project Builder

Started by Lyqyd, 31 August 2014 - 12:16 AM
Lyqyd #1
Posted 31 August 2014 - 02:16 AM
This program is a GUI frontend for turtle construction projects. It uses separate project files to provide the requirements and instruction code for each project the turtle can build, and provides the front-end to display the requirements to the user. I wrote this script after trying to put pretty interfaces on a couple of my other building programs. Here is an album of screenshots of what the program's interface looks like. This program can be used on both regular and advanced turtles. The key controls are listed in a spoiler below. Please note that some key controls will only work on a normal turtle and are disabled on advanced turtles, most notably the project selection screen controls.

The best way to get this program is via packman, with the command packman install lyqyd/setup, as this will fetch setup and its dependencies automatically. You could also grab it from pastebin:
setup: 4ARFQYmw, or simply: pastebin get 4ARFQYmw setup

Documentation for this program can be found in the README file in the Github repository.

The project files are intended to be used for discreet structures, specific configurations of a set number of blocks, rather than specifiably-sized objects. The project files may specify a number of requirements:
  • Slot contents. The slot content options allow for a minimum and maximum count, a name for the slot contents ("Logs", "Planks", etc.), a boolean specifying whether or not the count must exactly match the specified quantities (otherwise, any number equal to or greater than the specified number will work), and an optional function to be called to determine the slot's readiness (for slots whose content count depends on the contents of another slot, for example)
  • Location information. This is intended only for use with projects that need to be built at a separate location, like a GPS cluster needing to be built in the sky instead of at ground level. The current location of the turtle can be detected automatically, or the user can manually enter the location.
  • Fuel requirements. The fuel requirement can either be a number or a function, for projects that can vary in their fuel cost.
  • Other requirements. An optional function can be provided to check other requirements, and return true (if they are all met), or false and a short phrase for each unmet requirement ("Crafty Turtle", for instance).
You can see examples of these requirement options in use in the project files available on github.

Key ControlsOn Projects Screen:
  • Up: Move selection cursor up one project
  • Down: Move selection cursor down one project
  • Enter: Select currently highlighted project
On any Requirements Screen:
  • S: Jump to Slots Requirements screen
  • L: Jump to Locations Requirements screen
  • F: Jump to Fueling Requirements screen
  • G: Start building the project
  • P: Return to Projects screen
  • Q: Quit program
On the Location Requirements Screen:
  • Tab: Jump to next coordinate entry field.
  • Enter (while entering coordinates): Complete coordinate entry.
  • h/H: Cycle starting/build location facing directions
  • O: Access Location Options screen.
On the Location Options Screen:
  • 1-9: Select Numbered Option
On the Fueling Requirements Screen:
  • R: Refuel turtle.
TheOddByte #2
Posted 31 August 2014 - 02:29 AM
Usually don't check out the turtle section, but you caught my interest. I'll try this out right now and then give you some feedback.
Edit: I can't seem to start MC atm, guess I'll go to bed then and try it out in the morning, but by the looks of it it seems pretty useful :)/>
Edited on 31 August 2014 - 01:04 AM
Inksaver #3
Posted 06 September 2014 - 08:47 AM
Wow!

There is some serious coding here, and I am going to learn a whole lot from it.

One small point, if you go to the pastebin site, on line 23 you have put –]] instead of ]]– and it messes up the code formatting until you reach line 611 :)/>
Lyqyd #4
Posted 06 September 2014 - 09:34 AM
Thanks! About the pastebin syntax highlighting, if you take a look at my pocketgps paste, you'll see that the exact same situation is handled correctly. The issue is on pastebin's end–their highlighter is being greedy and marking everything from the first –[[ until the last ]] of the entire file as a block comment.

Edit: I've just reported the bug to them via email (and already gotten a response, holy crap!)
Edited on 06 September 2014 - 07:44 AM
Lyqyd #5
Posted 27 September 2014 - 07:13 AM
I've just updated this to add support for normal computers. The key controls are listed in a spoiler in the first post. I'm hoping to add some more project files soon, and would welcome quality submissions of project files. I plan on creating some sort of downloading system to make it easier to fetch the project files from github, but I'm not sure what I want to do in that regard yet.
Bomb Bloke #6
Posted 27 September 2014 - 08:05 AM
I don't suppose you've any plans to add a project file builder to it? Have an interface for telling the turtle to "scan" an area (by mining it out if need be), saving a table of the blocks found to disk, then later rebuilding it?

Even without access to turtle.inspect() or OpenPeripheral, this should be feasible in that harvesting two similar blocks will result in two items being contained within a single slot within the turtle's inventory (whereas two different items will be forced into separate slots). If the turtle returns to a drop-off chest every time it fills all sixteen of its slots and waits for a user to tell it what it's holding before it actually dumps its load and continues, it should be able to determine exactly which items were placed where. To recreate the structure, it need only re-place them in reverse.

Granted, the system would be imperfect for the purposes of dealing with items such as glass (which can't be recollected) or stairs (which can be placed in various orientations), and would require a fair bit of hand-holding when dealing with structures that use a diverse variety of blocks. It'd still be pretty cool, though, especially if paired with a system for uploading/downloading project files.
Lyqyd #7
Posted 27 September 2014 - 08:53 AM
Hmm. It sounds like you're looking more for a schematic builder, perhaps? I hadn't really planned on doing that sort of thing (except to whatever extent the existing project file system can be considered to be schematics), though it is a rather neat idea. If I were to ever make a schematic builder of my own, I think that it would be a separate project, and not part of this code base. I'd most likely try to create a converter tool to create project files out of schematic files if I did ever make a schematic builder, I think. Hmm. You've got the wheels turning, but I feel like there are too many edge cases that would make a robust schematic builder a nightmare to try to create.
Bomb Bloke #8
Posted 27 September 2014 - 09:14 AM
Granted, using "actual" schematic files allows for much more impressive builds than turtle-scanning would.

But there are downsides: If you want to use it to replicate your own builds you'll need world save access, and likewise if you want to get the schematics onto your turtle's drive without jumping through the hoops imposed by ComputerCraft's restriction to text-only file transfers over HTTP.

Being able to create your own "designs" within the game itself skirts the first issue neatly and makes it easier to deal with the latter.

Just a suggestion, of course - I realise full well that it'd be an extension of your plans for this thing. I just reckon your current setup would be a good base for such a project. :)/>
TDplay #9
Posted 16 October 2014 - 09:02 PM
Awesome! I've once tried to make "Turtle Town", but when it came to the Builder, I had no idea what to write for the code! Maybe I could look at the code, and learn a lesson or two, and get back to Turtle Town!
Lyqyd #10
Posted 03 June 2015 - 03:02 AM
I've added some documentation for this (and especially for the structure of the project files) to the Github repository, in the README file. I'd be happy to accept submissions of more project files to the repo!
atithaoss #11
Posted 04 February 2017 - 07:19 PM
Hello,
I just test it in mc 1.7.10 but it is not working.
Can you please indicate what are the requirements???
Thanks in advance
Lyqyd #12
Posted 04 February 2017 - 08:11 PM
What isn't working? Do you get an error message of some sort?
atithaoss #13
Posted 04 February 2017 - 09:56 PM
Yes finally i found that there is a dir etc/projects and of course the projects.
I install them through packman and i test 1-2 (your house is not working the turtle drops all the items at the time it makes the crafting table.)
Can you please tell me the mods that you use to build the gpssatellete? i can not find the program to run in the system.
Lyqyd #14
Posted 04 February 2017 - 10:32 PM
The only things you should need are the setup program and the project files. As long as you load up the turtle with exactly what it asks for, things should go smoothly.

I'll double check the projects as soon as I have some time to do so.
atithaoss #15
Posted 04 February 2017 - 10:51 PM
i done exactly what it asks for the gpssatellite but it just place the computers and the modems and not the program!!!
Bomb Bloke #16
Posted 05 February 2017 - 12:36 AM
It's not supposed to "place" "the program". You could still stand to be a lot more specific about the exact point where you're getting stuck - if you're having trouble putting it into words, screenshots may be better.
Edited on 04 February 2017 - 11:39 PM
Lyqyd #17
Posted 05 February 2017 - 02:36 AM
The GPS setup script does create a "gpsStart" and "startup" program on each satellite as it goes. Are these files not present on the computers after the turtle comes back?
atithaoss #18
Posted 05 February 2017 - 11:30 AM
The first time that i build was not there any program. After i read a post for Gps i face south my turtle and then all was good.
Now the GpsSatellite is ok for me. and of course its running. :)/> Great work….