Script to find text box overruns.

I'm trying to do something nice for my favorite RPGMaker content creator SierraLee.

Her magnum opus "The Last Sovereign" is a wordy game, and every time she posts an update about half the bugs we find are instances where a string fed into an event pages' "@>Text:" command generates a message box that exceeds the height of the display window and causes it to scroll. It's difficult to prevent these because RPGMaker VX Ace's text preview is not exactly WYSIWYG. Presumably Enterbrain thought this would be unnecessary because Kanji (or whatever, my knowledge of Japanese typography is very thin on the ground) is a fixed width script?

Looking at Shaz's nifty Text Extractor script, and poking around looking for a place in the game project files outside of code where the font and character size used in game is set (there is none, I think), what occurs to me is that it MIGHT be possible to programmatically determine how many lines of a RPGMaker a given string will display in an RPGMaker textbox, and then export the event info of any event or common event that exceeds a fixed number of lines. 4 for standard dialogue, ~16 for the longer fullscreen texts I think.

The tricky part would be coming up with a function that gets the number of RPGMaker lines for a given string and a given font characteristic, and I have no idea where to begin doing that. Once such a function was created though, getting a script to list event pages with overruns would be a fairly straightforward bit code welding into Shaz's already extant Text Extractor script.

Is this even possible, assuming a constant font?
How are you getting the text into the game? Doesn't Ace have a "preview" for text boxes so you can see as you're entering text, how it's going to look in-game?

There is a default text font and size that will be used for message boxes, unless you have a script that allows you to override them. What you are suggesting is certainly possible, but it depends on where the text is coming from, any message-box altering scripts you might have, and what escape codes you might use in messages.
How are you getting the text into the game? Doesn't Ace have a "preview" for text boxes so you can see as you're entering text, how it's going to look in-game?

For myself, and I presume also for SierraLee, clicking the Preview button on the UI for editing text boxes in RPG Maker VX Ace displays the text on a single line without any wrapping, which is not the way it is displayed during playtesting.

Here's a set of examples, the same text in three different UI instances as I see it:

In the event page interface.
ChattyGuard.jpg


In the preview window"
ChattyGuardPreview.jpg


And as it displays ingame:

ChattyGuardIngame.jpg


I'm using the version of RPG Maker VX Ace that is available on Steam.

I can't speak to what the font characteristics in the scripts might be, but as for the special characters that get evaluated in the text box strings themselves, I'd be inclined to ignore and them and accept a relatively high rate of false positives in the line count text, because it's (comparatively) easy to check each instance in playtesting for whether the overrun really occurs. Of course, many of these escaped character codes will be variables and thus potentially false negatives...
Text is not meant to be entered on a single line. If you are doing that and still getting line breaks when you play, that means you are using a script that alters the message box behaviour. Whatever you get written to do what you want, will need to do the same thing as that script is doing, as far as deciding where to put line breaks.

If it's done well, it will process the escape codes and allow for the appropriate length of the variables.
Text is not meant to be entered on a single line. If you are doing that and still getting line breaks when you play, that means you are using a script that alters the message box behaviour. Whatever you get written to do what you want, will need to do the same thing as that script is doing, as far as deciding where to put line breaks.

If it's done well, it will process the escape codes and allow for the appropriate length of the variables.
Interesting... OK, thank you.
Would this help? https://forums.rpgmakerweb.com/inde...d-evaluated-control-codes-for-database.39811/

It has automatic word wrap and means your friend can keep the text contained in text files instead of having to edit in VX Ace.
Would this help? https://forums.rpgmakerweb.com/inde...d-evaluated-control-codes-for-database.39811/

It has automatic word wrap and means your friend can keep the text contained in text files instead of having to edit in VX Ace.

Yes with a "but". The but being that it would probably necessitate recoding all previous events to work with your dialogue engine for consistency. I'd also rather not compel her to change her workflow more than is needed.

Shaz has basically told me what needs to happen, SierraLee's already using some script that alters the behavior of dialogue, it's just a matter of my figuring out which of the many scripts included in her game code, figuring out how it handles dialogue rendering and proceed with my orignial plan from there.
I could do the word wrapping part as a standalone script if all else fails, but sounds like you've got it sorted. At least you know about an alternative for future projects, though! 😀

Original thread: https://forums.rpgmakerweb.com/threads/script-to-find-text-box-overruns.90864/