Shop : Command Help

Shop : Command Help
Version: 3.5
By: Kain Nobel

Introduction

When you're in the normal shop scene (and maybe some custom ones), you'll notice that there is no help text when you're selecting the "Buy", "Sell" "Exit" commands... a little boring to look at, eh? Well, thats all this does is set text to that help window while the command window is active. Pretty simple!

Also, just to make it a little more interesting, you can set help text for different shops all within the script too! Like, lets say you want your Item shop to have different messages than your weapons/armors dealers, or if you want different trades of different types to all have personalized messages. Please read the FAQ on that if you're confused, and if you're still confused or having trouble you can ask me for help.

Features

  • Customizable messages for buy, sell and exit commands
  • Help messages can differ from shop to shop

Screenshots

Help window in scene shop with some text on it... imagine it, then you've taken a mental screenshot!

Script

Shop : Command Help (XP - SDK) Spoiler
  1. #===============================================================================
  2. # ** Shop : Command Help
  3. #===============================================================================
  4.  
  5. #-------------------------------------------------------------------------------
  6. # * SDK Log
  7. #-------------------------------------------------------------------------------
  8. SDK.log('Shop.CommandHelp', 'Kain Nobel ©', 3.5, '2009.06.17')
  9. #-------------------------------------------------------------------------------
  10. # * SDK Enabled Test : Begin
  11. #-------------------------------------------------------------------------------
  12. if SDK.enabled?('Shop.CommandHelp')
  13.  
  14. #===============================================================================
  15. # ** Scene_Shop
  16. #===============================================================================
  17.  
  18. class Scene_Shop
  19.   #-----------------------------------------------------------------------------
  20.   # * Help Text for Making Purchases
  21.   #-----------------------------------------------------------------------------
  22.   HelpBuy = {
  23.   'itm' => 'We\'ve got all your general goods, potions and breads \'n such...',
  24.   'arm' => 'Needing to suit up? You\'ll find something heavy around here...',
  25.   'wpn' => 'Got somebody or something to kill? You\'ve come to the right place!'
  26.   }
  27.   HelpBuy.default  = 'Welcome, would you like to look at our goods?'
  28.   #-----------------------------------------------------------------------------
  29.   # * Help Text for Selling Goods
  30.   #-----------------------------------------------------------------------------
  31.   HelpSell = {
  32.   'itm' => 'Although we only sell items, we\'ll buy your weapons and armors.',
  33.   'arm' => 'Sure, we\'re an armor shop, but we\'ll buy your other goods too!',
  34.   'wpn' => 'Even though we sell weapons, we buy anything you throw at us.'
  35.   }
  36.   HelpSell.default = 'Yes, we buy too! You got something to trade in?'
  37.   #-----------------------------------------------------------------------------
  38.   # * Help Text for Leaving Shop
  39.   #-----------------------------------------------------------------------------
  40.   HelpExit = {
  41.   'itm' => 'Stocked up on Potions already? Don\'t use them all in one place...',
  42.   'arm' => 'You look heavier already! Be safe dude, try not to get hurt!',
  43.   'wpn' => 'If you cause trouble with that thing, don\'t tell \'em you got it here!'
  44.   }
  45.   HelpExit.default = 'Leaving already? Thank you, come again soon!'
  46. end
  47.  
  48. #===============================================================================
  49. # ** Game_Temp
  50. #===============================================================================
  51.  
  52. class Game_Temp
  53.   #-----------------------------------------------------------------------------
  54.   # * Public Instance Variables
  55.   #-----------------------------------------------------------------------------
  56.   attr_accessor :shop_help_id     # Used for setting modes
  57.   attr_accessor :shop_help_buy    # Used for help text when buying
  58.   attr_accessor :shop_help_sell   # Used for help text when selling
  59.   attr_accessor :shop_sell_exit   # Used for help text when exiting
  60.   #-----------------------------------------------------------------------------
  61.   # * Alias Listings
  62.   #-----------------------------------------------------------------------------
  63.   alias_method :shophelptext_gmtemp_initialize, :initialize
  64.   #-----------------------------------------------------------------------------
  65.   # * Object Initialization
  66.   #-----------------------------------------------------------------------------
  67.   def initialize
  68.     shophelptext_gmtemp_initialize
  69.     shop_reset_help
  70.   end
  71.   #-----------------------------------------------------------------------------
  72.   # * Shop Help?
  73.   #-----------------------------------------------------------------------------
  74.   def shop_help?(command)
  75.     help_text = case command
  76.     when 0, SDK::Scene_Commands::Scene_Shop::Buy  then @shop_help_buy
  77.     when 1, SDK::Scene_Commands::Scene_Shop::Sell then @shop_help_sell
  78.     when 2, SDK::Scene_Commands::Scene_Shop::Exit then @shop_help_exit
  79.     else ; ''
  80.     end
  81.     (help_text.nil? ? '' : help_text)
  82.   end
  83.   #-----------------------------------------------------------------------------
  84.   # * Shop Help ID = (id)
  85.   #-----------------------------------------------------------------------------
  86.   def shop_help_id=(id)
  87.     shop_reset_help(id)
  88.   end
  89.   #-----------------------------------------------------------------------------
  90.   # * Shop Reset Help
  91.   #-----------------------------------------------------------------------------
  92.   def shop_reset_help(id = nil)
  93.     @shop_help_id   = id
  94.     @shop_help_buy  = Scene_Shop::HelpBuy[@shop_help_id]
  95.     @shop_help_sell = Scene_Shop::HelpSell[@shop_help_id]
  96.     @shop_help_exit = Scene_Shop::HelpExit[@shop_help_id]
  97.   end
  98. end
  99.  
  100. #===============================================================================
  101. # ** Scene_Shop
  102. #===============================================================================
  103.  
  104. class Scene_Shop < SDK::Scene_Base
  105.   #-----------------------------------------------------------------------------
  106.   # * Alias Listings
  107.   #-----------------------------------------------------------------------------
  108.   alias_method :shophelptext_snshop_main,          :main
  109.   alias_method :shophelptext_snshop_updatecommand, :update_command
  110.   #-----------------------------------------------------------------------------
  111.   # * Main
  112.   #-----------------------------------------------------------------------------
  113.   def main
  114.     shophelptext_snshop_main
  115.     $game_temp.shop_reset_help
  116.   end
  117.   #-----------------------------------------------------------------------------
  118.   # * Update Command
  119.   #-----------------------------------------------------------------------------
  120.   def update_command
  121.     shophelptext_snshop_updatecommand
  122.     if @help_window.respond_to?(:set_text)
  123.       help_text = @command_window.command
  124.       help_text = $game_temp.shop_help?(help_text)
  125.       @help_window.set_text(help_text, 1)
  126.     end
  127.   end
  128. end
  129.  
  130. #-------------------------------------------------------------------------------
  131. # * SDK Enabled Test : End
  132. #-------------------------------------------------------------------------------
  133. end
Expand to see the code.

Shop : Command Help (XP) Spoiler
  1. #===============================================================================
  2. # ** Shop : Command Help
  3. #===============================================================================
  4.  
  5. class Scene_Shop
  6.   #-----------------------------------------------------------------------------
  7.   # * Help Text for Making Purchases
  8.   #-----------------------------------------------------------------------------
  9.   HelpBuy = {
  10.   'itm' => 'We\'ve got all your general goods, potions and breads \'n such...',
  11.   'arm' => 'Needing to suit up? You\'ll find something heavy around here...',
  12.   'wpn' => 'Got somebody or something to kill? You\'ve come to the right place!'
  13.   }
  14.   HelpBuy.default  = 'Welcome, would you like to look at our goods?'
  15.   #-----------------------------------------------------------------------------
  16.   # * Help Text for Selling Goods
  17.   #-----------------------------------------------------------------------------
  18.   HelpSell = {
  19.   'itm' => 'Although we only sell items, we\'ll buy your weapons and armors.',
  20.   'arm' => 'Sure, we\'re an armor shop, but we\'ll buy your other goods too!',
  21.   'wpn' => 'Even though we sell weapons, we buy anything you throw at us.'
  22.   }
  23.   HelpSell.default = 'Yes, we buy too! You got something to trade in?'
  24.   #-----------------------------------------------------------------------------
  25.   # * Help Text for Leaving Shop
  26.   #-----------------------------------------------------------------------------
  27.   HelpExit = {
  28.   'itm' => 'Stocked up on Potions already? Don\'t use them all in one place...',
  29.   'arm' => 'You look heavier already! Be safe dude, try not to get hurt!',
  30.   'wpn' => 'If you cause trouble with that thing, don\'t tell \'em you got it here!'
  31.   }
  32.   HelpExit.default = 'Leaving already? Thank you, come again soon!'
  33. end
  34.  
  35. #===============================================================================
  36. # ** Game_Temp
  37. #===============================================================================
  38.  
  39. class Game_Temp
  40.   #-----------------------------------------------------------------------------
  41.   # * Public Instance Variables
  42.   #-----------------------------------------------------------------------------
  43.   attr_accessor :shop_help_id     # Used for setting modes
  44.   attr_accessor :shop_help_buy    # Used for help text when buying
  45.   attr_accessor :shop_help_sell   # Used for help text when selling
  46.   attr_accessor :shop_sell_exit   # Used for help text when exiting
  47.   #-----------------------------------------------------------------------------
  48.   # * Alias Listings
  49.   #-----------------------------------------------------------------------------
  50.   alias_method :shophelptext_gmtemp_initialize, :initialize
  51.   #-----------------------------------------------------------------------------
  52.   # * Object Initialization
  53.   #-----------------------------------------------------------------------------
  54.   def initialize
  55.     shophelptext_gmtemp_initialize
  56.     shop_reset_help
  57.   end
  58.   #-----------------------------------------------------------------------------
  59.   # * Shop Help?
  60.   #-----------------------------------------------------------------------------
  61.   def shop_help?(index)
  62.     help_text = case index
  63.     when 0 then @shop_help_buy
  64.     when 1 then @shop_help_sell
  65.     when 2 then @shop_help_exit
  66.     else ; ''
  67.     end
  68.     (help_text.nil? ? '' : help_text)
  69.   end
  70.   #-----------------------------------------------------------------------------
  71.   # * Shop Help ID = (id)
  72.   #-----------------------------------------------------------------------------
  73.   def shop_help_id=(id)
  74.     shop_reset_help(id)
  75.   end
  76.   #-----------------------------------------------------------------------------
  77.   # * Shop Reset Help
  78.   #-----------------------------------------------------------------------------
  79.   def shop_reset_help(id = nil)
  80.     @shop_help_id   = id
  81.     @shop_help_buy  = Scene_Shop::HelpBuy[@shop_help_id]
  82.     @shop_help_sell = Scene_Shop::HelpSell[@shop_help_id]
  83.     @shop_help_exit = Scene_Shop::HelpExit[@shop_help_id]
  84.   end
  85. end
  86.  
  87. #===============================================================================
  88. # ** Scene_Shop
  89. #===============================================================================
  90.  
  91. class Scene_Shop
  92.   #-----------------------------------------------------------------------------
  93.   # * Alias Listings
  94.   #-----------------------------------------------------------------------------
  95.   alias_method :shophelptext_snshop_main,          :main
  96.   alias_method :shophelptext_snshop_updatecommand, :update_command
  97.   #-----------------------------------------------------------------------------
  98.   # * Main
  99.   #-----------------------------------------------------------------------------
  100.   def main
  101.     shophelptext_snshop_main
  102.     $game_temp.shop_reset_help
  103.   end
  104.   #-----------------------------------------------------------------------------
  105.   # * Update Command
  106.   #-----------------------------------------------------------------------------
  107.   def update_command
  108.     shophelptext_snshop_updatecommand
  109.     if @help_window.respond_to?(:set_text)
  110.       help_text = @command_window.index
  111.       help_text = $game_temp.shop_help?(help_text)
  112.       @help_window.set_text(help_text, 1)
  113.     end
  114.   end
  115. end
Expand to see the code.

Shop : Command Help (VX) Spoiler
  1. #===============================================================================
  2. # ** Shop : Command Help
  3. #===============================================================================
  4.  
  5. class Scene_Shop
  6.   #-----------------------------------------------------------------------------
  7.   # * Help Text for Making Purchases
  8.   #-----------------------------------------------------------------------------
  9.   HelpBuy = {
  10.   'itm' => 'We\'ve got all your general goods, potions and breads \'n such...',
  11.   'arm' => 'Needing to suit up? You\'ll find something heavy around here...',
  12.   'wpn' => 'Got somebody or something to kill? You\'ve come to the right place!'
  13.   }
  14.   HelpBuy.default  = 'Welcome, would you like to look at our goods?'
  15.   #-----------------------------------------------------------------------------
  16.   # * Help Text for Selling Goods
  17.   #-----------------------------------------------------------------------------
  18.   HelpSell = {
  19.   'itm' => 'Although we only sell items, we\'ll buy your weapons and armors.',
  20.   'arm' => 'Sure, we\'re an armor shop, but we\'ll buy your other goods too!',
  21.   'wpn' => 'Even though we sell weapons, we buy anything you throw at us.'
  22.   }
  23.   HelpSell.default = 'Yes, we buy too! You got something to trade in?'
  24.   #-----------------------------------------------------------------------------
  25.   # * Help Text for Leaving Shop
  26.   #-----------------------------------------------------------------------------
  27.   HelpExit = {
  28.   'itm' => 'Stocked up on Potions already? Don\'t use them all in one place...',
  29.   'arm' => 'You look heavier already! Be safe dude, try not to get hurt!',
  30.   'wpn' => 'If you cause trouble with that thing, don\'t tell \'em you got it here!'
  31.   }
  32.   HelpExit.default = 'Leaving already? Thank you, come again soon!'
  33. end
  34.  
  35. #===============================================================================
  36. # ** Game_Temp
  37. #===============================================================================
  38.  
  39. class Game_Temp
  40.   #-----------------------------------------------------------------------------
  41.   # * Public Instance Variables
  42.   #-----------------------------------------------------------------------------
  43.   attr_accessor :shop_help_id     # Used for setting modes
  44.   attr_accessor :shop_help_buy    # Used for help text when buying
  45.   attr_accessor :shop_help_sell   # Used for help text when selling
  46.   attr_accessor :shop_sell_exit   # Used for help text when exiting
  47.   #-----------------------------------------------------------------------------
  48.   # * Alias Listings
  49.   #-----------------------------------------------------------------------------
  50.   alias_method :shophelptext_gmtemp_initialize, :initialize
  51.   #-----------------------------------------------------------------------------
  52.   # * Object Initialization
  53.   #-----------------------------------------------------------------------------
  54.   def initialize
  55.     shophelptext_gmtemp_initialize
  56.     shop_reset_help
  57.   end
  58.   #-----------------------------------------------------------------------------
  59.   # * Shop Help?
  60.   #-----------------------------------------------------------------------------
  61.   def shop_help?(index)
  62.     help_text = case index
  63.     when 0 then @shop_help_buy
  64.     when 1 then @shop_help_sell
  65.     when 2 then @shop_help_exit
  66.     else ; ''
  67.     end
  68.     (help_text.nil? ? '' : help_text)
  69.   end
  70.   #-----------------------------------------------------------------------------
  71.   # * Shop Help ID = (id)
  72.   #-----------------------------------------------------------------------------
  73.   def shop_help_id=(id)
  74.     shop_reset_help(id)
  75.   end
  76.   #-----------------------------------------------------------------------------
  77.   # * Shop Reset Help
  78.   #-----------------------------------------------------------------------------
  79.   def shop_reset_help(id = nil)
  80.     @shop_help_id   = id
  81.     @shop_help_buy  = Scene_Shop::HelpBuy[@shop_help_id]
  82.     @shop_help_sell = Scene_Shop::HelpSell[@shop_help_id]
  83.     @shop_help_exit = Scene_Shop::HelpExit[@shop_help_id]
  84.   end
  85. end
  86.  
  87. #===============================================================================
  88. # ** Scene_Shop
  89. #===============================================================================
  90.  
  91. class Scene_Shop
  92.   #-----------------------------------------------------------------------------
  93.   # * Alias Listings
  94.   #-----------------------------------------------------------------------------
  95.   alias_method :shophelptext_snshop_terminate,     :terminate
  96.   alias_method :shophelptext_snshop_updatecommand, :update_command_selection
  97.   #-----------------------------------------------------------------------------
  98.   # * Start
  99.   #-----------------------------------------------------------------------------
  100.   def terminate
  101.     shophelptext_snshop_terminate
  102.     $game_temp.shop_reset_help
  103.   end
  104.   #-----------------------------------------------------------------------------
  105.   # * Update Command
  106.   #-----------------------------------------------------------------------------
  107.   def update_command_selection
  108.     shophelptext_snshop_updatecommand
  109.     if @help_window.respond_to?(:set_text)
  110.       help_text = @command_window.index
  111.       help_text = $game_temp.shop_help?(help_text)
  112.       @help_window.set_text(help_text, 1)
  113.     end
  114.   end
  115. end
