Forum Discussion
MR_TURBODRIVER
7 years agoSeasoned Veteran
Hey!
When you want to display any text in the game, that text has to be sent to the client. The client is the C++ application running the game and rendering anything visual, like text.
In the Python code, you construct a LocalizedString, that contains the string information and tokens. The "{0.String}", "{M0.his}{F0.her}" and so on are tokens. You fill these tokens by either giving it another String, an ID to a String, or some kind of instance, like a SimInfo instance.
By including a SimInfo instance, something like "{M0.He}{F0.She}" can be replaced with the appropriate information. That information is constructed in functions called "populate_localization_token", you can find one in the "SimInfoNameData" class that sends the data you are speaking of.
But this is where I need to tell you, what you're trying to do, is most likely impossible with the modding capabilities we have. There is a set of pre-existing LocalizedStringToken types (Token Constructors), which construct the information that is being sent to the client. There is no way you can add your own constructor, and even if you would force it, the client wouldn't recognize it and possibly just crash.
That's pretty much it. If data has to be sent to the client, that's it, you can't go any further than that without hacking the client itself, which if you would do, it would be illegal to share it.
If this is for your limited use, try using the "{0.String}" tokens and just have separate strings that replace these depending on the context. but this is if you mainly make mods in Python. Extending the use of this for any purpose wouldn't really work.
When you want to display any text in the game, that text has to be sent to the client. The client is the C++ application running the game and rendering anything visual, like text.
In the Python code, you construct a LocalizedString, that contains the string information and tokens. The "{0.String}", "{M0.his}{F0.her}" and so on are tokens. You fill these tokens by either giving it another String, an ID to a String, or some kind of instance, like a SimInfo instance.
By including a SimInfo instance, something like "{M0.He}{F0.She}" can be replaced with the appropriate information. That information is constructed in functions called "populate_localization_token", you can find one in the "SimInfoNameData" class that sends the data you are speaking of.
But this is where I need to tell you, what you're trying to do, is most likely impossible with the modding capabilities we have. There is a set of pre-existing LocalizedStringToken types (Token Constructors), which construct the information that is being sent to the client. There is no way you can add your own constructor, and even if you would force it, the client wouldn't recognize it and possibly just crash.
That's pretty much it. If data has to be sent to the client, that's it, you can't go any further than that without hacking the client itself, which if you would do, it would be illegal to share it.
If this is for your limited use, try using the "{0.String}" tokens and just have separate strings that replace these depending on the context. but this is if you mainly make mods in Python. Extending the use of this for any purpose wouldn't really work.
About The Sims 4 Mods & Custom Content
Find expert tips, troubleshooting help, tutorials for mods and custom content, and The Sims 4 patch files in our forum.15,684 PostsLatest Activity: 2 hours ago
Community Highlights
Recent Discussions
- 10 hours ago