First, the game's error logs are nearly useless most of the time, which is why there is a Debug mod (https://itch.io/t/1137280/debugmod-v10d) to provide error messages, file names, and line numbers for error messages in real time (though the terminal window) with the bonus of somewhat improving the messages in the log file. The Debug mod is not a true mod and doesn't use the mod system so there is no to worry about erasing all the changes to your files by using the mod system.
Second, I recommend finding an online interactive tutorial for Python as GDScript is heavily based on that mainstream language, which will have better tutorials and explanations for stuff like scope. A few hours with a tutorial can easily save you days of fumbling around on your own.
As to what your problem is specifically, I don't know. You didn't include any information or description of outcomes that would clearly identify one. While much of your code is bulky and inefficient, I didn't see anything that would necessarily cause errors. This leaves three issues which would be possible causes of errors that I cannot verify. The first and biggest one is that at the end of your post you are replacing "enby" in a person's sex with "female", but there's no indication that you have replaced "futanari" with "enby" in a person's sex variable, which means that "futanari" slaves are searching for data entries that may not exist unless you added them. The second is whitespace. I am unable to check if spaces were used instead of tabs in your code since the forums convert everything to spaces. The third is the validity of the references to the original variable for names "globals.racefile.names". It's not entirely clear what you have done or not done to the original lists of names. If those lists still exist in the original variables and entry names, then those should still be functioning and not a problem.
Viewing post in Modding help
That actually makes me feel a bit better -- that it's not an obvious problem with my code, but something that requires more digging. And thanks for reminding me about the debug thing; it's been so long since I modded that I'd forgotten all about it.
White space has never been a problem for me; I've been coding since well before the turn of the century and that sort of feels like native punctuation to me (like the way people who are fluent in English and skilled in the use of language will typically know where to put a period or how to break things into appropriate paragraphs). My brain's well specced for it, and actually finds it a bit hard to conceptualize the people who don't notice the "tiers" there. (Also the spaces vs. tabs thing amuses me because I've recently started working as a proofreader and was just laughing with my friend about how the person whose work I'm editing uses spaces instead of tabs... just like my dad, sigh.)
And I'm relatively certain that I have the futanari/enby thing correct (added in one place, subtracted in another), but I'll double-check that I didn't inadvertently drop it in one spot when trying to troubleshoot the rest of the issues.
I have modified the contents of, but not the structure of, the names list (and the variables leading to it, which apparently go through three layers, sigh); basically I've been trying to mimic existing structure, and it's been frustrating when existing structure can't be easily mimicked. I don't like overhauling existing things, but like branching off to a piece of my own that I have to the side, and letting it do its thing, and then redirecting back to the original code, ideally so that less of it breaks. Or like turning a thing with two parts into a thing with three parts (as I did successfully with the pronouns code some months ago).
So, it sounds like your second piece of advice is key: I need to set aside a bit of time and go through a tutorial, with a focus on getting a grounding in the specific implementation details. The concepts are old hat, but given the number of languages I've studied over the years, it's more than likely I'm "speaking Spanish when I meant to speak Italian" as it were. That, or missing something unique to Godot.
Thanks for giving me a bit of confidence, though -- that my code (even if not efficient) doesn't look broken. (I have mixed feelings about the efficiency thing, because part of my frustration with the existing code is that some of the coding efficiencies have led to implementation opacities, such as "where the hell does it even set the surname? oh right there as part of a section to set all the things in this set, not specifically the surname" -- which is why I couldn't find the word "surname" anywhere useful.)
And in the meantime, I shall encourage myself with the thought that even if my code sucks, at least it isn't made by AI.
Okay, so, I found the part of the code causing the obvious harm (not to say there's not more to find; I'm currently testing a little at a time), and it's the "has" method. Not sure if an issue with the distinction between Godot and GDScript, or between different versions of the engine or something, but on the bit I'm testing the error stops if I swap out a tiny piece of code. ...and then I thought I understood the error, but the error comes right back if I correct it. Here are the four versions:
1. if person.race.has("Elf"):
2. if person.race.find("Elf") >= 0:
3. if "Elf" in person.race:
4. if person.race.contains("Elf"):
First version fails (generates empty log), which led me to the second version (as it gets used in the code a lot), which lets the game load without an error. But it feels inelegant, so I looked through the documentation and it says that the third one is identical, so I used that and it ran without error.
However, examining the documentation more closely, I realized that I was using an array operation when I should be using one for a string (so the third version might run without error, but it's not doing what I want it to do, and might still crash later). So I found the "contains" method, which appears to do what I want. However, when I use it in the code, we're right back to zero-content-log crash.
Is the second method really the only one that works?? I need to sort races into pools (Elves and Beastkin specifically), and it sure would be handy to ask the code if it has the little keyword in there, as opposed to "Does it have an Elf? Well, how about a Wood Elf? Well, how about a Dark Elf?" etc. The "where do you find this substring?" method clearly does work, but it feels weird.
Right, I forgot about the difference in engine versions. The game is essentially running on version 3.3 of the Godot engine, whereas the most recent version is 4.7.1, which includes a significant overhaul of the string variable functions. This is the relevant document for the game's string functions: https://docs.godotengine.org/en/3.3/classes/class_string.html. The string functions are still somewhat crude, so you will probably want to use the clunky #2 approach for most things. Alternatively you could use dictionaries to convert string keys into boolean values or integers, though it's really just pushing the bulk and work to somewhere else.
Godot is the game engine. GDScript is simply an abbreviation for Godot Script. Godot can run on other languages than GDScript, such as C#.
Oooh, that's a useful doc; thanks!
Oddly enough, despite it being less efficient than later versions, I do kinda appreciate having a version set in a given form. Far too many things moving faster than my workflow can account for these days, so it's nice to have a thing where I can learn it at my own pace and not have to keep up with changes.