The RPG Maker Resource Kit

RMRK RPG Maker Creation => Requests => Script Request => Topic started by: modern algebra on February 02, 2008, 09:17:22 PM

Title: 2 Simple Script Requests
Post by: modern algebra on February 02, 2008, 09:17:22 PM
This is pretty simple. I don't want to take any major requests, but since I want to try out RGSS2 and I need ideas, I am petitioning you for your aid. Basically, just request a script that you think ought to be simple, and I will write the script. I don't want anything too time consuming, even if they are simple (like CMSes), but I am more looking for simple features that you guys would like implemented. For instance, requests like my Extra Movement Frames script and the skill teaching Weapons/Items/Armors are what I am looking for.

Anyway, 1 request per person. 5 3 2 Total. I retain the right to refuse to take any script request and I do not need to justify my response (though I probably will)
Title: Re: 5 Simple Script Requests
Post by: Arrow on February 18, 2008, 08:52:02 PM
Modern: Could you make script that allows the following?:

1. When text is being displayed, it displays letter by letter, and plays a sound of the user's choice.
2. When the user selects a face set, there is an option for animating it. It would work like this:

I'd love you loads if you could.

Also, whatever happened to the script you were making me for XP? I don't mind if you don't want to do it anymore, but I would most certainly like at least an update to its status.
Title: Re: 5 Simple Script Requests
Post by: modern algebra on February 19, 2008, 03:09:43 AM
Yeah, sorry about that. I keep putting it off like a douchebag. If you still want it, I'll get back to work on it.

As for the rest -> I can probably do it. I will have to do some research perhaps, but the letter by letter should not provide a real challenge. The other is a really interestin idea. I'll give them a try. Also though, the default display for messages is letter by letter. Do you want me to make that slower?
Title: Re: 5 Simple Script Requests
Post by: Arrow on February 22, 2008, 06:25:22 AM
...seriously? My messages keep coming up as all at once. Perhaps I've messed with a script and forgotten about it, I will check back on that.

And if you would do that script, I would most certainly love you for it, but please don't feel pressured if you don't want to. :3
Title: Re: 5 Simple Script Requests
Post by: modern algebra on February 22, 2008, 01:59:14 PM
I'm working on the animated facesets now. What I have is basically that for the regular graphic, it must have _a at the end of it, then the second should have _b after it. We'll see how that will work.
Title: Re: 5 Simple Script Requests
Post by: modern algebra on February 23, 2008, 06:13:51 AM
Sorry, I just read that you wanted -a and -b, not _a and _b, but unless you have serious objections, I think I will stick with the underscores. Anyway, here's what I have so far. I decided I would take your request and just go all out and make an Advanced Message System. Since I needed to overwrite a major method of Window_Message, my script would have been incompatible with pretty much any other message system, and I figured I could add in all those features, so why not?

Well, one reason why not is that I could easily have made mistakes. It might throw errors so I suggest you test it in a non-critical project, or a test project. I doubt anything will corrupt the entire project, but it won't hurt to be careful. Anyway yeah, there's a bunch of stuff in the code that you never asked for. Take a look in the comments for what those are.

Code: [Select]
#=======================================================================
#  Modern Algebra Message Script
#  Version 0.5
#  Author: modern algebra
#  February 22, 2008
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Special Thanks to:
#      Arrow-1 for the request. I loved the animated facesets idea
#      Zeriab for his regular expressions tutorial
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Current Features:
#     - Precise letter-by-letter timing control
#     - Animated Facesets
#     - Can play a sound effect with each letter drawn
#     - numerous additional codes - see below for all the codes
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Current Codes:
#     - \< Slows the speed at which the text is drawn
#     - \> Increases the speed at which the text is drawn
#     - \b bold text
#     - \i italicized text
#     - \name[text] name box
#     - \ne[enemy_id] name of enemy
#     - \ni[item_id] Name of item
#     - \nw[weapon_id] Name of weapon
#     - \na[armor_id] Name of Armor
#     - \pi[item_id] price of item
#     - \pw[weapon_id] price of weapon
#     - \pa[armor_id] price of Armor
#     - \icon[icon_index] draw icon assigned to icon_index
#     - \iicon[item_id] draw icon of item
#     - \wicon[weapon_id] draw icon of weapon
#     - \aicon[armor_id] draw icon of armor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Instructions:
#    Fill in the constants below for default settings. You can change pretty much all of these
#    constants in-game with the codes:
#
#        Message_Options.letter_by_letter_sound = true/false
#        Message_Options.message_se = 'filename'
#        Message_Options.default_timing = integer (lower = faster)
#        Message_Options.namebox_windowskin = 'Windowskin'
#        Message_Options.namebox_color = integer (0..32)
#        Message_Options.namebox_fontname = 'font name'
#        Message_Options.namebox_fontsize = 'Windowskin'
#        Message_Options.namebox_offset_x = integer
#        Message_Options.namebox_offset_y = integer
#        Message_Options.opacity = integer (0..255)
#
#  To use animated facesets, merely use a face graphic that ends with _a and you must have
#  another faceset with the same name but ending with _b.
#=======================================================================

