Ruby Tutorial 3 - Classes/Methods/Inheritance
Loading...
2,925
Loading...
Uploader Comments (gubid)
see all
All Comments (20)
-
godlike
-
+1 to that. I was struggling with an error and all I was missing was the word 'end' that I had forgotten to write in twice.
-
@gubid Thank you! Now I can get into the game. But as soon as I talk to the NPC, I get an error: Script 'Tutorial 2' line 16: NameError occurred. uninitialized constant Scene_Mine::Imput. class Scene_Mine < Scene_Base def start @my_window = Window_Mine.new end def update @my_window.update if Imput.trigger?(Imput::C) $scene = Scene_Map.new end end def dispose @my_window.dispose end end
Loading...
class Window_Mine < Window_Base def initialize super (0,0,320,240) actor = $game_actors[1] x, y = 5, 50 draw_actor_face(actor, x, y) end
end
class Scene_Mine < Scene_Base def start @my_window = Window_Mine.new end def update @my_window.update if Input.trigger?(Input::C) sound.play_decision $scene = Scene_Map.new end
It's telling me I have 'wrong number of arguments (0 for 4)' on line 11
which is '@my_window = Window_Mine.new'.
diamondandplatinum3 2 months ago
@diamondandplatinum3 Looks like you have an extra space between super and the ()'s. If you space, then it assumes you are going to pass each argument that way.
gubid 2 months ago
@gubid Ugh, im such an idiot. Thank you anyways.
Yandrox14 6 months ago
@Yandrox14 As I have said, spelling errors are the most common errors you will encounter. I wish you the best of luck with your project.
gubid 6 months ago
@gubid Sorry, last post was a mess >_<. So I get NameError on line 16. unitialized constant Scene_Mine::Imput. The script:
class Scene_Mine < Scene_Base def start @my_window = Window_Mine.new end def update
@my_window.update if Imput.trigger?(Imput::C) $scene = Scene_Map.new end end def dispose @my_window.dispose end
end
Yandrox14 6 months ago
@Yandrox14 imput is not the module, its Input with an N. That would be why you get the error.
gubid 6 months ago