RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Global Text Codes

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Global Text Codes
Version: 1.0a
Author: modern algebra
Date: July 5, 2011

Version History


  • <Version 1.0a> 2011.07.05 - Fixed an F12 StackError
  • <Version 1.0> 2009.12.08 - Original Release

Description


This script allows you to use some of the special message codes in any window or scene. Want to bold the name of the lead actor or colour the name of special skills? You can do that with this script. For a full list of the codes you can use and what they do, look at the instructions. You can also create your own replacement codes with a minimum of scripting knowledge through a simple interface.

Also, note that this script will likely not apply to other scripts that already parse text and look for message codes. This is the case with Window_Message, for instance, so this script will not apply to Window_Message. It will also not apply to scripts like my Journal script. This is not to say it will cause errors, but some funky things may happen.

Features

  • Can use message codes in any scenes you want
  • A large variety of built-in message codes to suit your every desire
  • The ability to create your own filters and message codes relatively easily

Screenshots


Note: Times New Roman Font for the description, the icon in the description, wooden is italicized in the description, Bennet's name is underlined, the entire word, Robe, is a different colour and the capital letters of Feathered Hat are a different colour. All of that and more is possible with this script.

Instructions

See the header for detailed instructions and a list of text codes you can use, but there is very little you have to do - just put the script in your project and use the text codes you want where you want them. It's that simple.

Script


Code: [Select]
#==============================================================================
#    Global Text Codes
#    Version: 1.0a
#    Author: modern algebra (rmrk.net)
#    Date: July 5, 2011
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#
#    This script allows you to use some of the special message codes in any
#   window or scene. Want to bold the name of the lead actor or colour the name
#   of special skills? You can do that with this script. For a full list of the
#   codes you can use and what they do, look at the instructions. You can also
#   create your own replacement codes with a minimum of scripting knowledge
#   through a simple interface.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    All you need to do is put the script in the editor above Main and below
#   your default scripts and it should work. You can now use the following
#   codes in most windows (unless they parse texts out character by character
#   before drawing, as Window_Message does. You would need a custom message
#   system if you wanted to change that). But it would work in things like item
#   windows, the menu generally, shops and so on - everywhere there is a
#   bitmap pretty much. Again, a significant exception is Window_Message and
#   other custom scripts that already have a similar feature, such as my Diary
#   script. Anyway, the codes that can be used from the getgo are:
#      \v[x] - Shows the value located in the variable x
#      \n[x] - Shows the name of the Actor with ID x
#      \c[x] - Changes the colour of the text to x. x can be 0 - 31
#      \pid[x] - Shows Actor ID of Party Member in position X (0-3)
#      \nc[x]- Shows the name of class with ID x
#      \np[x]- Shows the name of the Party Member with index x
#      \ne[x]- Shows the name of Event with ID x on the map
#      \nm[x]- Shows the name of Monster with ID x
#      \ni[x]- Shows the name of Item with ID x
#      \nw[x]- Shows the name of Weapon with ID x
#      \na[x]- Shows the name of Armour with ID x
#      \pi[x]- Shows the price of Item with ID x
#      \pw[x]- Shows the price of Weapon with ID x
#      \pa[x]- Shows the price of Armour with ID x
#      \iicon[x] - Shows the Icon of Item with ID x
#      \wicon[x] - Shows the Icon of Weapon with ID x
#      \aicon[x] - Shows the Icon of Armour with ID x
#      \icon[x] - Shows the Icon with ID x
#      \fn[font name] - Changes the font to font name chosen
#      \fs[x] - Changes the font size to x
#      \vocab[value] - prints vocab for that item type. Suitable values for this
#                    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
#      \f[key] - Show Filter phrase attached to key
#      \b - Toggles Bold
#      \i - Toggles Italic
#      \u - Toggles Underline
#      \s - Toggles Shadow
#      \ac[x]- Shows class of actor with ID x
#      \a..[x] - 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.
#      \Gold - shows current gold of party
#
#  The filters can be set at line 82
#  You can also create your own replacement codes, though it is a little
# complicated. To see how, go to like 91
#==============================================================================

