Referencing variables with children inside a string?

I'm trying to create a dynamic description of the player based on the layering of different strings and such. But I'm having a problem where when I reference the variables that contain the information I'm trying to put in a given sentence (with \v[x]) it just displays [x] instead of what I put inside the variable.
So as a simple example

Inside a "check appearance" event, I have a variable (let's say v[1]) containing a sentence that I'd like to display to the player. So inside the event I have it display the message "\v[1]"

I have another event to set v[1] to something like "My eyes are \v[2]".
And finally, an event to set v[2] to the color.

So it sets v[2] to blue, uses that to change v[1] to "My eyes are blue", and uses v[1] in a message event to display the whole thing.

Problem is, it'll output "My eyes are [2]", instead of what I'd like.

I realize there's probably less roundabout ways to do what I'm trying to do, but I'm trying to make a rather deep system of nouns and adjectives, and placing them in dynamic phrases that change based on a player's status.
So I could display a simple variable that contains all the information in a given moment.
As a more elaborate example
Let's have a message event that contains the text "\v[1] \v[2]"
v[1] = "My \v[10] is \v[11]"
v[2] = "I'm \v[12] and \v[13]"

So I could put a status event that displays a message containing v[1] and v[2], and it could be anything like
"My arm/leg/foot is broken/bleeding/fine"
"I'm healthy/hungry/starving and ready/tired/dying"

I've got all of that working just fine if I reference the variables themselves, but it's when I put those variables into another and try to display the parent variable containing the children, it borks up and just shows the ID of the variable.
I've checked in a debug menu, and the nouns/descriptors are being set just fine, but the display text isn't.

Sorry if this was confusing! I've attached an image that'll hopefully make sense of it. I've got lines showing what's referenced where.
Hopefully it's something simple I'm overlooking.
Hi there!

Maybe, you can try use the script call, instead of the text.

So, instead of
"My eyes are \v[2]"

You would put(on the script field):
"My eyes are " + $gameVariables.value(2)

Replace 2 with the variable Id.
And you must use quotes.

Or

"My eyes are \x1bv[Id]"
Insert the \x1b before the esscape code.
Hi there!

Maybe, you can try use the script call, instead of the text.

So, instead of
"My eyes are \v[2]"

You would put(on the script field):
"My eyes are " + $gameVariables.value(2)

Replace 2 with the variable Id.
And you must use quotes.

Or

"My eyes are \x1bv[Id]"
Insert the \x1b before the esscape code.
I knew it was something simple!
The first suggestion of using the $gameVariables worked to get the variable to show. I had attempted to use that before coming here to ask, but I was putting the $gameVariables inside the quotations.

But yeah, that works, but it seems like it'd be hard to inject that into the middle of a sentence.

Gave the \x1bv[Id] a go and it worked perfectly, and fit snugly into a sentence. It worked inside the quoted string just fine. Not sure what you meant with "before the escape code" though.

What exactly is the \x1bv[Id] thing? Like for \v[Id] it's just short for "Variable [Id]", but what's the other thing? Why does it work but \v[Id] doesn't?

Thanks so much for the help by the way!
I can't test it right now.

Try double BackSlash:
Code:
\\

The same goes for showing Slash in a text:
Code:
\/

Quotes:
Code:
\"

If it doesn't work, it is because the text itself is actually a variable, as if it were a dynamic number.

Good luck
Gave the \x1bv[Id] a go and it worked perfectly, and fit snugly into a sentence. It worked inside the quoted string just fine. Not sure what you meant with "before the escape code" though.

What exactly is the \x1bv[Id] thing? Like for \v[Id] it's just short for "Variable [Id]", but what's the other thing? Why does it work but \v[Id] doesn't?
Nice, it worked!

I mean, there are several escape codes in RPG Maker. One of them is \v[id].
Another escape code is \c[n], etc...
So, if you ever want to use some of these escape codes again, in this kind of situation you are in,
you put the "x1b" between the slash "\" and the code:

\x1bv[id]
\x1bc[n]

etc... 🙂
\x1b is JavaScript escape notation for the ESC character. It's \x1b because ESC has ASCII code 27, which is 1B in hexadecimal.

RMMV converts all single backslashes in the message text into this character before parsing its text codes (e.g. \v[12] gets converted to \x1bv[12]). That's why you need to use \x1b instead of \ if you want to use a text code inside a variable like this.

Original thread: https://forums.rpgmakerweb.com/threads/referencing-variables-with-children-inside-a-string.137034/