Main Menu

[RMXP] Need help writing my Messaging Script [BEGINNER LEVEL]

Started by Reisuke, January 03, 2010, 11:58:20 PM

0 Members and 1 Guest are viewing this topic.

Reisuke

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

Falcon

Welcome, moved to the Script Help, do try to read the rules a bit better.

Reisuke

Sorry about that, I thought I had posted it under Script Help. My bad :D

Reisuke

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.

Mr_Wiggles

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.
[spoiler]
METALFRESH is a paint contractor that specializes in refinishing metal and vinyl siding. We paint metal buildings as well as siding on homes.

We also

    Refinish decks
    Do custom interior painting
    Strip wallpaper
    Refinish cedar siding
    Metal front doors and sidelights
    Metal garage and service doors
    Grained fiberglass doors

    If your structure is *RUSTED *FADED *CHALKING *IN NEED OF COLOR CHANGE, we can fix it with a guarentee!

northern Illinois and southern Wisconsin.

http://metalfreshcoatings.com

[/spoiler]