Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Enhanced Item Description

Enhanced Item Description Version: 1.0
By: ForeverZer0

Introduction

This is a small script I wrote when I got started scripting, but never released. I found it going through some old projects, but I'm sure someone else can make use of it. What it does is allows you to use the same shortcuts commands you can in a "Show Text..." command, but within the descriptions for Items, Weapons, and Armors. For example, if you wanted the description to include the value of a variable, in the database where you right the descriptions, just use "\v[VAR_ID]", and the command will be replaced with the actual value of the variable during the game.

Features
  • Easy to use.
  • Makes descriptions a little more dynamic.
  • Commands included: Actor Names, Variables, Gold, Switches, and Steps.
  • Can easily add custom ones

Screenshots

EnhancedDesc1.png
EnhancedDesc2.png
EnhancedDesc3.png

Script

[rgss]#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# Enhanced Item Description
# Author: ForeverZer0
# Version: 1.0
# Date: 5.14.2011
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
#
# Introduction:
#   This is a small, very basic script I wrote a while back, but never released.
#   It allows for you to use the same type of commands you can use in event
#   "Show Message" commands, but within the descriptions of Weapons, Armors, and
#   Items. Review the commands below, they will be substituted in the actual
#   text to display the respective value.
#
# Commands:
#   \v[ID]  = Replaces with value of game variable with ID
#   \n[ID]  = Replaces with name of actor that has ID
#   \sw[ID] = Replaces with value of switch withg ID  (ON/OFF)
#   \g      = Replaces with amount of gold party has
#   \st     = Replaces with step count
#
# Author's Notes:
#   I can add more at request. Only values that are global to the RTP scripts
#   and cannot be easily accessed will be added to the script, though I can
#   still give someone a one line of code they can add themselves for custom
#   commands.
#
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
 
module RPG
  
  def self.substitute_text(message)
    text = message.clone
    text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
    text.gsub!(/\\[Nn]\[([0-9]+)\]/) {
        $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : '' }
    text.gsub!(/\\[Gg]/) { $game_party.gold }
    text.gsub!(/\\[Ss][Tt]/) { $game_party.steps }
    text.gsub!(/\\[Ss][Ww]\[([0-9]+)\]/) {
      $game_switches[$1.to_i] ? 'ON' : 'OFF' }
    return text
  end
  
  class Weapon
    def description
      return RPG.substitute_text(@description)
    end
  end
  
  class Armor
    def description
      return RPG.substitute_text(@description)
    end
  end
  
  class Item
    def description
      return RPG.substitute_text(@description)
    end
  end
end
[/rgss]

Instructions

Place script anywhere above "Main".
Use the following commands in the database when making descriptions:
  • \v[ID] :  Replaces with value of game variable with ID
  • \n[ID] :  Replaces with name of actor that has ID
  • \sw[ID] :  Replaces with value of switch with ID  (ON/OFF)
  • \g :  Replaces with amount of gold party has
  • \st : Replaces with step count

Author's Notes

Please report any bugs/issues so that they can be resolved. Enjoy!

Terms and Conditions

Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
You are free:

to Share - to copy, distribute and transmit the work
to Remix - to adapt the work

Under the following conditions:

Attribution. You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).

Noncommercial. You may not use this work for commercial purposes.

Share alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.

- For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page.

- Any of the above conditions can be waived if you get permission from the copyright holder.

- Nothing in this license impairs or restricts the author's moral rights.
 
I recall a script snippet from... heh, I somehow have 'TREG' in my mind now, even though that seems highly unlikely XD But either way, it's called message tags everywhere, or something. It allows to use all the tags (including color, for example) in all the locations possible, and I think I recall it to be another tad slimmer than this. Might want to have a look into it, merge the two thoughts and make a third, better script coming from it ;)
 
You could easily just alias the draw_text method of the Bitmap class, but that could possibly cause compatibility issues, so I went this route.
 

Atoa

Member

I have an similar script that works for any help window, that allows most message comands into help windows.
But it also falls on the compatibility problem because it edits the Window_Help.set_text
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top