The RPG Maker Resource Kit

RMRK RPG Maker Creation => XP => XP Scripts Database => Topic started by: Season In The Abyss on May 14, 2007, 01:27:40 AM

Title: Scrolling Message System
Post by: Season In The Abyss on May 14, 2007, 01:27:40 AM
Scrolling Message System
Version: 1.2

Last Update

May 13, 2007

Introduction

This script makes message show in two lines of text at a time. If there are more than two lines, the lines will be scrolled in a smoothly way. Letters are drawed one by one.

FeaturesExtra Features
Code: [Select]
#==============================================================
# ** Scrolling Message System / Name Box
#------------------------------------------------------------------------------
# Slipknot (http://www.creationasylum.net/)
# Version 1.1
# March 13, 2007
#==============================================================

class Window_Message < Window_Selectable
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias slipknot_sms_nb_refresh refresh
  alias slipknot_sms_nb_repcod replace_code
  alias slipknot_sms_nb_termmes terminate_message
  #--------------------------------------------------------------------------
  # * Terminate Message
  #--------------------------------------------------------------------------
  def terminate_message
    slipknot_sms_nb_termmes
    if @name_box
      @name_box.dispose
      @name_box = nil
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    slipknot_sms_nb_refresh
    if @name_text
      @name_box = Window_MessageNameBox.new(x, y - 16, @name_text)
      @name_box.back.opacity = 0 if $game_system.message_frame == 1
      @name_text = nil
    end
  end
  #--------------------------------------------------------------------------
  # * Replace Code
  #--------------------------------------------------------------------------
  def replace_code
    slipknot_sms_nb_repcod
    @text.gsub!(/\\[Nn]ame\[(.*?)\]/) { @name_text = $1; '' }
  end
end

class Window_MessageNameBox < Window_Base
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader :back
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, y, text)
    dumb = Bitmap.new(160, 32)
    dumb.font = Message.font
    color = nil
    text.sub!(/\\[Cc](\d)/) { color = text_color($1.to_i); '' }
    size = dumb.text_size(text).width
    dumb.dispose
    @back = Window_Base.new(x, y, size + 12, 32)
    @back.z = 9998
    super(x - 10, y - 11, size + 32, 54)
    self.z = 9999
    self.opacity = 0
    self.contents = Bitmap.new(size, 22)
    contents.font = Message.font
    contents.font.color = color if color
    contents.draw_text(0, 0, size, 22, text)
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    @back.dispose
    @back = nil
    super
  end
end
[/spoiler]

Versions History

Version 1.2 (13/05/07)
 - added: Face
 - added: Name Box
 - added: Bold & Italic
 - fixed: Easier to expand the script
 - fixed: Small bug when using slow scrolling

Version 1.1 (23/01/07)
 - added: Choices supports "message code".
 - fixed: Small bug with the scroll arrows.

Version 1.0 (15/12/06)
 - First release

Screenshots

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg63.imageshack.us%2Fimg63%2F8613%2Fsms12wi3.gif&hash=b1a3ebf4e5f95dd90f9c3d3c1106d099a8468e06)

Demo

http://www.fileul.com/view.php?file=o2KsIL (http://www.fileul.com/view.php?file=o2KsIL)

Script

Spoiler for "Script":
Code: [Select]
#==============================================================
# ** Scrolling Message System
#------------------------------------------------------------------------------
# Slipknot (http://www.creationasylum.net/)
# Version 1.2
# May 13, 2007
#==============================================================

module Message
  #--------------------------------------------------------------------------
  # * Settings
  #--------------------------------------------------------------------------
  # ~ Font
  FontName = 'High Tower Text'
  FontSize = 20
  # ~ Size
  Width = 388
  Height = 24
  # ~ Delay
  TextDelay = 2
  Scroll = 30
  Autoclose = 16
  #--------------------------------------------------------------------------
  # * Font
  #--------------------------------------------------------------------------
  def self.font
    Font.new(FontName, FontSize)
  end
end


class Game_Temp
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :mes_choices
end


class Spriteset_Map
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader :character_sprites
end


