RMMV Saving current letter from Display Text being drawn on screen as a string variable

Doechano

Murderous Gentleman
Member
Joined
Sep 22, 2019
Messages
20
Reaction score
4
First Language
English
Primarily Uses
RMMV
If a Display Text is comprised of the message "This is a test" how would I save the current letter being drawn on screen into a string variable? For example, I would want the "s" to be saved into a string variable if it were at "This is" in the message. Every letter would have to be saved as the text is being drawn, not afterwards or before. The saved string needs to save each individual letter, symbol, or number as it's being drawn and then going on to the next until the message is done.
 

Dev_With_Coffee

Regular
Regular
Joined
Jul 20, 2020
Messages
1,045
Reaction score
543
First Language
PT-BR
Primarily Uses
RM2k3
As it is not possible to know the purpose of your system, so I made it in a way that you know where to insert some extra code if you need to:
JavaScript:
/*:
 * @plugindesc More Info on MainMenu
 * @author Nobody
 *
 * @help Return Char per Char on Message in realtime!
 *
 * Define which letter you want to start the function with,
 * call the Script event command:
 *   charCheck = "C"
 * Replace the String "C" with the letter you intend to use.
 * The system is case sensitive.
 *
 * To check how many characters it found:
 *   charFound.length
 *
 * Turn OFF searchChars function and clear:
 * resetChars();
 *
 */

var charFound=[];
var charCheck;

function searchChars(currentChar){
    if(currentChar == charCheck){
        charFound.push(currentChar);
        /*Inser your script here:*/
      
        /*---------- End --------*/
    }
}

function resetChars(){
    charFound=[];
    charCheck = undefined;
}

(function() {
    Window_Base.prototype.processNormalCharacter = function(textState) {
        searchChars(textState.text[textState.index]);
        var c = textState.text[textState.index++];
        var w = this.textWidth(c);
        this.contents.drawText(c, textState.x, textState.y, w * 2, textState.height);
        textState.x += w;
    }
})();

Example of use in Rpg Maker:
Code:
◆Script:charCheck = "s"
◆Text:None, Window, Bottom
:    :Hello \p[1] and \n[2]!
:    :Variable 17 contains the following String:
:    :\v[17]
◆Control Variables:#0001 CountTime = charFound.length
◆Script:resetChars();

Plugin is a workaround, but I hope it helps you.
Sorry for my bad English.
 
Last edited:

Doechano

Murderous Gentleman
Member
Joined
Sep 22, 2019
Messages
20
Reaction score
4
First Language
English
Primarily Uses
RMMV
The system that I'm trying to create is a way to determine which letter should be used to determine the mouth shape for an NPC portrait. So if the complete Display Text is "Hello there" the mouth shape being triggered is the "e" shape, but if the text is currently only at "Hello t" the mouth shape being triggered is the "t" shape.
 

Dev_With_Coffee

Regular
Regular
Joined
Jul 20, 2020
Messages
1,045
Reaction score
543
First Language
PT-BR
Primarily Uses
RM2k3
So I believe this Plugin will solve it, but if there is any difficulty in knowing how to change the Faceset in the dialog message I will be willing to help.
 

Doechano

Murderous Gentleman
Member
Joined
Sep 22, 2019
Messages
20
Reaction score
4
First Language
English
Primarily Uses
RMMV
Is there a way to search for two letters at once with this plugin? Like if I wanted to check if the currentChar is "h" and the previous letter to the current character is "t", which would trigger the "th" mouth shape. The reason I am stumped with this is that I don't know how the plugin could distinguish between a "t" and a "th" without reaching the h, but at that point, it would already trigger the "t" mouth shape. Do you have any ideas?
 

Dev_With_Coffee

Regular
Regular
Joined
Jul 20, 2020
Messages
1,045
Reaction score
543
First Language
PT-BR
Primarily Uses
RM2k3
Is there a way to search for two letters at once with this plugin?
As you said current letter and not syllable:
I save the current letter

The problem is that this would require a ready-made system (API) that would facilitate the work, because in many Western languages, the division of syllables is more by phonetic than by joining a consonant and a vowel.
"TH", for example:
THank's for your time.
I go wiTH the other car.

"N", for example:
I caN not wait.

As it changes to "G", "T", "K", examples:
I'm goinG to worK.
I'll waiT for the bus.
LocK the door.

It's not directly related to your order, but see this Plugin:

So far I haven't found any API or practical method to do this reading, besides British English being written differently from American. The same happens with Latin languages, due to the abbreviations.
 

Doechano

Murderous Gentleman
Member
Joined
Sep 22, 2019
Messages
20
Reaction score
4
First Language
English
Primarily Uses
RMMV
As you said current letter and not syllable:


The problem is that this would require a ready-made system (API) that would facilitate the work, because in many Western languages, the division of syllables is more by phonetic than by joining a consonant and a vowel.
"TH", for example:
THank's for your time.
I go wiTH the other car.

"N", for example:
I caN not wait.

As it changes to "G", "T", "K", examples:
I'm goinG to worK.
I'll waiT for the bus.
LocK the door.

It's not directly related to your order, but see this Plugin:

So far I haven't found any API or practical method to do this reading, besides British English being written differently from American. The same happens with Latin languages, due to the abbreviations.
Hey,

Thank you for all of your help with the letter searching plugin. I've made a lot of progress on my IPA aspect of my game, but I've hit another road block that I hope you or someone could help me with. Another user suggested I use a Simultaneous Message plugin, which only somewhat works. The only problem now is that this letter saving plugin is evaluating both of the text boxes:

