[RMMV] INHERITANCE PROBLEM

Posts

Pages: 1
This is probably something really basic in Javascript, but I'm still getting used to Javascript and unfortunately keep making mistakes. I'm trying to extend a pre-existing class that's already been extended by another plugin. But when I do, it can't find that previous plugin's functions and throws an error.

Specifically, I'm trying to extend Yanfly's message pack 2 to incorporate a few more escape characters. The plugins are in the right order on the plugin screen. Note that I'm using the letters "MYA" to indicate code from my project, and that the Yanfly plugin is unmodified. Here's my part of the code:


MYA_Window_Base_convertExtraEscapeCharacters = Window_Base.prototype.convertExtraEscapeCharacters;

Window_Base.prototype.convertExtraEscapeCharacters = function(text) {
text = MYA_Window_Base_convertExtraEscapeCharacters(this, text);

[unrelated code]
};


When I try to run the game, I get the following error:

"TypeError: this.convertItemQuantitiesCodes is not a function
at Window_Base.convertExtraEscapeCharacters (YEP_X_ExtMesPack2.js:1093)
at Window_Message.Window_Base.convertExtraEscapeCharacters ()"

It seems that when the code hits the line "text = MYA_Window_Base_convertExtraEscapeCharacters(this, text);", it goes over to YEP_X_ExtMesPack2.js, and its version of convertExtraEscapeCharacters like you'd expect. But as soon as it hits the very first line (1093), it comes to the function convertExtraEscapeCharacters from YEP_X_ExtMesPack2 and says that this function doesn't exist.

Any idea what I'm doing wrong?
Update, I found it, it was a stupid oversight on my part: I forgot to put .call next to MYA_Window_Base_convertExtraEscapeCharacters. Please consider this closed.
Pages: 1