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.

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

Code:
#===============================================================================

# ** Shop : Command Help

#===============================================================================

 

#-------------------------------------------------------------------------------

# * SDK Log

#-------------------------------------------------------------------------------

SDK.log('Shop.CommandHelp', 'Kain Nobel ©', 3.5, '2009.06.17')

#-------------------------------------------------------------------------------

# * SDK Enabled Test : Begin

#-------------------------------------------------------------------------------

if SDK.enabled?('Shop.CommandHelp')

 

#===============================================================================

# ** Scene_Shop

#===============================================================================

 

class Scene_Shop

  #-----------------------------------------------------------------------------

  # * Help Text for Making Purchases

  #-----------------------------------------------------------------------------

  HelpBuy = {

  'itm' => 'We\'ve got all your general goods, potions and breads \'n such...',

  'arm' => 'Needing to suit up? You\'ll find something heavy around here...',

  'wpn' => 'Got somebody or something to kill? You\'ve come to the right place!'

  }

  HelpBuy.default  = 'Welcome, would you like to look at our goods?'

  #-----------------------------------------------------------------------------

  # * Help Text for Selling Goods

  #-----------------------------------------------------------------------------

  HelpSell = {

  'itm' => 'Although we only sell items, we\'ll buy your weapons and armors.',

  'arm' => 'Sure, we\'re an armor shop, but we\'ll buy your other goods too!',

  'wpn' => 'Even though we sell weapons, we buy anything you throw at us.'

  }

  HelpSell.default = 'Yes, we buy too! You got something to trade in?'

  #-----------------------------------------------------------------------------

  # * Help Text for Leaving Shop

  #-----------------------------------------------------------------------------

  HelpExit = {

  'itm' => 'Stocked up on Potions already? Don\'t use them all in one place...',

  'arm' => 'You look heavier already! Be safe dude, try not to get hurt!',

  'wpn' => 'If you cause trouble with that thing, don\'t tell \'em you got it here!'

  }

  HelpExit.default = 'Leaving already? Thank you, come again soon!'

end

 

#===============================================================================

# ** Game_Temp

#===============================================================================

 

class Game_Temp

  #-----------------------------------------------------------------------------

  # * Public Instance Variables

  #-----------------------------------------------------------------------------

  attr_accessor :shop_help_id     # Used for setting modes

  attr_accessor :shop_help_buy    # Used for help text when buying

  attr_accessor :shop_help_sell   # Used for help text when selling

  attr_accessor :shop_sell_exit   # Used for help text when exiting

  #-----------------------------------------------------------------------------

  # * Alias Listings

  #-----------------------------------------------------------------------------

  alias_method :shophelptext_gmtemp_initialize, :initialize

  #-----------------------------------------------------------------------------

  # * Object Initialization

  #-----------------------------------------------------------------------------

  def initialize

    shophelptext_gmtemp_initialize

    shop_reset_help

  end

  #-----------------------------------------------------------------------------

  # * Shop Help?

  #-----------------------------------------------------------------------------

  def shop_help?(command)

    help_text = case command

    when 0, SDK::Scene_Commands::Scene_Shop::Buy  then @shop_help_buy

    when 1, SDK::Scene_Commands::Scene_Shop::Sell then @shop_help_sell

    when 2, SDK::Scene_Commands::Scene_Shop::Exit then @shop_help_exit

    else ; ''

    end

    (help_text.nil? ? '' : help_text)

  end

  #-----------------------------------------------------------------------------

  # * Shop Help ID = (id)

  #-----------------------------------------------------------------------------

  def shop_help_id=(id)

    shop_reset_help(id)

  end

  #-----------------------------------------------------------------------------

  # * Shop Reset Help

  #-----------------------------------------------------------------------------

  def shop_reset_help(id = nil)

    @shop_help_id   = id

    @shop_help_buy  = Scene_Shop::HelpBuy[@shop_help_id]

    @shop_help_sell = Scene_Shop::HelpSell[@shop_help_id]

    @shop_help_exit = Scene_Shop::HelpExit[@shop_help_id]

  end

end

 

#===============================================================================

# ** Scene_Shop

#===============================================================================

 

class Scene_Shop < SDK::Scene_Base

  #-----------------------------------------------------------------------------

  # * Alias Listings

  #-----------------------------------------------------------------------------

  alias_method :shophelptext_snshop_main,          :main

  alias_method :shophelptext_snshop_updatecommand, :update_command

  #-----------------------------------------------------------------------------

  # * Main

  #-----------------------------------------------------------------------------

  def main

    shophelptext_snshop_main

    $game_temp.shop_reset_help

  end

  #-----------------------------------------------------------------------------

  # * Update Command

  #-----------------------------------------------------------------------------

  def update_command

    shophelptext_snshop_updatecommand

    if @help_window.respond_to?(:set_text)

      help_text = @command_window.command

      help_text = $game_temp.shop_help?(help_text)

      @help_window.set_text(help_text, 1)

    end

  end