module Message_Options
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Constants
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  DEFAULT_TIMING = 0 # The default amount of frames between each letter as it is drawn
  LETTER_BY_LETTER_SOUND = true # Whether there should be an SE played with each character drawn
  MESSAGE_SE = 'Open1' # The SE to be played if LETTER_BY_LETTER_SOUND == true
  ANIMATED_FACESETS = true  # true => active animated facesets; false => deactivated
  NAMEBOX_WINDOWSKIN = "Window" # The windowskin for the name box
  NAMEBOX_COLOR = 5 # The Color of the text in the namebox
  NAMEBOX_FONTNAME = 'Times New Roman' # The Font of the namebox
  NAMEBOX_FONTSIZE = 20 # The Size of the text in the namebox
  NAMEBOX_OFFSET_X = 16 # How much the Namebox is in the X direction away from default
  NAMEBOX_OFFSET_Y = 16 # How much the Namebox is in the Y direction away from default
  NAMEBOX_OPACITY = 100 # The opacity of the name box
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Message SE (Lazy Initialization)
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.message_se
    self.message_se = MESSAGE_SE if @message_se.nil?
    return @message_se
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Message SE =
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.message_se= (file_name)
    @message_se = RPG::SE.new  (file_name)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Message_SE_Active?
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.message_se_active?
    @letter_by_letter_sound = LETTER_BY_LETTER_SOUND if @letter_by_letter_sound.nil?
    return @letter_by_letter_sound 
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Letter BY Letter Sound =
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.letter_by_letter_sound= (boolean)
    @letter_by_letter_sound = boolean
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Windowskin
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_windowskin
    @namebox_windowskin = Cache.system (NAMEBOX_WINDOWSKIN) if @namebox_windowskin == nil
    return @namebox_windowskin
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Windowskin=
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_windowskin= (string)
    @namebox_windowskin = Cache.system (string)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Color
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_color
    @namebox_color = NAMEBOX_COLOR if @namebox_color == nil
    return @namebox_color
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Color=
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_color= (value)
    @namebox_color = value
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Fontname
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_fontname
    @namebox_font = NAMEBOX_FONTNAME if @namebox_font == nil
    return @namebox_font
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Fontname=
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_fontname= (string)
    @namebox_font = string
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Fontsize
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_fontsize
    @namebox_fontsize = NAMEBOX_FONTSIZE if @namebox_fontsize == nil
    return @namebox_fontsize
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Fontsize=
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_fontsize= (value)
    @namebox_fontsize = value
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Offset X
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_offset_x
    @namebox_x = NAMEBOX_OFFSET_X if @namebox_x == nil
    return @namebox_x
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Offset X=
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_offset_x= (value)
    @namebox_x = value
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Offset Y
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_offset_y
    @namebox_y = NAMEBOX_OFFSET_Y if @namebox_y == nil
    return @namebox_y
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Offset Y=
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_offset_y= (value)
    @namebox_y = value
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Opacity
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_opacity
    @namebox_opacity = NAMEBOX_OPACITY if @namebox_opacity == nil
    return @namebox_opacity
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Opacity=
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_opacity= (value)
    @namebox_opacity = value
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Default timing
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.default_timing
    @default_timing = DEFAULT_TIMING if @default_timing == nil
    return @default_timing
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Default Timing =
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.default_timing= (value)
    value = [value, 0].max
    @default_timing = value
  end
end

module Sound
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Play Message SE
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.play_message_se
    Message_Options.message_se.play
  end
end

#======================================================================
# ** Sprite Message Face
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  A sprite to reduce lag when using Animated  Facesets
#======================================================================

class Sprite_MessageFace < Sprite_Base
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize (face_file, face_index = 0, size = 96, single = false)
    super ()
    self.visible = false
    self.z = 250
    face = Cache.face (face_file)
    if single
      self.bitmap = face
    else
      self.bitmap = Bitmap.new (face.width / 4, face.height / 2)
      rect = Rect.new(0, 0, 0, 0)
      rect.x = face_index %  4* 96 + (96 - size) / 2
      rect.y = face_index / 4 * 96 + (96 - size) / 2
      rect.width = size
      rect.height = size
      self.bitmap.blt(x, y, face, rect)
      face.dispose
    end
  end
end

#========================================================================
# ** Window Name Box
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  This window displays the name of a speaker in Window_Message
#========================================================================

