Substituting one variable with another if variable does not exist

Apologies for the vague/incorrect title, not sure how to explain it aside from in a post!

I’m trying to make it so that in certain scenes, if MC chooses to have a nickname, they are referred to by that nickname. But if they did not choose a nickname, they are simply referred to by their normal name. I’m sure this is accomplishable with something like *if (nickname = “true”) ${nickname} *elseif ${name} or what have you, but I’m wondering if there’s a neater way to accomplish this. I’m also not sure how that would work putting that code directly in the middle of a paragraph every single time MC’s nickname is used.

Thank you so so much, very much appreciated. So sorry if anything is worded strangely or if this has been answered before. I attempted to scour the forums to no avail. Thank you again!

If the player chooses not to have a nickname, just set the variable nickname to whatever name is. You can still put ${nickname} wherever it would be appropriate, but if the MC doesn’t have one, it will output their full name and the player will never know the difference.

10 Likes

I…cannot believe I never thought of this. Thank you kind stranger for your help and patience! My apologies for clogging up the forum, very very much appreciated.

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.