The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: HowlingWinds on February 13, 2007, 06:22:35 AM

Title: Help with my script (fixed)
Post by: HowlingWinds on February 13, 2007, 06:22:35 AM
Well I've been trying to learn ruby so I've been taking it step by step. So I decided to test my self in making a window but it says something is wrong but I can figure out what. So I was woundering what I did wrong in this script.


class My_First_Test
 
   def initialize
     super(0, 0, 200, 200)
     self.contents=Bitmap.new(width-32, heigth-32)
     self.contents.font.name = "Aerial"
     self.contents.font.size = 24
     refresh
   end
   
   def refresh
     self.contents.clear
     self.contents.text.color = text.color(7)
     self.contents.draw_text(20, 0, 200, 200, "Woot!")
   end
   
end


So yeah, it said something was wrong with line 4 but I can't figure out what ;__;
Title: Re: Help with my script
Post by: Yami on February 13, 2007, 06:28:11 AM
I am not a scripter so I'm not sure, but do you have to use semicolons in scripting on RPGMaker?  If you do, then thats the problem :x
Title: Re: Help with my script
Post by: Yami on February 13, 2007, 06:37:41 AM
Ok so I actually looked and I guess you don't use semicolon so I guess I didn't help much did I? X_x'  Sorry.
Title: Re: Help with my script
Post by: HowlingWinds on February 13, 2007, 06:51:14 AM
It said something about the numbers in line 4 or something. I'm not sure what I did wrong :x cuz how is the number incorrect when I'm placing the window! @_@
Title: Re: Help with my script
Post by: modern algebra on February 13, 2007, 07:22:29 AM
I'm not really a scripter either, but you might want to put < Window_Base after your class name. That'll probably fix it.
Also, you spelt Arial wrong, so unless "Aerial" is actually a font, I don't think anything will show up.
Title: Re: Help with my script
Post by: Yami on February 13, 2007, 07:30:52 AM
Also, the font is misspelled.  Should be Arial.  Maybe that makes a difference if you don't have a font called Aerial installed.
Title: Re: Help with my script
Post by: HowlingWinds on February 13, 2007, 03:54:04 PM
Okay I fixed it, looks like I was making things too complicated all I had to do was:

class My_First_Test < Window_Base

  def initialize
    super(0, 0, 200, 200)
    self.contents = Bitmap.new(width-32, height-32)
    self.contents.font.name = "Arial" 
    self.contents.font.size = 24
    self.contents.draw_text(0, 0, 200, 32, "If I am, then I'm coded.")
  end
 
end


Thanks for reminding me of my spelling and the window base  :P