class Interpreter
  #--------------------------------------------------------------------------
  # * Show Text
  #--------------------------------------------------------------------------
  def command_101
    return false if (temp = $game_temp).message_text
    @message_waiting = true
    temp.message_proc = Proc.new { @message_waiting = false }
    temp.message_text = @list.at(@index).parameters.at(0) + "\n"
    loop do
      com = @list.at(@index + 1)
      if com.code == 401 || com.code == 101
        temp.message_text += com.parameters.at(0) + "\n"
      else
        if com.code == 102
          temp.choice_max = com.parameters.at(0).size
          temp.mes_choices = com.parameters.at(0)
          temp.choice_cancel_type = com.parameters.at(1)
          current_indent = com.indent
          temp.choice_proc = Proc.new { |n| @branch[current_indent] = n }
          @index += 1
        elsif com.code == 103
          @index += 1
          temp.message_text += "\n"
          temp.num_input_variable_id = com.parameters.at(0)
          temp.num_input_digits_max = com.parameters.at(1)
        end
        return true
      end
      @index += 1
    end
  end
end


class Window_Message < Window_Selectable
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias slipknot_sms_init initialize
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  def initialize
    slipknot_sms_init
    self.height = Message::Height * 2 + 32
    self.back_opacity = 160
    self.windowskin = windowskin.clone
    self.windowskin.fill_rect(144, 16, 32, 32, Color.new(0, 0, 0, 0))
    @ey = 1.0
    @y = 0
  end
  #--------------------------------------------------------------------------
  # * Opacity
  #--------------------------------------------------------------------------
  def opacity=(val)
    super
    @choices.opacity = val if @choices
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    contents.font = Message.font
    @x = @y = @ex = @ey = 0
    return if ! (@text = temp.message_text)
    replace_code
    gold_win |= @text.gsub!(/\\[Gg]/, '')
    if fit |= @text[/\\[Pp]/]
      if @text.sub!(/\\[Pp]\[([-1,0-9]+)\]/, '')
        event = $1.to_i
      elsif @text.gsub!(/\\[Pp]/, '')
        event = ev_ac
      end
    end
    lines_size = [0]
    save, @lines = @text.clone, 0
    while @c = @text.slice!(/./m)
      if @c == "\n"
        @lines += 1
        lines_size << 0
        next
      end
      lines_size[@lines] += eval_text(self.contents, true)
    end
    if temp.choice_max > 0
      @c_data = [Bitmap.new(640 - Message::Width, Message::Height *
        temp.choice_max), Array.new(temp.choice_max, 0)]
      @c_data.at(0).font = Message.font
      @text = temp.mes_choices.join("\n")
      replace_basic_code
      @y = 0
      while @c = @text.slice!(/./m)
        @c_data.at(1)[@y] += eval_text(@c_data.at(0))
      end
      @c_data[1] = @c_data.at(1).max + 8
      @x = @y = 0
    end
    @text = save
    twidth = temp.choice_max > 0 ? @c_data.at(1) + 32 : 0
    self.width = fit ? lines_size.max + 40 + @ex : Message::Width - twidth
    twidth += self.width
    self.contents = Bitmap.new(self.width - 32, @lines * Message::Height)
    contents.font = Message.font
    if ! event
      h2 = self.height / 2
      self.y = temp.in_battle ? 96 - h2 :
        case $game_system.message_position
        when 0 then 96 - h2
        when 1 then 240 - h2
        when 2 then 384 - h2
        end
      self.x = 320 - twidth / 2
    else
      c = event > 0 ? $game_map.events[event] : $game_player
      mx, my = 636 - twidth, 476 - self.height
      fx = [[c.screen_x - twidth / 2, 4].max, mx].min
      ch = [$scene.spriteset.character_sprites[event - 1].bitmap.height /
        4 + 4, 48].max
      fy = [[c.screen_y - (ch + self.height), 4].max, my].min
      self.x, self.y = fx, fy
    end
    self.opacity = $game_system.message_frame == 0 ? 255 : 0
    if gold_win
      @gold_window = Window_Gold.new
      @gold_window.x = 560 - @gold_window.width
      if temp.in_battle
        @gold_window.y = 192
      else
        @gold_window.y = self.y >= 128 ? 32 : 384
      end
      @gold_window.opacity = self.opacity
    end
    if temp.choice_max > 0
      @choices = Window_MesChoices.new(self.x + self.width, self.y, @c_data)
      @choices.back_opacity = self.back_opacity
    end
  end
  #--------------------------------------------------------------------------
  # * Replace Code
  #--------------------------------------------------------------------------
  def replace_code
    replace_basic_code
    @text.gsub!('\!') { "\003" }
    @text.gsub!('\.') { "\004" }
    @text.gsub!(/\\\%\[(\d+)\]/) { "\011[#$1]" }
    @text.gsub!('\%') { "\011" }
  end
  def replace_basic_code
    @text.gsub!(/\\\\/) { "\000" }
    @text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
    @text.gsub!('\$') { $game_party.gold.to_s }
    @text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
      $game_actors[$1.to_i] ? $game_actors[$1.to_i].name : ''
    end
    @text.gsub!('\$') { $game_party.gold.to_s }
    @text.gsub!(/\\[Cc]\[([0-9]+?)\]/) { "\001[#$1]" }
  end
  #--------------------------------------------------------------------------
  # * Evaluate Text
  #--------------------------------------------------------------------------
  def eval_text(bitmap, read = false)
    case @c
    when "\000"
      @c = '\\'
    when "\001"
      @text.sub!(/\[(\d+)\]/, '')
      return 0 if read
      bitmap.font.color = text_color($1.to_i)
      return 0
    when "\002"
      @text.sub!(/\[(.*?)\]/, '')
      return 24 if read
      y = Message::Height * @y
      bitmap.blt(@ex + @x + 4, y, RPG::Cache.icon($1.to_s), Rect.new(0, 0, 24, 24))
      @x += 24
      return 0
    when "\003"
      return 0 if read
      @stop = true
      return 0
    when "\004"
      return 0 if read
      @wait_count += 10
      return 0
    when "\011"
      @text.sub!(/\[(\d+)\]/, '')
      return 0 if read || temp.num_input_variable_id > 0 || temp.choice_max > 0
      @autoclose = $1 ? $1.to_i : Message::Autoclose
      return 0
    end
    eval_extra(bitmap)
    return 0 if @c == '' || @c == nil
    if @c == "\n"
      @y += 1
      @x = 0
      return 0
    end
    w = bitmap.text_size(@c).width
    unless read
      bitmap.draw_text(@ex + @x + 4, Message::Height * @y, w, Message::Height, @c)
      @x += w
    end
    return w
  end
  def eval_extra(bitmap)
  end
  #--------------------------------------------------------------------------
  # * Variables
  #--------------------------------------------------------------------------
  def temp() $game_temp end
  def input_number() @input_number_window end
  def ev_ac() $game_system.map_interpreter.event_id end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    if @contents_showing
      super
      if self.oy < (@y - 1) * Message::Height && @y < @lines
        @ey += Message::Height / Message::Scroll.to_f
        ey = @ey - @ey.floor
        self.oy += @ey.floor
        @ey = ey
      end
      if @text
        if Input.trigger?(13) && @stop
          self.pause = @stop = false
          return
        elsif @stop
          return
        elsif @wait_count > 0
          @wait_count -= 1
          return
        end
        @wait_count = 0
        return if self.oy < (@y - 1) * Message::Height && @y != @lines
        if (@c = @text.slice!(/./m))
          eval_text(contents)
          if @stop
            self.pause = true
            return
          end
          @wait_count += Input.press?(13) ? 0 : Message::TextDelay
        else
          @text = nil
        end
        return if @text || @autoclose != -1
        if temp.num_input_variable_id > 0
          digits_max = temp.num_input_digits_max
          @input_number_window = Window_InputNumber.new(digits_max)
          input_number.number = $game_variables[temp.num_input_variable_id]
          input_number.x = self.x + (self.width / 2 - input_number.width / 2)
          input_number.y = self.y + Message::Height
          @y -= 1
          @ey -= 1.0
        end
        @choices.index, @choices.active = 0, true if @choices
        return
      else
        if @autoclose > 0
          @autoclose -= 1
          return
        elsif @autoclose == 0
          terminate_message
          @autoclose = -1
          return
        end
      end
      if input_number
        input_number.update
        if Input.trigger?(13)
          $game_system.se_play($data_system.decision_se)
          $game_variables[temp.num_input_variable_id] = input_number.number
          $game_map.need_refresh = true
          input_number.dispose
          @input_number_window = nil
          terminate_message
        end
        return
      elsif @choices
        @choices.update
      end
      self.pause = true
      if Input.trigger?(12)
        if temp.choice_max > 0 && temp.choice_cancel_type > 0
          $game_system.se_play($data_system.cancel_se)
          temp.choice_proc.call(temp.choice_cancel_type - 1)
          terminate_message
        end
      end
      if Input.trigger?(13)
        if temp.choice_max > 0
          $game_system.se_play($data_system.decision_se)
          temp.choice_proc.call(@choices.index)
        end
        terminate_message
      end
      return
    end
    if ! @fade_out && temp.message_text
      @contents_showing = temp.message_window_showing = true
      if @choices
        @choices.dispose
        @choices = nil
      end
      self.oy = 0
      @stop = false
      @autoclose = -1
      refresh
      @wait_count, self.visible = 0.0, true
      return
    end
    return if ! visible
    @fade_out = true
    self.opacity -= 48
    if self.opacity == 0
      self.visible = @fade_out = false
      if @choices
        @choices.dispose
        @choices = nil
      end
      temp.message_window_showing = false
    end
  end
