Ah yes, I should have clarified. By "not do anything", I mean it doesn't modify the "races" variable once applied.
Viewing post in Modding help
Noticed the problem, I had same issue on new files i made. Tabs vs. spaces, the game uses tabs for indentation and the mod code all expects tabs. You need to convert all those spaces to tabs, then it should work.
Edit: It's more than that, testing out more. The mod code expects all following lines to begin with a tab too, so the "Race One" and "Race two" need to be indented. However, even with that, using a regex tester it doesn't match the regex the game is using for variables.
Edit2: The game's regex for variables does not support this far as I can tell,
(var.*=)\s([{]([^\{\}]*[\r\n]*)*[}])?([^\{\}\s]*)
That won't match anything with nested {}'s which are required for adding a race. You could work around this by defining your own races, and then appending them to the official ones during startup of the game? Otherwise, we'll need a new version that supports this. Basically that chunk of code needs to be amended to also accept a form where it's "var blah = {" followed by a series of lines starting with tab, and then ending with a }, similar to what it does for functions.
To work around this, instead of modifying races.gd, add your own file that defines those 2 races, then do something like this for scripts/globals.gd
It's possible to mod the mod system, to change that regular expression to something that would work better.
I wasn't very familiar with Godot syntax when I wrote that regular expression. I had to look up multi-line variables, and was not aware at the time that a dictionary with multiple values could be declared on a single line, and I couldn't even find an example of a static multi-dimensional array/dictionary and its declaration.
Regular expressions are... difficult to get right.
Having said that,
what is a regex tester and where can I find one?
Haha yeah... I tried to tweak the regex to get it working right, but bit burned out on coding from work to finish. I typically use a site like www.regex101.com so I can visually see how it's matching to a set of text. Can then stick in a variety of test cases and see how it responds. I was able to tweak it to accept:
var blah = {
<tab indented text>
}
But the solution wouldn't have worked for single lines. Likely could have made it work with some more groupings and or operators. I used that site earlier to figure out why some of my code wasn't working, as in my own mod,it also fails on:
var randomportraits = load(globals.modfolder + "/randomportraits/randomportraits.gd").new()
Because it only matches on
var randomportraits = load(globals.modfolder
and inserts that into the file, breaking the game. Thus, i did var blah = null, and then conditionally load it first time i need it.