[VX ACE] NOMETHODERROR... EVERYWHERE.
Posts
Pages:
1
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
The method you seek is called "nil?", not "nil". "nil.nil" will throw a NoMethodError alright, but "nil.nil?" will happily return true.
Pages:
1














