Help - Search - Members - Calendar
Full Version: Never scripted before.
RPG RPG Revolution Forums > Scripting > Script Development and Support > RGSS3
Whatsthisdo
Hi, how's it going?

I've been trying to teach myself RGSS3 by using the Ace help function as well as searching google for helpful tutorials.I found a small snippet I've been playing with;

CODE
class Window_Test < Window_Base
  
  def initialize
    super (0, 320, 640, 160)
    self.contents = bitmap.new(width - 32, height - 32)
    refresh
  end
  
  def refresh
    self.contents.clear
  end
  end


As I understand it, [super] is meant to get the method from it's parent I.E; Window_Base.

I keep getting this error;
"Script 'Window_Test' line 4: SyntaxError occurred.

unexpected',', expecting ')'
super (0, 320, 640, 160)"

I'm having difficulty understanding that line, isn't it along the lines of (x, y, width, height)?
Jens of Zanicuud
QUOTE (Whatsthisdo @ Feb 27 2013, 09:56 AM) *
CODE
class Window_Test < Window_Base
  
  def initialize
    super (0, 320, 640, 160)
    self.contents = bitmap.new(width - 32, height - 32)
    refresh
  end
  
  def refresh
    self.contents.clear
  end
  end


From what I can see, there's a spelling mistake, since you should write Bitmap with the capital B, but for the rest I can't see any errors...
I'll give it a look...
Have you pasted it in a blank? In that case, that should not give such error... Syntax is perfect, as well as your idea about the super.

EDIT: Okay, I've tested it. Just remove the blank between super and the "(", and correct that Bitmap issue and it will work wink.gif

CODE
class Window_Test < Window_Base
  
  def initialize
    super(0, 320, 640, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  
  def refresh
    self.contents.clear
  end
end


It's like that "bitmap" created the whole problem...

Jens
Whatsthisdo
Ah yes, that fixed it, thanks a lot. Now I can move onto playing around with it so I can get the hang of it. Cheers!
lilcooldude69
another good place to learn ruby would be www.codeacademy.com, while this doesnt teach rgss3, it does teach you all you need to know about ruby programming, and it does help significantly when reading scripts to help yourself figure out how they work smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.