end


class Window_MesChoices < Window_Selectable
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  def initialize(x, y, data)
    super(x, y, data.at(1) + 32, 2 * (h = Message::Height) + 32)
    self.opacity = $game_system.message_frame == 0 ? 255 : 0
    self.index, self.active, @item_max = -1, false, $game_temp.choice_max
    self.contents = Bitmap.new(data.at(1), @item_max * h)
    contents.blt(0, 0, data.at(0), Rect.new(0, 0, data.at(1), h * @item_max))
  end
  #--------------------------------------------------------------------------
  # * Update Cursor
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
      return
    end
    self.oy = [[@index, @item_max].min - 1, 0].max * Message::Height
    y = @index * Message::Height - self.oy
    cursor_rect.set(0, y, width - 32, Message::Height)
  end
end


class Window_InputNumber < Window_Base
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  def initialize(digits)
    @digits_max = digits
    @number = 0
    dummy = Bitmap.new(32, 32)
    dummy.font = Message.font
    @cursor_width = dummy.text_size('0').width + 8
    dummy.dispose
    super(0, 0, @cursor_width * @digits_max + 32, Message::Height + 32)
    self.contents = Bitmap.new(width - 32, height - 32)
    contents.font = Message.font
    self.z += 9999
    self.opacity = @index = 0
    refresh
    update_cursor_rect
  end
  #--------------------------------------------------------------------------
  # * Update Cursor
  #--------------------------------------------------------------------------
  def update_cursor_rect
    cursor_rect.set(@index * @cursor_width, 0, @cursor_width, Message::Height)
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    contents.font.color = normal_color
    s = sprintf("%0*d", @digits_max, @number)
    for i in 0...@digits_max
      contents.draw_text(i * @cursor_width + 4, 0, 32, Message::Height, s[i, 1])
    end
  end