end

 

#-------------------------------------------------------------------------------

# * SDK Enabled Test : End

#-------------------------------------------------------------------------------

end
Code:
#===============================================================================

# ** Shop : Command Help

#===============================================================================

 

class Scene_Shop

  #-----------------------------------------------------------------------------

  # * Help Text for Making Purchases

  #-----------------------------------------------------------------------------

  HelpBuy = {

  'itm' => 'We\'ve got all your general goods, potions and breads \'n such...',

  'arm' => 'Needing to suit up? You\'ll find something heavy around here...',

  'wpn' => 'Got somebody or something to kill? You\'ve come to the right place!'

  }

  HelpBuy.default  = 'Welcome, would you like to look at our goods?'

  #-----------------------------------------------------------------------------

  # * Help Text for Selling Goods

  #-----------------------------------------------------------------------------

  HelpSell = {

  'itm' => 'Although we only sell items, we\'ll buy your weapons and armors.',

  'arm' => 'Sure, we\'re an armor shop, but we\'ll buy your other goods too!',

  'wpn' => 'Even though we sell weapons, we buy anything you throw at us.'

  }

  HelpSell.default = 'Yes, we buy too! You got something to trade in?'

  #-----------------------------------------------------------------------------

  # * Help Text for Leaving Shop

  #-----------------------------------------------------------------------------

  HelpExit = {

  'itm' => 'Stocked up on Potions already? Don\'t use them all in one place...',

  'arm' => 'You look heavier already! Be safe dude, try not to get hurt!',

  'wpn' => 'If you cause trouble with that thing, don\'t tell \'em you got it here!'

  }

  HelpExit.default = 'Leaving already? Thank you, come again soon!'

end

 

#===============================================================================

# ** Game_Temp

#===============================================================================

 

class Game_Temp

  #-----------------------------------------------------------------------------

  # * Public Instance Variables

  #-----------------------------------------------------------------------------

  attr_accessor :shop_help_id     # Used for setting modes

  attr_accessor :shop_help_buy    # Used for help text when buying

  attr_accessor :shop_help_sell   # Used for help text when selling

  attr_accessor :shop_sell_exit   # Used for help text when exiting

  #-----------------------------------------------------------------------------

  # * Alias Listings

  #-----------------------------------------------------------------------------

  alias_method :shophelptext_gmtemp_initialize, :initialize

  #-----------------------------------------------------------------------------

  # * Object Initialization

  #-----------------------------------------------------------------------------

  def initialize

    shophelptext_gmtemp_initialize

    shop_reset_help

  end

  #-----------------------------------------------------------------------------

  # * Shop Help?

  #-----------------------------------------------------------------------------

  def shop_help?(index)

    help_text = case index

    when 0 then @shop_help_buy

    when 1 then @shop_help_sell

    when 2 then @shop_help_exit

    else ; ''

    end

    (help_text.nil? ? '' : help_text)

  end

  #-----------------------------------------------------------------------------

  # * Shop Help ID = (id)

  #-----------------------------------------------------------------------------

  def shop_help_id=(id)

    shop_reset_help(id)

  end

  #-----------------------------------------------------------------------------

  # * Shop Reset Help

  #-----------------------------------------------------------------------------

  def shop_reset_help(id = nil)

    @shop_help_id   = id

    @shop_help_buy  = Scene_Shop::HelpBuy[@shop_help_id]

    @shop_help_sell = Scene_Shop::HelpSell[@shop_help_id]

    @shop_help_exit = Scene_Shop::HelpExit[@shop_help_id]

  end

end

 

#===============================================================================

# ** Scene_Shop

#===============================================================================

 

class Scene_Shop

  #-----------------------------------------------------------------------------

  # * Alias Listings

  #-----------------------------------------------------------------------------

  alias_method :shophelptext_snshop_main,          :main

  alias_method :shophelptext_snshop_updatecommand, :update_command

  #-----------------------------------------------------------------------------

  # * Main

  #-----------------------------------------------------------------------------

  def main

    shophelptext_snshop_main

    $game_temp.shop_reset_help

  end

  #-----------------------------------------------------------------------------

  # * Update Command

  #-----------------------------------------------------------------------------

  def update_command

    shophelptext_snshop_updatecommand

    if @help_window.respond_to?(:set_text)

      help_text = @command_window.index

      help_text = $game_temp.shop_help?(help_text)

      @help_window.set_text(help_text, 1)

    end

  end

