The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: Reisuke on January 03, 2010, 11:58:20 PM

Title: [RMXP] Need help writing my Messaging Script [BEGINNER LEVEL]
Post by: Reisuke on January 03, 2010, 11:58:20 PM
Hello everyone, I`m new to these forums. This is my first script. For those who are bored to look for themselves at what it does, it creates a window for messages with the possibility to change the font each time, the person speaking (which also his name is highlighted in red and allows 3 lines of text to be displayed. My problem is, I don`t know how to make this window I`m creating act like a normal window. Meaning it will dissapear if I press "Action" button again, it will not overlay other windows etc. etc. Basically I want it to act like a normal "Show Text" event window. Right now, my window acts on it's own. I press action, call it, shows up, and dissapears after some time by itself. Also, if I press "Action" too many times, it will look as if it`s adding a layer of brightness to the text. Please help.
class My_Window < Window_Base
 attr_accessor :fontused
 attr_accessor :person
 attr_accessor :message
 attr_accessor :message2
 attr_accessor :message3
 def initialize(fontused = "Arial", person = " ", message = " ", message2 = " ", message3 = " ")
   @fontused = fontused
   @person = person
   @message = message
   @message2 = message2
   @message3 = message3
   if @message.size > 64
     print "Warning! More than 64 characters in line 1"
   elsif @message2.size > 64
     print "Warning! More than 64 characters in line 2"
   elsif @message3.size > 64
     print "Warning! More than 64 characters in line 3"
   end
   super(5, 365, 630, 110)
   #says the content will be drawn in Bitmap 32x32 Format
   self.contents = Bitmap.new(width-32, height-32)
   self.contents.font.name = fontused
   self.contents.font.size = 17
   self.contents.font.color = text_color(8)
   self.contents.draw_text(0,0, 630, 32, person)
   self.contents.font.color = text_color(0)
   self.contents.draw_text(0,17, 630, 32, message)
   self.contents.draw_text(0,34, 630, 32, message2)
   self.contents.draw_text(0,51, 630, 32, message3)
   end
 
end
Title: Re: [RMXP] Need help writing my Messaging Script [BEGINNER LEVEL]
Post by: Falcon on January 04, 2010, 12:35:04 AM
Welcome, moved to the Script Help, do try to read the rules a bit better.
Title: Re: [RMXP] Need help writing my Messaging Script [BEGINNER LEVEL]
Post by: Reisuke on January 04, 2010, 10:11:35 AM
Sorry about that, I thought I had posted it under Script Help. My bad :D
Title: Re: [RMXP] Need help writing my Messaging Script [BEGINNER LEVEL]
Post by: Reisuke on March 31, 2010, 05:14:06 PM
I'm sorry for bumping this thread but I can't seem to find the way to do what I asked in the first place. If someone can help I'd be very grateful.
Title: Re: [RMXP] Need help writing my Messaging Script [BEGINNER LEVEL]
Post by: Mr_Wiggles on March 31, 2010, 10:02:25 PM
Make it run a refresh in the window and have it say "self.contents.clear"  whats happening is that every time it seems to get brighter its stacking on top of its self.

like this...


class My_Window < Window_Base
 attr_accessor :fontused
 attr_accessor :person
 attr_accessor :message
 attr_accessor :message2
 attr_accessor :message3
def initialize(fontused = "Arial", person = " ", message = " ", message2 = " ", message3 = " ")
super(5, 365, 630, 110)
   #says the content will be drawn in Bitmap 32x32 Format
   self.contents = Bitmap.new(width-32, height-32)
   self.contents.font.name = fontused
   self.contents.font.size = 17
   refresh
end # initialize

def refresh
   self.contents.clear
   @fontused = fontused
   @person = person
   @message = message
   @message2 = message2
   @message3 = message3
   if @message.size > 64
     print "Warning! More than 64 characters in line 1"
   elsif @message2.size > 64
     print "Warning! More than 64 characters in line 2"
   elsif @message3.size > 64
     print "Warning! More than 64 characters in line 3"
   end
   
   self.contents.font.color = text_color(8)
   self.contents.draw_text(0,0, 630, 32, person)
   self.contents.font.color = text_color(0)
   self.contents.draw_text(0,17, 630, 32, message)
   self.contents.draw_text(0,34, 630, 32, message2)
   self.contents.draw_text(0,51, 630, 32, message3)
 end # refresh
 
end # class


and then you'll need to up date this window when something changes, so where you press the "Input::C" in the scrip that is calling this one, make it up date when or if it changes the contents. Oh, and the reason to why its stacking on other windows and the map is because you need to dispose of the window when your done with it.


just look over the default window message in the scripts data base for help on this stuff.