Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.
This library simplifies the usage of GSText. With this library you do not need to store the instance of GSText in order to set parameters. Using variable argument count it calls GSText.AddParam internally.
Strings have been put in the GSText class to prevent any possible clashes with existing names (unlikely as they are if your strings start with STR_, but that is not a requirement).
Idea: force STR_ as prefix for all strings and put them in the global namespace.
That would work, but it wouldn't scale well if you have hundreds of strings in your language file.
Yexo wrote:Idea: force STR_ as prefix for all strings and put them in the global namespace.
This could work well and would scale well. Alternatively, is there a way to make everything in the GSText scope within the global scope? point the GSText scope to the mainbody scope of your GameScript maybe?
I think, but I am not sure, you can just list all entries in a class (which are tables). So you should be able to list all members of GSText, match it against STR_, and put it in the global scope
foreach (idx, val in GSText) {} ..
The only thing necessary for the triumph of evil is for good men to do nothing.
If the variable arguments to the constructor were the only addition in your Text-library, it's obsolete since r23651 as GSText now has that feature too. Very nice suggestion!
Yexo wrote:If the variable arguments to the constructor were the only addition in your Text-library, it's obsolete since r23651 as GSText now has that feature too. Very nice suggestion!
Unless I misunderstood Truebrain yesterday, he told me yesterday that it is hard/impossible to implement variable argument count for constructors in the interface between C++ and Squirrel. That's why I did publish this library on bananas. But apparently you guys solved this hard/impossible task in less than 24 hours.
Thus, if anyone wants to write Text instead of GSText they can just do: