$gameMessage.add() and YEP Message Core text codes

How do you use these together? I can understand how to use them individually, but is there a way to combine them, or are they used in separate scenarios all together?
Code:
$gameMessage.addText("\\af[1]\\n<Harold>Hello world!")

Note that:
  1. you'll want to use addText(), not add() because addText() is what handles all the special yanfly codes, including word wrap.
  2. backslashes need to be used twice because they're normally used by strings for escape codes
Edit: Oh wait, maybe add does work, but the double-backslash is key when doing it at code level. I vaguely recall running into issues with add instead of addText though at one point, so there's that.

I've moved this thread to Plugin Support. Thank you.

Code:
$gameMessage.addText("\\af[1]\\n<Harold>Hello world!")

Note that:
  1. you'll want to use addText(), not add() because addText() is what handles all the special yanfly codes, including word wrap.
  2. backslashes need to be used twice because they're normally used by strings for escape codes
Edit: Oh wait, maybe add does work, but the double-backslash is key when doing it at code level. I vaguely recall running into issues with add instead of addText though at one point, so there's that.

Can you apply text codes to, let's say, target.name()? Or do I have to save it first in a variable as text at runtime then apply text codes on it?


Moved to: Plugin Support
Thank you.
Yeah.

Code:
$gameMessage.addText("\\n<" + $gameParty.members()[0].name() + ">Hello world!")

To elaborate, strings in javascript work like this:

"Literal text goes in quotes"

variables do not go in quotes

+ is for concatenation (connecting things together)

So:

"Welcome home, " + target.name() + "."

Renders as

"Welcome home, Harold."
Yeah.

Code:
$gameMessage.addText("\\n<" + $gameParty.members()[0].name() + ">Hello world!")

To elaborate, strings in javascript work like this:

"Literal text goes in quotes"

variables do not go in quotes

+ is for concatenation (connecting things together)

So:

"Welcome home, " + target.name() + "."

Renders as

"Welcome home, Harold."
Yeah I figured I had to know a bit more of js syntax for this. Thank you very much!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/gamemessage-add-and-yep-message-core-text-codes.120514/