• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

primem0ver

Major
16 Badges
Jul 15, 2015
563
70
  • Stellaris
  • Cities: Skylines
  • Cities: Skylines - After Dark
  • Cities: Skylines - Snowfall
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Cities: Skylines - Natural Disasters
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Mass Transit
  • Cities: Skylines - Green Cities
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Cities: Skylines Industries
  • Stellaris: Synthetic Dawn
I would say that this advice is applicable to a significant portion, if not a majority of all Stellaris modders out there who post mods that are bigger than one or two files (and probably for other Paradox games as well... though I do not play them). I am shocked at the number of modders who do not clean up their mistakes and I would appreciate it if a moderator would make this a sticky/pinned post (or post something similar and make it a sticky).

I am sick of spending hours cleaning other peoples mods of errors in order to get them to work properly/as intended. I am not talking about bugs. I realize that bugs take time and game-play to find. I am talking about parsing errors. In the past when I hosted and updated the one mod I shared, I always made sure, with each update, that my mod didn't have any reported errors (barring the occasional meaningless one that can't be helped) in the error.log file before posting. A raw run without mods never has an error.log file bigger than around 11k-13k. I have had error files reach as big as over 200k in size because people are not doing their jobs as modders. Most of these errors are stupid mistakes. Yes... I make them too. Coding always leads to mistakes which lead to bugs in the code. You need to cleanup your own. All that time coding won't make a difference, if it silently doesn't work because of a silly error.

BIG HINT: Get a feel for what the unmodded Stellaris error.log file looks like for each update. Things occasionally change but it is easy to get a feel for what appears there in an unmodded run.

ANOTHER HINT: Yes... for some of us it takes time to check and uncheck all those mods we've installed. However, if you back up your settings.txt file located in MyDocuments\Paradox Interactive\Stellaris, you can simply delete all the entries under "last_mods={" section (without quotes) except the one you want to clean. Then simply copy it back when you are done.

One big issue that causes errors (and sometimes crashes) which I have seen a large number of times is an uneven number of brackets; where the number of open block brackets is not balanced by the number of close block brackets.

I cleaned a file that HAD OVER 30 EXTRA close brackets. 327 open (left) and 361 close (right).

Catching this problem can now be very easy. I built a utility using c# that checks the number of brackets in the mod I created and posted a while back and makes it easy to find where the missing/extra brackets are and correct the mistakes using a "paring by color" visual interface. It checks all files in a mod folder AND subfolders for balance errors. I have adapted it for general use and have shared it at the bottom of this post. Instructions for use are in the second post below. Feel free to comment if you find an issue or have a request/suggestion. I am not going to guarantee that I will honor requests but I will consider it.

Here are some screenshots:
Bracket_Checker.png

Bracket_Checker2.png


NOTE: If you are using a Mac or Linux, you should be able to get this utility to work by downloading and installing Mono.NET
 

Attachments

  • StellarisBracketCheck.v1.02.zip
    123,7 KB · Views: 5
Last edited:

primem0ver

Major
16 Badges
Jul 15, 2015
563
70
  • Stellaris
  • Cities: Skylines
  • Cities: Skylines - After Dark
  • Cities: Skylines - Snowfall
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Cities: Skylines - Natural Disasters
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Mass Transit
  • Cities: Skylines - Green Cities
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Cities: Skylines Industries
  • Stellaris: Synthetic Dawn
I uploaded the utility.

Instructions/TIPS FOR USE:
  • IMPORTANT: The utility backs up your files by default to myfile.bak when you edit. You may change this behavior by either commenting out the appropriate line and modifying the value. You must delete the .bak files before using/uploading your mod if they exist.
  • You may copy file names from the files reported in the main interface (make sure to include the full path).
  • You may put the path to any file you want to check in the "Edit" box and hit edit to check, whether it is listed or not.
  • You can use/modify the modlist.txt in the application folder to specify mod/file directories to check OR to modify default values used by the program (see below)
  • Only one folder per line
  • You may use # or ; to comment lines out (or type comments).
  • When you add/delete brackets, you will need to hit the "Reset View" button to update the bracket colors.
  • Commented brackets should not be detected (count).
  • When brackets are unbalanced, the green "Brackets are Balanced" will tell you the totals it counted for both right and left facing brackets.
  • Note: I did not create the FastColoredTextBox control used in this program. If you are curious about it, PM me.
  • The FastColoredTextBox turns tabs into the number of spaces set by the tabLength value automatically. This behavior cannot be changed (easily). As such, by default, this same number of consecutive spaces is converted back to tabs when the file is saved by clicking the "Accept Changes" button. You may change this behavior. See details below.
  • Mistakes in the modlist.txt file will generally cause the line to be ignored.
  • If you do not specify any files in the modlist.txt file or you delete the file, you will be shown a Browse for folder dialog box. This will keep showing until you select a valid folder or cancel.

Default Values:
These values can be changed using the provided modlist.txt file or writing your own (must have the same name). Caps do not matter.
  • BackupFile=true
  • UseTabs=true (set to false if you do not wish to convert the set number of consecutive spaces back into tabs when saving).
  • TabLength=4
PLEASE NOTE that you must preface any line to change a value with a $. Only one change per line. Example:
$backupFile=false
 
Last edited:

Idhrendur

