Can you use var in a text as pointer to another var?

What I mean is if you can do something like this:
ex. \v[ v[7] ]

While Yanfly's extended messages allows to display item icons and text, it only works when you input a specific number (like \ii[7]), however I would like a message to display a previously selected item.

I already know the item's ID and Name (using a script) can be stored in variables and those can be used to display the variable values in the text... And while for ex. v[7] can store selected item's ID and v[8] selected item's NAME... I still can't figure out how to place items icon in there. Hence the question wether you can do something that would work like \ii[v[7]] OR perhaps is it possible to store an icon in a variable?

Is it possible to use a text code (or some kind of formula) within a text code? Scripts are fine. - it would be very useful. 🙂
You could overwrite the function that processes escape characters to be able to handle that syntax and get the value of a variable to figure out which variable to show the value of, yes.
SOLVED IT! 😀

Actually I dug in the default jscript and in the plugin's script and those things are usually handled by the "replace" and "parseInt" String function. And there is no smart way to take over the "parseInt" except to already feed it pre-prepped data. And THAT gave me an idea to use the $gameMessage functions to prepare the String passed onto the game script.

So the solution is:
$gameMessage.add("Item \\ii[" + $gameVariables.value(*pointer variable ID*) + "] can't be used here.")

By displaying the message through scripts and feeding the game interpreter an alredy prepared string with the value of a variable inserted!
I tried that in tandem with Yanfly's Extended Message plugins and it works! You just have to add the message configure functions before that, you know the $gameMessage [icon, index], background and positionType. 🙂 Instead of $gameVariables you can just input some other game data and use it as a formula after placing it in ( ).

The text code used here is from the plugin but you can use anything instead of \\ii, like \\v or \\p etc.

You just have to remember to use two "\". Since your messages go through java script interpretation before baing passed to the game interpreter and "\\" means to pass down a "\". 🙂

Oh and sadly text codes stored inside $gameVariables don't work, so you can't store "\n[2] is down" in a variable. but you can store it in a script variable to use it later within this script.

Man this is so awesome and simple I'm stumped baffled I didn't find that anywhere...
I scoured the internet and everyone says the same thing... To write yourself a plugin... Or write own functons to text interpretation. But this solution is much more neat and simple!
I don't want to sound cheeky but you might want to sticky that solution example somwhere. ;P Kind of obvious in the hind sight. xD

Thank you Trihan for nudging me in the right direction. 🙂
I did wonder if that would work. Handy to see it does, good find!

Original thread: https://forums.rpgmakerweb.com/threads/can-you-use-var-in-a-text-as-pointer-to-another-var.75720/