Reference external files inside of scripts
bookerthegeek opened this issue ยท 1 comments
Hello...
good sirs and madams. I have an interesting thought. But first, a little background
With the plethora of Thaumcraft mods, their comes a time when it becomes necessary to do a little cleanup of the thaumcraft research tabs. Removing recipes and pages, re-adding recipes and all the new pages. More importantly, add descriptions that make sense to all those re-added recipes.
Now here is where we com into an issue, file size and the amount of text inside the scripts for the localization of researches. I propose a solution to this. The ability to reference a text file from, wait for it... inside the script!
Yes, you heard me right! Pull the text for the localization from an external location of the script itself, and insert it during the loading of the scripts into the script itself!
"What do you mean?" you might be asking. Well, let me show you my idea!
Examples
Inside of the scripts for Thaumcraft we have this little tidbit.
game.setLocalization("en_US", "tc.research_page.TCWAND_wood1", "Insert description Here");
The sad part is that the description can span multiple pages, and when you start having one script for each page... You can see where this is going. THOUSANDS of lines of code. This leads to very easily making mistakes and/or just plain missing things.
My solution:
game.setLocalization("en_US", "tc.research_page.TCWAND_wood1", "TCWAND_wood1.txt");
Where the file that is named "TCWAND_wood1.txt" would contain the actual description that is going there.
An example you say? Ok, but only a short one.
game.setLocalization("en_US", "tc.research_page.TCWAND_wood1", "TCWAND_wood1.txt");
with the "TCWAND_wood1.txt" containing:
Here is the description. As short or as long as you like
[b]Maybe it could support formatting [/b]
Would function the same as:
game.setLocalization("en_US", "tc.research_page.TCWAND_wood1", "Here is the description. As short or as long as you like, Maybe it could support formatting.");
So... I hope you like my idea.
Forum Post for reference