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

Name character whatever you want Spoiler
Image

Use command in the description Spoiler
Image

Description remains correct Spoiler
Image


Script

  1. #=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
  2. # Enhanced Item Description
  3. # Author: ForeverZer0
  4. # Version: 1.0
  5. # Date: 5.14.2011
  6. #=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
  7. #
  8. # Introduction:
  9. #   This is a small, very basic script I wrote a while back, but never released.
  10. #   It allows for you to use the same type of commands you can use in event
  11. #   "Show Message" commands, but within the descriptions of Weapons, Armors, and
  12. #   Items. Review the commands below, they will be substituted in the actual
  13. #   text to display the respective value.
  14. #
  15. # Commands:
  16. #   \v[ID]  = Replaces with value of game variable with ID
  17. #   \n[ID]  = Replaces with name of actor that has ID
  18. #   \sw[ID] = Replaces with value of switch withg ID  (ON/OFF)
  19. #   \g      = Replaces with amount of gold party has
  20. #   \st     = Replaces with step count
  21. #
  22. # Author's Notes:
  23. #   I can add more at request. Only values that are global to the RTP scripts
  24. #   and cannot be easily accessed will be added to the script, though I can
  25. #   still give someone a one line of code they can add themselves for custom
  26. #   commands.
  27. #
  28. #=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
  29.  
  30. module RPG
  31.   
  32.   def self.substitute_text(message)
  33.     text = message.clone
  34.     text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  35.     text.gsub!(/\\[Nn]\[([0-9]+)\]/) {
  36.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : '' }
  37.     text.gsub!(/\\[Gg]/) { $game_party.gold }
  38.     text.gsub!(/\\[Ss][Tt]/) { $game_party.steps }
  39.     text.gsub!(/\\[Ss][Ww]\[([0-9]+)\]/) {
  40.       $game_switches[$1.to_i] ? 'ON' : 'OFF' }
  41.     return text
  42.   end
  43.   
  44.   class Weapon
  45.     def description
  46.       return RPG.substitute_text(@description)
  47.     end
  48.   end
  49.   
  50.   class Armor
  51.     def description
  52.       return RPG.substitute_text(@description)
  53.     end
  54.   end
  55.   
  56.   class Item
  57.     def description
  58.       return RPG.substitute_text(@description)
  59.     end
  60.   end
  61. end
Expand to see the code.


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
Content Hidden Spoiler
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.
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

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=74940