How to store an icon to a string variable?

Pipilson

Villager
Member
Joined
Jul 8, 2019
Messages
14
Reaction score
4
First Language
Portuguese
Primarily Uses
RMMV
Is it possible for a string variable to store an icon just like messages does? I tried writing \i[n]"string" but that just crashes the game, and "\i[n]string" but obviously that meant the game would literally just print \i[n]string. Is this possible somehow? Is there a puglin for this?
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
965
Reaction score
708
First Language
English
Primarily Uses
RMMV
@Pipilson Sure, just set the variable to :

Code:
"\x1bI[n]"
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
965
Reaction score
708
First Language
English
Primarily Uses
RMMV
@Pipilson No problem! Basically '\x1b' is a special character that will replace the '\' during the message conversion process. By the time the contents of the variable is inserted into the message, the stored tag is beyond the point where it could be prepared to be displayed as anything other than simple text. But if we do the conversion manually with '\x1b', the tag will have a chance to be displayed properly.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,568
Reaction score
12,073
First Language
English
Primarily Uses
RMMV
Note, that will only work if whatever you're doing with that variable is set up to parse escape codes. If you have a plugin for a quest journal, and it just displays text, it might not even convert variables at all, much less parse what's in them and display icons instead of text.
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
2,390
Reaction score
3,684
First Language
English
Primarily Uses
RMMV
Basically what Shaz said. The reason why the message window displays an icon when writing what you wrote is because it's using a method to interpret the content of the string. It's not like strings automatically convert that code to an icon.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

I made an RPG Discord bot and it FINALLY got accepted on top.gg and is already trending!! <3
1st of March 2014 I joined and it has been a great experience for 6 whole years. The only thing I can say is a huge thank you to ALL members of this forum.
Hope everyone is enjoying their weekend!!!
Now irinea just blocked me in discord
Just finished making a character selector at the beginning of the game that allows the player to pick gender and skin tone. I couldn't be more pleased.

Forum statistics

Threads
94,615
Messages
922,405
Members
124,502
Latest member
DerKruste
Top