@TURBODRIVER Ahh, I see. That helps a ton, thank you so much for your reply!
HUUGE MONSTER EDIT:
Okay, so I've been thinking a little bit more about this. Obviously, I can't create a new token--got it. So I can't just do, for instance, "{0.Option1}{0.Option2}{0.Option3} when there's not a token for option three. And you mentioned overriding strings. What about something like this? (And this may be the exact kind of thing you meant with using the {0.String} method in which case sorry for my brain malfunctioning.)
So let's assume that in normal gameplay, there is an interaction "Tell Secret" that children can do with friends. And that when they do this interaction, a message is displayed on the player's wall (like in Sims 3). Sometimes, this message says:
"My favorite color is {#.red}{#.blue}."
And the game already has a token for this called is_red. The game assigns this token (or doesn't assign it) based on something--RNG, user input, etc. to each sim individually. (I am basing this off of the is_female token that seems to work by having it assigned to female sims, and if they don't have this token, the message, I assume, uses {M0.He}.)
Alright, and then let's say I decide I want more options for my sims' favorite color. So I decide to make a mod to add some. I want to add the colors purple, green, and yellow as options. Okay, so simply adding {#.green}{#.purple}{#yellow} won't work. And I can't touch the string once it's passed off to the client (well, I can't, both technically and as you've pointed out, legally). So I'm going to try and edit the message while it's being built, and before it gets passed to the client.
My hypothetical mod has two main parts:
1. A package file containing new interaction(s?) and any files needed to make it run (pie menu cats, etc). It also contains three new traits and a string table with three new strings.
The new traits are favoriteColor_isGreen, favoriteColor_isPurple, and favoriteColor_isYellow.
The strings in the string table are "My favorite color is green.", "My favorite color is purple.", and "My favorite color is yellow."
2. A python script component.
And it works like this:
1. The mod uses python scripting (or scumbumbo's xml injecting for interactions which I just discovered and sounds really cool!!) to inject its new interaction into every sim object in the game. When the player clicks on any sim in the game, they can click on "Change favorite color..." which prompts the submenus of "Green", "Purple", and "Yellow".
When a player chooses an option, the corresponding trait is assigned to the sim. So, if they click "Green," the interaction now assigns the trait favoriteColor_isGreen to the sim. The trait itself doesn't really do anything, and it is hidden so the player can't see it. If traits wouldn't work for that, maybe a buff? Anyway...
2. Back in the mod's scripting component, there is another injection. This time, it’s injecting new code into some of the game's functions for handling tokens and strings. For messages where the is_red token comes into play, the mod will get the sim ID used by the is_red token originally. Then, it will use this ID to get the relevant sim’s traits. If the sim has one of my new hidden traits assigned to them, the mod will alter the message being built according. Something loosely structured like:
if favoriteColor_isGreen in (#tuple of our sim's traits):
msg = “My favorite color is green.” #or the hash key for this string or however that works.
return msg
if favoriteColor_isPurple in (#tuple):
msg = “My favorite color is purple.”
return msg
If favoriteColor_isYellow in (#tuple):
msg = “My favorite color is yellow.”
return msg
And then msg gets sent to the client after that.
Does something like this seem doable? I wrote this on break at work so I may have some of my assumptions on game mechanics wrong (can’t play around with files right now) and it's a bit vague, I know. If you made it this far, thx for reading.
TL;DR:
Make interaction. Interaction assigns new trait to sim based on user choice.
Script adds code to function(s) to check traits of sim whenever a specific preexisting token is used, using sim ID passed to this token(?).
If sim has trait assigned by interaction, overwrite current msg with a new, non-tokenized message (or use {0.String}) and pass to client.
Profit????