#==============================================================================
# *** MA GLOBAL CODES
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#    This module is used for configuring the settings for the script. It also
#   interprets and saves the special user-defined replacement codes.
#==============================================================================

module MA_GlobalCodes
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * CONSTANTS
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  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.
    'PF3' => '\c[1]Paragraph Formatter\c[0], Version 2.0: Formatter_3',
    0 => 'Numbered filters work too'
  }
  USER_CODES = {
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  #  Here you can create your own special codes for your own nefarious
  # purposes. The format is:
  #    "code" => ["replacement", "arguments"]
  # This can probably be understood best by comparing it to codes you already
  # know of (and are included. Take, for instance the variable code:
  #    \V[x] # shows the value of variable with ID x.
  #  If that were being added as a user code, then the code would be:
  #    "V" => [$game_variables[~1~], "%d"]
  #
  #    So, the first part,"code", is what goes after the "\" for the code to be
  #   identified. The "replacement" is what that code is replaced with when it
  #   appears, and the "arguments" are what goes in the brackets that are then
  #   used in the replacement by identifying where they go with the ~x~ codes,
  #   where x is a digit referring to what comes first. The codes for the
  #   arguments are:
  #      %d - this means that the argument must be a number
  #      %w - this includes all word characters, including numbers. Thus, it
  #         would be ideal if you need filenames for arguments, for instance.
  #      %. - this accepts any type of character, including whitespace
  #
  # Thus to put this in more concrete terms, a code like the following:
  #    "LX" => ["3*~1~ + 5*~2~", "%d%d"]
  #   would correspond to the code:
  #    \LX[x, y], where x and y are numbers
  #   and would be replaced with the result of the evaluation of
  #  3*x + 5*y
  # It's obviously, a useless code, but hopefully that is a reasonable example.
  #  Also, if you don't need any arguments, you can write simply:
  #    "code" => "replacement"
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    #  The two following codes are additional examples
    # \VM[x, y] would be replaced by the product of variable x and variable y
    "VM" => ["$game_variables[~1~]*$game_variables[~2~]", "%d%d"],
    # \GOLD would be replaced by the amount of gold the party currently has
    "GOLD" => "$game_party.gold"
  }
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * User Code
  #    key : the key to check
  #``````````````````````````````````````````````````````````````````````````
  #  This method interprets and saves appropriate coding, thus avoiding
  # repetitious interpretation.
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.user_code (key)
    @interpreted_hash = {} if @interpreted_hash.nil?
    if @interpreted_hash[key].nil?
      value = USER_CODES[key]
      return "", nil if value.nil?
      if value.is_a? (Array)
        # Get correct replacement value
        replacement = value[0].dup
        args = value[1].dup
        # Put arguments into the replacement
        i = 1
        while i < args.size
          ext = args[i, 1] == "d" ? "i" : "s"
          replacement.sub! (/~(#{(i + 1) / 2})~/) { "$#{$1.to_i}.to_#{ext}" }
          i += 2
        end
        args.gsub! (/%d/) { "(-?\\d+?),\\s*?" }
        args.gsub! (/%w/) { "(\\w+?),\\s*?" }
        args.gsub! (/%\./) { "(.+?),\\s*?" }
        args.slice! (-5, 5)
        @interpreted_hash[key] = [replacement, args]
      else
        @interpreted_hash[key] = [value, nil]
      end
    end
    return *@interpreted_hash[key]
  end
end

#==============================================================================
# ** Bitmap
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - draw_text
#    new methods - convert_special_characters; perform_substitution;
#                 execute_special_code
#==============================================================================

class Bitmap
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Text
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias malgr_glbl_msgcdes_drwtxt_8kf2 draw_text unless self.method_defined? (:malgr_glbl_msgcdes_drwtxt_8kf2)
  def draw_text (*args)
    # Retrieve Arguments
    if args[0].is_a? (Rect)
      tx, ty, tw, th = args[0].x, args[0].y, args[0].width, args[0].height
      string = args[1].to_s.dup
      align = args[2].nil? ? 0 : args[2]
    else
      tx, ty, tw, th = *args[0, 4]
      string = args[4].to_s.dup
      align = args[5].nil? ? 0 : args[5]
    end
    text = convert_special_characters (string)
    text, codes, indices, icon_count = extract_special_codes (text)
    if codes.empty?
      # Underline
      if @underline
        uy = ty + self.font.size + (Window_Base::WLH - self.font.size) / 2
        ul_lngth = [tw, self.text_size (text)].min
        tx += align == 1 ? (tw - ul_lngth) / 2 : align == 2 ? (tw - ul_lngth) : 0
        self.fill_rect (tx, uy, ul_lngth, 2, self.font.color)
      end
      # Run original method exactly if there are no special codes
      malgr_glbl_msgcdes_drwtxt_8kf2 (tx, ty, tw, th, text, align)
    else
      i = 0
      room_w = tw - (24*icon_count)
      ts = self.text_size (text).width
      if ts < room_w && align != 0
        tx += align == 1 ? (room_w - ts) / 2 : room_w - ts
      end
      room_w = [tw.to_f / room_w.to_f, 1.0].min
      while !codes.empty?
        code = codes.shift
        j = indices.shift
        if i != j
          txt = text[i, j-i]
          rw = (self.text_size (txt).width*room_w).to_i
          if @underline
            uy = ty + self.font.size + (Window_Base::WLH - self.font.size) / 2
            self.fill_rect (tx, uy, rw, 2, self.font.color)
          end
          # Run Original Method on portion
          malgr_glbl_msgcdes_drwtxt_8kf2 (tx, ty, rw, th, txt)
          tx += rw
        end
        tx = execute_special_code (tx, ty, code)
        i = j
      end
      return if i == text.size - 1
      txt = text[i, text.size - i]
      rw = (self.text_size (txt).width*room_w).to_i
      if @underline
        uy = ty + self.font.size + (Window_Base::WLH - self.font.size) / 2
        self.fill_rect (tx, uy, rw, 2, self.font.color)
      end
      # Run Original Method on final portion
      malgr_glbl_msgcdes_drwtxt_8kf2 (tx, ty, rw, th, txt)
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Execute Special Code
  #    x, y : coordinates for execution
  #    code : code to be executed
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def execute_special_code (x, y, code)
    case code[0,1]
    when "\x01" # Colour
      code[/<(#?[\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)
        self.font.color = Color.new (r, g, b)
      else
        wx = 64 + ($1.to_i % 8) * 8
        wy = 96 + ($1.to_i / 8) * 8
        windowskin = Cache.system ("Window")
        self.font.color = windowskin.get_pixel(wx, wy)
      end
    when "\x02"
      code[/<(\d+)>/]
      bitmap = Cache.system("Iconset")
      rect = Rect.new($1.to_i % 16 * 24, $1.to_i / 16 * 24, 24, 24)
      self.blt(x, y, bitmap, rect, 255)
      x += 24
    when "\x03" then self.font.bold = !self.font.bold     # Bold
    when "\x04" then self.font.italic = !self.font.italic # Italic
    when "\x05" then self.font.shadow = !self.font.shadow # Shadow
    when "\x06" then @underline = !@underline             # Underline
    when "\x09"                        # Change Font Name
      code[/<(.*?)>/]
      self.font.name = $1.to_s if Font.exist? ($1.to_s)
    when "\x10"                        # Change Font Size
      code[/<(\d*)>/]
      self.font.size = $1.to_i
    end
    return x
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Convert Special Characters
  #    text : the text to convert
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def convert_special_characters (text)
    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.between? (1, $data_items.size - 1) ? "\x02<#{$data_items[$1.to_i].icon_index}>" : "" } # Item Icon
    text.gsub! (/\\WIC?O?N?\[(\d+)\]/i) { $1.to_i.between? (1, $data_weapons.size - 1) ? "\x02<#{$data_weapons[$1.to_i].icon_index}>" : "" } # Weapon Icon
    text.gsub! (/\\AIC?O?N?\[(\d+)\]/i) { $1.to_i.between? (1, $data_armors.size - 1) ? "\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
    text.gsub! (/\\I/i) { "\x04" }                                # Italic
    text.gsub! (/\\S/i) { "\x05" }                                # Shadow
    text.gsub! (/\\U/i) { "\x06" }                                # Underline
    text.gsub! (/\\FN\[(.+?)\]/i)   { "\x09<#{$1.to_s}>" }        # Font Name
    text.gsub! (/\\FS\[(\d+)\]/i)   { "\x10<#{$1.to_s}>" }        # Font Size
    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)  { MA_GlobalCodes::FILTERS[$1.to_s] }
    text.gsub!(/\\F\[(.+?)\]/i)          { MA_GlobalCodes::FILTERS[$1.to_i] }
    # Party ID to Actor ID
    text.gsub!(/\\PID\[(\d+)\]/i)  { $game_party.members[$1.to_i].id }
    # Old Codes
    text.gsub!(/\\N\[([0-9]+)\]/i) { $1.to_i > 0 ? $game_actors[$1.to_i].name : ""} # Actor Name
    # 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
    # Parse custom replacement codes
    MA_GlobalCodes::USER_CODES.keys.each { |key|
      replacement, args = MA_GlobalCodes.user_code (key)
      if args != nil
        begin
          text.gsub! (/\\#{key}\[#{args}\]/i) { eval (replacement) }
        rescue
        end
      else
        begin
          text.gsub! (/\\#{key}/i) { eval (replacement) }
        rescue
        end
      end
    }
    text.gsub! (/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }   # Variable
    text.gsub! (/\\\\/)             { "\\" }
    return text
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * No Argument Codes
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def no_args_codes
    return ["\x03", "\x04", "\x05", "\x06"]
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Argument Codes
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def args_codes
    return ["\x01", "\x02", "\x09", "\x10"]
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Extract Special Codes
  #``````````````````````````````````````````````````````````````````````````
  #  This parses the text and removes the special codes, while retaining
  # their position in order to be inserted when the time comes.
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def extract_special_codes (text)
    codes = []
    code_indices = []
    icon_count = 0
    i = 0
    while i < text.size
      # Work from the end of the string
      c = text[i, 1]
      if no_args_codes.include? (c)
        text.sub!(c, "")
        codes.push (c)
        code_indices.push (i)
      elsif args_codes.include? (c)
        a = text.sub! (/(#{c}<.*?>)/, "")
        # If nothing is replaced
        if a == nil
          i += 1
        else
          codes.push ($1)
          code_indices.push (i)
          icon_count += 1 if c == "\x02"
        end
      else
        i += 1
      end
    end
    return text, codes, code_indices, icon_count
  end
end

Credit


  • modern algebra

Thanks

  • Anahuyu Izimori, for the request

Support


Please post in this topic at rmrk.net for support. Do not PM me. I am not active on other forums, and so there is no guarantee I will ever see your post if you do not post it here.

Known Compatibility Issues

Probably quite a few. I doubt there will be many game-breaking errors, but as I mentioned in the description, it will not apply to some scripts such as message scripts or any scripts (again, it may be possible that a message script and this could be in the same project without errors, but only to say that the message codes in this script will not work in a message)


Creative Commons License
This script by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
« Last Edit: July 04, 2011, 01:18:39 PM by modern algebra »

***
Rep:
Level 88
http://www.rukinet.com
I take it this function is not included in your previous Advanced Text System? Or perhaps it's meant to be like a lighter version without any of the other functionalities?


Rukinet. - the dot's included!

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Well, the ATS applies only to Show Text messages. This script applies to all scenes, such as Equip, or Item, or the Menu, or what have you. However, it doesn't have nearly the customizability of the ATS and doesn't apply to messages at all.

******
Revolution is not a bed of roses.
Rep:
Level 91
Project of the Month winner for July 2009
Great script, if I used VX this would be one of the first ones I would use.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Thanks Falcon, I'm glad you think so. I'm a little worried about its efficiency and possible incompatibilities, but it is a useful script I think.

Unrelated, but I was looking through my old posts the other day, and you were the first person to ever help me with scripting :)

***
Rep:
Level 88
http://www.rukinet.com
Well, the ATS applies only to Show Text messages. This script applies to all scenes, such as Equip, or Item, or the Menu, or what have you. However, it doesn't have nearly the customizability of the ATS and doesn't apply to messages at all.

Are the two scripts compatible, though? Otherwise I will probably only be using this one, assuming you would be OK with that for a potentially commercial game (credits would be given, of course), since GTC (Global Text Codes) can be used to color code items and equipment - and let's not forget regular discussion!

~Rukishou


Rukinet. - the dot's included!

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Well, like I said, it doesn't apply to regular discussion, which is what the ATS does. The ATS also allows for name windows, face windows, et al.

In any case, I think they probably are compatible, but I haven't done any testing. On a side note, there is another script in the database that colour codes items and weapons and armors and skills, so if that's all you want it for I'd recommend that over this.

***
Rep:
Level 88
http://www.rukinet.com
Well, like I said, it doesn't apply to regular discussion, which is what the ATS does. The ATS also allows for name windows, face windows, et al.

In any case, I think they probably are compatible, but I haven't done any testing. On a side note, there is another script in the database that colour codes items and weapons and armors and skills, so if that's all you want it for I'd recommend that over this.

I see. Oh, and I'm sorry I asked (or stated, really) something you had just said wasn't possible... ^^;


Rukinet. - the dot's included!

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Yeah, I am sort of wording things weird and I apologize. What I mean is: this script doesn't apply to messages. It doesn't mean that it's "incompatible" in the sense that it cause errors, it just means that the special codes of this script won't be interpreted by a message window. So I simply mean that a special code like \FN[font_name] won't actually do anything if it's in a message window, since message windows parse and draw character by character affording this script no opportunity to interpret codes longer than one character.

So, that's what I mean - the two scripts can probably be used in conjunction, but you would need to use ATS codes in messages and not GTC codes.

***
Rep:
Level 84
---> LOL <---
How could I use this script to change the color for when a character enter battle and sees "slime emerged" and then after the battle where you see "you won - you get x gold, x items....."

The enemy display and the reward window messages are what I want to change

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
In the Script Editor, there is a slot named Vocab. In there, you will see a bunch of things like this:

Code: [Select]
  ShopBuy         = "Buy"
  ShopSell        = "Sell"
  ShopCancel      = "Cancel"
  Possession      = "Possession"

You would just alter the ones for those things by adding the colour codes. So, for instance, at line 29:

Code: [Select]
  Emerge          = "%s emerged!"

For these you'll need to use \\ for the codes instead of just \. So, to say, change that message to be in the system colour:

Code: [Select]
  Emerge          = "\\c[16]%s emerged!\\c[0]"

You would do the same for the other messages you want to change.

The other basic battle messages for things like surprise attacks are all in the same block. Underneath them are the Battle Ending Messages:

Code: [Select]
  # Battle Ending Messages
  Victory         = "%s was victorious!"
  Defeat          = "%s was defeated."
  ObtainExp       = "%s EXP were received!"
  ObtainGold      = "%s%s were obtained!"
  ObtainItem      = "%s was found!"
  LevelUp         = "%s is now %s %s!"
  ObtainSkill     = "%s was learned!"

You should be able to use any of the GTC codes there, but again - just remember you need to escape the \s in single quotation mark strings. IE \\, not \

**
Rep: +0/-0Level 84
Current Project: RoSL
Hey modern,

I was looking through your ATS script and then this script, and was wondering how I could get the
Code: [Select]
# \w_method[x] - This will draw whatever weapon.method returns for the weapon
#          with ID x. Some suitable values for method are: name, description,
#          price, hit, atk, def, spi, agi, note, n, & any other methods that
#          return values from RPG::Weapon.
feature from ATS into the Text Codes script.

I use your Equipment Stat Variance script and would like to show the actual stat values of weapons, and armors, in the item's description. Tried using the "create your own" section of the GTC script, but couldn't figure out how to get that feature over from ATS successfully.

Hope I made things clear enough. If not, just let me know. Thanks in advance!

-Heart of Shadow-

"How can I be expected to save the world, when I can't even save myself?" --Sysolos(Return of a Shadow Lord)

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Well, it'd be a little tricky to get the proper ID if using Equipment Stat Variance, since each instance of the item is given a unique ID. So it wouldn't be as simple as it is in the ATS. But it's certainly doable - I would just want to add a code into the Instance Items Base that allows you to retrieve the ID of the particular instance in the description, and then add the stated code to the GTC.

It's not too hard, but I don't have the time to do it right now. I will, however.