Generating Crafting Recipes (HTML)

I have posted a list of crafting recipes for TUG and SteamPower mod over a week ago on twitter.
Then 2 days later I have posted one with search functionality for both TUG and SteamPower.

Here is how I did it and no I didn’t do it one by one, that would take way too long and would just be silly. I have used the IDE to do all of the work for me.

The basic list took only 4 hours to make, if I’m to guess it would take about 2/3 days to get all of them done one by one, no way of knowing if you have made a mistake and each time there is an update it would take additional time (not to mention making those lists for mods).

Crafting Recipes

This part was simple enough, all I had to do it use the txt parser (TUGON parser/TUG parser) to get a list of crafting recipes, then parse the item groups, item names, tools and crafting stations.

HTML Files

Generating the HTML files was a bit more difficult, surprisingly, but that was probably because I wanted it to look nice and use a css file. This part was the most time consuming one, approximately 2 hours of tweaking the code.

Icons

The icons were pretty much there, the main problem was that I needed name to icon map, but since the txt parser (TUGON parser/TUG parser) is capable of reading the files it was just a matter of reading all of the files and getting the objects schematic files. Once I had a full list of objects I could easily get the icon path, convert the image to a smaller png and save it in the generated directory.

Search Functionality

This one was pretty simple, credits for the idea go to Cameron. It required me to change the HTML code and add a JavaScript lib, it didn’t take too long since it was just a matter of tweaking it a bit.

Leave a Reply

Your email address will not be published. Required fields are marked *