I have been editing the default Window_Status code, removing the actor parameters and equipment to open up an larger area for the actor profile. The stored profile text is passed through drawTextEx which uses the convertEscapeCharacters function. Now, convertEscapeCharacters should convert the new line escape codes I placed into the text, but it doesn't.
Here is the simple, two line dummy text which is stored in the profile :
Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n Quisque arcu quam, convallis rutrum neque id, cursus est.
[Console]
> typeof $gameActors.actor(1)._profile;
< "string"
Ok.
> $gameActors.actor(1)._profile;
< "Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n Quisque arcu quam, convallis rutrum neque id, cursus est."
Ok.
> Window_Base.prototype.convertEscapeCharacters($gameActors.actor(1)._profile);
< "Lorem ipsum dolor sit amet, consectetur adipiscing elit.n Quisque arcu quam, convallis rutrum neque id, cursus est."
Wait, what? The function should be replacing '\n' with '\x1bn' which then is converted into a new line.
Window_Base.prototype.convertEscapeCharacters = function(text) {
//
// Replacement
text = text.replace(/\\/g, '\x1b');
//
//
text = text.replace(/\x1b\x1b/g, '\\');
text = text.replace(/\x1bV\[(\d+)\]/gi, function() {
return $gameVariables.value(parseInt(arguments[1]));
}.bind(this));
text = text.replace(/\x1bV\[(\d+)\]/gi, function() {
return $gameVariables.value(parseInt(arguments[1]));
}.bind(this));
text = text.replace(/\x1bN\[(\d+)\]/gi, function() {
return this.actorName(parseInt(arguments[1]));
}.bind(this));
text = text.replace(/\x1bP\[(\d+)\]/gi, function() {
return this.partyMemberName(parseInt(arguments[1]));
}.bind(this));
text = text.replace(/\x1bG/gi, TextManager.currencyUnit);
return text;
};
Why do you do this, function?
Here is the simple, two line dummy text which is stored in the profile :
Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n Quisque arcu quam, convallis rutrum neque id, cursus est.
[Console]
> typeof $gameActors.actor(1)._profile;
< "string"
Ok.
> $gameActors.actor(1)._profile;
< "Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n Quisque arcu quam, convallis rutrum neque id, cursus est."
Ok.
> Window_Base.prototype.convertEscapeCharacters($gameActors.actor(1)._profile);
< "Lorem ipsum dolor sit amet, consectetur adipiscing elit.n Quisque arcu quam, convallis rutrum neque id, cursus est."
Wait, what? The function should be replacing '\n' with '\x1bn' which then is converted into a new line.
Window_Base.prototype.convertEscapeCharacters = function(text) {
//
// Replacement
text = text.replace(/\\/g, '\x1b');
//
//
text = text.replace(/\x1b\x1b/g, '\\');
text = text.replace(/\x1bV\[(\d+)\]/gi, function() {
return $gameVariables.value(parseInt(arguments[1]));
}.bind(this));
text = text.replace(/\x1bV\[(\d+)\]/gi, function() {
return $gameVariables.value(parseInt(arguments[1]));
}.bind(this));
text = text.replace(/\x1bN\[(\d+)\]/gi, function() {
return this.actorName(parseInt(arguments[1]));
}.bind(this));
text = text.replace(/\x1bP\[(\d+)\]/gi, function() {
return this.partyMemberName(parseInt(arguments[1]));
}.bind(this));
text = text.replace(/\x1bG/gi, TextManager.currencyUnit);
return text;
};
Why do you do this, function?
Last edited by a moderator:
