Can't get a menu script to open a window when selected... (Noob)

Bethins

Villager
Member
Joined
Nov 4, 2012
Messages
69
Reaction score
0
First Language
English
Primarily Uses
I'm working on my own title menu script that has an option for "Credits".  There are a few out there, I know.  But I want the knowledge to do it myself.  Ive been watching diamondplatinums tutorials and I've a few other resources I go to when I get stumped but I've been stuck on this for months without any sort of breakthrough.  I'm not sure how to explain my exact issue...

I've successfully been able to hash together a script that adds a "Credits" option to the title menu.  When i select that, it opens up another menu with the following options

Graphics

Audio

Scripts

Other

When I select one of those options, it should open a window on the right of the menu that lists my credits.  I CANNOT make it open a window when i select one of the above options.  What am i doing wrong?

#==============================================================================# ** Scene_Title#------------------------------------------------------------------------------# This class performs the title screen processing.#==============================================================================class Scene_Title < Scene_Base #-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- alias customscene_credits_create_command_window create_command_window #-------------------------------------------------------------------------- def create_command_window customscene_credits_create_command_window() #Call Original Method @command_window.set_handler:)credits, method:)command_credits)) end def command_credits SceneManager.call (Scene_Credits) endend#==============================================================================# ** Window_TitleCommand#------------------------------------------------------------------------------# This window is for selecting New Game/Continue on the title screen.#==============================================================================class Window_TitleCommand < Window_Command #-------------------------------------------------------------------------- # * Create Command List #-------------------------------------------------------------------------- alias customscene_credits_make_command_list make_command_list #-------------------------------------------------------------------------- def make_command_list customscene_credits_make_command_list() #Call Original Method add_command("Credits", :credits, true) end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width return 200 endend#==============================================================================# ** Window_CreditsMenu#------------------------------------------------------------------------------# This command window appears on the credits screen.#==============================================================================class Window_CreditsMenu < Window_Command #-------------------------------------------------------------------------- # * Initialize Command Selection Position (Class Method) #-------------------------------------------------------------------------- def self.init_command_position @@last_command_symbol = nil end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width return 160 end #-------------------------------------------------------------------------- # * Get Number of Lines to Show #-------------------------------------------------------------------------- def visible_line_number item_max end #-------------------------------------------------------------------------- # * Create Command List #-------------------------------------------------------------------------- def make_command_list add_main_commands add_original_commands end #-------------------------------------------------------------------------- # * Add Main Commands to List #-------------------------------------------------------------------------- def add_main_commands add_command("Graphics", :graphics, true) add_command("Audio", :audio) add_command("Scripts", :scripts) add_command("Other", :other) end #-------------------------------------------------------------------------- # * For Adding Original Commands #-------------------------------------------------------------------------- def add_original_commands end #-------------------------------------------------------------------------- # * Processing When OK Button Is Pressed #-------------------------------------------------------------------------- def process_ok @@last_command_symbol = current_symbol super endend#==============================================================================# ** Scene_Credits#------------------------------------------------------------------------------# This is the Credits Scene.#==============================================================================class Scene_Credits < Scene_Base #-------------------------------------------------------------------------- # * Start Processing #-------------------------------------------------------------------------- def start super() @Window_CreditsMenu = Window_CreditsMenu.new(x=0, y=71) end #-------------------------------------------------------------------------- # * Post-Start Processing #-------------------------------------------------------------------------- def post_start super() end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super() return_scene() if Input.trigger?:) return_scene() if Input.trigger?:)C) end #-------------------------------------------------------------------------- # * Pre-Termination Processing #-------------------------------------------------------------------------- def pre_terminate end #-------------------------------------------------------------------------- # * Termination Processing #-------------------------------------------------------------------------- def terminate super() @Window_CreditsMenu.dispose() end end#==============================================================================# ** Window_TitleCommand#------------------------------------------------------------------------------# This window is for selecting New Game/Continue on the title screen.#==============================================================================class Window_Graphics < Window_Message #-------------------------------------------------------------------------- # * Start Processing #-------------------------------------------------------------------------- def start super() @Window_Graphics = Window_Graphics.new(100, 100) @credits_window = Window_Help.new() @text = "Test" end #-------------------------------------------------------------------------- # * Post-Start Processing #-------------------------------------------------------------------------- def post_start super() end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super() @window_graphics.set_text(@text) return_scene() if Input.trigger?:) return_scene() if Input.trigger?:)C) end #-------------------------------------------------------------------------- # * Pre-Termination Processing #-------------------------------------------------------------------------- def pre_terminate end #-------------------------------------------------------------------------- # * Termination Processing #-------------------------------------------------------------------------- def terminate super() @Window_Graphics.dispose() endend
Please bare with me, I'm very new at this and I'm not sure what info I need to post to get the advice I need.  If more is needed, I will gladly provide.

I just have the Graphics option set up right now.  Nothing is meant to show for the other options right now, its all in testing phase.

Thank you!
 
Last edited by a moderator:

Mike

Veteran
Veteran
Joined
Aug 28, 2013
Messages
316
Reaction score
35
First Language
English
Primarily Uses
So window graphic is the one you're trying to show on the right corner when you choose 'graphic' on the window credits menu?
 

ShadowLurk

Tanoshii~
Veteran
Joined
Feb 14, 2014
Messages
226
Reaction score
53
Primarily Uses
The windows' response handling is usually done in the scene. You need to set the credit menu's window's handler.

And your Window_Graphics start function made another Window_Graphics. Is that your intention?

Usually, at the start of a scene, all related windows are made first, and then shown/hidden as necessary. See Scene_Battle, actor selection and enemy selection windows are created from the initialize.

And making a child of window_message is not really a good idea. There's so many unnecessary functionality there.
 

Venka

Veteran
Veteran
Joined
Jun 20, 2012
Messages
945
Reaction score
365
First Language
English
Primarily Uses
I'm kind of confused on what your Window_Graphics is suppose to be.. it says it's a window and it's based off another window.. but it's set up like a scene.

For your credits menu I'd change it to this

  #--------------------------------------------------------------------------  # * Start Processing  #--------------------------------------------------------------------------  def start    super()    @Window_CreditsMenu = Window_CreditsMenu.new(0, 71)    @Window_CreditsMenu.set_handler:)graphics, method:)call_graphics))    @Window_CreditsMenu.set_handler:)audio, method:)needs_method))    @Window_CreditsMenu.set_handler:)scripts, method:)some_method))    @Window_CreditsMenu.set_handler:)other, method:)define_me))    @Window_CreditsMenu.set_handler:)cancel, method:)return_scene)) # when esc pressed  endset_handler tells the scene what to do when something is done... so when you press the action key while the graphics command is highlighted then it'll do the method

"def call_graphics" of course you'd have to write what you want to happen when the player selects the graphics command... like open up the windows that display the credits for the graphics used.. or open a new scene that does the credits for it.. or whatever your heart desires :) You'd also need to name/create methods for the other commands in your list :)audio, :scripts, and :other)

you'll need to do the same for the other options. notice the set_handler for :cancel. That's what happens when the esc key is pressed. So there is no need to set those input lines in the update.

oh a side note (it could just be a pet peeve of mine), but consider using all lower case letters when naming your window variable "@Window_CreditsMenu". Capital letters can sometimes change the way variables and things work. Variables with capital letters are usually constants that don't change (like you see in customize sections of scripts). You also have to be careful when using symbols and capital letters (ex :Cancel is not the same as :cancel)

edit:

here's the credits making use of the scrolling text window. I commented the code so you should be able to see what I did

