Script call to show variable?

I am currently using script calls to make certain message windows in my game, normall a new item.
But the usual \v[] doesn't seem to work while doing a script call.
Can anyone help me?

Code:
$gameMessage.setPositionType(1);
$gameMessage.setBackground(1);
$gameMessage.add("You got \V[19] Ultra Ether's!.");

I am trying to have that just display the amount according to the stored variable.

Thanks in advance!
Code:
$gameMessage.add("You got " + $gameVariables.value(19) + " Ultra Ether's!");
@Skunk in your case the \V should work, because it is a string added for a regular show text message.
If you have problems displaying that, it is most likely because of something outside the snippet you gave, and that means there is a good chance Naveed's solution won't work either (depends on the exact contaxt on where that code is used).

If you still have problems, you need to tell and show us the context where you're using that code.
The context is, im catching fireflies, and counting them with a variable.
When I trade in the fireflies it awards me that amount of what ever item.
So I was using this script call in a message box to make this kind of message appear different than normal dialogue boxes.

@Naveed thanks a lot for that, that worked perfectly.
I wonder why those aren't easier to find lol
cheers folks!

@Andar this is a closed case <3
That's actually normal behaviour.
In javascript when using strings "\" is a special character used to do other things, like specifying a new line using "\n".
Thus, if you want \ to remain for RPGMaker to interpret as a message code you must tell javascript to use "\" as is and not as a special character. It's as simple as using "\\" instead of "\".
For reference: strings.

Your code should look like this:
Code:
$gameMessage.setPositionType(1);
$gameMessage.setBackground(1);
$gameMessage.add("You got \\V[19] Ultra Ether's!.");

Or you can of course use concatenation, but it's much less practical.
For a list of equivalent script call of event commands, look here.
So I was using this script call in a message box to make this kind of message appear different than normal dialogue boxes.
And where did you get the idea that the script command was needed for that?
The command you used is the script function that is called by the show text command, and everything you did there could have been more easily set in the show text event command.
"setPositionType" is the droplist for windows position in show text, "setBackground" is the Background dropdown list in the show text command.
The only difference is that the droplists contain the descriptions for each index while in the script equivalent you'll have to guess what 0, 1, 2 stand for.
this is a closed case <3
If you want to close a topic, please report it to be closed, not everytime a moderator reads every topic.
And I'm not yet closing this because you did get additional info on where your mistake was and might comment on that.
Report it when you really want it closed.
Maybe im explaining it wrong lol
I've been learning Java script on code academy, while doing that I was watching alternative ways of doing basic things in rpg maker.
So I wanted to learn how to make message boxes appear differently based on what was happening in the scene.
Just as a test.
box 1.JPG
box2.JPG

But doing the message box the second way and using the normal variable call didnt work..
I hope im explaining this right.
English is not my first language so its tricky for me to explain more complex scenarios.

Original thread: https://forums.rpgmakerweb.com/threads/script-call-to-show-variable.82040/