Changelog tutorial

Place to get help with not working mods / modding interface.
User avatar
themadgunman
Inserter
Inserter
Posts: 47
Joined: Wed Jan 18, 2017 5:07 pm
Contact:

Re: Changelog tutorial

Post by themadgunman »

This whole tab hatred thing really needs fixing, especially as most IDE's will automatically add a tab when you do a new line from an already indented line, I think I spend more time debugging my changelog than I do my actual mod code atm :evil:

I suspect this is why 90% of mod changelogs don't actually work in game
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3716
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Changelog tutorial

Post by DaveMcW »

themadgunman wrote: Sat Mar 16, 2019 2:01 pm This whole tab hatred thing really needs fixing, especially as most IDE's will automatically add a tab when you do a new line from an already indented line,
Spaces won the whitespace war. If your IDE is any good you can configure it to convert tabs to spaces when it saves the file.
User avatar
themadgunman
Inserter
Inserter
Posts: 47
Joined: Wed Jan 18, 2017 5:07 pm
Contact:

Re: Changelog tutorial

Post by themadgunman »

DaveMcW wrote: Sat Mar 16, 2019 2:15 pm Spaces won the whitespace war. If your IDE is any good you can configure it to convert tabs to spaces when it saves the file.
I just switched it to automatically indent with spaces rather than tabs, for some reason this never occured to me before, thanks for the tip
Schallfalke
Fast Inserter
Fast Inserter
Posts: 162
Joined: Sun Oct 28, 2018 7:57 am
Contact:

Re: Changelog tutorial

Post by Schallfalke »

themadgunman wrote: Sat Mar 16, 2019 2:42 pm
DaveMcW wrote: Sat Mar 16, 2019 2:15 pm Spaces won the whitespace war. If your IDE is any good you can configure it to convert tabs to spaces when it saves the file.
Interesting, time for Uncle Google to earn his keep today and inform me on how to do this in VS, thanks for the tip
Some text editors allow changing tabs to spaces, can save you a lot of time.
For example, I am using "Sublime Text". Under menu "View" → "Indentation", there are whole bunch of options including "Indent Using Spaces", setting "Tab Width", "Convert Indentation to Spaces".
I am sure other (free) modern text editors have similar functions as well.
User avatar
themadgunman
Inserter
Inserter
Posts: 47
Joined: Wed Jan 18, 2017 5:07 pm
Contact:

Re: Changelog tutorial

Post by themadgunman »

Schallfalke wrote: Sat Mar 16, 2019 3:14 pm Some text editors allow changing tabs to spaces, can save you a lot of time.
For example, I am using "Sublime Text". Under menu "View" → "Indentation", there are whole bunch of options including "Indent Using Spaces", setting "Tab Width", "Convert Indentation to Spaces".
I am sure other (free) modern text editors have similar functions as well.
yeah it was actually just a simple setting change, it just never occured to me to look tbh :oops:
Pi-C
Smart Inserter
Smart Inserter
Posts: 1726
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Changelog tutorial

Post by Pi-C »

Updated the text again. I actually fixed a changelog to try out a few things. Now the tutorial contains a lot of boring stuff about where to use spaces and how many, or how to indent lists correctly. :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Bilka
Factorio Staff
Factorio Staff
Posts: 3309
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Changelog tutorial

Post by Bilka »

The changelog cannot be encoded in UTF-8-BOM, this will cause Factorio to error on line 1. I recommend to use plain UTF-8 (no Byte Order Mark) instead.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1726
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Changelog tutorial

Post by Pi-C »

Thank you, updated!
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3133
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Changelog tutorial

Post by BlueTemplar »

Is changelog.txt in the YAML format or the JSON format, or neither ?
viewtopic.php?p=416982#p416982
BobDiggity (mod-scenario-pack)
User avatar
Muppet9010
Filter Inserter
Filter Inserter
Posts: 279
Joined: Sat Dec 09, 2017 6:01 pm
Contact:

Re: Changelog tutorial

Post by Muppet9010 »