Expand to see the code.

Instructions

Place Above Main (Below SDK if using SDK Version, obviously). There is already messages setup as an example of the settings, please read the FAQ before asking how to use this.

FAQ

Setting Help Messages Spoiler
This part is fun, so long as you don't need the Idiots Guide to Ruby Hashes. Here's an example of setting up help messages for the 'Buy' command...

HelpBuy = {
'itm' => "Yes, we sell items!",
'arm' => "Yes, we sell armor!",
'wpn' => "Yes, we sell weapons!"
}
HelpBuy.default = "This is the default message... yeah..."


The same applies to HelpBuy, HelpSell and HelpExit as well, and the keys can be anything that isn't nil, a string, an integer, a floating point number, it doesn't matter so long as you know what message you want to call for what shop. Also nil denotes the .default setting of that message anyways, so yeah it'd be pointless to define a nil key and a default at the same time.

Now, before calling the shop in question, lets say you want to call an item shop, you'd do...

$game_temp.shop_help_id = 'itm'

Any further questions on this, please feel free to ask...


Compatibility

One for XP (with or without SDK), one for VX, they should be compatible with most custom shop scripts. Also, you can use the non-SDK version if you're using SDK, but I'd suggest using the SDK version in that case anyways.

This script aliases the folliwng methods... Spoiler
Game_Temp.initialize
Scene_Shop.main (XP)
Scene_Shop.update_command (XP)
Scene_Shop.terminate (VX)
Scene_Shop.update_command_selection (VX)


Authors Notes

Please leave me any comments, questions or suggestions that may arise!

Terms and Conditions

Another "Free to use in commercial and non-commercial" projects, so long as you credit me!
Wow really good script.

I'm surely going to use this one!
Neat. Useful. Fun!

And easy too!

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