ControlC ControlC.com

Help Window for Choices v2.00 Edited with...

Views: 217Total Chars: 16,461
Created: 9/30/14 12:20:41PM ET
Self Destructs: Never
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Help Window for Choices
# Version: 2.0
# Authors: DiamondandPlatinum3
# Date: December 4, 2012 (Original)
# December 14, 2013 (Updated)
# -------------------------------------
# Help Picture for Choices(add-on)
# By: BoluBolu
# Date: September 26, 2014(Original)
#
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Description:
#
# This script adds on to the default choice system, allowing you to have a
# help window at the top of the screen to assist players in the choices they
# have to make

# BoluBolu Description :
#
# Now you can not only show help window text, but also a picture for each
# choice in the window choicelist.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#------------------------------------------------------------------------------
# Instructions:
#
# {Note to previous users of this script: This script has updated the way you
# Insert data. Fear not, for the old way to insert data is still available;
# so you will not have to redo anything, however read up on the new way to
# insert data}
#
#
#
# ~ To use this script, just before using a choice event, use the following
# script call to begin adding text to the help window:
# add_command_list_help_text
#
# Now using Show Text Windows, insert the text to be displayed.
# Once the desired information is inserted, close the link with
# the following script call:
# end_command_list_help_text
#
# Continue using that same pattern until all of your choices have
# descriptions.
#
#
# ~ The Position of the Help Window depends on what position you gave the
# Show Text window.
#
#
# # Example Screen Can Be Found Here:
# http://i.imgur.com/XAkhNEf.png
#
#
# ----------------------------------------------------------------------------
# BoluBolu Instructions:
# - Before using show choice you need to add your picture first.
# Use this script call :
# add_picture_help(index, filename, x_pos, y_pos)
#
# index = your choice list index, 0 means the first top choice list index.
# filename = The filename of the picture in Graphics/Picture folder.
# filename must be written with doublequotes. i.e: "testpicture"
# x_pos = The x coordinate of picture in screen.
# y_pos = The y coordinate of picture in screen
#
# - This also compatible with DP3 original hepl window text, means you can
# display picture also window help together.
#
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# THERE IS NO EDITABLE REGION TO THIS SCRIPT
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

# Attention : At the very bottom of the script you should see the script's End
# Line. If not the script might not copied completely and might
# cause crash. Go download again this script.
#


#==============================================================================
# ** Game_Message
#------------------------------------------------------------------------------
# This class handles the state of the message window that displays text or
# selections, etc. The instance of this class is referenced by $game_message.
#==============================================================================

class Game_Message
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# *= Alias Listings
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias_method(:dp3_gamemessage_initialize_235ufnh, :initialize)
alias_method(:dp3_gamemessage_clear_235ufnh, :clear )
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * New Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_accessor :choice_help_text # Help Text for choices (Hash)
attr_accessor :picture_help # Help Pic for choices (Hash) (BoluBolu)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Aliased Method: Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize()
dp3_gamemessage_initialize_235ufnh() # Call Original Method
@choice_help_text = Hash.new()
@picture_help = Hash.new() # Bolu new instance variable
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Aliased Method: Clear
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def clear()
dp3_gamemessage_clear_235ufnh() # Call Original Method
@choice_help_text = Hash.new()
@picture_help = Hash.new() # Bolu new instance variable
end

end

#==============================================================================
# ** DP3_Choice_Window_Help
#------------------------------------------------------------------------------
# This window displays help text for the choices inside of a choice window
#==============================================================================

