How would I transfer the decision.txt into the Wiki? Do authors use a script to convert the code into human-friendly text? Or is it just done manually?
https://github.com/ajul/pyradox helps extract the data from the files. E.g. after loading the decisions folder you could do
decisions['GER_reichskommissariats']['GER_reichskommissariat_norwegen']
in Python code but there is still a lot to be done to produce actual wiki text. To stick with this example, the condition for Reichskommissariat Norwegen looks like this:
Code:
available = {
has_completed_focus = GER_form_the_reichskommissariats
has_government = fascism
controls_state = 110
controls_state = 142
controls_state = 143
controls_state = 144
}
Turning that into a textual representation requires recognizing the different triggers, looking up their values (like the matching state names for
controls_state
, focus names for
has_completed_focus
), their English localizations and so on. So doing it by script is maybe more future proof and slightly less error prone, but not necessarily any easier than typing out the hundreds of decisions by hand.
https://hoi4.paradoxwikis.com/German_events and other event pages already do something similar, but I don't know how that came into being. The first version by
@SolSys already contained most of the content.
And as far as I know, that format isn't documented, so there can be guesswork as to what the syntax means
I reversed the file format as well, but there is not much to it. Pyradox basically guessed it correctly. Most files may start with a UTF-8 byte order mark but it has no real impact on how the file content is treated. On the lexical level, the following characters have special meaning:
!#;(),<=>{}
Either of the first three introduces a comment which stretches until the end of the line. There is no option for multiline comments. Parenthesis and commas are not really used for anything as far as I can tell (there are only
two places across the whole game where commas are used - wrongly).
The comparison operators and curly braces are used for the usual nested elements you see throughout the files.
All other stretches of text delimited by special characters or whitespace are treated as numbers or generic tokens depending on whether they look like a number or not. This means whitespace is not required anywhere except to separate two generic tokens or for stylistic purposes. Generic tokens may be quoted with double quotes but this is only necessary if they contain whitespace or characters with special meaning. I.e. almost all quotes you see in the game source are completely useless like
tag = "GER"
is strictly the same as
tag = GER
. Within a quoted token
"
can be escaped as
\"
and
\
in turn can be escaped as
\\
.
Beyond this basic level there is no common syntax. The content of curly braces might be a list of uniform numbers, it might contain simple assignments or nested elements. It all depends on the element they belong to.