Add text to the Game_Message of the Dialogue Window that persists on second viewings

Status
Not open for further replies.

Anyone

Veteran
Veteran
Joined
Aug 24, 2019
Messages
90
Reaction score
64
First Language
German
Primarily Uses
RMMV
So, I'm working on a way to read the FaceName of the picture in a Show Text event and then add text to the existing text based on that.

So far, everything is working...but only the first time around.

JavaScript:
//This adds ActorBust commands automatically Bust|Bustmirror|LightSelf|DimOther|Expression
var Irina_IS_Game_Message_addText = Game_Message.prototype.addText;
Game_Message.prototype.addText = function(text) {
    console.log("==============ADDTEXT GAME MESSAGE===============");
    if (Irina_IS_ActorSwitched == true) {
        if (Irina_IS_Direction == "RIGHT") {
            console.log("WE'RE HEADING RIGHT")
            var Irina_IS_Bust = "\\bust[1]" + "\\bustExpression[1," + Irina_IS_New_FaceIndex + "]" + "\\bustLight[1]" + "\\bustDim[2]";
            var Irina_Text = Irina_IS_Bust + "\\" + Irina_IS_ActorName + "_RIGHT";
        } else if (Irina_IS_Direction == "LEFT") {
            console.log("WE'RE HEADING LEFT")
            var Irina_IS_Bust = "\\bust[2]" + "\\bustMirror[2]" + "\\bustExpression[2," + Irina_IS_New_FaceIndex + "]" + "\\bustLight[2]" + "\\bustDim[1]";
            var Irina_Text = Irina_IS_Bust + "\\" + Irina_IS_ActorName + "_LEFT";
        }
    text = Irina_Text + text;
    }
    Irina_IS_Game_Message_addText.call(this, text);
}

//injects into command101 and switches the original face with the redirected one
var _IS_Game_Message_Show_Text = Game_Interpreter.prototype.command101;
Game_Interpreter.prototype.command101 = function() {
    Irina_IS_ActorFace = this._params[0];
    Irina_IS_ActorIndex = this._params[1];
    Game_Interpreter.IS_Clean_Setup();
    Game_Interpreter.IS_Origin_Face_Extract();
    if (Irina_IS_ActorSwitched == true) {
        this._params[0] = Irina_IS_SourceFolder + Irina_IS_New_ActorFace;
        this._params[1] = Irina_IS_New_FaceIndex;
    }
    _IS_Game_Message_Show_Text.call(this);
    if (Irina_IS_DEBUG == true) {
        console.log("==OUTPUT (Anyone/Irina)==");
        console.log("FaceName: " + this._params[0] + ", FaceIndex: " + this._params[1]);
    }
};
This is my code that works in conjunction with the Irina Visual Novel Bust plugin.

To simplify it:

The plugin reads certain expressions such as \bust[1] and then changes the text message based on that.
But I want to save myself time, and instead of having to write all the escape strings like \bust[1] into the actual text window, I want them added to the text window based on certain parameters I extract from the name.

What happens right now is that everything works, the correct picture is picked for the bust and displayed and all escape strings are added to the message.
But when I play the message a second time, none of those are added again.

So the first time I read the message I get as
text text = Irina_Text + text;
while the second time the same text is displayed, I only get
text = text

I think the reason must be that Game_Message.prototype.addText = function(text) only plays the first time around when a message is created, but not the second time around?

Does anyone know how I can add a text to a textmessage permanently, even when the text is played again and the escapes are removed, so that something like:
"Hi, this is my face." will always instead be written as "\bust[1]Hi this is my face" even on repeat viewings?
 

Anyone

Veteran
Veteran
Joined
Aug 24, 2019
Messages
90
Reaction score
64
First Language
German
Primarily Uses
RMMV
The issue has been resolved.

I mistakenly assumed the process was not executed every time, when in fact the issue had been that the conditional if-checks were not true the second time around due to the way another part of the script works.

(I basically regex the faceName and switch to another face based on it, but since the new faceName then enters the this._params for that specific message a second switch isn't executed when rereading the message, since the faceName this time doesn't get switched.
That in turn also ensured that the necessary if check values for Actor Switch, Direction and Name no longer existed, thus obviously failing the "if it exists" check. To resolve this, I wrote I used this._params.push(Irina_IS_ActorName) and this._params.push(Irina_IS_Direction) in command 101 during the Actor FaceName switch, to ensure the references were entered permanently into the Message's parameters, thus allowing me to draw on those instead of the variables.
That fixed it.)
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
5,895
Reaction score
4,217
First Language
Dutch
Primarily Uses
RMXP

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.

 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

Oh, stop with the Melodrama...

...Listen to it instead!

anybody else like getting baked whilst coding?

When you go to the beach watch out for coconuts. Coconuts are more dangerous than sharks. Fact.
Try to get into pixelart again, so far its a sucess.
Also finally found a useful pixeltutorial which helps a lot.
♫ Anyone knows an ant can't move a rubber tree plant, but he's got high hopes, he's got high hopes, he's got high apple pie in the sky hopes ♫

Forum statistics

Threads
93,615
Messages
913,982
Members
123,180
Latest member
tdominach
Top