Example:

"ðə kwɪk braʊn fɒks ʤʌmps əʊvə ðə leɪzi dɒg."
(Textbox I do want searched with your plugin)

"The quick brown fox jumps over the lazy dog."
(Textbox I don't want searched with your plugin)

Both of these Show Texts are drawn at the same time with the Simultaneous Message plugin.

I took a look at the Simultaneous Message plugin but I don't have a good enough understanding of how to edit your plugin in order to have it work with it. I'm trying to find a way for your plugin to only search for letters in one of the textboxes, most specifically the top most one in the example above. I know that you aren't the author of the Simultaneous Message plugin, but it would be a huge help if you could help alter your plugin in order for it to work with it or point me in the right direction with what to change.

Thank you.
 

Dev_With_Coffee

Regular
Regular
Joined
Jul 20, 2020
Messages
1,045
Reaction score
543
First Language
PT-BR
Primarily Uses
RM2k3
You don't need to make two dialogs, it's best to make just one and the text that will be used with the Plugin can be inserted directly into a variable in Rpg Maker using the Script field using quotes to turn a string.

But in this case I would redo the Plugin to directly receive the content of the variable without passing it on to the text box.

But if you intend to transform this text into audio with some existing API it would be more practical to create a more functional plugin.
 

Doechano

Murderous Gentleman
Member
Joined
Sep 22, 2019
Messages
20
Reaction score
4
First Language
English
Primarily Uses
RMMV
You don't need to make two dialogs, it's best to make just one and the text that will be used with the Plugin can be inserted directly into a variable in Rpg Maker using the Script field using quotes to turn a string.

But in this case I would redo the Plugin to directly receive the content of the variable without passing it on to the text box.

But if you intend to transform this text into audio with some existing API it would be more practical to create a more functional plugin.
I don't really understand how it could be done without two text boxes running at once. If I pass a variable through the textbox it will still draw (or in this case evaluate) the variable before or after and not during, right?
 
Last edited:

Shaz

Keeper of the Nuts
Global Mod
Joined
Mar 2, 2012
Messages
46,153
Reaction score
16,958
First Language
English
Primarily Uses
RMMV

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

 

Dev_With_Coffee

Regular
Regular
Joined
Jul 20, 2020
Messages
1,045
Reaction score
543
First Language
PT-BR
Primarily Uses
RM2k3
If the idea is to never use this text on the screen:
"ðə kwɪk braʊn fɒks ʤʌmps əʊvə ðə leɪzi dɒg."
(Textbox I do want searched with your plugin)
Then why pass it to the message box?

Both texts have different phonetics and tenses, due to the necessary adaptations for interpretation.

With the same processNormalCharacter function I can read the variable with the text that will not appear, but without executing the drawText.

The fact is that I really believe that this plugin doesn't do what you really need, that from what you said it will be a system that will "convert" text to audio. Or wasn't it?
 

Doechano

Murderous Gentleman
Member
Joined
Sep 22, 2019
Messages
20
Reaction score
4
First Language
English
Primarily Uses
RMMV
If the idea is to never use this text on the screen:

Then why pass it to the message box?

Both texts have different phonetics and tenses, due to the necessary adaptations for interpretation.

With the same processNormalCharacter function I can read the variable with the text that will not appear, but without executing the drawText.

The fact is that I really believe that this plugin doesn't do what you really need, that from what you said it will be a system that will "convert" text to audio. Or wasn't it?
This system does do exactly what I need. I initially thought that it would be best to create another plugin that was complex, being able to do the translations and phonetic conversions, but I realized that there wasn't really any need for it. Thank you for explaining the differences between the two features of the plugin.
 

Dev_With_Coffee

Regular
Regular
Joined
Jul 20, 2020
Messages
1,045
Reaction score
543
First Language
PT-BR
Primarily Uses
RM2k3
What great news, so I ask you to wait, I'm a little short on time. I will make the necessary changes so that the system can read two texts at the same time, but only present the main one.
 

Doechano

Murderous Gentleman
Member
Joined
Sep 22, 2019
Messages
20
Reaction score
4
First Language
English
Primarily Uses
RMMV
Thank you for all the help on this project. I still need to learn how to program my own plugins but in the meantime you have been a huge help.
 

Latest Threads

Latest Posts

Latest Profile Posts

Obvious One.gif
Meet my new mascot. He's also a mimic! No prizes for guessing this guy's name, though, haha
BANNER2.png
I put out a new pack and I swear, I did not realize how it looks like the ones on the right are scared/nervous of the one on the left until way after o_O I just wanted to showcase some of them randomly xD
Well, if anyone has a funny, simple, easy RM game they want me to playtest/review, I would love it.
Someone close to me straight up told me they didn't think my relationship with my girlfriend would last. No lead up, very bluntly. Like it's obvious or something. Trying not to let it get to my head, but it's hard.
The distraction would be a life saver.
QuestMZPlugin.png

My first foray into a plugin that I plan to release. Working on something for those who want to set up a Dragon Quest style battle HUD with minimal fuss. Includes the ability to round the battleback corners to fit your windowskin and, of course, front-view animations.

QuestMZPLugin_CustomWindow.png
Do you ever wonder where the heck everyone is going at 9:00 at night? Like... guys, go home! Get some sleep! Me? Oh, I'm out to get pizza 'cause I decided supper time was 9:30 tonight.

Forum statistics

Threads
134,756
Messages
1,250,345
Members
177,516
Latest member
uglychristmassweaterbio
Top