How can I make two variables related, so setting one sets the other?
Posted: 17 Jun 2022 21:16
I'm working on a tool for creating fantasy world histories in detail (Yes, in batch, it's all I know. It actually works too! Just trying to make it better now.). At present I am stuck trying to find a way to set the right adjective for a race. For example, if a kingdom is populated by dwarves, I want the script to set raceadj to "dwarvern". That way it can generate text along the lines of "Mournhold is a dwarven town..." Now I could just make a TON of text files and have the variable raceadj loaded from racename.txt as needed... But that feels kinda like a bad practice. Especially since I want this to be easily user configurable. Ideally the end user could open one text file and make sure each race had its additive (and plural if possible) listed in the file simply by typing them all in.
Currently, my thought is I could have one text file with each line reading something like "dwarf:dwarvern", and then somehow use a findstr to detect which line the currently loaded race is on, then select the string after the : and make whatever that is get set as the adjective. Unfortunately, I have no clue at all how I would do that. Can anyone here help me out? Also if that's not the best practice for this, please tell me what is, and what I should be using instead. How to use it would also be appreciated.
Currently, my thought is I could have one text file with each line reading something like "dwarf:dwarvern", and then somehow use a findstr to detect which line the currently loaded race is on, then select the string after the : and make whatever that is get set as the adjective. Unfortunately, I have no clue at all how I would do that. Can anyone here help me out? Also if that's not the best practice for this, please tell me what is, and what I should be using instead. How to use it would also be appreciated.