Code:
#==============================================================================# ** Scene_Credits#------------------------------------------------------------------------------#  This is the Credits Scene.#==============================================================================class Scene_Credits < Scene_Base  #--------------------------------------------------------------------------  # * Start Processing  #--------------------------------------------------------------------------  def start    super()    @Window_CreditsMenu = Window_CreditsMenu.new(x=0, y=71)    @Window_CreditsMenu.set_handler(:graphics, method(:show_graphic_credits))    @Window_CreditsMenu.set_handler(:audio,    method(:show_audio_credits))    @Window_CreditsMenu.set_handler(:scripts,  method(:show_script_credits))    @Window_CreditsMenu.set_handler(:other,    method(:show_other_credits))    @Window_CreditsMenu.set_handler(:cancel,   method(:return_scene)) # when esc pressed    @scrolling_window = Window_ScrollText.new  end  #--------------------------------------------------------------------------  # * Set the text for graphic credits  #--------------------------------------------------------------------------  def show_graphic_credits    # add in the lines of text you want to show    $game_message.add("Some text to be shown")    $game_message.add("Some more text to be shown")    $game_message.add("New line of text to be shown")    start_scrolling_window # starts the scrolling window  end  #--------------------------------------------------------------------------  # * Set the text for audio credits  #--------------------------------------------------------------------------  def show_audio_credits    $game_message.add("Some audio text to be shown")    start_scrolling_window  end  #--------------------------------------------------------------------------  # * Set the text for script credits  #--------------------------------------------------------------------------  def show_script_credits    $game_message.add("Some script text to be shown")    start_scrolling_window  end  #--------------------------------------------------------------------------  # * Set the text for other credits  #--------------------------------------------------------------------------  def show_other_credits    $game_message.add("Some other left over text to be shown")    start_scrolling_window  end  #--------------------------------------------------------------------------  # * Start the scrolling credits  #--------------------------------------------------------------------------  def start_scrolling_window    # hides the command window so we can see the scrolling text    @Window_CreditsMenu.hide    # must be set to true to start scrolling text window    $game_message.scroll_mode = true    # set your scrolling speed (lower numbers are slower)    $game_message.scroll_speed = 3    # do you want the player to be able to speed up the scroll speed when    # the shift key or action key is pressed? If yes, then set to false    $game_message.scroll_no_fast = false    # this loop will let the window scroll. When it's done scrolling or the    # esc key is pressed, the loop will end and the command window will show    # again.    loop do      Graphics.update      Input.update      update      # If Esc Key is pressed, close out the scroll window and break the loop      if Input.press?(:        @scrolling_window.terminate_message        break      end      # break the loop when the scroll window is done      break unless $game_message.scroll_mode    end    @Window_CreditsMenu.show.activate  end  #--------------------------------------------------------------------------  # * Post-Start Processing  #--------------------------------------------------------------------------  def post_start    super()  end  #--------------------------------------------------------------------------  # * Frame Update  #--------------------------------------------------------------------------  def update    super()  end  #--------------------------------------------------------------------------  # * Pre-Termination Processing  #--------------------------------------------------------------------------  def pre_terminate  end  #--------------------------------------------------------------------------  # * Termination Processing  #--------------------------------------------------------------------------  def terminate    super()    @Window_CreditsMenu.dispose() # not needed, Scene_Base already disposes all windows  endend
 
Last edited by a moderator:

Bethins

Villager
Member
Joined
Nov 4, 2012
Messages
69
Reaction score
0
First Language
English
Primarily Uses
Thank you!!  I'm working on implementing all that!  ill let you know how it goes : )
 

Venka

Veteran
Veteran
Joined
Jun 20, 2012
Messages
945
Reaction score
365
First Language
English
Primarily Uses
you can of course make alterations to it. By default the ScrollText window hides the windowskin.. you could show it, or use background images if you wanted. I saw your blog and you said you only needed a simple credit script :) so if you're happy with the black background then that's great too :)
 

Bethins

Villager
Member
Joined
Nov 4, 2012
Messages
69
Reaction score
0
First Language
English
Primarily Uses
Thanks for checking out my blog : )

Simple works!  For now anyway : P 
 

Bethins

Villager
Member
Joined
Nov 4, 2012
Messages
69
Reaction score
0
First Language
English
Primarily Uses
How do i change the alignment of text in a window from centered to left?  Im assuming it is done with this...

  #--------------------------------------------------------------------------
  # * Draw Item
  #--------------------------------------------------------------------------
  def draw_item(index)
    change_color(normal_color, command_enabled?(index))
    draw_text(item_rect_for_text(index), command_name(index), alignment)
  end
 

Venka

Veteran
Veteran
Joined
Jun 20, 2012
Messages
945
Reaction score
365
First Language
English
Primarily Uses
yep :) alignment should be a number. 0 is left aligned, 1 is centered, and 2 is right aligned. If you omit the alignment then it left aligns by itself.

however, unless you've changed the windows your using.. the ScrollText window uses a different method to draw text. "draw_text_ex(x, y, text)" and this one is always left aligned. So you would have to change the way it draws the text
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Can the Eternal Dreamers finish off the final boss? We'll see!
Fekken kill me. I unknowingly swapped out two important events's codes and saved the game to test it. I'm just doing this for fun and the fun has now been replaced with excruciating torture.
Is this how game developers feel all the time?

EDIT:
WAIT HOLY S***
MY LAST POST ASKING FOR HELP ON AN EVENT ACTUALLY SAVED IT
OH MY GOD
Coffee + Silk Coconut Milk + Splenda Zero = Not ..... awful :/ .
I was making a cutscene where Hero's dad got killed by the dragon but when he lose its say game over and send you to the tittle screen. How can remove game over for that cutscene
My new RPG Maker music pack, Emotional: Redemption, is now in progress and will be coming to RPG Maker soon. It is an album that focuses on emotional themes including the darker forms of sorrow and despair. Below is a demo of a composition from the album.

Forum statistics

Threads
94,446
Messages
920,991
Members
124,260
Latest member
Charles2020
Top