end
Code:
#===============================================================================

# ** Shop : Command Help

#===============================================================================

 

class Scene_Shop

  #-----------------------------------------------------------------------------

  # * Help Text for Making Purchases

  #-----------------------------------------------------------------------------

  HelpBuy = {

  'itm' => 'We\'ve got all your general goods, potions and breads \'n such...',

  'arm' => 'Needing to suit up? You\'ll find something heavy around here...',

  'wpn' => 'Got somebody or something to kill? You\'ve come to the right place!'

  }

  HelpBuy.default  = 'Welcome, would you like to look at our goods?'

  #-----------------------------------------------------------------------------

  # * Help Text for Selling Goods

  #-----------------------------------------------------------------------------

  HelpSell = {

  'itm' => 'Although we only sell items, we\'ll buy your weapons and armors.',

  'arm' => 'Sure, we\'re an armor shop, but we\'ll buy your other goods too!',

  'wpn' => 'Even though we sell weapons, we buy anything you throw at us.'

  }

  HelpSell.default = 'Yes, we buy too! You got something to trade in?'

  #-----------------------------------------------------------------------------

  # * Help Text for Leaving Shop

  #-----------------------------------------------------------------------------

  HelpExit = {

  'itm' => 'Stocked up on Potions already? Don\'t use them all in one place...',

  'arm' => 'You look heavier already! Be safe dude, try not to get hurt!',

  'wpn' => 'If you cause trouble with that thing, don\'t tell \'em you got it here!'

  }

  HelpExit.default = 'Leaving already? Thank you, come again soon!'

end

 

#===============================================================================

# ** Game_Temp

#===============================================================================

 

class Game_Temp

  #-----------------------------------------------------------------------------

  # * Public Instance Variables

  #-----------------------------------------------------------------------------

  attr_accessor :shop_help_id     # Used for setting modes

  attr_accessor :shop_help_buy    # Used for help text when buying

  attr_accessor :shop_help_sell   # Used for help text when selling

  attr_accessor :shop_sell_exit   # Used for help text when exiting

  #-----------------------------------------------------------------------------

  # * Alias Listings

  #-----------------------------------------------------------------------------

  alias_method :shophelptext_gmtemp_initialize, :initialize

  #-----------------------------------------------------------------------------

  # * Object Initialization

  #-----------------------------------------------------------------------------

  def initialize

    shophelptext_gmtemp_initialize

    shop_reset_help

  end

  #-----------------------------------------------------------------------------

  # * Shop Help?

  #-----------------------------------------------------------------------------

  def shop_help?(index)

    help_text = case index

    when 0 then @shop_help_buy

    when 1 then @shop_help_sell

    when 2 then @shop_help_exit

    else ; ''

    end

    (help_text.nil? ? '' : help_text)

  end

  #-----------------------------------------------------------------------------

  # * Shop Help ID = (id)

  #-----------------------------------------------------------------------------

  def shop_help_id=(id)

    shop_reset_help(id)

  end

  #-----------------------------------------------------------------------------

  # * Shop Reset Help

  #-----------------------------------------------------------------------------

  def shop_reset_help(id = nil)

    @shop_help_id   = id

    @shop_help_buy  = Scene_Shop::HelpBuy[@shop_help_id]

    @shop_help_sell = Scene_Shop::HelpSell[@shop_help_id]

    @shop_help_exit = Scene_Shop::HelpExit[@shop_help_id]

  end

end

 

#===============================================================================

# ** Scene_Shop

#===============================================================================

 

class Scene_Shop

  #-----------------------------------------------------------------------------

  # * Alias Listings

  #-----------------------------------------------------------------------------

  alias_method :shophelptext_snshop_terminate,     :terminate

  alias_method :shophelptext_snshop_updatecommand, :update_command_selection

  #-----------------------------------------------------------------------------

  # * Start

  #-----------------------------------------------------------------------------

  def terminate

    shophelptext_snshop_terminate

    $game_temp.shop_reset_help

  end

  #-----------------------------------------------------------------------------

  # * Update Command

  #-----------------------------------------------------------------------------

  def update_command_selection

    shophelptext_snshop_updatecommand

    if @help_window.respond_to?(:set_text)

      help_text = @command_window.index

      help_text = $game_temp.shop_help?(help_text)

      @help_window.set_text(help_text, 1)

    end

  end

end
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

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.

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!
 

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