class Window_NameBox < Window_Base
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize (x, y, string)
    temp_bitmap = Bitmap.new (1, 1)
    temp_bitmap.font.name = Message_Options.namebox_fontname
    temp_bitmap.font.size = Message_Options.namebox_fontsize
    rect = temp_bitmap.text_size (string)
    temp_bitmap.dispose
    super (x, y, rect.width + 32, rect.height + 32)
    self.z = 300
    create_contents
    # Use Namebox settings
    self.back_opacity = Message_Options.namebox_opacity
    self.windowskin = Message_Options.namebox_windowskin
    self.contents.font.name = Message_Options.namebox_fontname
    self.contents.font.size = Message_Options.namebox_fontsize
    self.contents.font.color = text_color(Message_Options.namebox_color)
    # Draw the text
    self.contents.draw_text (0, 0, rect.width, rect.height, string)
  end
end

#======================================================================
# ** Window_Message
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of changes:
#     Basically, this script changes the way letter-by-letter works in order to allow for various
#     options: namely speed variability, sound effects, and animated facesets
#
#     aliased method - convert_special_characters
#     overwritten methods - update_message
#======================================================================

class Window_Message < Window_Selectable
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Convert Special Characters
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_msg_script_special_char_conversion convert_special_characters
  def  convert_special_characters
    # New codes
    modalg_msg_script_special_char_conversion
    @text.gsub!(/\\NE\[([0-9]+)\]/i) { $data_enemies[$1.to_i].name } # Name Enemy
    @text.gsub!(/\\NI\[([0-9]+)\]/i) { $data_items[$1.to_i].name }   # Name Item
    @text.gsub!(/\\NW\[([0-9]+)\]/i) { $data_weapons[$1.to_i].name } # Name Weapon
    @text.gsub!(/\\NA\[([0-9]+)\]/i) { $data_armors[$1.to_i].name } # Name Armor
    @text.gsub!(/\\PI\[([0-9]+)\]/i) { $data_items[$1.to_i].price.to_s } # Price Item
    @text.gsub!(/\\PW\[([0-9]+)\]/i) { $data_weapons[$1.to_i].price.to_s } # Price Weapon
    @text.gsub!(/\\PA\[([0-9]+)\]/i) { $data_armors[$1.to_i].price.to_s } # Price Armor
    @text.gsub! (/\\IICON\[([0-9]+)\]/i) { "\x10[#{$data_items[$1.to_i].icon_index}]" } # Icon Item
    @text.gsub! (/\\WICON\[([0-9]+)\]/i) { "\x10[#{$data_weapons[$1.to_i].icon_index}]" } # Icon Weapon
    @text.gsub! (/\\AICON\[([0-9]+)\]/i) { "\x10[#{$data_armors[$1.to_i].icon_index}]" } # Icon Armor
    # Retrieve Name
    name = @text[/\\NAME\[.*?\]/i]
    name.sub! (/\\NAME/i, '') unless name == nil
    @text.gsub! (/\\NAME\[.*?\]/i) { "\x09#{name}" } # Name Window
    @text.gsub! (/\\ICON\[([0-9]+)\]/i) { "\x10[#{$1}]" } # Icon
    @text.gsub!(/\\B/i) { "\x11" } # Bold
    @text.gsub!(/\\I/i) { "\x12" } # Italic
    # Run original script
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_msg_script_init initialize
  def initialize
    # Run original method
    modalg_msg_script_init
    @letter_timing = Message_Options.default_timing
    @face_sprites = []
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * New Page
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def new_page
    contents.clear
    if $game_message.face_name.empty?
      @contents_x = 0
    else
      @face_sprites.clear
      name = $game_message.face_name.dup
      index = $game_message.face_index
      # Determine if the face is a single graphic
      single = name[/^\$/] != nil
      face = Sprite_MessageFace.new (name, index, 96, single)
      face.x = self.x + 16
      face.y = self.y + 16
      face.visible = true
      @face_sprites.push (face)
      @current_face = 0
      unless name[/\_a$/i] == nil
        name.gsub! (/\_a$/i) {|s| s = '_b'}
        face = Sprite_MessageFace.new (name, index, 96, single)
        face.x = self.x + 16
        face.y = self.y + 16
        @face_sprites.push (face)
      end
      @contents_x = 112
    end
    @contents_y = 0
    @line_count = 0
    @show_fast = false
    @line_show_fast = false
    @pause_skip = false
    contents.font.color = text_color(0)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Message
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   def update_message
     loop do
      @wait_count = Message_Options.default_timing
      c = @text.slice!(/./m)            # ???????
      case c
      when nil                          # ??????????
        finish_message                  # ????
        break
      when "\x00"                       # ??
        new_line
        if @line_count >= MAX_LINE      # ????????
          unless @text.empty?           # ??????????
            self.pause = true           # ????????
            break
          end
        end
        break
      when "\x01"                       # \C[n]  (?????)
        @text.sub!(/\[([0-9]+)\]/, "")
        contents.font.color = text_color($1.to_i)
        next
      when "\x02"                       # \G  (?????)
        @gold_window.refresh
        @gold_window.open
      when "\x03"                       # \.  (???? 1/4 ?)
        @wait_count = 15
        break
      when "\x04"                       # \|  (???? 1 ?)
        @wait_count = 60
        break
      when "\x05"                       # \!  (????)
        self.pause = true
      when "\x06"                       # \>  (???? ON)
        @letter_timing -= 1
        @letter_timing = 0 if @letter_timing < 0
      when "\x07"                       # \<  (???? OFF)
        @letter_timing += 1
      when "\x08"                       # \^  (??????)
        @pause_skip = true
      when "\x09"                       # \name Name Box
        name = @text[/\[.*?\]/]
        @text.sub!(/\[.*?\]/, "")
        name = name[1, name.size - 2]
        x = self.x + Message_Options.namebox_offset_x
        y = self.y + Message_Options.namebox_offset_y
        @name_window = Window_NameBox.new (x, y, name)
        @name_window.y -= @name_window.height
      when "\x10"                      # \icon Shows an icon
        @text.sub!(/\[([0-9]+)\]/, "")
        draw_icon ($1.to_i, @contents_x, @contents_y)
        @contents_x += 24
        @wait_count += @letter_timing
      when "\x11"                       # \b Bold
        # Toggle Bold
        self.contents.font.bold = self.contents.font.bold ? false : true
      when "\x12"                       # \i Italic           
        # Toggle Italic
        self.contents.font.italic = self.contents.font.italic ? false : true
      else                              # ?????
        contents.draw_text(@contents_x, @contents_y, 40, WLH, c)
        c_width = contents.text_size(c).width
        @contents_x += c_width
        Sound.play_message_se if Message_Options.message_se_active?
        @wait_count += @letter_timing
        # Switch Facesets
        if Message_Options::ANIMATED_FACESETS && @face_sprites.size > 1
          @face_sprites[@current_face].visible = false
          @current_face += 1
          @current_face %= @face_sprites.size
          @face_sprites[@current_face].visible = true
        end
      end
      break unless @show_fast or @line_show_fast
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Finish Message
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_msg_script_message_fin finish_message
  def finish_message
    # Show initial face
    unless @face_sprites.empty?
      @face_sprites[@current_face].visible = false
      @current_face = 0
      @face_sprites[0].visible = true
    end
    @letter_timing = Message_Options.default_timing
    modalg_msg_script_message_fin
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Terminate Message
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_msg_script_message_term terminate_message
  def terminate_message
    self.contents.font.bold = false
    self.contents.font.italic = false
    modalg_msg_script_message_term
    @face_sprites.each {|face| face.dispose}
    @name_window.dispose unless @name_window.nil? || @name_window.disposed?
    @face_sprites.clear
  end