end


class Interpreter
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader :event_id
end


class Scene_Map
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader :spriteset
end

Instructions

You need paste the code before Main.
Take a look to the demo and see how it works.Compatibility

This script couldn't work with other message window script.

Author's Notes

Credit me and report bugs!
Title: Re: Scrolling Message Window
Post by: modern algebra on May 14, 2007, 01:38:00 AM
This looks cool. I am testing now.
Title: Re: Scrolling Message Window
Post by: Falcon on May 14, 2007, 02:03:48 AM
Wow, this looks very nice :)
Title: Re: Scrolling Message Window
Post by: :) on May 14, 2007, 02:17:25 AM
Looks sweet!  :)
Title: Re: Scrolling Message Window
Post by: Season In The Abyss on May 14, 2007, 02:20:14 AM
Thanks  ;D
Title: Re: Scrolling Message System
Post by: Zeriab on May 14, 2007, 04:52:40 AM
A very nice and clean script. Great job ^_^
Title: Re: Scrolling Message System
Post by: Irock on May 14, 2007, 04:58:19 AM
Awesome job.

I was playing Earthbound a few days ago, and wondered if there was a script like this. ;)
Title: Re: Scrolling Message System
Post by: firerain on June 26, 2007, 02:18:45 AM
I get an error with the name box script, error reads:

Script'' line 14 NameError occurred
undefined method 'replace_code' for class 'window_message'
Title: Re: Scrolling Message System
Post by: Season In The Abyss on June 30, 2007, 07:46:55 AM
Be sure to paste the main script before the rest ;)
Title: Re: Scrolling Message System
Post by: Kokowam on June 30, 2007, 10:56:03 AM
"I'm Slipknot." XD Anyways, is this a more advanced version of the letter by letter? If so, awesome! If not, awesome! ;D Job good. :)
Title: Re: Scrolling Message System
Post by: firerain on June 30, 2007, 01:25:23 PM
Be sure to paste the main script before the rest ;)
I have. :(
Title: Re: Scrolling Message System
Post by: Doctor Professor Nikolai on June 30, 2007, 04:06:32 PM
Nice, I love it. You get a bean. :bb:
Title: Re: Scrolling Message System
Post by: Season In The Abyss on July 01, 2007, 08:03:40 PM
@Lac: The order of the scripts should be like this:
 - Scene_Debug
 - SDK (if you use it)
 - SMS (main code)
 - Name Box
 - Others scripts
 - Main


@rest: thanks  ;D
Title: Re: Scrolling Message System
Post by: modern algebra on July 14, 2007, 01:09:55 AM
Yup, I think I'm definitely using this Message system for my game. Thank you for writing and posting this. You made me very happy  ;D
Title: Re: Scrolling Message System
Post by: MrMoo on July 19, 2007, 05:11:07 AM
With the window above the event, anybody know how to get it above the player?
Title: Re: Scrolling Message System
Post by: modern algebra on July 22, 2007, 07:34:47 AM
\p[-1]
Title: Re: Scrolling Message System
Post by: Sophist on July 22, 2007, 07:47:41 AM
This script is made out of immediant win.

( ???) This is terrifyingly relevant to my intrests today, isn't it?
Title: Re: Scrolling Message System
Post by: SirJackRex on July 24, 2007, 11:43:58 PM
Wow, this is such an amazing script!
Title: Re: Scrolling Message System
Post by: Kamin on August 13, 2007, 03:00:58 AM
The text doesn't show up for me. :/

Any idea on how to fix that?
Title: Re: Scrolling Message System
Post by: drakenkanon on August 17, 2008, 05:31:23 PM
i really like this script, could you make it so you can have endless choices, like this:

show choices: choice 1, choice 2, choice 3, choice 4
(call script)
show choice: choice 5, choiche 6, choice 7, choice 8

and so on
Title: Re: Scrolling Message System
Post by: xplody08 on August 22, 2008, 06:42:23 AM
Neat looking script! Looks very nice!  ;D
Title: Re: Scrolling Message System
Post by: Berans on August 22, 2008, 06:54:17 AM
The text doesn't show up for me. :/

Any idea on how to fix that?
Is the font you've defined in the script installed on your system? If it's not, it just won't show up
Title: Re: Scrolling Message System
Post by: Dralel on November 11, 2008, 07:32:14 PM
When I test play it won't let me move the cursor on the title screen!! Help!
Title: Scrolling Message System help
Post by: justin900 on April 09, 2009, 02:14:22 PM
Hey..this is justin chael. from jworks production.
it's my first time to use this program and i also bought it.
i just want you to help me with my problem..
everytime i use use script..and put it in to the script editor..on the top of the main..this message always shows up."script "Main"line 14: name error occurred.
undefined method 'replace_code' for class 'window_message' i cant figure out how to solve that problem..i tried to download your Demo but the link is broken..

please help me out with this...
thank you for your time.
Justine.

One more thing..
do you have any idea how can i put a "Quest" menu in the menu?
thanks again..

Good Day And Good luck!
Title: Re: Scrolling Message System
Post by: apoclaydon on May 19, 2010, 06:26:23 AM
Ok sorry for this but i can not get the demo to download. the script sounds nice but i dont know how to use it (how to get text to scroll or how to add the choices
Title: Re: Scrolling Message System
Post by: Sophist on June 06, 2010, 05:29:34 AM
The demo is long out dated.

You are an idiot for posting in a thread from 2007 and expecting downloads to work.
Title: Re: Scrolling Message System
Post by: modern algebra on June 06, 2010, 11:46:27 AM
Just copy it from the Script spoiler. It scrolls automatically when you have more than two lins. The choices are added when you use the Show Choice Branch. If you are trying and nothing is showing up, you might not have the font he is using, so change FontName to something you have.
Title: Re: Scrolling Message System
Post by: PKSkwerl on October 07, 2010, 08:38:57 PM
Hello. Sorry to topic necro on my first post but I was just wondering if anyone knows how to add the text sound to this script? I love this script and can live without the text sounds in the other script but would definitely prefer it. Thanks :)
Title: Re: Scrolling Message System
Post by: Glennx95 on April 19, 2011, 08:31:06 PM
I know this is an old topic, but how do i get the name box above the text? it might be a dumb question, but I'm new to the script parts, so i dint know how to edit them yet. Thanks.
Title: Re: Scrolling Message System
Post by: modern algebra on April 19, 2011, 09:53:54 PM
I thought it was just by using the code \name[text] inside a text box.
Title: Re: Scrolling Message System
Post by: Glennx95 on April 20, 2011, 12:41:34 PM
Thats what i thought too, but it doesn't work
Title: Re: Scrolling Message System
Post by: modern algebra on April 26, 2011, 02:15:44 AM
Well, it was an extra feature, so you needed to add this code into its own slot below the SMS:

Code: [Select]
#==============================================================
# ** Scrolling Message System / Name Box
#------------------------------------------------------------------------------
# Slipknot (http://www.creationasylum.net/)
# Version 1.1
# March 13, 2007
#==============================================================

class Window_Message < Window_Selectable
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias slipknot_sms_nb_refresh refresh
  alias slipknot_sms_nb_repcod replace_code
  alias slipknot_sms_nb_termmes terminate_message
  #--------------------------------------------------------------------------
  # * Terminate Message
  #--------------------------------------------------------------------------
  def terminate_message
    slipknot_sms_nb_termmes
    if @name_box
      @name_box.dispose
      @name_box = nil
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    slipknot_sms_nb_refresh
    if @name_text
      @name_box = Window_MessageNameBox.new(x, y - 16, @name_text)
      @name_box.back.opacity = 0 if $game_system.message_frame == 1
      @name_text = nil
    end
  end
  #--------------------------------------------------------------------------
  # * Replace Code
  #--------------------------------------------------------------------------
  def replace_code
    slipknot_sms_nb_repcod
    @text.gsub!(/\\[Nn]ame\[(.*?)\]/) { @name_text = $1; '' }
  end
end

class Window_MessageNameBox < Window_Base
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader :back
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, y, text)
    dumb = Bitmap.new(160, 32)
    dumb.font = Message.font
    color = nil
    text.sub!(/\\[Cc](\d)/) { color = text_color($1.to_i); '' }
    size = dumb.text_size(text).width
    dumb.dispose
    @back = Window_Base.new(x, y, size + 12, 32)
    @back.z = 9998
    super(x - 10, y - 11, size + 32, 54)
    self.z = 9999
    self.opacity = 0
    self.contents = Bitmap.new(size, 22)
    contents.font = Message.font
    contents.font.color = color if color
    contents.draw_text(0, 0, size, 22, text)
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    @back.dispose
    @back = nil
    super
  end
end
Title: Re: Scrolling Message System
Post by: Glennx95 on April 26, 2011, 07:41:34 PM
Okay, thanks. It's working now :D