Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- #
- # Yanfly 6 - Help Window Advanced
- # --- Last Date Updated: 2011.11.09
- # --- Level: Normal, Lunatic
- # Requires: n/a
- #
- #==============================================================================
- $imported = {} if $imported == nil
- $imported["Y6-HelpWindowAdvanced"] = true
- #==============================================================================
- # Updates
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # o 2011.11.09 - Bugfix regarding \n[x].
- # o 2011.11.03 - Started Script and Finished.
- #
- #==============================================================================
- # Introduction
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # This script gives you the ability to expand the help window's number of lines
- # up to a maximum of 4 times. You will be able to use unique text codes in your
- # help descriptions to change text colour, font, place in icons, and more.
- #
- # This script also contains Lunatic Mode for those who wish to have custom
- # descriptions that vary for items and skills.
- #
- #==============================================================================
- # Instructions
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ¥ Materials but above ¥ Main. Remember to save.
- #
- # -----------------------------------------------------------------------------
- # Help Window REGEXP Codes - These go inside of your help description.
- # -----------------------------------------------------------------------------
- # Code: Effect:
- # \v[x] Writes variable x's value.
- # \n[x] Writes actor x's name.
- # \c[x] Changes the colour of the text to x.
- #
- # | Line break.
- #
- # \fn[x] Changes the font name to x. Set to 0 to reset font name.
- # \fs[x] Changes the font size to x. Set to 0 to reset font size.
- # \fb Changes the font to bold and back.
- # \fi Changes the font to italic
- # \fh Changes the font to shadowed and back.
- #
- # \i[x] Draws icon ID x into the message window.
- # \ii[x] Writes item ID x's name with icon included.
- # \iw[x] Writes weapon ID x's name with icon included.
- # \ia[x] Writes armour ID x's name with icon included.
- # \is[x] Writes skill ID x's name with icon included.
- # \it[x] Writes state ID x's name with icon included.
- #
- # \nc[x] Writes class ID x's name.
- # \ni[x] Writes item ID x's name.
- # \nw[x] Writes weapon ID x's name.
- # \na[x] Writes armour ID x's name.
- # \ns[x] Writes skill ID x's name.
- # \nt[x] Writes state ID x's name.
- #
- # \X[x] Custom conversion code used for Lunatic Mode.
- # \X[x:y] Custom conversion code used for Lunatic Mode.
- # \X[x:y:z] Custom conversion code used for Lunatic Mode.
- #
- #==============================================================================
- # Compatibility
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # Note: This script may not work with former Yanfly Engine scripts.
- # Use Yanfly Engine 6 scripts to work with this if available.
- #==============================================================================
- module Y6
- module HELP
- #--------------------------------------------------------------------------
- # - Help Window Settings -
- #--------------------------------------------------------------------------
- # Here, you can adjust the basic settings that govern all the help windows
- # found in the game such as the number of lines it has, the font size, etc.
- #--------------------------------------------------------------------------
- LINES = 2 # Maximum lines is 4. Minimum is 1.
- FONT_SIZE = 22 # Original default font size is 20.
- FONT_NAME = ["Janda Manatee Solid"]
- # Depending on whether or not you have custom scene scripts, you can choose
- # whether or not you want certain scenes to be automatically modified via
- # this script.
- FIX_SCENE_ITEM = true
- FIX_SCENE_SKILL = true
- FIX_SCENE_EQUIP = true
- FIX_SCENE_FILE = true # This will revert Help_Window to 1 line.
- # This part adjusts the help window for what windows use the help window
- # in the default battle scene. This does not adjust the windows for custom
- # battle scripts. For custom battle scripts, you will need to manually
- # adjust them to fit in an expanded help window.
- FIX_BATTLE_ITEM = true
- FIX_BATTLE_SKILL = true
- # This adjusts the text that appears when \N[0] is used in a scene without
- # an active battler or in a scene that is unsupported by the Help Window.
- N0_NAME = "User"
- end # HELP
- end # Y6
- #==============================================================================
- # Lunatic Mode - Custom Message System
- #==============================================================================
- #
- # This portion is for those who know how to script and would like to use
- # various tags to produce easy Lunatic Mode shortcuts.
- #
- # \X[x] or \X[x:y] or \X[x:y:z]
- # These let you create your own custom tags. If you use the first tag, there is
- # one case for the "custom_convert" definition to return. If you use the second
- # tag, there will be two cases for you to select from. And likewise, if there's
- # three tags, then the z case will also be taken into account of.
- #
- #==============================================================================
- class Window_Help < Window_Base
- #--------------------------------------------------------------------------
- # new method: custom_convert
- #--------------------------------------------------------------------------
- def custom_convert(x_case, y_case = 0, z_case = 0)
- text = ""
- case x_case
- #----------------------------------------------------------------------
- # Start editting here.
- #----------------------------------------------------------------------
- when 1 # Show the full name of the actor.
- case y_case # This is the extra case for the actor.
- when 1
- text = "\\n[1] von Xiguel"
- when 2
- text = "Michelle \\n[2]"
- when 3
- text = "\\n[3] Manfred"
- when 4
- text = "\\n[4] Fernaeus"
- end
- when 2 # Test
- actor = $data_actors[1]
- hp = actor.parameters[0, @level]
- text = actor.hp * 0.05
- when 3 # Show variable 123
- text = $game_variables[123]
- #----------------------------------------------------------------------
- # Stop editting past this point.
- #----------------------------------------------------------------------
- end
- return text
- end
- end # Window_Help
- #==============================================================================
- # Editting anything past this point may potentially result in causing computer
- # damage, incontinence, explosion of user's head, coma, death, and/or halitosis
- # so edit at your own risk.
- #==============================================================================
- #==============================================================================
- # ** Scene_Item
- #==============================================================================
- class Scene_Item < Scene_Base
- if Y6::HELP::FIX_SCENE_ITEM
- #--------------------------------------------------------------------------
- # alias method: start
- #--------------------------------------------------------------------------
- alias scene_item_start_hwa start unless $@
- def start
- scene_item_start_hwa
- adjust_hwa
- end
- #--------------------------------------------------------------------------
- # new method: adjust_hwa
- #--------------------------------------------------------------------------
- def adjust_hwa
- @item_window.height = Graphics.height - @help_window.height
- @item_window.y = @help_window.height + @help_window.y
- @item_window.refresh
- end
- end # Y6::HELP::FIX_SCENE_ITEM
- end # Scene_Item
- #==============================================================================
- # ** Scene_Skill
- #==============================================================================
- class Scene_Skill < Scene_Base
- #--------------------------------------------------------------------------
- # public instance variables
- #--------------------------------------------------------------------------
- attr_accessor :actor
- if Y6::HELP::FIX_SCENE_SKILL
- #--------------------------------------------------------------------------
- # alias method: start
- #--------------------------------------------------------------------------
- alias scene_skill_start_hwa start unless $@
- def start
- scene_skill_start_hwa
- adjust_hwa
- end
- #--------------------------------------------------------------------------
- # new method: adjust_hwa
- #--------------------------------------------------------------------------
- def adjust_hwa
- @skill_window.height = Graphics.height - @help_window.height - 56
- @status_window.y = @help_window.height + @help_window.y
- @skill_window.y = @help_window.height + @help_window.y + 56
- @skill_window.refresh
- end
- end # Y6::HELP::FIX_SCENE_SKILL
- end # Scene_Skill
- #==============================================================================
- # ** Scene_Equip
- #==============================================================================
- class Scene_Equip < Scene_Base
- #--------------------------------------------------------------------------
- # public instance variables
- #--------------------------------------------------------------------------
- attr_accessor :actor
- if Y6::HELP::FIX_SCENE_EQUIP
- #--------------------------------------------------------------------------
- # alias method: start
- #--------------------------------------------------------------------------
- alias scene_equip_start_hwa start unless $@
- def start
- scene_equip_start_hwa
- adjust_hwa
- end
- #--------------------------------------------------------------------------
- # new method: adjust_hwa
- #--------------------------------------------------------------------------
- def adjust_hwa
- @equip_window.y = @help_window.height + @help_window.y
- @status_window.y = @help_window.height + @help_window.y
- for i in 0...EQUIP_TYPE_MAX
- @item_windows[i].height = Graphics.height - @help_window.height
- @item_windows[i].height -= @status_window.height
- @item_windows[i].refresh
- @item_windows[i].y = @help_window.height + @help_window.y
- @item_windows[i].y += @equip_window.height
- end
- end
- end # Y6::HELP::FIX_SCENE_EQUIP
- end # Scene_Skill
- #==============================================================================
- # ** Scene_File
- #==============================================================================
- class Scene_File < Scene_Base
- if Y6::HELP::FIX_SCENE_FILE
- #--------------------------------------------------------------------------
- # alias method: start
- #--------------------------------------------------------------------------
- alias scene_file_start_hwa start unless $@
- def start
- scene_file_start_hwa
- adjust_hwa
- end
- #--------------------------------------------------------------------------
- # new method: adjust_hwa
- #--------------------------------------------------------------------------
- def adjust_hwa
- @help_window.height = 56
- @help_window.create_contents
- @help_window.set_text("")
- if @saving
- @help_window.set_text(Vocab::SaveMessage)
- else
- @help_window.set_text(Vocab::LoadMessage)
- end
- end
- end # Y6::HELP::FIX_SCENE_FILE
- end # Scene_File
- #==============================================================================
- # ** Scene_Battle
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # public instance variables
- #--------------------------------------------------------------------------
- attr_accessor :active_battler
- if Y6::HELP::FIX_BATTLE_ITEM
- #--------------------------------------------------------------------------
- # alias method: start_item_selection
- #--------------------------------------------------------------------------
- alias start_item_selection_battle_hwa start_item_selection unless $@
- def start_item_selection
- start_item_selection_battle_hwa
- adjust_hwa_battle_item
- end
- #--------------------------------------------------------------------------
- # new method: adjust_hwa_battle_item
- #--------------------------------------------------------------------------
- def adjust_hwa_battle_item
- @item_window.height = Graphics.height - @help_window.height - 128
- @item_window.y = @help_window.height + @help_window.y
- @item_window.refresh
- end
- end # Y6::HELP::FIX_BATTLE_ITEM
- if Y6::HELP::FIX_BATTLE_SKILL
- #--------------------------------------------------------------------------
- # alias method: start_skill_selection
- #--------------------------------------------------------------------------
- alias start_skill_selection_battle_hwa start_skill_selection unless $@
- def start_skill_selection
- start_skill_selection_battle_hwa
- adjust_hwa_battle_skill
- end
- #--------------------------------------------------------------------------
- # new method: adjust_hwa_battle_skill
- #--------------------------------------------------------------------------
- def adjust_hwa_battle_skill
- @skill_window.height = Graphics.height - @help_window.height - 128
- @skill_window.y = @help_window.height + @help_window.y
- @skill_window.refresh
- end
- end # Y6::HELP::FIX_BATTLE_SKILL
- end # Scene_Battle
- #==============================================================================
- # ** Window_Help
- #==============================================================================
- class Window_Help < Window_Base
- #--------------------------------------------------------------------------
- # overwrite method: initialize
- #--------------------------------------------------------------------------
- def initialize
- dw = Graphics.width
- dh = 32 + WLH * [[Y6::HELP::LINES, 1].max, 4].min
- super(0, 0, dw, dh)
- end
- #--------------------------------------------------------------------------
- # overwrite method: set_text
- #--------------------------------------------------------------------------
- def set_text(text, align = 0)
- test = short_convert(text.clone)
- return unless test != @test or align != @align
- @test = test
- text = convert_special_characters(text.clone)
- @text = text
- @align = align
- contents.font.size = Y6::HELP::FONT_SIZE
- #---
- contents.clear
- contents.font.name = Y6::HELP::FONT_NAME
- contents.font.color = normal_color
- produce_contents
- end
- #--------------------------------------------------------------------------
- # new method: short_convert
- #--------------------------------------------------------------------------
- def short_convert(text)
- text.gsub!(/\\X\[(\d+)\]/i) {
- custom_convert($1.to_i) }
- text.gsub!(/\\X\[(\d+):(\d+)\]/i) {
- custom_convert($1.to_i, $2.to_i) }
- text.gsub!(/\\X\[(\d+):(\d+):(\d+)\]/i) {
- custom_convert($1.to_i, $2.to_i, $3.to_i) }
- text.gsub!(/\\V\[(\d+)\]/i) { $game_variables[$1.to_i] }
- text.gsub!(/\\V\[(\d+)\]/i) { $game_variables[$1.to_i] }
- text.gsub!(/\\N\[0\]/i) { current_actor }
- text.gsub!(/\\N\[(\d+)\]/i) { $game_actors[$1.to_i].name }
- return text
- end
- #--------------------------------------------------------------------------
- # new method: convert_special_characters
- #--------------------------------------------------------------------------
- def convert_special_characters(text)
- text.gsub!(/\\X\[(\d+)\]/i) {
- custom_convert($1.to_i) }
- text.gsub!(/\\X\[(\d+):(\d+)\]/i) {
- custom_convert($1.to_i, $2.to_i) }
- text.gsub!(/\\X\[(\d+):(\d+):(\d+)\]/i) {
- custom_convert($1.to_i, $2.to_i, $3.to_i) }
- #------------------------------------------------------------------------
- text.gsub!(/\\V\[(\d+)\]/i) { $game_variables[$1.to_i] }
- text.gsub!(/\\V\[(\d+)\]/i) { $game_variables[$1.to_i] }
- text.gsub!(/\\N\[0\]/i) { current_actor }
- text.gsub!(/\\N\[(\d+)\]/i) { $game_actors[$1.to_i].name }
- text.gsub!(/\\C\[(\d+)\]/i) { "\x01{#{$1}}" }
- text.gsub!(/\\I\[(\d+)\]/i) { "\x10{#{$1}}" }
- #------------------------------------------------------------------------
- text.gsub!(/\\FS\[(\d+)\]/i) { "\x11{#{$1}}" }
- text.gsub!(/\\FN\[(.*?)\]/i) { "\x12{#{$1}}" }
- text.gsub!(/\\FB/i) { "\x13" }
- text.gsub!(/\\FI/i) { "\x14" }
- text.gsub!(/\\FH/i) { "\x15" }
- #------------------------------------------------------------------------
- text.gsub!(/\\NC\[(\d+)\]/i) {
- $data_classes[$1.to_i].name }
- text.gsub!(/\\NI\[(\d+)\]/i) {
- $data_items[$1.to_i].name }
- text.gsub!(/\\NW\[(\d+)\]/i) {
- $data_weapons[$1.to_i].name }
- text.gsub!(/\\NA\[(\d+)\]/i) {
- $data_armors[$1.to_i].name }
- text.gsub!(/\\NS\[(\d+)\]/i) {
- $data_skills[$1.to_i].name }
- text.gsub!(/\\NT\[(\d+)\]/i) {
- $data_states[$1.to_i].name }
- text.gsub!(/\\II\[(\d+)\]/i) {
- "\x10{#{$data_items[$1.to_i].icon_index}}" +
- "#{$data_items[$1.to_i].name}"}
- text.gsub!(/\\IW\[(\d+)\]/i) {
- "\x10{#{$data_weapons[$1.to_i].icon_index}}" +
- "#{$data_weapons[$1.to_i].name}"}
- text.gsub!(/\\IA\[(\d+)\]/i) {
- "\x10{#{$data_armors[$1.to_i].icon_index}}" +
- "#{$data_armors[$1.to_i].name}"}
- text.gsub!(/\\IS\[(\d+)\]/i) {
- "\x10{#{$data_skills[$1.to_i].icon_index}}" +
- "#{$data_skills[$1.to_i].name}"}
- text.gsub!(/\\IT\[(\d+)\]/i) {
- "\x10{#{$data_states[$1.to_i].icon_index}}" +
- "#{$data_states[$1.to_i].name}"}
- #------------------------------------------------------------------------
- return text
- end
- #--------------------------------------------------------------------------
- # new method: current_actor
- #--------------------------------------------------------------------------
- def current_actor
- if $scene.is_a?(Scene_Skill) or $scene.is_a?(Scene_Equip)
- return $scene.actor.name
- elsif $scene.is_a?(Scene_Battle) and $scene.active_battler != nil
- return $scene.active_battler.name
- else
- return Y6::HELP::N0_NAME
- end
- end
- #--------------------------------------------------------------------------
- # new method: produce_contents
- #--------------------------------------------------------------------------
- def produce_contents
- @contents_x = 0
- @contents_y = 0
- loop do
- c = @text.slice!(/./m)
- case c
- #----------------------------------------------------------------------
- # Code Settings
- #----------------------------------------------------------------------
- when nil
- break
- when "|"
- @contents_y += WLH
- @contents_x = 0
- when "\x01" # \C[n] (text character color change)
- @text.sub!(/\{(\d+)\}/, "")
- contents.font.color = text_color($1.to_i)
- when "\x10" # \i Draws icon ID x
- @text.sub!(/\{(\d+)\}/, "")
- draw_icon($1.to_i, @contents_x, @contents_y)
- @contents_x += 24
- when "\x11" # \fs Font Size Change
- @text.sub!(/\{(\d+)\}/, "")
- size = $1.to_i
- if size <= 0 # If 0, revert back to the default font size.
- size = Y6::HELP::FONT_SIZE
- end
- contents.font.size = size
- text_height = [size + (size / 5), WLH].max
- when "\x12" # \fs Font Name Change
- @text.sub!(/\{(.*?)\}/, "")
- name = $1.to_s
- if name == "0" # If 0, revert back to the default font.
- name = Y6::HELP::FONT_NAME
- end
- contents.font.name = name
- else
- contents.draw_text(@contents_x, @contents_y, 40, WLH, c)
- @contents_x += contents.text_size(c).width
- end
- end
- end
- end # Window_Help
- #===============================================================================
- #
- # END OF FILE
- #
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement