RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

Help with my script (fixed)

Started by HowlingWinds, February 13, 2007, 06:22:35 AM

0 Members and 1 Guest are viewing this topic.

HowlingWinds

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 ;__;

Yami

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

Yami

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.

HowlingWinds

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! @_@

modern algebra

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.

Yami

Also, the font is misspelled.  Should be Arial.  Maybe that makes a difference if you don't have a font called Aerial installed.

HowlingWinds

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