Etarc Coders Club

Mandatory XKCD reference:

6 Likes

NP++ can handle format for various coding, including xml, which you select through the ā€˜Language’ tab. I still do it this way, even though I should have likely coded up something by now to let Google sheet handle it all. The language files are pretty consistent when it comes to format, so I’d likely rarely have to adjust a script. I do use scripts for some other NMS files. Just been lazy and a dislike for Google Apps Script. Not to mention the awkward way the decompiled exml files are generated. All tags are property tags, instead of properly named tags as you’d expect.

1 Like

For example:

<?xml version="1.0" encoding="utf-8"?>
<!--File created using MBINCompiler version (5.04.0.2)-->
<Data template="TkLocalisationTable">
  <Property name="Table">
    <Property value="TkLocalisationEntry.xml">
      <Property name="Id" value="SCAN_NO_TECH" />
      <Property name="English" value="No scan technology installed &lt;IMG&gt;SLASH&lt;&gt;" />
      <Property name="French" value="" />
      <Property name="Italian" value="" />
      <Property name="German" value="" />
      <Property name="Spanish" value="" />
      <Property name="Russian" value="" />
      <Property name="Polish" value="" />
      <Property name="Dutch" value="" />
      <Property name="Portuguese" value="" />
      <Property name="LatinAmericanSpanish" value="" />
      <Property name="BrazilianPortuguese" value="" />
      <Property name="SimplifiedChinese" value="" />
      <Property name="TraditionalChinese" value="" />
      <Property name="TencentChinese" value="" />
      <Property name="Korean" value="" />
      <Property name="Japanese" value="" />
      <Property name="USEnglish" value="" />
    </Property>
  </Property>
</Data>

So using a script makes it hard to reference tags, and instead requires some smart work-around using the attributes. I believe there was once a reason for doing it this way though, have to blame MBINCompiler for that, which is otherwise great!

3 Likes

Why didn’t they tell us in school, ā€œone day you will need to mod game files and get 1337 streetcred from gamers! So, do your regex homework!ā€

I have never seen a ā€œregex that just worksā€, lol. Only regexes that needed to be corrected a dozen times to hammer them into shape.

We are having the same conversations at work, plus, I’m a wiki admin for another game and extracting values from the game’s XML files for it (probably very similar to what you are doing). When it’s a one-off or rare task, I also use ā€œregular expression groupsā€ in NotePad++, as the others recommend here.

When I want to fully automate a complex search and replace in XML, I use a python library called beautifulsoup - which also uses regular expressions, and it would not be easier for todd to get started than just doing it in NotePad++. But maybe keep it in the back of your head.

Unfortunately regular expressions are not taught in two minutes in a forum post, still, I found them worth learning – for exactly what you are doing.

If you have specific questions like these, I guess just ask us and we give you the expression. Have you tried describing your request to a Large Language Model? They can generate regex and adjust them too when you ask for corrections.

6 Likes

I scrolled back and noticed that apparently I have been adding to my script for over a year already! (I found the missing values; mass is calculated by adding up the masses of the ingredients, and Wattage appears as one of three values depending on block type. I am still working on calculating inventory capacity.) Turns out, 10 years old games are not very consistent. :wink:

In the last few months, I have been working on integrating a wikimedia feature which may also be of interest to the NMS wiki, it’s called Cargo: You use it when you add properties or a recipe to the wiki, then you can have the infobox put the values also into a database.

And then on the page about one of the materials, you could add a table that lists all products made with this material; this table then updates itself when you update the recipes elsewhere! Or for NMS ship or suit upgrades, you could describe their stats on their pages, and on a higher level page, you could have a sortable table to compare them all!

To use it, I need to update the Template and also hundreds of existing wiki pages to the new info box format. So I’m experimenting with a python script… that sends bot API calls … that can do bulk search and replace … across a whole wiki. :exploding_head: (PS: I’m not running the script on the live wiki, but on a test wiki, for now.) :grimacing:

3 Likes

I have not given up on this. The API page update calls and the database work, albeit not smoothly out of the box. Some wiki pages group block variants together and hence the page is not named exactly as the block in the game files. Do I need a custom mapping file? :thinking:

My second ā€œarbitrary goal to give me a reason to learn something newā€ project keeps changing ever so often. Currently I’m back to minimalist procedural generation in python. No, not like no man’s Sky. :wink: More like a ā€œWhere is Waldoā€ game. But since it’s minimalist (i.e. I don’t know how to ā€œgenerateā€ realistic 3D models), the animals to find will be cuboids and tetrahedrons and spheres with varying legs and colours…

Like these ā€œKopffüßlerā€ Tadpole person - Wikipedia

Everything, including the ground and flora, will be generated out of triangle meshes. But hilariously badly and crooked, with asymmetrical eyes, like done by a preschooler, is my goal.

4 Likes

I havem’t given up on the idea, either. I had made some progress, but then I ended up in hospital - and I’m still coming to terms with the outcome. Concentration was difficult for a long time.

I’d be interested to seee what you come up with.

4 Likes