Keeper of the Converters
107 Badges
Feb 27, 2009
11.438
3.135
  • Hearts of Iron IV: No Step Back
  • Hearts of Iron IV: By Blood Alone
  • Crusader Kings II
  • Victoria 3 Sign Up
  • Stellaris: Nemesis
  • Sengoku
  • Pillars of Eternity
  • Tyranny: Archon Edition
  • Europa Universalis IV
  • March of the Eagles
  • Victoria 2
  • 500k Club
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Colonel
  • Shadowrun Returns
  • Imperator: Rome Deluxe Edition
  • Crusader Kings III: Royal Edition
  • Commander: Conquest of the Americas
  • Darkest Hour
Agreed!

Also, thanks for the tool. Do you think it would also work for mods for other games? If so, I would probably find it very helpful.
 

Mitchz95

Field Marshal
17 Badges
Feb 4, 2016
3.537
2.571
  • Stellaris: Synthetic Dawn
  • Stellaris: Humanoids Species Pack
  • Stellaris: Nemesis
  • Stellaris: Necroids
  • Stellaris: Federations
  • Stellaris: Lithoids
  • Stellaris: Ancient Relics
  • Stellaris: Megacorp
  • Stellaris: Distant Stars
  • Stellaris: Apocalypse
  • Stellaris
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Major Wiki Contributor
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
I've rarely found the error log all that helpful, to be honest. Most of the "errors" listed point to empty lines of code, or to lines that work exactly as intended. I only go there if I absolutely can't figure out a problem, and then I just Ctrl-F the event scope to skip to the relevant stuff.
 

Dayshine

Second Lieutenant
43 Badges
Aug 25, 2016
111
45
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Horse Lords
  • BATTLETECH
  • Surviving Mars
  • Stellaris: Humanoids Species Pack
  • Cities: Skylines - Parklife
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome Sign Up
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Cities: Skylines
  • Europa Universalis IV
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Imperator: Rome
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Stellaris: Synthetic Dawn
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Magicka
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Mare Nostrum
  • Sword of the Stars II
  • Crusader Kings II
Hey, just in case you're not aware, my tool (CWTools, which is pinned in this subforum) has supported this for quite a few months now :)

It goes far beyond bracket matching too, full syntax validation as well as effects/triggers/scopes checking. You point it at your Stellaris documents folder and it'll scan and validate all the mods you've got there.
 

primem0ver

Major
16 Badges
Jul 15, 2015
563
70
  • Stellaris
  • Cities: Skylines
  • Cities: Skylines - After Dark
  • Cities: Skylines - Snowfall
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Cities: Skylines - Natural Disasters
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Mass Transit
  • Cities: Skylines - Green Cities
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Cities: Skylines Industries
  • Stellaris: Synthetic Dawn
Agreed!

Also, thanks for the tool. Do you think it would also work for mods for other games? If so, I would probably find it very helpful.
Yes. It doesn't pay any attention to the game. It simply counts (and colors) braces. The only issue you might run into is if the other games use a different symbol for marking a comment. (As you can see, comments starting with a '#' are greyed out. Braces behind them are ignored.)

Cool tool, though you might want to put in some error handling to catch instances where a user would forget to put in the path to the file they wish to edit. Just my own developer OCD
I thought about that after I posted it. Honestly I just took between 30-60 minutes to allow some basic versatile features. All the locations were hardcoded in my original program. I may do that a little later.

Hey, just in case you're not aware, my tool (CWTools, which is pinned in this subforum) has supported this for quite a few months now :)

It goes far beyond bracket matching too, full syntax validation as well as effects/triggers/scopes checking. You point it at your Stellaris documents folder and it'll scan and validate all the mods you've got there.
No, I was not aware. Sounds like a great tool! I will have to check it out when I get back into adding to my mod; though I am not currently updating it with the game since I am not a fan of star lanes. I am pretty irritated that they chose to keep the one method of travel I hate (though I understand their reasons for cutting back). Stellaris is the only truly "Paradox" game I play so I haven't really done a whole lot with making the job easier other than this bracket tool and another tool that creates the localization files from excel files. I can link your tool in first post as well if you like. I mainly posted it because brackets are a large source of problems since it is tough to find the brackets without actually counting them otherwise. I wanted to offer something to help with fixing this rampant problem.
 

primem0ver

Major
16 Badges
Jul 15, 2015
563
70
  • Stellaris
  • Cities: Skylines
  • Cities: Skylines - After Dark
  • Cities: Skylines - Snowfall
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Cities: Skylines - Natural Disasters
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Mass Transit
  • Cities: Skylines - Green Cities
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Cities: Skylines Industries
  • Stellaris: Synthetic Dawn
I've rarely found the error log all that helpful, to be honest. Most of the "errors" listed point to empty lines of code, or to lines that work exactly as intended. I only go there if I absolutely can't figure out a problem, and then I just Ctrl-F the event scope to skip to the relevant stuff.
Well, I don't know what to tell you other than to say if you develop mods, you should learn how to use it since any block with an error in it is completely ignored without any kind of warning/heads up unless the game crashes. This often leads to parts of the code that just don't function and your mod is less than you hoped for.

An imbalance of brackets is the number one cause of game crashes and I would say that around 30-50% of the time you have a large number of errors, it is because of a bracket imbalance. I am (almost) always able to find the problem with a mod by paying attention to the errors.log file combined with a/my bracket tool.