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.

Message : Longer Choices

Message : Longer Choices
Version: 3.5
By: Kain Nobel & RPG Advocate

Introduction

You ever notice how your text box for the Show Choice commands aren't as long as the choice window can display? Silly Enterbrain! Well, I made this snippet to relieve that, for people who want to fill their choice selections.

Features

  • Show longer choices with a simple call script!
  • Works alongside normal choice setting concepts
  • Way cleaner and compact than RPG Advocate's origional code
  • Long choices reset themselves between messages

Screenshots

In both examples, the first line is the choices made via call script, and the second choice just demonstrates the constraints of EB's choice box in their editor.
LongChoices.png

Script

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

# * Message : Longer Choices

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

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

# * SDK Log

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

if Object.const_defined?(:SDK)

  SDK.log('Message.LongerChoices', 'Kain Nobel ©', 3.5, '2009.06.17')

end

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

# ** Interpreter

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

 

class Interpreter

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

  # * Alias Listings

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

  alias_method :longerchoices_interpreter_initialize,   :initialize

  alias_method :longerchoices_interpreter_setupchoices, :setup_choices

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

  # * Object Initialization

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

  def initialize(*args)

    longerchoices_interpreter_initialize (*args)

    @choices = Hash.new

    @choices.default = ''

  end

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

  # * lc[n]= ''

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

  def lc

    @choices

  end

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

  # * Long Choices

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

  def setup_choices(parameters)

    if @choices.is_a?(Hash)

      s1 = (@choices[1].nil? ? '' : @choices[1])

      s2 = (@choices[2].nil? ? '' : @choices[2])

      s3 = (@choices[3].nil? ? '' : @choices[3])

      s4 = (@choices[4].nil? ? '' : @choices[4])

      @parameters[0][0] = s1 if s1 != ''

      @parameters[0][1] = s2 if s2 != ''

      @parameters[0][2] = s3 if s3 != ''

      @parameters[0][3] = s4 if s4 != ''

    end

    @choices = Hash.new

    @choices.default = ''

    longerchoices_interpreter_setupchoices(parameters)

  end

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

# ** Interpreter

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

 

class Game_Interpreter

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

  # * Alias Listings

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

  alias_method :longerchoices_gminterpreter_initialize,   :initialize

  alias_method :longerchoices_gminterpreter_setupchoices, :setup_choices

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

  # * Object Initialization

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

  def initialize(*args)

    longerchoices_gminterpreter_initialize (*args)

    @choices = Hash.new

    @choices.default = ''

  end

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

  # * lc[n]= ''

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

  def lc

    @choices

  end

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

  # * Long Choices

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

  def setup_choices(params)

    if @choices.is_a?(Hash)

      s1 = (@choices[1].nil? ? '' : @choices[1])

      s2 = (@choices[2].nil? ? '' : @choices[2])

      s3 = (@choices[3].nil? ? '' : @choices[3])

      s4 = (@choices[4].nil? ? '' : @choices[4])

      params[0][0] = s1 if s1 != ''

      params[0][1] = s2 if s2 != ''

      params[0][2] = s3 if s3 != ''

      params[0][3] = s4 if s4 != ''

    end

    @choices = Hash.new

    @choices.default = ''

    longerchoices_gminterpreter_setupchoices(params)

  end

end

Instructions

The standard, below Main and above SDK (if using), although this doesn't require SDK at all so you're good to go. In order to do longer choices, you'd set up a call script like so...

Code:
lc[1] = "I'm the first very long ch"+

"oice, look I fill the window!"

You'd then setup your Show Choices event command as normal, but whatever you put as your first choice would be ignored and replaced with whatever you set lc[1] as, same applies to other choices.

Compatibility

XP version does NOT require SDK but will log if SDK is present. Should be compatable with most exotic message systems.

Credits and Thanks

I've improved RPG Advocate's cluster of overwritten command_101 and command_102 and made syntax easier.

Terms and Conditions

Free to use in commercial and non-commercial games. Please credit RPG Advocate for origional, and me for the much more compact and friendly version ;)
 

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