BLACKDRAZON'S PROFILE
Search
[RMMV] Inheritance Problem
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:
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?
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?
[VX Ace] NoMethodError... everywhere.
I don't even know what to say. I was going through the VX Ace tutorial on the site when I got to Tutorial 7, where you run tests of the battles (I never did the testing suggested in Tut6). However, an error popped up in the script given in Tutorial 3.5, so I went to fix it, having some non-Ruby programming experience myself. You can download the code yourself here in the Tut3.5 zip. I hadn't modified the code one bit before the error occurred so you're seeing it just as I did. The error occurred on this line:
The error was a NoMethodError, and it occurred whenever anyone used the Attack skill. Judging from what the game was giving me, I assumed the script wasn't finding any tags in the notes section of the Attack skill (nor should it - it was blank) and wasn't handling the empty results properly. Fine, that seemed fixable. So I went to work.
Unfortunately, I couldn't find the problem, as even the print statements began to throw me NoMethodErrors. Was scan empty? I couldn't tell: despite what the internet tells me, arrays apparently do not have a function called "empty". Was scan nil? NoMethodError. Is "nil" nil? Aka, "print nil.nil"? Apparently nil isn't nil, because "Undefined method 'nil' for nil:NilClass"! If NilClass doesn't even have the nil method, what on earth does? It's as though Ruby can't access methods for anything! Have I missed some obvious Ruby oversight?
Thanks if you can work head or tail about it. :S
scan[0][0].scan(/\d+/).each {|b|
@self_effects.push(@effects[b.to_i - 1]) if b.to_i >= 1
}The error was a NoMethodError, and it occurred whenever anyone used the Attack skill. Judging from what the game was giving me, I assumed the script wasn't finding any tags in the notes section of the Attack skill (nor should it - it was blank) and wasn't handling the empty results properly. Fine, that seemed fixable. So I went to work.
Unfortunately, I couldn't find the problem, as even the print statements began to throw me NoMethodErrors. Was scan empty? I couldn't tell: despite what the internet tells me, arrays apparently do not have a function called "empty". Was scan nil? NoMethodError. Is "nil" nil? Aka, "print nil.nil"? Apparently nil isn't nil, because "Undefined method 'nil' for nil:NilClass"! If NilClass doesn't even have the nil method, what on earth does? It's as though Ruby can't access methods for anything! Have I missed some obvious Ruby oversight?
Thanks if you can work head or tail about it. :S
Pages:
1













