Hello forums,
I'm relatively new to RGSS3 scripting and the Ruby language as a whole. I made a little script to excercise what I know and hopefully get better at typing the lanuage's syntax, but I haven't been able to understand why its throwing me this error.
class Person def initialize(color, number) @color, @number = color, number endendPerson = Person.new( "Red ", 2) Person2 = Person.new ("Blue", 1)When I run this, I get this
"line 8: NoMethodError occured"
"undefined method 'new' for #<Person0x773cb78 @color = "Red", @number=2>"
Okay so here's the funny thing about this code. Ruby is saying I'm getting a error at line 8, but once I get rid of line 9 the code works.
The only way I can get this code to work while still having 2 objects is by changing
"Person = Person.new("Red", 2)" in line 8 to something like
"Person1 =Person.new("Red", 2)"
So why doesn't RGSS3 not like the word "Person" as the object name ? Well it likes it, but only when I don't make a second object of the class Person. Is there something I'm not understanding here ??
Oh just to throw this out. The code is not suppose to do anything yet, but run the game with no errors.
I'm relatively new to RGSS3 scripting and the Ruby language as a whole. I made a little script to excercise what I know and hopefully get better at typing the lanuage's syntax, but I haven't been able to understand why its throwing me this error.
class Person def initialize(color, number) @color, @number = color, number endendPerson = Person.new( "Red ", 2) Person2 = Person.new ("Blue", 1)When I run this, I get this
"line 8: NoMethodError occured"
"undefined method 'new' for #<Person0x773cb78 @color = "Red", @number=2>"
Okay so here's the funny thing about this code. Ruby is saying I'm getting a error at line 8, but once I get rid of line 9 the code works.
The only way I can get this code to work while still having 2 objects is by changing
"Person = Person.new("Red", 2)" in line 8 to something like
"Person1 =Person.new("Red", 2)"
So why doesn't RGSS3 not like the word "Person" as the object name ? Well it likes it, but only when I don't make a second object of the class Person. Is there something I'm not understanding here ??
Oh just to throw this out. The code is not suppose to do anything yet, but run the game with no errors.