Where is it said it's in JSON format?
Btw it very clearly isn't json
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3133
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Changelog tutorial

Post by BlueTemplar »

I gave a link !?
BobDiggity (mod-scenario-pack)
User avatar
Muppet9010
Filter Inserter
Filter Inserter
Posts: 279
Joined: Sat Dec 09, 2017 6:01 pm
Contact:

Re: Changelog tutorial

Post by Muppet9010 »

Doing a search on the linked thread (both pages) found no reference to JSON. Hence why I asked as the format is so visually different to JSON.
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3133
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Changelog tutorial

Post by BlueTemplar »

YAML is a superset of JSON.
BobDiggity (mod-scenario-pack)
User avatar
Muppet9010
Filter Inserter
Filter Inserter
Posts: 279
Joined: Sat Dec 09, 2017 6:01 pm
Contact:

Re: Changelog tutorial

Post by Muppet9010 »

Does Factorio changelog support the JSON type syntax of YAML 1.2 or the full YAML syntax?
As my understanding was that it only supported a simplified syntax that is YAML compliment.
User avatar
Omnifarious
Filter Inserter
Filter Inserter
Posts: 276
Joined: Wed Jul 26, 2017 3:24 pm
Contact:

Re: Changelog tutorial

Post by Omnifarious »

BlueTemplar wrote: Tue Mar 26, 2019 3:21 pm YAML is a superset of JSON.
No... YAML is an alternative to JSON. It might be that you can represent more kinds of data with YAML (though I suspect not because YAML doesn't really have a distinction between integers and strings), but superset implies that all JSON files are YAML files, which is definitely not the case. JSON is a curly-brace based syntax, and YAML is whitespace (and some special delimiter characters) based.
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3133
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Changelog tutorial

Post by BlueTemplar »

https://yaml.org/spec/1.2/spec.html#id2759572
YAML can therefore be viewed as a natural superset of JSON, offering improved human readability and a more complete information model. This is also the case in practice; every JSON file is also a valid YAML file. This makes it easy to migrate from JSON to YAML if/when the additional features are required.
(Though this seems to be morphing into a pointless discussion about the definition of "superset", my bad...)
BobDiggity (mod-scenario-pack)
User avatar
Omnifarious
Filter Inserter
Filter Inserter
Posts: 276
Joined: Wed Jul 26, 2017 3:24 pm
Contact:

Re: Changelog tutorial

Post by Omnifarious »

BlueTemplar wrote: Tue Mar 26, 2019 11:14 pm https://yaml.org/spec/1.2/spec.html#id2759572
YAML can therefore be viewed as a natural superset of JSON, offering improved human readability and a more complete information model. This is also the case in practice; every JSON file is also a valid YAML file. This makes it easy to migrate from JSON to YAML if/when the additional features are required.
(Though this seems to be morphing into a pointless discussion about the definition of "superset", my bad...)
Interesting. I'm going to have to test out a few YAML parsers and do some investigations to see if that means what it seems it should mean based on a plain reading. In practice, YAML files typically do not use curly or square brackets. Anyway, you're right. This is kind of silly. The changelog parser seems simplistic, and I suspect that it does not support the full YAML syntax, and only a restrictive subset.
badtouchatr
Long Handed Inserter
Long Handed Inserter
Posts: 80
Joined: Sat Aug 20, 2016 8:00 pm
Contact:

Re: Changelog tutorial

Post by badtouchatr »

I've found another picky requirement of the changelog parser: The header line of dashes (and subsequent dashed lines between versions) must have exactly 99 dashes. I've tried it with 80, 98, 99, and 100. The only one that works is 99.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1726
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Changelog tutorial

Post by Pi-C »

badtouchatr wrote: Fri Mar 29, 2019 6:14 am I've found another picky requirement of the changelog parser:
Thanks! I've included that information.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Pi-C
Smart Inserter
Smart Inserter
Posts: 1726
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Changelog tutorial

Post by Pi-C »

Update: Empty lines must be really empty -- spaces or even tabs will cause a parsing error!
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Post Reply

Return to “Modding help”