end
Title: Re: 5 Simple Script Requests
Post by: forgottenpains on February 23, 2008, 12:31:00 PM
Hi, I'm new and I've got request :3 How about an ATB system? Active Time Battle System... Like in Final Fantasy. :D
Title: Re: 5 Simple Script Requests
Post by: modern algebra on February 23, 2008, 01:03:15 PM
Battle Systems are a pain in the ass, unfortunately. Maybe some other time.
Title: Re: 5 Simple Script Requests
Post by: ahref on February 29, 2008, 11:50:11 PM
Ill try to describe my problem:

in my game for vx i want randomly moving boats these are made as events but continuously end up on my land masses.

so my request is a script that prevents this from happening.I would like the boats only to be able to travel on water tiles.

i believe this is fairly simple

thanks
Title: Re: 5 Simple Script Requests
Post by: modern algebra on March 01, 2008, 03:15:17 AM
Yeah, it's probably not so hard, but I always find it weird to work with events. I would suggest making pseudorandom boats. Give them seemingly random movement through Custom Move Route. However, since this is a script request topic I suppose I can pull it off. Give me a little bit. How do you want to identify boats by the way?

EDIT::

Alright, here's a script:

Code: [Select]
#========================================================================
# ** Game_Event
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#      aliased method - initialize
#      super methods changed - passable?
#========================================================================

class Game_Event < Game_Character
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #     map_id : map ID
  #     event  : event object (RPG::Event)
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_boat_random_movement_init initialize
  def initialize(map_id, event)
    # Run Original Method
    modalg_boat_random_movement_init (map_id, event)
    @boat_object = @event.name[/\\BOAT/i] != nil
    @ship_object = @event.name[/\\SHIP/i] != nil
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Passable?
  #       x : the x coordinate of the square being tested
  #       y : the y coordinate of the square being tested
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def passable? (x, y)
    return false if collide_with_characters? (x, y)
    if @ship_object
      return $game_map.ship_passable? (x, y)
    elsif @boat_object
      return $game_map.boat_passable? (x, y)
    end
    return super (x, y)
  end
end

