Aldeia RPG

Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Suporte ao desenvolvimento de jogos


3 participantes

    Email estilo ff7 cc

    Link
    Link
    Membro Ativo
    Membro Ativo


    Mensagens : 307
    Créditos : 35

    Email estilo ff7 cc Empty Email estilo ff7 cc

    Mensagem por Link Dom Fev 05, 2012 6:35 pm

    INTRODUÇÃO
    Esse script permite que você receba mails estilo final fantasy 7 chrsis core.
    Instruçoes:
    Voce precisara editar as linhas a partir 95, 114, 136, 156
    lembrando q a cada linha adicionada as outras mudarao entao veja cada linha primeiro e depois edite.
    Scren:
    Email estilo ff7 cc 2r6037r
    Creditos:

    COZZIEKUNS por criar
    Leo639 por traduzir algumas partes e postar aqui para voces junto com um tutorial que eu mesmo criei.
    E por mim por apresentar a aldeia rpg
    Código:

    [justify]#===============================================================================
    #
    # Cozziekuns' Simple Mail System
    # Last Date Updated: 5/13/2010
    #
    # A simple mail system akin to the one in Final Fantasy VII: Crisis Core, and
    # Final Fantasy III DS.
    #
    #===============================================================================
    # Updates
    # -----------------------------------------------------------------------------
    # o 06/28/10 - Rewrote some code, seeing as it was pretty sloppy.
    # o 06/14/10 - Changed the Switch function around a bit
    # o 05/13/10 - Created Script
    #===============================================================================
    # What's to come?
    # -----------------------------------------------------------------------------
    # o A lot of things. Probably too many to count.
    # o For example, a deleting system?
    # o Attachments...
    # o More than one page...
    # o The list goes on.
    #===============================================================================
    # Instructions
    # -----------------------------------------------------------------------------
    # To install this script, open up your script editor and copy/paste this script
    # to an open slot below ? Materials but above ? Main. Remember to save. You can
    # edit the modules as you wish.
    #
    # Special codes can be input into messages at any time, thanks to Modern
    # Algebra's Special Codes Formatter. Just use:
    #
    #  \n - line break to next paragraph (Note the single \, NOT \\)
    #      [url=http://www.aldeiarpgbr.com/file://\\v[x]\\v[x[/url]] - Shows the value located in the variable x
    #      [url=http://www.aldeiarpgbr.com/file://\\n[x]\\n[x[/url]] - Shows the name of the Actor with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\c[x]\\c[x[/url]] - Changes the colour of the text to x. x can be 0 - 31
    #      [url=http://www.aldeiarpgbr.com/file://\\c[#hex]\\c[#hex[/url]] - Changes the colour of text to the hex value
    #      \\ - \
    #      [url=http://www.aldeiarpgbr.com/file://\\pid[x]\\pid[x[/url]] - Shows Actor ID of Party Member in position X (0-3)
    #      [url=http://www.aldeiarpgbr.com/file://\\nc[x]\\nc[x[/url]]- Shows the name of class with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\np[x]\\np[x[/url]]- Shows the name of the Party Member with index x
    #      [url=http://www.aldeiarpgbr.com/file://\\ne[x]\\ne[x[/url]]- Shows the name of Event with ID x on the map
    #      [url=http://www.aldeiarpgbr.com/file://\\nm[x]\\nm[x[/url]]- Shows the name of Monster with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\ni[x]\\ni[x[/url]]- Shows the name of Item with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\nw[x]\\nw[x[/url]]- Shows the name of Weapon with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\na[x]\\na[x[/url]]- Shows the name of Armour with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\pi[x]\\pi[x[/url]]- Shows the price of Item with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\pw[x]\\pw[x[/url]]- Shows the price of Weapon with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\pa[x]\\pa[x[/url]]- Shows the price of Armour with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\iicon[x]\\iicon[x[/url]] - Shows the Icon of Item with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\wicon[x]\\wicon[x[/url]] - Shows the Icon of Weapon with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\aicon[x]\\aicon[x[/url]] - Shows the Icon of Armour with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\icon[x]\\icon[x[/url]] - Shows the Icon with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\vocab[value]\\vocab[value[/url]] - prints vocab for that item type. Suitable values are:
    #                      level, level_a, hp, hp_a, mp, mp_a, atk, def, spi,
    #                      agi, weapon, armor1, armor2, armor3, armor4, weapon1,
    #                      weapon2, attack, skill, guard, item, equip, status, save,
    #                      game_end, fight, escape, new_game, shutdown, to_title,
    #                      continue, cancel, gold
    #      [url=http://www.aldeiarpgbr.com/file://\\f[key]\\f[key[/url]] - Show Filter phrase attached to key
    #      [url=http://www.aldeiarpgbr.com/file://\\b]\\b[/url] - Bold ON
    #      \/b - Bold OFF
    #      [url=http://www.aldeiarpgbr.com/file://\\i]\\i[/url] - Italic ON
    #      \/i - Italic OFF
    #      [url=http://www.aldeiarpgbr.com/file://\\u]\\u[/url] - Underline ON
    #      \/u - Underline OFF
    #      [url=http://www.aldeiarpgbr.com/file://\\s]\\s[/url] - Shadow ON
    #      \/s - Shadow OFF
    #      [url=http://www.aldeiarpgbr.com/file://\\hl[x]\\hl[x[/url]] - Highlights with color x. [url=http://www.aldeiarpgbr.com/file://\\hl]\\hl[/url] toggles off
    #      [url=http://www.aldeiarpgbr.com/file://\\ac[x]\\ac[x[/url]]- Shows class of actor with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\a...[x]\\a...[x[/url]] - Shows the ... of Actor X. ... can be any of the following:
    #                hp, maxhp, mp, maxmp, atk, def, spi, agi, exp_s, next_exp_s,
    #                next_rest_exp_s, level, weapon_id, armor1_id, armor2_id,
    #                armor3_id, armor4_id - and any other methods from Game_Actor.
    #      [url=http://www.aldeiarpgbr.com/file://\\c]\\c[/url] - Centres text
    #      [url=http://www.aldeiarpgbr.com/file://\\r]\\r[/url] - Sets right alignment to text
    #
    # Call with $scene = Scene_Mail.new
    #===============================================================================[/justify]
    [justify]$imported = {} if $imported == nil
    $imported["CozSimpleMailSystem"] = true[/justify]
    [justify]module COZZIEKUNS
      COMMAND_X = 0 # Where you want the command window to be.
      COMMAND_Y = 56 # Where you want the command window to be.
      COMMAND_WINDOWSKIN = "Window" # The windowskin you want your window to be in.
      ICONS = true # If you want to use icons or not.
      MAIL_LEFT = "E-mail:" # What shows up on the left of the top window.
      MAIL_RIGHT = "Caixa de Mensagens" # What shows up on the right of the top window.
      COMING_FROM_MENU = false # Whether or not your going to the mail system throug the menu.
     
      ICON_INDEX ={
    # Syntax: Vocab => Icon Number
      "Saudaçoes!" => 112,
      "Creditos!" => 112,
      }
    #===============================================================================
    # * Mail Command Instructions
    # -----------------------------------------------------------------------------
    # This array lets you order you mail. For example, an array of
    #
    # 151
    # 152
    #
    # Would show up as:
    #
    # "(151's Text)"
    # "(152's Text)"
    #
    #===============================================================================[/justify]
    [justify]  MAIL_COMMANDS =[
      151, # Saudaçoes
      152, # Creditos
    ][/justify]
    [justify]#===============================================================================
    # * Mail Data Instructions
    # -----------------------------------------------------------------------------
    # This hash lets you determine what you want to call your mail, as well as what
    # switch hides your mail. For example,
    #
    # 151 => [151, "Shop"]
    #
    # Would show up as
    #
    # Shop
    #
    # and could be hidden if the switch 151 is OFF.
    #
    #===============================================================================[/justify]
    [justify]  MAIL_DATA ={
    # Syntax: Switch ID, Text
      151 => [151, "Saudaçoes!"],
      152 => [152, "Creditos!"],
    }[/justify]
    [justify]  #--------------------------------------------------------------------------
      # * Command List
      #--------------------------------------------------------------------------
      def self.create_mail_data(id)
        from = " [url=http://www.aldeiarpgbr.com/file://\\c[18]Not]\\c[18]Not[/url] Specified\/c[0] "
        message = " [url=http://www.aldeiarpgbr.com/file://\\c[18]Not]\\c[18]Not[/url] Specified\/c[0] "
        date = " [url=http://www.aldeiarpgbr.com/file://\\c[18]Not]\\c[18]Not[/url] Specified\/c[0] "
        case id
    #===============================================================================
    # * Mail Data Instructions.
    # -----------------------------------------------------------------------------
    # All this holds is the data that goes in the mail. For example, in the demo
    # message, from is who the person is from, message is what's in the message, and
    # the date is, obviously the date.
    #
    #===============================================================================
        when 151
          from = "Leo"
          message = "There are a few new functions in Version 1.1 that probably don't mean much to you. Obviously, it uses [url=http://www.aldeiarpgbr.com/file://\\c[16]Paragraph]\\c[16]Paragraph[/url] Formatting\\c[0] now. Also, if you close the command window, you'll notice that it [url=http://www.aldeiarpgbr.com/file://\\bdoesn't\/b]\\bdoesn't\/b[/url] open and close anymore. That's because it created [url=http://www.aldeiarpgbr.com/file://\\blag\/b]\\blag\/b[/url] with [url=http://www.aldeiarpgbr.com/file://\\btoo]\\btoo[/url] many mail options\/b. Finally, the mail index is now stored and your cursor is [url=http://www.aldeiarpgbr.com/file://\\bredirected\/b]\\bredirected\/b[/url] to your last mail index upon arrival. \n \n ~ Leo"
          date = "6/26/2010"
        when 152
          from = "Leo"
          message = "Creditos a Cozziekuns por criar esse maravlhoso script e a mim [url=http://www.aldeiarpgbr.com/file://\\Leo639\/b]\\Leo639\/b[/url], [url=http://www.aldeiarpgbr.com/file://\\c[14]por]\\c[14]por[/url] traduzir\\c[0] e [url=http://www.aldeiarpgbr.com/file://\\udisponibilizar/\u]\\udisponibilizar/\u[/url] nos foruns brasileiros\n \n ~ Leo639"
          date = "6/26/2010"
        end
        return from, message, date
      end
    end[/justify]
    [justify]#==============================================================================
    # ** Window_MailTop
    #------------------------------------------------------------------------------
    #  This window displays a window that helps you out.
    #==============================================================================[/justify]
    [justify]class Window_MailTop < Window_Base
      #--------------------------------------------------------------------------
      # * Object Initialization
      #    x : window X coordinate
      #    y : window Y coordinate
      #--------------------------------------------------------------------------
      def initialize
        super(0, 0, 544, WLH + 32)
        refresh
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        self.contents.font.color = system_color
        self.contents.draw_text(4, 0, 544, WLH, COZZIEKUNS::MAIL_LEFT, 0)
        self.contents.font.color = normal_color
        self.contents.draw_text(4, 0, 500, WLH, COZZIEKUNS::MAIL_RIGHT, 2)
      end
    end[/justify]
    [justify]#==============================================================================
    # ** Window_MailSecond
    #------------------------------------------------------------------------------
    #  This class performs the Mail window processing.
    #==============================================================================
    #
    class Window_MailSecond < Window_Base
      #--------------------------------------------------------------------------
      # * Object Initialization
      #    x : window X coordinate
      #    y : window Y coordinate
      #--------------------------------------------------------------------------
      def initialize(mail_index)
        super(0, 0, 544, 416)
        @mail_index = mail_index
        @from, @message, @date = COZZIEKUNS.create_mail_data(mail_index)
        refresh
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        self.contents.font.color = system_color
        self.contents.draw_text(4, 0, 120, WLH, "From:", 0)
        self.contents.draw_text(4, WLH * 2, 120, WLH, "Message:", 0)
        self.contents.draw_text(4, WLH * 14, 120, WLH, "Date:", 0)
        self.contents.font.color = normal_color
        self.contents.draw_text(65, 0, 544, WLH, @from)
        formatter = Paragrapher::Formatter_SpecialCodes.new
        artist = Paragrapher::Artist_SpecialCodes.new
        specifications = 500
        pg = Paragrapher.new(formatter, artist)
        text_bitmap = pg.paragraph(@message, specifications)
        self.contents.blt(4, WLH * 3.5, text_bitmap, Rect.new(0, 0, text_bitmap.width, text_bitmap.height))
        self.contents.draw_text(65, WLH * 14, 544, WLH, @date)
      end
    end[/justify]
    [justify]#==============================================================================
    # ** Window_MailCommand
    #------------------------------------------------------------------------------
    #  This window displays the icons in the mail screen.
    #==============================================================================[/justify]
    [justify]class Window_MailCommand < Window_Command
      #--------------------------------------------------------------------------
      # * Draw Item
      #    index  : item number
      #    enabled : enabled flag. When false, draw semi-transparently.
      #--------------------------------------------------------------------------
      def draw_item(index, enabled = true)
        rect = item_rect(index)
        rect.x += 4
        rect.width -= 8
        rectx = rect.x
        recty = rect.y
        rectw = rect.width
        recth = rect.height
        self.contents.clear_rect(rect)
        self.contents.font.color = normal_color
        if COZZIEKUNS::ICON_INDEX.include?(@commands[index])
          icon = COZZIEKUNS::ICON_INDEX[@commands[index]]
        else
          icon = 0
        end
        draw_icon(icon, rectx, recty)
        self.contents.font.color.alpha = enabled ? 255 : 128
        self.contents.draw_text(rectx + 24, recty, rectw - 24, recth, @commands[index])
        rect = item_rect(index)
        rect.x += 4
        rect.width -= 8
      end
    end[/justify]
    [justify]#==============================================================================
    # ** Scene_Mail
    #------------------------------------------------------------------------------
    #  This class performs the mail screen processing.
    #==============================================================================[/justify]
    [justify]class Scene_Mail < Scene_Base
      #--------------------------------------------------------------------------
      # * Object Initialization
      #    menu_index : command cursor's initial position
      #--------------------------------------------------------------------------
      def initialize(menu_index = 0)
        @menu_index = menu_index
      end
      #--------------------------------------------------------------------------
      # * Start processing
      #--------------------------------------------------------------------------
      def start
        super
        create_menu_background
        create_command_window   
        @mailtop_window = Window_MailTop.new
      end
      #--------------------------------------------------------------------------
      # * Termination Processing
      #--------------------------------------------------------------------------
      def terminate
        super
        @mailtop_window.dispose
        @unread_window.dispose
        dispose_menu_background
      end
      #--------------------------------------------------------------------------
      # * Command List
      #--------------------------------------------------------------------------
      def create_command_list
        commands = []
        @ex_cmds = {}
        COZZIEKUNS::MAIL_COMMANDS.each_with_index { |c, i|
          case c
          when 0..999
            next unless COZZIEKUNS::MAIL_DATA.include?(c)
            mail_list = COZZIEKUNS::MAIL_DATA[c]
            next unless $game_switches[mail_list[0]]
            @ex_cmds[c] = commands.size
            commands.push(mail_list[1])
          end
          }
        return commands
      end
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update
        super
        @unread_window.update
        if @unread_window.active
          if Input.trigger?(Input::B)
            Sound.play_cancel
            if COZZIEKUNS::COMING_FROM_MENU
              $scene = Scene_Menu.new
            else
              $scene = Scene_Map.new
            end
          elsif Input.trigger?(Input::C)
            index = @unread_window.index
            for key in @ex_cmds
              if @ex_cmds[key[0]] == index
                return_check = false
                found_key = key[0]
                break
              end
            end
            if found_key == 0
              Sound.play_buzzer
            elsif found_key >= 0
              Sound.play_decision
              $scene = Scene_MailSecond.new(found_key, index)
            end
          end
        end
      end
      #--------------------------------------------------------------------------
      # * Create Command Window
      #--------------------------------------------------------------------------
      def create_command_window
        @unread_files = create_command_list
        if COZZIEKUNS::ICONS
          @unread_window = Window_MailCommand.new(544, @unread_files)
        else
          @unread_window = Window_Command.new(544, @unread_files)
        end
        @unread_window.index = @menu_index
        @unread_window.x = COZZIEKUNS::COMMAND_X
        @unread_window.y = COZZIEKUNS::COMMAND_Y
        @unread_window.height = 360
        @unread_window.windowskin = Cache.system(COZZIEKUNS::COMMAND_WINDOWSKIN)
      end
    end[/justify]
    [justify]#==============================================================================
    # ** Scene_MailSecond
    #------------------------------------------------------------------------------
    #  This class performs the bulk of the mail message.
    #==============================================================================[/justify]
    [justify]class Scene_MailSecond < Scene_Base
      #--------------------------------------------------------------------------
      # * Object Initialization
      #    actor_index : actor index
      #--------------------------------------------------------------------------
      def initialize(mail_index, index)
        @mail_index = mail_index
        @index = index
      end
      #--------------------------------------------------------------------------
      # * Start processing
      #--------------------------------------------------------------------------
      def start
        super
        create_menu_background
        @mailsecond_window = Window_MailSecond.new(@mail_index)
      end
      #--------------------------------------------------------------------------
      # * Termination Processing
      #--------------------------------------------------------------------------
      def terminate
        super
        dispose_menu_background
        @mailsecond_window.dispose
      end
      #--------------------------------------------------------------------------
      # * Return to Original Screen
      #--------------------------------------------------------------------------
      def return_scene
        $scene = Scene_Mail.new(@index)
      end
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update
        update_menu_background
        @mailsecond_window.update
        if Input.trigger?(Input::B)
          Sound.play_cancel
          return_scene
        end
        super
      end
    end[/justify]
    [justify]Codigos especiais:[/justify]
    [justify]Código: [Selecionar]
    #==============================================================================
    #    Special Codes Formatter (Addon for Paragraph Formatter 2.0)
    #    Version: 1.0
    #    Author: modern algebra (rmrk.net)
    #    Date: September 15, 2009
    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #  Description:
    #
    #    This is a formatter and artist combo that interprets and accounts for
    #  various special codes:
    #
    #      \n - line break to next paragraph (Note the single \, NOT \\)
    #      [url=http://www.aldeiarpgbr.com/file://\\v[x]\\v[x[/url]] - Shows the value located in the variable x
    #      [url=http://www.aldeiarpgbr.com/file://\\n[x]\\n[x[/url]] - Shows the name of the Actor with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\c[x]\\c[x[/url]] - Changes the colour of the text to x. x can be 0 - 31
    #      [url=http://www.aldeiarpgbr.com/file://\\c[#hex]\\c[#hex[/url]] - Changes the colour of text to the hex value
    #      \\ - \
    #      [url=http://www.aldeiarpgbr.com/file://\\pid[x]\\pid[x[/url]] - Shows Actor ID of Party Member in position X (0-3)
    #      [url=http://www.aldeiarpgbr.com/file://\\nc[x]\\nc[x[/url]]- Shows the name of class with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\np[x]\\np[x[/url]]- Shows the name of the Party Member with index x
    #      [url=http://www.aldeiarpgbr.com/file://\\ne[x]\\ne[x[/url]]- Shows the name of Event with ID x on the map
    #      [url=http://www.aldeiarpgbr.com/file://\\nm[x]\\nm[x[/url]]- Shows the name of Monster with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\ni[x]\\ni[x[/url]]- Shows the name of Item with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\nw[x]\\nw[x[/url]]- Shows the name of Weapon with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\na[x]\\na[x[/url]]- Shows the name of Armour with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\pi[x]\\pi[x[/url]]- Shows the price of Item with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\pw[x]\\pw[x[/url]]- Shows the price of Weapon with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\pa[x]\\pa[x[/url]]- Shows the price of Armour with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\iicon[x]\\iicon[x[/url]] - Shows the Icon of Item with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\wicon[x]\\wicon[x[/url]] - Shows the Icon of Weapon with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\aicon[x]\\aicon[x[/url]] - Shows the Icon of Armour with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\icon[x]\\icon[x[/url]] - Shows the Icon with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\vocab[value]\\vocab[value[/url]] - prints vocab for that item type. Suitable values are:
    #                      level, level_a, hp, hp_a, mp, mp_a, atk, def, spi,
    #                      agi, weapon, armor1, armor2, armor3, armor4, weapon1,
    #                      weapon2, attack, skill, guard, item, equip, status, save,
    #                      game_end, fight, escape, new_game, shutdown, to_title,
    #                      continue, cancel, gold
    #      [url=http://www.aldeiarpgbr.com/file://\\f[key]\\f[key[/url]] - Show Filter phrase attached to key
    #      [url=http://www.aldeiarpgbr.com/file://\\b]\\b[/url] - Bold ON
    #      \/b - Bold OFF
    #      [url=http://www.aldeiarpgbr.com/file://\\i]\\i[/url] - Italic ON
    #      \/i - Italic OFF
    #      [url=http://www.aldeiarpgbr.com/file://\\u]\\u[/url] - Underline ON
    #      \/u - Underline OFF
    #      [url=http://www.aldeiarpgbr.com/file://\\s]\\s[/url] - Shadow ON
    #      \/s - Shadow OFF
    #      [url=http://www.aldeiarpgbr.com/file://\\hl[x]\\hl[x[/url]] - Highlights with color x. [url=http://www.aldeiarpgbr.com/file://\\hl]\\hl[/url] toggles off
    #      [url=http://www.aldeiarpgbr.com/file://\\ac[x]\\ac[x[/url]]- Shows class of actor with ID x
    #      [url=http://www.aldeiarpgbr.com/file://\\a...[x]\\a...[x[/url]] - Shows the ... of Actor X. ... can be any of the following:
    #                hp, maxhp, mp, maxmp, atk, def, spi, agi, exp_s, next_exp_s,
    #                next_rest_exp_s, level, weapon_id, armor1_id, armor2_id,
    #                armor3_id, armor4_id - and any other methods from Game_Actor.
    #      [url=http://www.aldeiarpgbr.com/file://\\c]\\c[/url] - Centres text
    #      [url=http://www.aldeiarpgbr.com/file://\\r]\\r[/url] - Sets right alignment to text
    #
    #  It otherwise functions the same as the default Formatter and Artist combo.
    # The names of the classes are:
    #
    #    Formatter_SpecialCodes
    #    Artist_SpecialCodes
    #==============================================================================[/justify]
    [justify]module Paragrapher
      #============================================================================
      # ** FILTERS
      #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
      #  FILTERS allows you to set a filter and replace any \F[x] code with it's
      # corresponding Entry in the Hash. Leave the FILTERS = {} line alone and
      # below it, you can set all of the codes you will want to be able to put
      # as an argument in the \F code.
      #============================================================================
      FILTERS = {}
      FILTERS['PF3'] = '\c[1]Paragraph Formatter\c[0], Version 2.0: Formatter_SpecialCodes'
      FILTERS[0] = 'Numbered filters work too'
      #============================================================================
      # ** Formatter 3
      #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
      #  This class converts a string into a formatted text object, but also
      # recognizes special message codes.
      #============================================================================
     
      class Formatter_SpecialCodes < Formatter
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        # * Format
        #    string : the string to convert into paragraphs
        #    specs  : the specification, either maximum width or a bitmap
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        def format (string, specs)
          string = convert_special_characters (string)
          @code_argument = false
          @line_width = 0
          @word_width = 0
          @word_letter_count = 0
          @line_letter_count = 0
          # Run Original Method
          return super (string, specs)
        end
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        # * Format Character
        #    i : index of character to format, or the character
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        def format_character (i)
          character = @string[i, 1]
          if args_codes.include? (character)
            extract_code (character)
            @code_argument = true
          elsif @code_argument
            @code_argument = false if character == ">"
          elsif no_args_codes.include? (character)
            extract_code (character)
          elsif character == " "
            char_width = @format_text.bitmap.text_size (character).width
            if @line_width + char_width + @word_width > @max_width
              if @line_width == 0 # Really long word!
                @last_word = i
                @line_width = @word_width
              end
              next_line (@last_word)
            else
              @line_width += char_width
              @line_letter_count += 1
            end
            @line_width += @word_width
            @line_letter_count += @word_letter_count
            @word_width = 0
            @word_letter_count = 0
            @last_word = i
          elsif character == "\n" # Line break
            char_width = @format_text.bitmap.text_size (" ").width
            next_line (@last_word) if @line_width + char_width + @word_width > @max_width
            @line_width += @word_width
            @line_letter_count += @word_letter_count
            next_line (i)
            # Add in \n independent of system
            @format_text.lines[-1].push (character)
            @format_text.blank_width[-1] = 0
            @word_width = 0
            @last_word = i
          else # Regular Character
            @word_width += @format_text.bitmap.text_size(character).width
            @word_letter_count += 1
            if i == @string.size - 1
              next_line (@last_word) if @line_width + @word_width > @max_width
            end
          end
        end
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        # * Proceed to Next Line
        #    last_word : the index of the beginning of the previous word
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        def next_line (last_word)
          line = @string[@line_break, last_word - @line_break]
          # Adds current line to f.lines
          @format_text.lines.push ( line.scan (/./) )
          # Calculates the blank space left to cover in the line
          line_blank = @max_width - @line_width
          @format_text.blank_width.push (line_blank.to_f / (@line_letter_count.to_f) )
          # Keeps track of the position in the array of each line
          @line_break = last_word + 1
          @line_width = 0
          @line_letter_count = 0
        end
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        # * Convert Special Characters
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        def convert_special_characters (text = @string)
          return "" if text == nil
          text = perform_substitution (text)
          # Get substitutions
          text.gsub! (/\\C\[(\d+)\]/i)          { "\x01<#{$1.to_i}>" } # Palette Color
          text.gsub! (/\\C\[#([\dABCDEF]+)\]/i) { "\x01<##{$1.to_s}>" } # Hex Color 
          text.gsub! (/\\IIC?O?N?\[(\d+)\]/i) { $1.to_i > 0 ? "\x02<#{$data_items[$1.to_i].icon_index}>" : ""} # Item Icon
          text.gsub! (/\\WIC?O?N?\[(\d+)\]/i) { $1.to_i > 0 ? "\x02<#{$data_weapons[$1.to_i].icon_index}>" : ""} # Weapon Icon
          text.gsub! (/\\AIC?O?N?\[(\d+)\]/i) { $1.to_i > 0 ? "\x02<#{$data_armors[$1.to_i].icon_index}>" : ""} # Armor Icon
          text.gsub! (/\\IC?O?N?\[(\d+)\]/i)  { "\x02<#{$1.to_s}>" } # Icon
          text.gsub! (/\\B/i) { "\x03" }                      # Bold ON
          text.gsub! (/\\I/i) { "\x04" }                      # Italic ON
          text.gsub! (/\\S/i) { "\x05" }                      # Shadow ON
          text.gsub! (/\\U/i) { "\x06" }                      # Underline ON
          text.gsub! (/\/B/i) { "\x07" }                      # Bold OFF
          text.gsub! (/\/S/i) { "\x09" }                      # Shadow OFF
          text.gsub! (/\/I/i) { "\x08" }                      # Italic OFF
          text.gsub! (/\/U/i) { "\x10" }                      # Underline OFF
          text.gsub! (/\\HL\[(-*\d+)\]/i) { "\x11<#{$1.to_s}>" }  # HighLight
          text.gsub! (/\\HL/i)          { "\x11<-1>" } 
          text.gsub! (/\\C/i)        { "\x12<1>" }          # Align Centre
          text.gsub! (/\\CENTRE/i)  { "\x12<1>" }          # Align Centre 
          text.gsub! (/\\RI?G?H?T?/i)  { "\x12<2>" }          # Align Right
          return text
        end
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        # * Perform Substitution
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        def perform_substitution (text = @string)
          text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }  # Variable
          # FILTERS
          text.gsub!(/\\F\[["'](.+?)["']\]/i)  { FILTERS[$1.to_s] }
          text.gsub!(/\\F\[(.+?)\]/i)          { FILTERS[$1.to_i] }
          # Party ID to Actor ID
          while text[/\\PID\[(\d+)\]/i] != nil
            x = $1.to_i < $game_party.members.size ? $game_party.members[$1.to_i].id : 0
            text.sub! (/\\PID\[(\d+)\]/i)  { x.to_s }
          end
          # Old Codes
          text.gsub!(/\\N\[([0-9]+)\]/i) { $1.to_i > 0 ? $game_actors[$1.to_i].name : ""} # Actor Name
          text.gsub!(/\\\\/)            { "\" }
          # New Codes
          begin
            text.gsub! (/\\VOCAB\[(\w+)\]/i) { Vocab.send ($1.downcase) } # Vocab
          rescue
          end
          text.gsub! (/\\AC\[(\d+)\]/i) { $game_actors[$1.to_i].class.name } # Actor Class
          # Actor Stats
          begin
            text.gsub! (/\\A([^\[]+?)\[(\d+)\]/i) { $game_actors[$2.to_i].send ($1.to_s.downcase) }
          rescue
          end
          text.gsub! (/\\NC\[(\d+)\]/i) { $1.to_i > 0 ? $data_classes[$1.to_i].name : "" } # Class Name
          text.gsub! (/\\NE\[(\d+)\]/i) { $1.to_i > 0 ? $game_map.events[$1.to_i].name : "" } # Event Name
          text.gsub! (/\\NM\[(\d+)\]/i) { $1.to_i > 0 ? $data_enemies[$1.to_i].name : "" } # Monster Name
          text.gsub! (/\\NI\[(\d+)\]/i) { $1.to_i > 0 ? $data_items[$1.to_i].name : "" }  # Item Name
          text.gsub! (/\\NW\[(\d+)\]/i) { $1.to_i > 0 ? $data_weapons[$1.to_i].name : "" } # Weapon Name
          text.gsub! (/\\NA\[(\d+)\]/i) { $1.to_i > 0 ? $data_armors[$1.to_i].name : "" } # Armor Name
          text.gsub! (/\\PI\[(\d+)\]/i) { $1.to_i > 0 ? $data_items[$1.to_i].price.to_s : "" } # Item Price
          text.gsub! (/\\PW\[(\d+)\]/i) { $1.to_i > 0 ? $data_weapons[$1.to_i].price.to_s : "" } # Weapon Price
          text.gsub! (/\\PA\[(\d+)\]/i) { $1.to_i > 0 ? $data_armors[$1.to_i].price.to_s : "" } # Armor Price
          text.gsub! (/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }  # Variable
          return text
        end
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        # * Extract Code
        #    code : the code to extract
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        def extract_code (code)
          case code
          when "\x02"
            @word_letter_count += 1
            @word_width += 24
          when "\x03" then @format_text.bitmap.font.bold = true    # Bold
          when "\x04" then @format_text.bitmap.font.italic = true  # Italic
          when "\x05" then @format_text.bitmap.font.shadow = true  # Shadow
          when "\x07" then @format_text.bitmap.font.bold = false  # Bold
          when "\x08" then @format_text.bitmap.font.italic = false # Italic
          when "\x09" then @format_text.bitmap.font.shadow = false # Shadow
          end
        end
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        # * Argument Codes
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        def no_args_codes
          return ["\x03",  "\x04", "\x05", "\x06", "\x07",  "\x08", "\x09", "\x10"]
        end
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        # * Argument Codes
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        def args_codes
          return ["\x01", "\x02", "\x11", "\x12"]
        end
      end
     
      #============================================================================
      # ** Artist 2
      #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
      #  This is an artist class designed to recognize some special message codes.
      #============================================================================
     
      class Artist_SpecialCodes
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        # * Draw
        #    f            : Formatted Text Object
        #    justify_text : boolean value on whether to justify text
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        def draw (f, justify_text = true)
          @f = f
          @justify_text = justify_text
          @highlight = -1
          @underline = false
          # Calculates the necessary distance between lines
          line_distance = @f.bitmap.height.to_f / @f.lines.size.to_f
          @line_distance = [@f.bitmap.font.size + 4, line_distance].min
          # For all lines in the lines array
          for i in [email=0...@f.lines.size]0...@f.lines.size[/email]
            # Compose line into a single string
            @text = ""
            @f.lines[i].each { |char| @text += char }
            @blank_space = @f.blank_width[i]
            @centre = @text[/\x12<1>/] != nil
            @right = @text[/\x12<2>/] != nil && [email=!@centre]!@centre[/email]
            total_blank = 0
            if @centre || @right
              @real_bitmap = @f.bitmap.dup
              @f.bitmap  = Bitmap.new (@real_bitmap.width, @line_distance)
              @f.bitmap.font = @real_bitmap.font.dup
              @y = 0
            else
              @y = [email=i*@line_distance]i*@line_distance[/email]
            end
            @x = 0
            # For all indices of the line array
            loop do
              c = @text.slice!(/./m)
              break if c.nil?
              interpret_string (c)
            end
            # Align Text
            if @centre || @right
              blank = (@real_bitmap.width - @x)
              blank /= 2 if @centre
              rect = Rect.new (0, 0, @real_bitmap.width, @line_distance)
              @real_bitmap.blt (blank, [email=i*@line_distance]i*@line_distance[/email], @f.bitmap, rect)
              @real_bitmap.font = @f.bitmap.font.dup
              @f.bitmap.dispose
              @f.bitmap = @real_bitmap
            end
          end
          return @f.bitmap
        end
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        # * Get Text Color
        #    n : Text color number  (0-31)
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        def text_color(n)
          x = 64 + (n % 8) * 8
          y = 96 + (n / 8) * 8
          windowskin = Cache.system ("Window")
          return windowskin.get_pixel(x, y)
        end
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        # * Draw Icon
        #    icon_index : Icon number
        #    x,y        : draw spot coordinates
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        def draw_icon(icon_index, x, y)
          bitmap = Cache.system("Iconset")
          rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
          @f.bitmap.blt(x, y, bitmap, rect)
        end
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        # * Interpret Character
        #    char : the char to decode
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        def interpret_string (char)
          case char
          when "\x01" # Colour
            @text.slice! (/<(#?[\dABCDEF]+)>/i)
            if $1.include? ("#")
              r, g, b = $1[1, 2].to_i (16), $1[3, 2].to_i (16), $1[5, 2].to_i (16)
              @f.bitmap.font.color = Color.new (r, g, b)
            else
              @f.bitmap.font.color = text_color ($1.to_i)
            end
          when "\x02" # Icon
            @text.slice! (/<(\d+)>/)
            draw_icon ($1.to_i, @x, @y)
            @x += 24
            @x += @justify_text && [email=!@centre]!@centre[/email] && [email=!@right]!@right[/email] ? @blank_space : 0
          when "\x03" then @f.bitmap.font.bold = true    # Bold ON
          when "\x04" then @f.bitmap.font.italic = true  # Italic ON
          when "\x05" then @f.bitmap.font.shadow = true  # Shadow ON
          when "\x06" then @underline = true            # Underline ON
          when "\x07" then @f.bitmap.font.bold = false  # Bold OFF
          when "\x08" then @f.bitmap.font.italic = false # Italic OFF
          when "\x09" then @f.bitmap.font.shadow = false # Shadow OFF
          when "\x10" then @underline = false          # Underline OFF
          when "\x11" # Highlight
            @text.slice! (/<(-?\d+)>/)
            @highlight = $1.to_i
          when "\x12" # Centre or Right
            @text.slice! (/<\d>/)
          when "\n"  # Draw nothing when blank space
          else
            draw_character (char)
          end
        end
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        # * Draw Character
        #    string : the string to draw
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        def draw_character (string)
          tw = @f.bitmap.text_size (string).width
          ls = @justify_text && [email=!@centre]!@centre[/email] && [email=!@right]!@right[/email] ? @blank_space : 0
          hl_rect = Rect.new (@x, @y, tw + ls, @line_distance)
          # Draw Highlight
          if @highlight.between? (0, 31)
            colour = text_color (@highlight)
            colour.alpha = 120
            contents.fill_rect (hl_rect, colour)
          end
          # Draw Underline
          if @underline
            y = @y + @line_distance - 2
            @f.bitmap.fill_rect (@x, y, hl_rect.width, 2, @f.bitmap.font.color)
          end
          # Draws the string located at each index
          @f.bitmap.draw_text (@x, @y, tw, @line_distance, string)
          # Keeps track of the position we are in in pixels
          @x += tw + ls
        end
      end
    end[/justify]
    [justify]
    Paragraph Formater VX[/justify]
    [justify]Código: [Selecionar]
    #==============================================================================
    #  Paragraph Formatter (VX)
    #  Version: 2.0
    #  Author: modern algebra (rmrk.net)
    #  Date: September 10, 2009
    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #  Description:
    #    The idea behind this script is to easily separate a long string into a
    #  paragraph that fits in to the dimensions you specify. More than that, you
    #  can also justify the paragraph
    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #  Instructions:
    #    For ease of use of people who are not neccesarily interested in writing
    #  their own algorithm, I have included a facade which you can use simply by
    #  this code:
    #
    #      bitmap.draw_paragraph (x, y, width, height, string)
    #
    #  where x & y are the x & y coordinates on the specified bitmap, and width
    #  and height are the maximum dimensions of the paragraph and string is the
    #  text you want to display in paragraph form. You can easily change which
    #  formatter or artist classes you want to use with the codes:
    #
    #      bitmap.paragraph_formatter = Paragrapher::<formatter_name>
    #      bitmap.paragraph_artist = Paragrapher::<artist_name
    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #  How it works:
    #    The paragrapher expects two objects when initialized, a Formatter and an
    #  Artist. The idea  behind the formatter is that it is expected to take the
    #  initial specifications and convert it to a Formatted Text object. Then, the
    #  Artist class is expected to interpret the Formatted Text object and draw
    #  the paragraph. For details on how each specific algorithm works,  visit the
    #  comments above and inside them. It is not necessary to use the default
    #  Formatter, Artist, or Formatted Text objects.
    #==============================================================================[/justify]
    [justify]#==============================================================================
    # ** Bitmap
    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #  Summary of Changes:
    #    new attr_writer - paragraph_formatter, paragraph_artist
    #    new methods - paragraph_formatter, paragraph_artist, draw_paragraph
    #==============================================================================[/justify]
    [justify]class Bitmap
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * Public Instance Variables
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      attr_writer :paragraph_formatter # The formatting class for Paragraphing
      attr_writer :paragraph_artist    # The artist class for Paragraphing
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * Get Formatter
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      def paragraph_formatter
        @paragraph_formatter = $game_system.default_formatter if @paragraph_formatter.nil?
        return @paragraph_formatter.new
      end
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * Get Artist
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      def paragraph_artist
        @paragraph_artist = $game_system.default_artist if @paragraph_artist.nil?
        return @paragraph_artist.new
      end
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * The Facade, which uses default Formatter and Artist to draw the formatted text directly
      #  to a bitmap, such as self.contents
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      def draw_paragraph (x, y, max_width, max_height, string)
        bitmap = Bitmap.new (max_width, max_height)
        bitmap.font = self.font.dup
        pg = Paragrapher.new (paragraph_formatter, paragraph_artist)
        bitmap = pg.paragraph (string, bitmap)
        blt (x, y, bitmap, bitmap.rect)
        # Dispose of the proxy bitmap
        bitmap.dispose
      end
    end[/justify]
    [justify]#==============================================================================
    # *** Paragrapher
    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #  Module containing the objects for the Paragrapher
    #==============================================================================[/justify]
    [justify]module Paragrapher
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * New
      #``````````````````````````````````````````````````````````````````````````
      #  Allows the 'Paragrapher.new' command outside of the module to be used
      # rather than having to use 'Paragrapher::Paragrapher.new'
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      class << self
        def new(*args, &block)
          return Paragrapher.new(*args, &block)
        end
      end
     
      #==========================================================================
      # ** Formatted_Text
      #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
      #  Bundles together the result of a Formatter class
      #==========================================================================
      Formatted_Text = Struct.new (:lines, :blank_width, :bitmap)
     
      #==========================================================================
      # ** Paragrapher
      #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
      #  This struct has accessible attributes and can easily paragraph objects.
      #==========================================================================
      class Paragrapher < Struct.new (:formatter, :artist)
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        # * Paragraph
        #    string        : the string to be broken into lines
        #    specifications : the other arguments required for the Formatter
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        def paragraph(string, *specifications)
          f = formatter.format (string, *specifications)
          return artist.draw (f)
        end
      end
     
      #============================================================================
      # ** Formatter
      #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
      #  This class converts a string into a formatted text object
      #============================================================================
     
      class Formatter
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        # * Format
        #    string        : the string to be formatted
        #    specifications : the desired width of the paragraph, or a bitmap
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        def format(string, specifications)
          @string = string
          # Checks whether specifications is a bitmap or a number. It then sets
          # max_width and f.bitmap accordingly
          if specifications.is_a? (Bitmap)
            bitmap = specifications
            @max_width = specifications.width
          elsif specifications.is_a? (Numeric)
            @max_width = specifications
            bitmap = Bitmap.new (@max_width, 32)
          else
            # Error Catching: Incorrect Specifications
            f = format ('Specifications Error', Bitmap.new (200, 64))
            p 'Specifications Error: Please Pass Numeric or Bitmap'
            return f
          end
          # Initializes Formatted_Text object
          @format_text = Formatted_Text.new ([], [], bitmap)
          @line_break = 0
          @last_word = 0
          for i in [email=0...@string.size]0...@string.size[/email]
            format_character (i)
          end
          # Adds the last line to f.lines
          @format_text.lines.push ( @string[@line_break, @string.size - @line_break].scan (/./) )
          # Since the last line is drawn normally, blank_width should be 0
          @format_text.blank_width.push (0)
          height = @format_text.lines.size*Window_Base::WLH
          @format_text.bitmap = Bitmap.new (@max_width, height) if specifications.is_a? (Numeric)
          # Returns the Formatted_Text object
          formatted_text = @format_text.dup
          @format_text = nil
          return formatted_text
        end
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        # * Format Character
        #    i : index of position in the string
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        def format_character (i)
          character = @string[i, 1]
          # If at the end of a word
          if character == "\n" || character == " " || i == @string.size - 1
            i += 1 if i == @string.size - 1 # Account for possible overlap at end
            # If this word fits on the current line
            substring = @string[@line_break, i - @line_break]
            if @format_text.bitmap.text_size (substring).width > @max_width
              next_line (@last_word)
            end
            if character == "\n"
              next_line (i)
              @format_text.blank_width[-1] = 0
            end
            @last_word = i
          end
        end
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        # * Proceed to Next Line
        #    last_word : the index of the beginning of the previous word
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        def next_line (last_word)
          line = @string[@line_break, last_word - @line_break]
          # Adds current line to f.lines
          @format_text.lines.push ( line.scan (/./) )
          # Calculates the blank space left to cover in the line
          line_blank = @max_width - @format_text.bitmap.text_size(line).width
          @format_text.blank_width.push (line_blank.to_f / (line.size.to_f - 1.0) )
          # Keeps track of the position in the array of each line
          @line_break = last_word + 1
        end
      end
     
      #============================================================================
      # ** Artist
      #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
      #  Interprets a Formatted Text object and returns a bitmap of the paragraph
      #============================================================================
     
      class Artist
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        # * Draw
        #    f            : Formatted Text Object
        #    justify_text : boolean value on whether to justify text
        #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        def draw (f, justify_text = true)
          # Calculates the necessary distance between lines
          line_distance = f.bitmap.height.to_f / f.lines.size.to_f
          line_distance = [f.bitmap.font.size + 4, line_distance].min
          # For all lines in the lines array
          for i in 0...f.lines.size
            blank_space = f.blank_width[i]
            position = 0
            # For all indices of the line array
            for j in 0...f.lines[i].size
              string = f.lines[i][j]
              tw = f.bitmap.text_size (string).width
              # Draws the string located at each index
              f.bitmap.draw_text (position, line_distance*i, tw, line_distance, string)
              # Keeps track of the position we are in in pixels
              position += tw
              position += blank_space if justify_text
            end
          end
          return f.bitmap
        end
      end
    end[/justify]
    [justify]#========================================================================
    # ** Game_System
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    #  Summary of changes:
    #    new instance variables - default_formatter, default_artist
    #    aliased methods - initialize
    #========================================================================[/justify]
    [justify]class Game_System
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * Public Instance Variables
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      attr_accessor :default_formatter
      attr_accessor :default_artist
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * Object Initialization
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      alias ma_paragraph_formatter_init initialize
      def initialize
        # Run original method
        ma_paragraph_formatter_init
        # Initialize original default format and artist classes
        @default_formatter = Paragrapher::Formatter
        @default_artist = Paragrapher::Artist
      end
    end[/justify]
    [justify]
    [/justify]


    Última edição por Lucas Wugades em Qua Fev 08, 2012 10:11 pm, editado 5 vez(es)
    gustavotx
    gustavotx
    Experiente
    Experiente


    Mensagens : 411
    Créditos : 64

    Email estilo ff7 cc Empty Re: Email estilo ff7 cc

    Mensagem por gustavotx Dom Fev 05, 2012 7:44 pm

    mano vc poderia postar ss? Grato .


    _________________
    Meu Game Lupus Online:

    Email estilo ff7 cc Sing2zq

    Email estilo ff7 cc AIymW
    Tem Meu Respeito:
    Link
    Link
    Membro Ativo
    Membro Ativo


    Mensagens : 307
    Créditos : 35

    Email estilo ff7 cc Empty Re: Email estilo ff7 cc

    Mensagem por Link Qua Fev 08, 2012 5:32 pm

    O que é ss em


    _________________
    Zelda eu irei te salvar
    jefferson20100
    jefferson20100
    Iniciante
    Iniciante


    Mensagens : 79
    Créditos : 26

    Email estilo ff7 cc Empty Re: Email estilo ff7 cc

    Mensagem por jefferson20100 Qua Fev 08, 2012 8:08 pm

    Acho q ele escrevel errado acho q ele ia escreve SC (SCREEN)
    OU SE ERA SS MESMO(SCREN SHOT)


    _________________
    Pc quebro.
    :;(:
    Link
    Link
    Membro Ativo
    Membro Ativo


    Mensagens : 307
    Créditos : 35

    Email estilo ff7 cc Empty Re: Email estilo ff7 cc

    Mensagem por Link Qua Fev 08, 2012 10:11 pm

    SCREN SHOT pronto hehe.


    _________________
    Zelda eu irei te salvar
    jefferson20100
    jefferson20100
    Iniciante
    Iniciante


    Mensagens : 79
    Créditos : 26

    Email estilo ff7 cc Empty Re: Email estilo ff7 cc

    Mensagem por jefferson20100 Qua Fev 29, 2012 11:25 am

    esse script ou não funciona ou vc postou errado.


    _________________
    Pc quebro.
    :;(:

    Conteúdo patrocinado


    Email estilo ff7 cc Empty Re: Email estilo ff7 cc

    Mensagem por Conteúdo patrocinado


      Data/hora atual: Qui Nov 21, 2024 10:30 pm