class DP3_Choice_Window_Help < Window_Help
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * New Method: Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize(text, position)
super( [text.split("
").size, 2].max )
self.y = position * (Graphics.height - self.height) / 2
self.openness = 0
set_text(text)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * New Method: Immediately Open
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def immediately_open()
self.openness = 255
end
end

#==============================================================================
# ** Sprite_Bolu_Picture (Bolu New Class)
#------------------------------------------------------------------------------
# This class will display a picture for the choices of inside a window choice
#==============================================================================
class Sprite_Bolu_Picture < Sprite_Base
def initialize(filename, x_pos, y_pos, viewport = nil)
super(viewport)
@filename = filename
@x_pos = x_pos
@y_pos = y_pos
create_sprite_picture
end

def hide; self.visible = false; end
def show; self.visible = true; end

def create_sprite_picture
self.bitmap.dispose if self.bitmap
self.bitmap = Cache.picture(@filename)
self.x = @x_pos
self.y = @y_pos
self.z = 10
end

end # End of Sprite_Bolu_Picture

#==============================================================================
# ** Window_ChoiceList
#------------------------------------------------------------------------------
# This window is used for the event command [Show Choices].
#==============================================================================

class Window_ChoiceList < Window_Command
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# *= Alias Listings
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias_method(:dp3_windowchoicelist_update_235ufnh, :update )
alias_method(:dp3_windowchoicelist_select_235ufnh, :select )
alias_method(:dp3_windowchoicelist_cursordown_235ufnh, :cursor_down)
alias_method(:dp3_windowchoicelist_cursorup_235ufnh, :cursor_up )
alias_method(:dp3_windowchoicelist_open_235ufnh, :open )
alias_method(:dp3_windowchoicelist_close_235ufnh, :close )
alias_method(:dp3_windowchoicelist_dispose_235ufnh, :dispose )
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Aliased Method: Update
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def update(*args)
dp3_windowchoicelist_update_235ufnh(*args)
@choicehelp_helpwindow.update() unless @choicehelp_helpwindow.nil?
update_index # (Bolu method)
end

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Aliased Method: Select Item
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def select(*args)
dp3_windowchoicelist_select_235ufnh(*args)
dp3_dispose_choicehelp_window()
unless dp3_get_current_choice_windowinfo[0].nil?
@choicehelp_helpwindow = DP3_Choice_Window_Help.new(*dp3_get_current_choice_windowinfo)
end
refresh_picture_help # (Bolu method)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Aliased Method: Move Cursor Down
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def cursor_down(*args)
dp3_windowchoicelist_cursordown_235ufnh(*args)
@choicehelp_helpwindow.immediately_open() unless @choicehelp_helpwindow.nil?
refresh_picture_help # (Bolu method)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Aliased Method: Move Cursor Up
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def cursor_up(*args)
dp3_windowchoicelist_cursorup_235ufnh(*args)
@choicehelp_helpwindow.immediately_open() unless @choicehelp_helpwindow.nil?
refresh_picture_help # (Bolu method)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Aliased Method: Open
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def open(*args)
dp3_windowchoicelist_open_235ufnh(*args) # Call Original Method
@choicehelp_helpwindow.open() unless @choicehelp_helpwindow.nil?
@picture_help.show if @picture_help # show picture (Bolu method)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Aliased Method: Close
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def close(*args)
@choicehelp_helpwindow.close() unless @choicehelp_helpwindow.nil?
@picture_help.hide if @picture_help # hide picture (Bolu method)
dp3_windowchoicelist_close_235ufnh(*args) # Call Original Method
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Aliased Method: Dispose
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def dispose(*args)
dp3_windowchoicelist_dispose_235ufnh(*args) # Call Original Method
dp3_dispose_choicehelp_window()
bolu_dispose_picture_help # erase picture (Bolu method)
end

#=-=-=-=-=-=-= NEW METHODS -=-=-=-=-=-=-=#
# DP3's Methods
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * New Method: Dispose ChoiceHelp Window
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def dp3_dispose_choicehelp_window()
@choicehelp_helpwindow.dispose unless @choicehelp_helpwindow.nil? || @choicehelp_helpwindow.disposed?
@choicehelp_helpwindow = nil
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * New Method: Get Required Info for the Window Choice
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def dp3_get_current_choice_windowinfo()
return [nil] if $game_message.choice_help_text[self.index].nil?
return [$game_message.choice_help_text[self.index][:text],
$game_message.choice_help_text[self.index][:position] ]
end

# BoluBolu's Methods
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * New Method: Get info if the index of the window choice is changed.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def update_index
if @current_index != self.index
refresh_picture_help
@current_index = self.index
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * New Method: Refreshing the Help Picture for when hovering choice.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def refresh_picture_help
bolu_dispose_picture_help
unless bolu_get_current_picture_help[0].nil?
@picture_help = Sprite_Bolu_Picture.new(*bolu_get_current_picture_help)
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * New Method: Disposed the Help Picture
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def bolu_dispose_picture_help
return unless @picture_help
@picture_help.bitmap.dispose unless @picture_help.bitmap.disposed?
@picture_help.dispose unless @picture_help.disposed?
@picture_help = nil
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * New Method: Get Required Info for the Help Picture
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def bolu_get_current_picture_help
return [nil] if $game_message.picture_help[self.index].nil?
return [$game_message.picture_help[self.index][:filename],
$game_message.picture_help[self.index][:x_pos],
$game_message.picture_help[self.index][:y_pos] ]
end


end # End of Window_ChoiceList


#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
# An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================

class Game_Interpreter
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * New Method: Add Command List Help Text
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def add_command_list_help_text( text = nil )
position = 0

# Add Text Argument
unless text.nil?
text = text.gsub(/[

]+/, "")
text = text.gsub(/\endl/, "
")

# Add Show Text Command Text Paramters
else
text = ""
while( !@list[@index].nil? )
@index += 1
case @list[@index].code
when 101 # Show Text Window Command
position = @list[@index].parameters[3]
when 401 # Show Text Line
text += @list[@index].parameters[0] + "
"
when 355 # Script Command
script = @list[@index].parameters[0] + "
"
while next_event_code == 655
@index += 1
script += @list[@index].parameters[0] + "
"
end
break if script.include?("end_command_list_help_text")
end
end
end

# Add to List
index = $game_message.choice_help_text.size
$game_message.choice_help_text[index] = Hash.new()
$game_message.choice_help_text[index][:position] = position
$game_message.choice_help_text[index][:text] = text
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * New Method: End Command List Help Text
#--------------------------------------------------------------------------
# Method only exists in case the user actually tries to call it outside of
# bounds.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def end_command_list_help_text()
end


# BoluBolu's Methods
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * New Method: Get info for Help Picture from the user
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def add_picture_help(index, filename, x, y)
$game_message.picture_help[index] = Hash.new
$game_message.picture_help[index][:filename] = filename
$game_message.picture_help[index][:x_pos] = x
$game_message.picture_help[index][:y_pos] = y
end

end # End of Game Interpreter

#=====================================
# End of Script ! << This should exist
#=====================================
16,461 chars, 1,303 words, 384 lines·Create new version