Escape codes in Scenes

So, I don't see anyone asking for this.

I don't remember who did this in VX Ace, I think it was Victor and someone else had it too, a script that allowed to use the escape codes used in messages (specifically looking for Color and Icons) in the rest of the scenes, like the menu.

So if I wanted to show, in the menu status, the character class with the class "Icon" 65 before the name of the class, I would write something like:

/i[65]NameOfTheClass. Instead of going to the base code and modify lines that can break the whole game if used wrong.

Is anyone doing this? Or is it already done and I couldn't find it?
The problem is this: escape codes are processed when you use the drawTextEx command, most of the game uses drawText except for a few certain things.

You just have to sift through and make those changes.

I could be wrong though.
If it's only a replace, like \v[...], it's easy.


For more complex things (changing color, drawing icons), you would need to:


- Draw all text up to this point.


- Get the length of the text printed so far.


- Change color / draw icon


- Draw text from the offset, until the next match happens.
Yep, that's why I was looking for something like this.

Rearranging things in the Scenes is really easy but when you want to draw icons or, more specifically, change color of some texts, I just can't understand how it works. Guess I'll have to become really good at that.

I wanted the actor class in the menu and status to have a specific color and icon depending on the class, maybe I can manage to draw an icon, but colors seem to be a bit harder. Tho, probably nothing a few hours of work can't solve ;D
It's just a matter of making the drawText function call the drawTextEx function rather than writing to the bitmap itself. The difficult comes in the fact that drawTextEx requires more parameters (I think) so you have to work out where it's going to start and end, and allow for the possibility that it will be centered or right justified.


If you can link to an Ace script that does it, that'll make it easier for someone to do it in MV.
If you can link to an Ace script that does it, that'll make it easier for someone to do it in MV.
I only know Victor's script, I don't remember if there was another one. And the page to download the script from Victor is gone.

For me, I'll look at plugins that change colors and add icons in scenes and learn from that.

I guess I'll leave this thread here so maybe someone takes the request.
@Shaz: This won't really work, since drawTextEx can't deal with the "align" parameter.
I managed to show actor class with icon and colors using this:

this.drawIcon(ICON, 500, y);this.changeTextColor(this.textColor(COLOR));this.drawText(actor.currentClass().name, 540, y, width);this.resetTextColor();Just saying.

Escape codes in scenes would still be awesome.

The problem is that methods like "changeTextColor"  aren't available in all the windows right? Because if it is, maybe something like this would work: <e_code> The Text </e_code>
I'm pretty sure it wasn't one of victor's scripts - but I know for a fact that modern algebra's global text codes did exactly that:


http://rmrk.net/index.php/topic,44810.0.html
I wrote a version of that for MV too, though it is pretty clumsy since I am still learning javascript. It is here: http://rmrk.net/index.php?topic=50445.0
@Shaz: This won't really work, since drawTextEx can't deal with the "align" parameter.
 
Yes, I know, which is why I said this:

you have to work out where it's going to start and end, and allow for the possibility that it will be centered or right justified
I wrote a version of that for MV too, though it is pretty clumsy since I am still learning javascript. It is here: http://rmrk.net/index.php?topic=50445.0
Oh this is nice! Thanks for linking to it.

Tho, I already made what I wanted with some conditions and variables in the Window_Base to detect class name and actor level, so it colors and shows the icon I want.

You think using your plugin with escape codes will lag more than my method for now?
Whether my plugin is faster than your way or not would depend on which function you changed. Neither is likely to generate any lag though.

Original thread: https://forums.rpgmakerweb.com/threads/escape-codes-in-scenes.51059/