Like I said, pseudorandom is going to be better because there is a possibilty that a randomly moving boat will continually try to move towards land, and it will make it look stationary. In any case, it ought to keep the little guy from getting onto land. To identify any given event as being a ship or a boat, just type \boat or \ship (captialization doesn't matter) as some part of the name of the event. So, if you name an event:

\boat Captain Amos, then it will be identified as a boat and adhere to passability of boats. If it is named \ship Captain Amos, it will identify as a ship and will adhere to rules regarding ships. If named \boatCaptain Amos\ShIp, it will identify as ship since ship has priority over boat. I would do airship as well, but it seems to me that clicking the Through Box would be enough.
Title: Re: 5 Simple Script Requests
Post by: Arrow on March 01, 2008, 04:06:26 AM
Sorry, I just read that you wanted -a and -b, not _a and _b, but unless you have serious objections, I think I will stick with the underscores. Anyway, here's what I have so far. I decided I would take your request and just go all out and make an Advanced Message System. Since I needed to overwrite a major method of Window_Message, my script would have been incompatible with pretty much any other message system, and I figured I could add in all those features, so why not?

Well, one reason why not is that I could easily have made mistakes. It might throw errors so I suggest you test it in a non-critical project, or a test project. I doubt anything will corrupt the entire project, but it won't hurt to be careful. Anyway yeah, there's a bunch of stuff in the code that you never asked for. Take a look in the comments for what those are.

Code: [Select]
#=======================================================================
#  Modern Algebra Message Script
#  Version 0.5
#  Author: modern algebra
#  February 22, 2008
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Special Thanks to:
#      Arrow-1 for the request. I loved the animated facesets idea
#      Zeriab for his regular expressions tutorial
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Current Features:
#     - Precise letter-by-letter timing control
#     - Animated Facesets
#     - Can play a sound effect with each letter drawn
#     - numerous additional codes - see below for all the codes
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Current Codes:
#     - \< Slows the speed at which the text is drawn
#     - \> Increases the speed at which the text is drawn
#     - \b bold text
#     - \i italicized text
#     - \name[text] name box
#     - \ne[enemy_id] name of enemy
#     - \ni[item_id] Name of item
#     - \nw[weapon_id] Name of weapon
#     - \na[armor_id] Name of Armor
#     - \pi[item_id] price of item
#     - \pw[weapon_id] price of weapon
#     - \pa[armor_id] price of Armor
#     - \icon[icon_index] draw icon assigned to icon_index
#     - \iicon[item_id] draw icon of item
#     - \wicon[weapon_id] draw icon of weapon
#     - \aicon[armor_id] draw icon of armor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Instructions:
#    Fill in the constants below for default settings. You can change pretty much all of these
#    constants in-game with the codes:
#
#        Message_Options.letter_by_letter_sound = true/false
#        Message_Options.message_se = 'filename'
#        Message_Options.default_timing = integer (lower = faster)
#        Message_Options.namebox_windowskin = 'Windowskin'
#        Message_Options.namebox_color = integer (0..32)
#        Message_Options.namebox_fontname = 'font name'
#        Message_Options.namebox_fontsize = 'Windowskin'
#        Message_Options.namebox_offset_x = integer
#        Message_Options.namebox_offset_y = integer
#        Message_Options.opacity = integer (0..255)
#
#  To use animated facesets, merely use a face graphic that ends with _a and you must have
#  another faceset with the same name but ending with _b.
#=======================================================================

module Message_Options
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Constants
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  DEFAULT_TIMING = 0 # The default amount of frames between each letter as it is drawn
  LETTER_BY_LETTER_SOUND = true # Whether there should be an SE played with each character drawn
  MESSAGE_SE = 'Open1' # The SE to be played if LETTER_BY_LETTER_SOUND == true
  ANIMATED_FACESETS = true  # true => active animated facesets; false => deactivated
  NAMEBOX_WINDOWSKIN = "Window" # The windowskin for the name box
  NAMEBOX_COLOR = 5 # The Color of the text in the namebox
  NAMEBOX_FONTNAME = 'Times New Roman' # The Font of the namebox
  NAMEBOX_FONTSIZE = 20 # The Size of the text in the namebox
  NAMEBOX_OFFSET_X = 16 # How much the Namebox is in the X direction away from default
  NAMEBOX_OFFSET_Y = 16 # How much the Namebox is in the Y direction away from default
  NAMEBOX_OPACITY = 100 # The opacity of the name box
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Message SE (Lazy Initialization)
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.message_se
    self.message_se = MESSAGE_SE if @message_se.nil?
    return @message_se
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Message SE =
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.message_se= (file_name)
    @message_se = RPG::SE.new  (file_name)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Message_SE_Active?
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.message_se_active?
    @letter_by_letter_sound = LETTER_BY_LETTER_SOUND if @letter_by_letter_sound.nil?
    return @letter_by_letter_sound 
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Letter BY Letter Sound =
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.letter_by_letter_sound= (boolean)
    @letter_by_letter_sound = boolean
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Windowskin
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_windowskin
    @namebox_windowskin = Cache.system (NAMEBOX_WINDOWSKIN) if @namebox_windowskin == nil
    return @namebox_windowskin
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Windowskin=
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_windowskin= (string)
    @namebox_windowskin = Cache.system (string)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Color
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_color
    @namebox_color = NAMEBOX_COLOR if @namebox_color == nil
    return @namebox_color
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Color=
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_color= (value)
    @namebox_color = value
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Fontname
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_fontname
    @namebox_font = NAMEBOX_FONTNAME if @namebox_font == nil
    return @namebox_font
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Fontname=
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_fontname= (string)
    @namebox_font = string
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Fontsize
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_fontsize
    @namebox_fontsize = NAMEBOX_FONTSIZE if @namebox_fontsize == nil
    return @namebox_fontsize
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Fontsize=
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_fontsize= (value)
    @namebox_fontsize = value
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Offset X
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_offset_x
    @namebox_x = NAMEBOX_OFFSET_X if @namebox_x == nil
    return @namebox_x
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Offset X=
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_offset_x= (value)
    @namebox_x = value
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Offset Y
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_offset_y
    @namebox_y = NAMEBOX_OFFSET_Y if @namebox_y == nil
    return @namebox_y
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Offset Y=
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_offset_y= (value)
    @namebox_y = value
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Opacity
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_opacity
    @namebox_opacity = NAMEBOX_OPACITY if @namebox_opacity == nil
    return @namebox_opacity
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * NameBox Opacity=
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.namebox_opacity= (value)
    @namebox_opacity = value
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Default timing
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.default_timing
    @default_timing = DEFAULT_TIMING if @default_timing == nil
    return @default_timing
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Default Timing =
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.default_timing= (value)
    value = [value, 0].max
    @default_timing = value
  end
end

module Sound
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Play Message SE
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.play_message_se
    Message_Options.message_se.play
  end
end

#======================================================================
# ** Sprite Message Face
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  A sprite to reduce lag when using Animated  Facesets
#======================================================================

class Sprite_MessageFace < Sprite_Base
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize (face_file, face_index = 0, size = 96, single = false)
    super ()
    self.visible = false
    self.z = 250
    face = Cache.face (face_file)
    if single
      self.bitmap = face
    else
      self.bitmap = Bitmap.new (face.width / 4, face.height / 2)
      rect = Rect.new(0, 0, 0, 0)
      rect.x = face_index %  4* 96 + (96 - size) / 2
      rect.y = face_index / 4 * 96 + (96 - size) / 2
      rect.width = size
      rect.height = size
      self.bitmap.blt(x, y, face, rect)
      face.dispose
    end
  end
end

#========================================================================
# ** Window Name Box
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  This window displays the name of a speaker in Window_Message
#========================================================================

class Window_NameBox < Window_Base
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize (x, y, string)
    temp_bitmap = Bitmap.new (1, 1)
    temp_bitmap.font.name = Message_Options.namebox_fontname
    temp_bitmap.font.size = Message_Options.namebox_fontsize
    rect = temp_bitmap.text_size (string)
    temp_bitmap.dispose
    super (x, y, rect.width + 32, rect.height + 32)
    self.z = 300
    create_contents
    # Use Namebox settings
    self.back_opacity = Message_Options.namebox_opacity
    self.windowskin = Message_Options.namebox_windowskin
    self.contents.font.name = Message_Options.namebox_fontname
    self.contents.font.size = Message_Options.namebox_fontsize
    self.contents.font.color = text_color(Message_Options.namebox_color)
    # Draw the text
    self.contents.draw_text (0, 0, rect.width, rect.height, string)
  end
end

#======================================================================
# ** Window_Message
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of changes:
#     Basically, this script changes the way letter-by-letter works in order to allow for various
#     options: namely speed variability, sound effects, and animated facesets
#
#     aliased method - convert_special_characters
#     overwritten methods - update_message
#======================================================================

class Window_Message < Window_Selectable
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Convert Special Characters
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_msg_script_special_char_conversion convert_special_characters
  def  convert_special_characters
    # New codes
    modalg_msg_script_special_char_conversion
    @text.gsub!(/\\NE\[([0-9]+)\]/i) { $data_enemies[$1.to_i].name } # Name Enemy
    @text.gsub!(/\\NI\[([0-9]+)\]/i) { $data_items[$1.to_i].name }   # Name Item
    @text.gsub!(/\\NW\[([0-9]+)\]/i) { $data_weapons[$1.to_i].name } # Name Weapon
    @text.gsub!(/\\NA\[([0-9]+)\]/i) { $data_armors[$1.to_i].name } # Name Armor
    @text.gsub!(/\\PI\[([0-9]+)\]/i) { $data_items[$1.to_i].price.to_s } # Price Item
    @text.gsub!(/\\PW\[([0-9]+)\]/i) { $data_weapons[$1.to_i].price.to_s } # Price Weapon
    @text.gsub!(/\\PA\[([0-9]+)\]/i) { $data_armors[$1.to_i].price.to_s } # Price Armor
    @text.gsub! (/\\IICON\[([0-9]+)\]/i) { "\x10[#{$data_items[$1.to_i].icon_index}]" } # Icon Item
    @text.gsub! (/\\WICON\[([0-9]+)\]/i) { "\x10[#{$data_weapons[$1.to_i].icon_index}]" } # Icon Weapon
    @text.gsub! (/\\AICON\[([0-9]+)\]/i) { "\x10[#{$data_armors[$1.to_i].icon_index}]" } # Icon Armor
    # Retrieve Name
    name = @text[/\\NAME\[.*?\]/i]
    name.sub! (/\\NAME/i, '') unless name == nil
    @text.gsub! (/\\NAME\[.*?\]/i) { "\x09#{name}" } # Name Window
    @text.gsub! (/\\ICON\[([0-9]+)\]/i) { "\x10[#{$1}]" } # Icon
    @text.gsub!(/\\B/i) { "\x11" } # Bold
    @text.gsub!(/\\I/i) { "\x12" } # Italic
    # Run original script
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_msg_script_init initialize
  def initialize
    # Run original method
    modalg_msg_script_init
    @letter_timing = Message_Options.default_timing
    @face_sprites = []
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * New Page
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def new_page
    contents.clear
    if $game_message.face_name.empty?
      @contents_x = 0
    else
      @face_sprites.clear
      name = $game_message.face_name.dup
      index = $game_message.face_index
      # Determine if the face is a single graphic
      single = name[/^\$/] != nil
      face = Sprite_MessageFace.new (name, index, 96, single)
      face.x = self.x + 16
      face.y = self.y + 16
      face.visible = true
      @face_sprites.push (face)
      @current_face = 0
      unless name[/\_a$/i] == nil
        name.gsub! (/\_a$/i) {|s| s = '_b'}
        face = Sprite_MessageFace.new (name, index, 96, single)
        face.x = self.x + 16
        face.y = self.y + 16
        @face_sprites.push (face)
      end
      @contents_x = 112
    end
    @contents_y = 0
    @line_count = 0
    @show_fast = false
    @line_show_fast = false
    @pause_skip = false
    contents.font.color = text_color(0)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Message
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   def update_message
     loop do
      @wait_count = Message_Options.default_timing
      c = @text.slice!(/./m)            # ???????
      case c
      when nil                          # ??????????
        finish_message                  # ????
        break
      when "\x00"                       # ??
        new_line
        if @line_count >= MAX_LINE      # ????????
          unless @text.empty?           # ??????????
            self.pause = true           # ????????
            break
          end
        end
        break
      when "\x01"                       # \C[n]  (?????)
        @text.sub!(/\[([0-9]+)\]/, "")
        contents.font.color = text_color($1.to_i)
        next
      when "\x02"                       # \G  (?????)
        @gold_window.refresh
        @gold_window.open
      when "\x03"                       # \.  (???? 1/4 ?)
        @wait_count = 15
        break
      when "\x04"                       # \|  (???? 1 ?)
        @wait_count = 60
        break
      when "\x05"                       # \!  (????)
        self.pause = true
      when "\x06"                       # \>  (???? ON)
        @letter_timing -= 1
        @letter_timing = 0 if @letter_timing < 0
      when "\x07"                       # \<  (???? OFF)
        @letter_timing += 1
      when "\x08"                       # \^  (??????)
        @pause_skip = true
      when "\x09"                       # \name Name Box
        name = @text[/\[.*?\]/]
        @text.sub!(/\[.*?\]/, "")
        name = name[1, name.size - 2]
        x = self.x + Message_Options.namebox_offset_x
        y = self.y + Message_Options.namebox_offset_y
        @name_window = Window_NameBox.new (x, y, name)
        @name_window.y -= @name_window.height
      when "\x10"                      # \icon Shows an icon
        @text.sub!(/\[([0-9]+)\]/, "")
        draw_icon ($1.to_i, @contents_x, @contents_y)
        @contents_x += 24
        @wait_count += @letter_timing
      when "\x11"                       # \b Bold
        # Toggle Bold
        self.contents.font.bold = self.contents.font.bold ? false : true
      when "\x12"                       # \i Italic           
        # Toggle Italic
        self.contents.font.italic = self.contents.font.italic ? false : true
      else                              # ?????
        contents.draw_text(@contents_x, @contents_y, 40, WLH, c)
        c_width = contents.text_size(c).width
        @contents_x += c_width
        Sound.play_message_se if Message_Options.message_se_active?
        @wait_count += @letter_timing
        # Switch Facesets
        if Message_Options::ANIMATED_FACESETS && @face_sprites.size > 1
          @face_sprites[@current_face].visible = false
          @current_face += 1
          @current_face %= @face_sprites.size
          @face_sprites[@current_face].visible = true
        end
      end
      break unless @show_fast or @line_show_fast
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Finish Message
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_msg_script_message_fin finish_message
  def finish_message
    # Show initial face
    unless @face_sprites.empty?
      @face_sprites[@current_face].visible = false
      @current_face = 0
      @face_sprites[0].visible = true
    end
    @letter_timing = Message_Options.default_timing
    modalg_msg_script_message_fin
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Terminate Message
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_msg_script_message_term terminate_message
  def terminate_message
    self.contents.font.bold = false
    self.contents.font.italic = false
    modalg_msg_script_message_term
    @face_sprites.each {|face| face.dispose}
    @name_window.dispose unless @name_window.nil? || @name_window.disposed?
    @face_sprites.clear
  end
end

Post was deleted, but in summation: THANKS! Very much appreciated, good buddy! I owe you a song or something.
Title: Re: 5 Simple Script Requests
Post by: modern algebra on March 01, 2008, 04:12:29 AM
Not a problem. I should be thanking you for the idea.  :lol:
Title: Re: 5 Simple Script Requests
Post by: ahref on March 01, 2008, 01:40:39 PM
thanks thats perfect :D
Title: Re: 5 Simple Script Requests
Post by: Arrow on March 04, 2008, 03:57:19 AM
Modern, another thought: could you restore a few functions from RM2K3 as well? Namely the text pausing functions? They went like this:

\! = Text waits until the user presses a key
\. = Text waits a fourth of a second

I think that's how it worked anyway...and I think there was also a command for:

\|

but I can't remember it.

But yes, if it wouldn't be too much trouble, I'd be immensely thankful!
Title: Re: 5 Simple Script Requests
Post by: modern algebra on March 04, 2008, 01:35:59 PM
They're already built in.
Title: Re: 5 Simple Script Requests
Post by: Arrow on March 04, 2008, 11:02:52 PM
Oh snap, they are!

Okay I am totally not gonna bug you for a long time now, thanks a lot!
Title: Re: 5 Simple Script Requests
Post by: modern algebra on March 05, 2008, 03:41:50 PM
No worries, I enjoy being bugged :P
Title: Re: 5 Simple Script Requests
Post by: modern algebra on April 05, 2008, 07:41:05 PM
Revival! There are still 3 requests to be made. And, ahref and Arrow, if you guys want another script made, feel free to make one more request, despite my rules :P

And lol, putting a strike through the number 4 makes absolutely no visual difference
Title: Re: 3 Simple Script Requests
Post by: Zeriab on April 06, 2008, 10:21:29 AM
I want a pathfinding script :X
Title: Re: 3 Simple Script Requests
Post by: modern algebra on April 06, 2008, 04:33:20 PM
Oh, all right I'll get on it.

What did you mean when you said hierarchical? That it evaluates all possible paths to take and chooses the best?
Title: Re: 3 Simple Script Requests
Post by: Zeriab on April 06, 2008, 05:06:25 PM
I was kidding modern. I forgot how extremely simple the request is :V
Feel free to have fun with it if you want. And no, when I said hierarchical (which I didn't in the request), I meant an hierarchical ordering of more and more abstract search spaces with the lowest level being the normal search space.
Title: Re: 3 Simple Script Requests
Post by: ahref on April 06, 2008, 08:15:37 PM
oo yay i needed a pathfinding also. Im fed up with the move event dialog.
Title: Re: 3 Simpre Script Requests
Post by: worale on April 06, 2008, 10:15:47 PM
I saw pathfinding at RRR rong time ago,
I'm not sure if this wirr work tho :p

http://www.rpgrevolution.com/forums/?showtopic=8710
Title: Re: 3 Simpre Script Requests
Post by: Zeriab on April 06, 2008, 10:20:44 PM
Bah, I tried to fix your link but failed.
It does not lead to the correct place right now -_-
Title: Re: 3 Simpre Script Requests
Post by: modern algebra on April 06, 2008, 10:23:22 PM
Nothing does since 1 was removed from the a1phabet

Just copy it into address bar and change r to 1 (the 1etter)
Title: Re: 3 Simple Script Requests
Post by: worale on April 07, 2008, 02:04:44 AM
Yeah, I don't know what happens, but this forum is somehow change alphabet

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fhavenworks.com%2Fimages%2Flanguages%2Falphabet%2Fletter%2Falphabet-letter%2FL-Alphabet-Letter-L.gif&hash=173617db494136ff04c019ec6fb83bfed326b23c) to r
Title: Re: 3 Simple Script Requests
Post by: modern algebra on April 07, 2008, 05:04:49 AM
Yeah, it was just a gag. It's back to normal now.
Title: Re: 3 Simple Script Requests
Post by: Zeriab on April 07, 2008, 08:35:16 AM
There, fixed :3
Title: Re: 2 Simple Script Requests
Post by: Falcon on May 09, 2008, 11:19:03 AM
Do not bump a month old topic, make your down damn topic.