The RPG Maker Resource Kit

RMRK RPG Maker Creation => Requests => Script Request => Topic started by: kawagiri on August 21, 2010, 01:09:32 AM

Title: [request] help menu
Post by: kawagiri on August 21, 2010, 01:09:32 AM
Help Menu/Information Menu
21/08/2010  1:55am GMT




Summary
in the menu i need an option to open up a new window, and need new windows created for information about the game, information about controls states and equipment etc..

Features Desired
*NOTE* avoid using noteboxes please as some states use codes in the notebox, so typing in a description there to appear on the menu wouldn't work right i don't think... i think it would also show the code in the notebox.


Mockups
[spoiler](https://rmrk.net/proxy.php?request=http%3A%2F%2Fi416.photobucket.com%2Falbums%2Fpp247%2FL_and_misa%2FNewmenuscript1.png&hash=91cfbe80f0e01c98574b884fe48b89b328a10fc3)[/spoiler]
[spoiler](https://rmrk.net/proxy.php?request=http%3A%2F%2Fi416.photobucket.com%2Falbums%2Fpp247%2FL_and_misa%2FNewmenuscript2.png&hash=9ddd291d1b5390ccf8d7beeca0781d442f00318b)[/spoiler]
[spoiler](https://rmrk.net/proxy.php?request=http%3A%2F%2Fi416.photobucket.com%2Falbums%2Fpp247%2FL_and_misa%2FNewmenuscript3.png&hash=c96b940d3b484378de60cbb56972c6c73c140c60)[/spoiler]
[spoiler](https://rmrk.net/proxy.php?request=http%3A%2F%2Fi416.photobucket.com%2Falbums%2Fpp247%2FL_and_misa%2FNewmenuscript4.png&hash=b09724a57d5fc2c8f9b6b846a0cbbfc6254c1f13)[/spoiler]


Current Unfinished script - TDS (Zanaziel)
[/list][/list]
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs the menu screen processing.
#==============================================================================

class Scene_Menu < Scene_Base
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    s1 = Vocab::item
    s2 = Vocab::skill
    s3 = Vocab::equip
    s4 = Vocab::status
    s5 = Vocab::save
    s6 = Vocab::game_end
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, "Help"])
    @command_window.index = @menu_index
    if $game_party.members.size == 0          # If number of party members is 0
      @command_window.draw_item(0, false)     # Disable item
      @command_window.draw_item(1, false)     # Disable skill
      @command_window.draw_item(2, false)     # Disable equipment
      @command_window.draw_item(3, false)     # Disable status
    end
    if $game_system.save_disabled             # If save is forbidden
      @command_window.draw_item(4, false)     # Disable save
    end
  end
  #--------------------------------------------------------------------------
  # * Update Command Selection
  #--------------------------------------------------------------------------
  def update_command_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      if $game_party.members.size == 0 and @command_window.index < 4
        Sound.play_buzzer
        return
      elsif $game_system.save_disabled and @command_window.index == 4
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      case @command_window.index
      when 0      # Item
        $scene = Scene_Item.new
      when 1,2,3  # Skill, equipment, status
        start_actor_selection
      when 4      # Save
        $scene = Scene_File.new(true, false, false)
      when 5      # End Game
        $scene = Scene_End.new
      when 6     # Help
        $scene = Scene_Help.new
      end
    end
  end
end



#==============================================================================
# ** Scene_Help
#------------------------------------------------------------------------------
#  This class performs the Help screen processing.
#==============================================================================

class Scene_Help < Scene_Base
  #--------------------------------------------------------------------------
  # * Constants
  #--------------------------------------------------------------------------
  # Line limit per page
  PAGE_LINE_LIMIT = 12
  # Help Commands
  HELP_COMMANDS = [
  "Test",
  "Test2", 
  ]
  # Help Information Hash
  HELP_INFORMATION = {
  # Command name => Text information,
  "Test" =>
  ["Help Text here", 
   "TEST
   This is line 1 testing..................   
   This is line 2 testing..................
   This is line 3 testing..................
   This is line 4 testing..................
   This is line 5 testing..................
   This is line 6 testing..................
   This is line 7 testing..................
   This is line 8 testing........................
   This is line 9 testing.....................
   This is line 10 testing....................
   This is line 11 testing....................
   This is line 12 testing....................
   This is line 13 testing....................
   This is line 14 testing....................
   This is line 15 testing....................
   This is line 16 testing....................
   This is line 17 testing....................
   This is line 18 testing....................
   This is line 19 testing....................
   This is line 20 testing....................
   This is line 21 testing....................
   This is line 22 testing....................
   This is line 23 testing....................
   This is line 24 testing....................
   This is line 25 testing....................
   This is line 26 testing....................
   This is line 27 testing....................
   This is line 28 testing....................
   This is line 29 testing....................
   This is line 30 testing....................
   This is line 31 testing....................
   This is line 32 testing....................
   This is line 33 testing....................
   This is line 34 testing....................
   This is line 35 testing....................
   This is line 36 testing....................
   This is line 37 testing....................
   This is line 38 testing....................
   This is line 39 testing...................."], 
   
  "Test2" =>
  ["Help Text here", 
   "TEST2
   Test 2"]     
  }
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background   
    # Create Help Window     
    @help_window = Window_Help.new
    # Create command Window
    @command_window = Window_Command.new(172, HELP_COMMANDS)
    @command_window.y = 56
    @command_window.height = 360
    # Create Help Contents Window
    @help_contents_window = Window_Base.new(172, 56, 372, 360)
    # Viewing Help Information Flag
    @viewing_help = false
    # Display Page
    @display_page = 0
    # Current Page
    @current_page = 1
    # Total Pages
    @total_pages = 1
    # Current Command
    @current_command = active_command
    # Update Help Window information
    update_help_information   
    # Draw Help Window Contents
    draw_help_window_contents
  end
  #--------------------------------------------------------------------------
  # * Make Help Commands
  #--------------------------------------------------------------------------
  def active_command(index = nil)
    # Get command
    command = index == nil ? @command_window.index :  index
    return @command_window.commands[command]
  end
  #--------------------------------------------------------------------------
  # * Make Help Commands
  #--------------------------------------------------------------------------
  def draw_help_window_contents 
    # Return if Help information hash information text is empty
    return if HELP_INFORMATION[active_command][1].empty?
    # Get Text
    text = HELP_INFORMATION[active_command][1].split(/\n/)
    # Page Start
    start = @display_page * PAGE_LINE_LIMIT   
    # Page limit
    limit = start + PAGE_LINE_LIMIT   
    # Clear Help Contents Window
    @help_contents_window.contents.clear
    @help_contents_window.contents.font.color = @help_contents_window.normal_color     
    for line in start...limit
      # Break if line is nil
      break if text[line] == nil
      index = line
      index %= 12
      @help_contents_window.contents.draw_text(0, 0 + index * 25, 340, 24, text[line].strip)
    end
    # Adjust Total Pages
    @total_pages = (text.size.to_f / PAGE_LINE_LIMIT.to_f).ceil   
    # Draw Pages
    @help_contents_window.contents.font.color = @help_contents_window.system_color
    @help_contents_window.contents.draw_text(100, 305, 340, 24, "Page:" )   
    @help_contents_window.contents.font.color = @help_contents_window.normal_color
    @help_contents_window.contents.draw_text(160, 305, 150, 24, sprintf("%d / %d", @current_page, @total_pages))
  end 
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background 
    # Dispose of windows
    @help_window.dispose
    @command_window.dispose
    @help_contents_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Return to Original Screen
  #--------------------------------------------------------------------------
  def return_scene
    $scene = Scene_Menu.new(6)
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super   
    # Update Help Window information
    update_help_information
    # Update Command Window
    @command_window.update   
    # If Command Window Active
    if @command_window.active
      update_command
      return
    end   
    # If viewing help information
    if @viewing_help
      # Update Help Information viewing
      update_help_information_viewing
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Update Command
  #--------------------------------------------------------------------------   
  def update_command

    # If active command is not the same as current command
    if active_command != @current_command
      # Set Display Page
      @display_page = 0
      # Set Current Page
      @current_page = @display_page + 1
      # Draw Help window contents
      draw_help_window_contents
      # Set Current Command
      @current_command = active_command
    end   
     
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
      return
    end   

    if Input.trigger?(Input::C)
      Sound.play_decision   
      @command_window.active = false
      @viewing_help = true
      return
    end 
  end 
  #--------------------------------------------------------------------------
  # * Update Help Window Information Viewing
  #--------------------------------------------------------------------------   
  def update_help_information_viewing

    if Input.trigger?(Input::B)
      Sound.play_cancel   
      @viewing_help = false     
      @command_window.active = true
      return
    end   
   
    if Input.repeat?(Input::RIGHT) or Input.trigger?(Input::RIGHT)     
      next_page
    end
    if Input.repeat?(Input::LEFT) or Input.trigger?(Input::LEFT)
      previous_page
    end
    if Input.repeat?(Input::R)
      next_page(true)
    end
    if Input.repeat?(Input::L)
      previous_page(true)
    end       
  end 
  #--------------------------------------------------------------------------
  # * Go to the next page
  #--------------------------------------------------------------------------   
  def next_page(last = false)
    # Return if current page is the same or more than the total pages available
    return Sound.play_buzzer if @current_page >= @total_pages
    # If go to last page is true
    if last       
      # Play cursor SE
      Sound.play_cursor     
      return
    end     
    # Play cursor SE   
    Sound.play_cursor           
    # Set Display Page
    @display_page += 1
    # Set Current Page
    @current_page = @display_page + 1
    # Draw Help window contents
    draw_help_window_contents         
  end 
  #--------------------------------------------------------------------------
  # * Go to the previous page
  #--------------------------------------------------------------------------   
  def previous_page(first = false)
    # Return if current page is the same or less than 0
    return Sound.play_buzzer if @current_page <= 1
    # If go to first page is true
    if first
      # Play cursor SE     
      Sound.play_cursor   
      # Set Display Page
      @display_page = 0
      # Set Current Page
      @current_page = @display_page + 1
      # Draw Help window contents
      draw_help_window_contents       
      return
    end   
    # Play cursor SE   
    Sound.play_cursor           
    # Set Display Page
    @display_page -= 1
    # Set Current Page
    @current_page = @display_page + 1
    # Draw Help window contents
    draw_help_window_contents   
  end 
  #--------------------------------------------------------------------------
  # * Update Help Window Information
  #-------------------------------------------------------------------------- 
  def update_help_information
    # If command window is active
    if @command_window.active
      @help_window.set_text("Select an option for help and information.")
      return
    end       
    # If viewing help information
    if @viewing_help     
      @help_window.set_text(HELP_INFORMATION[active_command][0])     
      return
    end       
  end 
end
Games its been in




Did you search?
yes

Where did you search?

What did you search for?



[spoiler]This is quite a specific script to me, i don't know much at all about coding however this could be applied to most games anyone makes.[/spoiler]

hope this won't be too much hassle for one of you guys :([/list][/list]
Title: Re: [request] help menu
Post by: Mitsarugi on August 22, 2010, 03:52:41 PM
this looks really intresting, i would like to see this too ^^
ask Zanaziel he loves to take requests.

Zanaziel said:
QuoteI usually make most requests in requests forums to keep my skills good
Title: Re: [request] help menu
Post by: TDS on August 22, 2010, 04:40:04 PM
I already did this one.

I changed it from scrolling to pages to reduce the weight of drawing content, but I haven't thought of a way to make the status part of it global, so I decided not to finish it.

And also.

Quote
*NOTE* avoid using noteboxes please as some states use codes in the notebox, so typing in a description there to appear on the menu wouldn't work right i don't think... i think it would also show the code in the notebox.

Note boxes don't really work that way. Regular Expression allows a programmer to take select information such as text between 2 tags "Info Text /Info" and ignore everything else.

And I preffer TDS not Zanaziel, I just couldn't get the name.
Title: Re: [request] help menu
Post by: Mitsarugi on August 22, 2010, 04:49:53 PM
Quote from: Zanaziel on August 22, 2010, 04:40:04 PM
I already did this one.

I changed it from scrolling to pages to reduce the weight of drawing content, but I haven't thought of a way to make the status part of it global, so I decided not to finish it.

And also.

Quote
*NOTE* avoid using noteboxes please as some states use codes in the notebox, so typing in a description there to appear on the menu wouldn't work right i don't think... i think it would also show the code in the notebox.

Note boxes don't really work that way. Regular Expression allows a programmer to take select information such as text between 2 tags "Info Text /Info" and ignore everything else.

And I preffer TDS not Zanaziel, I just couldn't get the name.

so could i see it so i can learn from it (and maybe use it too ^^) cause i wanna script too ,so i like to look at others work :p
please TDS?
Title: Re: [request] help menu
Post by: kawagiri on August 22, 2010, 07:41:21 PM
Quote from: Zanaziel on August 22, 2010, 04:40:04 PM
I already did this one.

I changed it from scrolling to pages to reduce the weight of drawing content, but I haven't thought of a way to make the status part of it global, so I decided not to finish it.

And also.

Quote
*NOTE* avoid using noteboxes please as some states use codes in the notebox, so typing in a description there to appear on the menu wouldn't work right i don't think... i think it would also show the code in the notebox.

Note boxes don't really work that way. Regular Expression allows a programmer to take select information such as text between 2 tags "Info Text /Info" and ignore everything else.

And I preffer TDS not Zanaziel, I just couldn't get the name.

right i thought notebox could work as a vessel to take information from ... i don't script really so didn't know...


and do you mean you've already done a script like this, or do you mean you've done a script for this.

also do you mean that you're not doing the script at all now? cos that's how it reads to me, just want some clarification on where it stands.

i wanted a help menu to refer to no matter where you are because i used a script the other day and had to work out the buttons myself to cycle through options. this way i'd be able to tell people how to play :p

thank you for your time either way though ^^
Title: Re: [request] help menu
Post by: TDS on August 22, 2010, 07:59:12 PM
I meant that I saw the request and did the script requested.

I just could not think of a good way at the moment to finish a feature, in this case the status part and decided not to finish it.


#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs the menu screen processing.
#==============================================================================

class Scene_Menu < Scene_Base
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    s1 = Vocab::item
    s2 = Vocab::skill
    s3 = Vocab::equip
    s4 = Vocab::status
    s5 = Vocab::save
    s6 = Vocab::game_end
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, "Help"])
    @command_window.index = @menu_index
    if $game_party.members.size == 0          # If number of party members is 0
      @command_window.draw_item(0, false)     # Disable item
      @command_window.draw_item(1, false)     # Disable skill
      @command_window.draw_item(2, false)     # Disable equipment
      @command_window.draw_item(3, false)     # Disable status
    end
    if $game_system.save_disabled             # If save is forbidden
      @command_window.draw_item(4, false)     # Disable save
    end
  end
  #--------------------------------------------------------------------------
  # * Update Command Selection
  #--------------------------------------------------------------------------
  def update_command_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      if $game_party.members.size == 0 and @command_window.index < 4
        Sound.play_buzzer
        return
      elsif $game_system.save_disabled and @command_window.index == 4
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      case @command_window.index
      when 0      # Item
        $scene = Scene_Item.new
      when 1,2,3  # Skill, equipment, status
        start_actor_selection
      when 4      # Save
        $scene = Scene_File.new(true, false, false)
      when 5      # End Game
        $scene = Scene_End.new
      when 6     # Help
        $scene = Scene_Help.new
      end
    end
  end
end



#==============================================================================
# ** Scene_Help
#------------------------------------------------------------------------------
#  This class performs the Help screen processing.
#==============================================================================

class Scene_Help < Scene_Base
  #--------------------------------------------------------------------------
  # * Constants
  #--------------------------------------------------------------------------
  # Line limit per page
  PAGE_LINE_LIMIT = 12
  # Help Commands
  HELP_COMMANDS = [
  "Test",
  "Test2", 
  ]
  # Help Information Hash
  HELP_INFORMATION = {
  # Command name => Text information,
  "Test" =>
  ["Help Text here", 
   "TEST
   This is line 1 testing..................   
   This is line 2 testing..................
   This is line 3 testing..................
   This is line 4 testing..................
   This is line 5 testing..................
   This is line 6 testing..................
   This is line 7 testing..................
   This is line 8 testing........................
   This is line 9 testing.....................
   This is line 10 testing....................
   This is line 11 testing....................
   This is line 12 testing....................
   This is line 13 testing....................
   This is line 14 testing....................
   This is line 15 testing....................
   This is line 16 testing....................
   This is line 17 testing....................
   This is line 18 testing....................
   This is line 19 testing....................
   This is line 20 testing....................
   This is line 21 testing....................
   This is line 22 testing....................
   This is line 23 testing....................
   This is line 24 testing....................
   This is line 25 testing....................
   This is line 26 testing....................
   This is line 27 testing....................
   This is line 28 testing....................
   This is line 29 testing....................
   This is line 30 testing....................
   This is line 31 testing....................
   This is line 32 testing....................
   This is line 33 testing....................
   This is line 34 testing....................
   This is line 35 testing....................
   This is line 36 testing....................
   This is line 37 testing....................
   This is line 38 testing....................
   This is line 39 testing...................."], 
   
  "Test2" =>
  ["Help Text here", 
   "TEST2
   Test 2"]     
  }
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background   
    # Create Help Window     
    @help_window = Window_Help.new
    # Create command Window
    @command_window = Window_Command.new(172, HELP_COMMANDS)
    @command_window.y = 56
    @command_window.height = 360
    # Create Help Contents Window
    @help_contents_window = Window_Base.new(172, 56, 372, 360)
    # Viewing Help Information Flag
    @viewing_help = false
    # Display Page
    @display_page = 0
    # Current Page
    @current_page = 1
    # Total Pages
    @total_pages = 1
    # Current Command
    @current_command = active_command
    # Update Help Window information
    update_help_information   
    # Draw Help Window Contents
    draw_help_window_contents
  end
  #--------------------------------------------------------------------------
  # * Make Help Commands
  #--------------------------------------------------------------------------
  def active_command(index = nil)
    # Get command
    command = index == nil ? @command_window.index :  index
    return @command_window.commands[command]
  end
  #--------------------------------------------------------------------------
  # * Make Help Commands
  #--------------------------------------------------------------------------
  def draw_help_window_contents 
    # Return if Help information hash information text is empty
    return if HELP_INFORMATION[active_command][1].empty?
    # Get Text
    text = HELP_INFORMATION[active_command][1].split(/\n/)
    # Page Start
    start = @display_page * PAGE_LINE_LIMIT   
    # Page limit
    limit = start + PAGE_LINE_LIMIT   
    # Clear Help Contents Window
    @help_contents_window.contents.clear
    @help_contents_window.contents.font.color = @help_contents_window.normal_color     
    for line in start...limit
      # Break if line is nil
      break if text[line] == nil
      index = line
      index %= 12
      @help_contents_window.contents.draw_text(0, 0 + index * 25, 340, 24, text[line].strip)
    end
    # Adjust Total Pages
    @total_pages = (text.size.to_f / PAGE_LINE_LIMIT.to_f).ceil   
    # Draw Pages
    @help_contents_window.contents.font.color = @help_contents_window.system_color
    @help_contents_window.contents.draw_text(100, 305, 340, 24, "Page:" )   
    @help_contents_window.contents.font.color = @help_contents_window.normal_color
    @help_contents_window.contents.draw_text(160, 305, 150, 24, sprintf("%d / %d", @current_page, @total_pages))
  end 
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background 
    # Dispose of windows
    @help_window.dispose
    @command_window.dispose
    @help_contents_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Return to Original Screen
  #--------------------------------------------------------------------------
  def return_scene
    $scene = Scene_Menu.new(6)
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super   
    # Update Help Window information
    update_help_information
    # Update Command Window
    @command_window.update   
    # If Command Window Active
    if @command_window.active
      update_command
      return
    end   
    # If viewing help information
    if @viewing_help
      # Update Help Information viewing
      update_help_information_viewing
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Update Command
  #--------------------------------------------------------------------------   
  def update_command

    # If active command is not the same as current command
    if active_command != @current_command
      # Set Display Page
      @display_page = 0
      # Set Current Page
      @current_page = @display_page + 1
      # Draw Help window contents
      draw_help_window_contents
      # Set Current Command
      @current_command = active_command
    end   
     
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
      return
    end   

    if Input.trigger?(Input::C)
      Sound.play_decision   
      @command_window.active = false
      @viewing_help = true
      return
    end 
  end 
  #--------------------------------------------------------------------------
  # * Update Help Window Information Viewing
  #--------------------------------------------------------------------------   
  def update_help_information_viewing

    if Input.trigger?(Input::B)
      Sound.play_cancel   
      @viewing_help = false     
      @command_window.active = true
      return
    end   
   
    if Input.repeat?(Input::RIGHT) or Input.trigger?(Input::RIGHT)     
      next_page
    end
    if Input.repeat?(Input::LEFT) or Input.trigger?(Input::LEFT)
      previous_page
    end
    if Input.repeat?(Input::R)
      next_page(true)
    end
    if Input.repeat?(Input::L)
      previous_page(true)
    end       
  end 
  #--------------------------------------------------------------------------
  # * Go to the next page
  #--------------------------------------------------------------------------   
  def next_page(last = false)
    # Return if current page is the same or more than the total pages available
    return Sound.play_buzzer if @current_page >= @total_pages
    # If go to last page is true
    if last       
      # Play cursor SE
      Sound.play_cursor     
      return
    end     
    # Play cursor SE   
    Sound.play_cursor           
    # Set Display Page
    @display_page += 1
    # Set Current Page
    @current_page = @display_page + 1
    # Draw Help window contents
    draw_help_window_contents         
  end 
  #--------------------------------------------------------------------------
  # * Go to the previous page
  #--------------------------------------------------------------------------   
  def previous_page(first = false)
    # Return if current page is the same or less than 0
    return Sound.play_buzzer if @current_page <= 1
    # If go to first page is true
    if first
      # Play cursor SE     
      Sound.play_cursor   
      # Set Display Page
      @display_page = 0
      # Set Current Page
      @current_page = @display_page + 1
      # Draw Help window contents
      draw_help_window_contents       
      return
    end   
    # Play cursor SE   
    Sound.play_cursor           
    # Set Display Page
    @display_page -= 1
    # Set Current Page
    @current_page = @display_page + 1
    # Draw Help window contents
    draw_help_window_contents   
  end 
  #--------------------------------------------------------------------------
  # * Update Help Window Information
  #-------------------------------------------------------------------------- 
  def update_help_information
    # If command window is active
    if @command_window.active
      @help_window.set_text("Select an option for help and information.")
      return
    end       
    # If viewing help information
    if @viewing_help     
      @help_window.set_text(HELP_INFORMATION[active_command][0])     
      return
    end       
  end 
end


It's not done (Just missing the status). It's Sunday so it's my day off and I don't feel like scripting today. If you want it you can use it or have someone finish it.

Have a nice day.
Title: Re: [request] help menu
Post by: kawagiri on August 22, 2010, 10:16:59 PM
that's fine, you're volunteering, i have no right to ask you to do more nor do you have obligation to work on it at all. but tyvm for your time ^^
Title: Re: [request] help menu
Post by: modern algebra on August 23, 2010, 03:56:07 AM
Quote from: Zanaziel on August 22, 2010, 04:40:04 PM
I preffer TDS not Zanaziel, I just couldn't get the name.

Ah, you should have asked earlier; I will use my magical powers to get you the name TDS :) You'll still have to sign in as Zanaziel though.
Title: Re: [request] help menu
Post by: TDS on August 27, 2010, 04:25:06 AM
Thank you very much for the name change modern algebra, if there is anything I could do for you, please let me know.

As for the script I forgot about it until today. Spent the whole week watching all the movies I've missed since 2005 and looking for a nice project to join.

This script adds the help command to the main menu in the default menu.


#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs the menu screen processing.
#==============================================================================

class Scene_Menu < Scene_Base
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    s1 = Vocab::item
    s2 = Vocab::skill
    s3 = Vocab::equip
    s4 = Vocab::status
    s5 = Vocab::save
    s6 = Vocab::game_end
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, "Help"])
    @command_window.index = @menu_index
    if $game_party.members.size == 0          # If number of party members is 0
      @command_window.draw_item(0, false)     # Disable item
      @command_window.draw_item(1, false)     # Disable skill
      @command_window.draw_item(2, false)     # Disable equipment
      @command_window.draw_item(3, false)     # Disable status
    end
    if $game_system.save_disabled             # If save is forbidden
      @command_window.draw_item(4, false)     # Disable save
    end
  end
  #--------------------------------------------------------------------------
  # * Update Command Selection
  #--------------------------------------------------------------------------
  def update_command_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      if $game_party.members.size == 0 and @command_window.index < 4
        Sound.play_buzzer
        return
      elsif $game_system.save_disabled and @command_window.index == 4
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      case @command_window.index
      when 0      # Item
        $scene = Scene_Item.new
      when 1,2,3  # Skill, equipment, status
        start_actor_selection
      when 4      # Save
        $scene = Scene_File.new(true, false, false)
      when 5      # End Game
        $scene = Scene_End.new
      when 6     # Help
        $scene = Scene_Help.new
      end
    end
  end
end


And this is the Help Scene.


#==============================================================================
# ** RPG::State Module
#------------------------------------------------------------------------------
# This module handles state information.
#==============================================================================

module RPG
  class State   
    #--------------------------------------------------------------------------
    # * Get State Information
    #--------------------------------------------------------------------------           
    def state_information
      # Get Help information
      help_text = self.note.scan(/INFO[\s]?(.*?)[\s]?INFO/m).flatten
      # If help text array is not empty
      if !help_text.empty?
        # Split text
        help_text = help_text[0].strip!.split(/\r\n/)
      end     
      # Return help text
      return help_text           
    end
  end
end

#==============================================================================
# ** Scene_Help
#------------------------------------------------------------------------------
#  This class performs the Help screen processing.
#==============================================================================

class Scene_Help < Scene_Base
  #--------------------------------------------------------------------------
  # * Constants
  #--------------------------------------------------------------------------
  # Line limit per page
  PAGE_LINE_LIMIT = 12
  # Help Commands
  HELP_COMMANDS = [
  "Basics",
  "Basics2",
  "Status", 
  ]
  # Status Command Name
  STATUS_COMMAND = "Status"
  # Status States [States ID]
  STATUS_STATES = [1, 2, 3, 4, 5] 
  # Help Information Hash
  HELP_INFORMATION = {
  # Command name => Help Header Text, Text information,
  "Basics" =>
  ["These are the basics help text header.",
   "Basics:
   Here we put information to help the
   player."],

  "Basics2" =>
  ["These are the basics help text header.",
   "Width Test:
   -----------------------------------------------------   
   -----------------------------------------------------
   -----------------------------------------------------
   -----------------------------------------------------
   -----------------------------------------------------
   -----------------------------------------------------
   -----------------------------------------------------
   -----------------------------------------------------
   -----------------------------------------------------
   -----------------------------------------------------
   -----------------------------------------------------
   -----------------------------------------------------
   -----------------------------------------------------
   -----------------------------------------------------
   -----------------------------------------------------
   -----------------------------------------------------
   -----------------------------------------------------
   -----------------------------------------------------"],   
   
  "Status" =>
  ["View status effects information.", ""],
 
  }
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background   
    # Create Help Window     
    @help_window = Window_Help.new
    # Create command Window
    @command_window = Window_Command.new(172, HELP_COMMANDS)
    @command_window.y = 56
    @command_window.height = 360
    # Create Help Contents Window
    @help_contents_window = Window_Base.new(172, 56, 372, 360)
    # Status Command Window
    @status_command_window = Window_Command.new(180, make_status_commands)
    @status_command_window.x = 172
    @status_command_window.y = 56   
    @status_command_window.height = 360
    @status_command_window.visible = false
    @status_command_window.active = false
    # Status Contents Display
    @status_contents_window = Window_Base.new(352, 56, 192, 360)   
    @status_contents_window.visible = false
    # Draw Status Window information
    draw_status_window_information
    # Viewing Help Information Flag
    @viewing_help = false
    # Display Page
    @display_page = 0
    # Current Page
    @current_page = 1
    # Total Pages
    @total_pages = 1
    # Current Command
    @current_command = active_command
    # Update Help Window information
    update_help_information   
    # Draw Help Window Contents
    draw_help_window_contents
  end
  #--------------------------------------------------------------------------
  # * Make Status Commands
  #--------------------------------------------------------------------------
  def make_status_commands
    # Commands Array
    commands = []   
    for i in 0...STATUS_STATES.size           
      # Add State name to commands array
      commands << sprintf("%d.%s", i + 1, $data_states[STATUS_STATES[i]].name)
    end           
    # Return commands
    return commands
  end
  #--------------------------------------------------------------------------
  # * Get Active Command
  #--------------------------------------------------------------------------
  def active_command(index = nil)
    # Get command
    command = index == nil ? @command_window.index : index
    return @command_window.commands[command]
  end
  #--------------------------------------------------------------------------
  # * Check if Current Command is a Status Commmand
  #--------------------------------------------------------------------------
  def status_command?   
    return STATUS_COMMAND == active_command
  end 
  #--------------------------------------------------------------------------
  # * Make Help Commands
  #--------------------------------------------------------------------------
  def draw_help_window_contents     
    # Clear Help Contents Window
    @help_contents_window.contents.clear
    # Return if Help information hash information text is empty
    return if HELP_INFORMATION[active_command][1].empty?
    # Get Text
    text = HELP_INFORMATION[active_command][1].split(/\n/)
    # Page Start
    start = @display_page * PAGE_LINE_LIMIT   
    # Page limit
    limit = start + PAGE_LINE_LIMIT   
    @help_contents_window.contents.font.color = @help_contents_window.normal_color           
    for line in start...limit
      # Break if line is nil
      break if text[line] == nil
      index = line
      index %= PAGE_LINE_LIMIT
      @help_contents_window.contents.draw_text(0, 0 + index * 25, 340, 24, text[line].strip)
    end
    # Adjust Total Pages
    @total_pages = (text.size.to_f / PAGE_LINE_LIMIT.to_f).ceil   
    # Draw Pages
    @help_contents_window.contents.font.color = @help_contents_window.system_color
    @help_contents_window.contents.draw_text(100, 305, 340, 24, "Page:" )   
    @help_contents_window.contents.font.color = @help_contents_window.normal_color
    @help_contents_window.contents.draw_text(160, 305, 150, 24, sprintf("%d / %d", @current_page, @total_pages))
  end 
  #--------------------------------------------------------------------------
  # * Draw Status Window Information
  #--------------------------------------------------------------------------
  def draw_status_window_information
    # Get State
    state = $data_states[STATUS_STATES[@status_command_window.index]]       
    # Get State information
    info = state.state_information   
    # Resize Window
    @status_contents_window.height = [[60 + info.size * 24, 60].max, 360].min
    @status_contents_window.create_contents   
    # Draw State Icon
    @status_contents_window.draw_icon(state.icon_index, 0, 0)
    @status_contents_window.contents.draw_text(26, 0, 150, 24, state.name)
    for i in 0...info.size
      @status_contents_window.contents.draw_text(0, 27 + i * 24, 165, 24, info[i])
    end   
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background 
    # Dispose of windows
    @help_window.dispose   
    @command_window.dispose
    @status_command_window.dispose
    @help_contents_window.dispose
    @status_contents_window.dispose   
  end
  #--------------------------------------------------------------------------
  # * Return to Original Screen
  #--------------------------------------------------------------------------
  def return_scene
    $scene = Scene_Menu.new(6)
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super   
    # Update Help Window information
    update_help_information
    # Update Command Window
    @command_window.update   
    # Update Status Command
    @status_command_window.update
    # If Status Command Window
    if @status_command_window.active
      update_status_command
      return     
    end   
    # If Command Window Active
    if @command_window.active
      update_command
      return
    end   
    # If viewing help information
    if @viewing_help
      # Update Help Information viewing
      update_help_information_viewing
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Update Status Command
  #--------------------------------------------------------------------------   
  def update_status_command
    # If active status command is not the same as the current command
    if @status_command_window.index != @current_command
      # Draw Status Window Information
      draw_status_window_information
      # Set Current Command
      @current_command = @status_command_window.index
    end   
   
    if Input.trigger?(Input::B)
      # Play cancel SE
      Sound.play_cancel
      @status_command_window.active = false     
      @status_command_window.index = 0
      @command_window.active = true
      # Set Status Window visibility
      @status_contents_window.visible = false
      return
    end   
  end 
  #--------------------------------------------------------------------------
  # * Update Command
  #--------------------------------------------------------------------------   
  def update_command

    # If active command is not the same as current command
    if active_command != @current_command
      # Set Display Page
      @display_page = 0
      # Set Current Page
      @current_page = @display_page + 1
      # Set windows visibility
      @help_contents_window.visible = status_command? ? false : true
      @status_command_window.visible = status_command? ? true : false
      @status_contents_window.visible = false
      # Draw Help window contents
      draw_help_window_contents
      # Set Current Command
      @current_command = active_command     
    end   
     
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
      return
    end   

    if Input.trigger?(Input::C)
      # Play Decision SE
      Sound.play_decision   
      # If Status Command
      if status_command?
        @command_window.active = false       
        @status_command_window.active = true             
        @current_command = @status_command_window.index
        # Set Status Window visibility
        @status_contents_window.visible = true
        # Draw Status Window Information
        draw_status_window_information
        return
      else
        @command_window.active = false
        @viewing_help = true
        return
      end     
    end 
  end 
  #--------------------------------------------------------------------------
  # * Update Help Window Information Viewing
  #--------------------------------------------------------------------------   
  def update_help_information_viewing

    if Input.trigger?(Input::B)
      Sound.play_cancel   
      @viewing_help = false     
      @command_window.active = true
      return
    end   
   
    if Input.repeat?(Input::RIGHT) or Input.trigger?(Input::RIGHT)     
      next_page
    end
    if Input.repeat?(Input::LEFT) or Input.trigger?(Input::LEFT)
      previous_page
    end
    if Input.repeat?(Input::R)
      next_page(true)
    end
    if Input.repeat?(Input::L)
      previous_page(true)
    end       
  end 
  #--------------------------------------------------------------------------
  # * Go to the next page
  #--------------------------------------------------------------------------   
  def next_page(last = false)
    # Return if current page is the same or more than the total pages available
    return Sound.play_buzzer if @current_page >= @total_pages
    # If go to last page is true
    if last       
      # Play cursor SE
      Sound.play_cursor     
      return
    end     
    # Play cursor SE   
    Sound.play_cursor           
    # Set Display Page
    @display_page += 1
    # Set Current Page
    @current_page = @display_page + 1
    # Draw Help window contents
    draw_help_window_contents         
  end 
  #--------------------------------------------------------------------------
  # * Go to the previous page
  #--------------------------------------------------------------------------   
  def previous_page(first = false)
    # Return if current page is the same or less than 0
    return Sound.play_buzzer if @current_page <= 1
    # If go to first page is true
    if first
      # Play cursor SE     
      Sound.play_cursor   
      # Set Display Page
      @display_page = 0
      # Set Current Page
      @current_page = @display_page + 1
      # Draw Help window contents
      draw_help_window_contents       
      return
    end   
    # Play cursor SE   
    Sound.play_cursor           
    # Set Display Page
    @display_page -= 1
    # Set Current Page
    @current_page = @display_page + 1
    # Draw Help window contents
    draw_help_window_contents   
  end 
  #--------------------------------------------------------------------------
  # * Update Help Window Information
  #-------------------------------------------------------------------------- 
  def update_help_information
    # If command window is active
    if @command_window.active
      @help_window.set_text("Select an option for help and information.")
      return
    end       
    # If viewing help information
    if @viewing_help     
      @help_window.set_text(HELP_INFORMATION[active_command][0])     
      return
    end       
  end 
end


Normally I pass on making scripts like these due to all the explaining involved. So I'll be as brief as possible and you better know your way around arrays, hashes and constants.

To limit the number of lines that appear per page edit this line:


PAGE_LINE_LIMIT = 12


Change the 12 to whatever number of lines you want it to display per page.

To add help commands/topics edit this constant in the script:


HELP_COMMANDS = ["Command1", "Command2", "Command3", "etc"]


Now this is probably the most complex part of it. The help information.


HELP_INFORMATION = {"Command1" => ["Help Window Header Text",
                                   "Help Info Text"]}


The Key in the hash has to have the same name as one in the help commands array constant.

To set which command will respond as the status command edit this constant in the script:


STATUS_COMMAND = "Name"


And here you set the state ID's that are displayed on the status command.


STATUS_STATES = [ID, ID, ID, ID] 


ID = Number of the ID in the database.

And finally for the state information.

Add into the states notebox the following:


INFO
Text here
INFO


Example:


INFO
This is state info-
rmation

TEST
TEST
TEST
INFO


And sorry if the explanation sucks, but I stopped making public scripts because I can't stand explaining complex scripts, so you might have to find someone to explain how the scripts work to you. It's very simple stuff so with enough poking around you might figure it out yourself.

Have a nice day.
Title: Re: [request] help menu
Post by: kawagiri on August 28, 2010, 01:06:32 PM
thanks i'll try to work out the fine details myself :p

tried replying yesterday but my internet cut out :/