Need to Add Text to Menu?

brettdmason

Villager
Member
Joined
Jul 4, 2014
Messages
18
Reaction score
0
First Language
English
Primarily Uses
Trying to make it when the player presses Esc, it shows a window that says "Game Paused" on the first line with a command below it to exit the game. I already have it just down to the exit game part, but I have no idea how to add just text that doesn't act like a command.
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
Make the command window invisible

.opacity = 0

then add another window behind it, with height to fit both the commands and extra space to add the "Game Paused" text.

you can control window's layer by

.z = number

edit:

you can also use sprite instead of window
 
Last edited by a moderator:

brettdmason

Villager
Member
Joined
Jul 4, 2014
Messages
18
Reaction score
0
First Language
English
Primarily Uses
Uh huh, I understand how this will work, but I'm stupid and have no idea how to script this. Any help there?
 

brettdmason

Villager
Member
Joined
Jul 4, 2014
Messages
18
Reaction score
0
First Language
English
Primarily Uses
I'm doing this all in the Script Editor, not through events. I don't really know how to transfer script calls to the Script Editor.

Edit: Really, if anyone knows a way I can just add this to Window_MenuCommand, it'd probably be easier for me.
 
Last edited by a moderator:

skymen

Veteran
Veteran
Joined
Aug 26, 2013
Messages
46
Reaction score
5
First Language
French
Primarily Uses
Hi, just add in a "help window"
Juste copy/paste the code of any help window, and then, in the update_help, juste set help text to "game paused"
 

brettdmason

Villager
Member
Joined
Jul 4, 2014
Messages
18
Reaction score
0
First Language
English
Primarily Uses
Little help with how I'd do this? I'm fairly new to scripting, and all my attempts have failed to add a help window.

Edit: As for my script so far, this are my edits so far to Window_MenuCommand. Some stuff I deleted instead of turning into comments, so I plan to fix that later, just because it's been bothering me. *UPDATED* Undid all changes to Window_MenuCommand, made a new script and have all my script changes there.

Code:
#==============================================================================# ** Window_TitleCommand#------------------------------------------------------------------------------class Window_TitleCommand < Window_Command  def alignment    return 1  endend#------------------------------------------------------------------------------# ** Window_MenuCommand#------------------------------------------------------------------------------class Window_MenuCommand < Window_Command  def update_placement    self.x = (Graphics.width - width) / 2    self.y = (Graphics.height - height) / 2  end  def make_command_list    add_cancel_command    add_game_end_command  end  def make_command_list    add_command(Vocab::cancel,   :cancel)    add_command(Vocab::game_end, :game_end)  end  def alignment    return 1  endend#------------------------------------------------------------------------------# ** Window_GameEnd#------------------------------------------------------------------------------class Window_GameEnd < Window_Command  def alignment    return 1  end  def make_command_list    add_command(Vocab::cancel,   :cancel)    add_command(Vocab::to_title, :to_title)    add_command(Vocab::shutdown, :shutdown)  endend
 
Last edited by a moderator:

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
hmm.. so you are editing the window of menu command for that. ain't that showing the rest of the contents like status and such? thought you only want pause/title/exit/cancel to show when pressing ESC?

for that, you need to edit that in scene class.

or a quick redirect of the key press to scene end will do the trick. then from there. add a text display.

i can make the script for you if you can confirm what you really want. if you want more details on how to position them. make a picture to show how you want them to be on screen will help.
 

brettdmason

Villager
Member
Joined
Jul 4, 2014
Messages
18
Reaction score
0
First Language
English
Primarily Uses
Alright, just making a new post for this one. Got a Help window that says "Game Paused", but I want to move it and I want to center the text. So far, this is what I have and it didn't center the text and I have no idea how to move it directly above the Menu window.

Code:
#==============================================================================# ** Title Window#------------------------------------------------------------------------------class Window_TitleCommand < Window_Command  def alignment    return 1  endend#------------------------------------------------------------------------------# ** Menu Window#------------------------------------------------------------------------------class Window_MenuCommand < Window_Command  def update_placement    self.x = (Graphics.width - width) / 2    self.y = (Graphics.height - height) / 2  end  def make_command_list    add_cancel_command    add_game_end_command  end  def make_command_list    add_command(Vocab::cancel,   :cancel)    add_command(Vocab::game_end, :game_end)  end  def alignment    return 1  endend#------------------------------------------------------------------------------# ** Game End Window#------------------------------------------------------------------------------class Window_GameEnd < Window_Command  def alignment    return 1  end  def make_command_list    add_command(Vocab::cancel,   :cancel)    add_command(Vocab::to_title, :to_title)    add_command(Vocab::shutdown, :shutdown)  endend#------------------------------------------------------------------------------# ** Help Window#------------------------------------------------------------------------------class Window_Help < Window_Base  def alignment    return 1  endend#------------------------------------------------------------------------------# ** Menu Scene#------------------------------------------------------------------------------class Scene_Menu < Scene_MenuBase  def start    super    create_command_window    create_help_window  end  def create_help_window    @help_window = Window_Help.new(1)    @help_window.set_text(help_window_text)  end  def help_window_text    return "Game Paused"  endend
 

brettdmason

Villager
Member
Joined
Jul 4, 2014
Messages
18
Reaction score
0
First Language
English
Primarily Uses
Here are some screenshots:

Original:



How I Want It:



Edit: Alright, so I got it moved and resized on my own, but I still can't get the text centered. This script is the only one in which alignment didn't fix that.

Code:
class Window_Help < Window_Base  def initialize(line_number = 2)    super(198, 125, 145, fitting_height(line_number))  end  def alignment    return 1  endend
 
Last edited by a moderator:

skymen

Veteran
Veteran
Joined
Aug 26, 2013
Messages
46
Reaction score
5
First Language
French
Primarily Uses
You may wanna add this:

Code:
class Window_Help < Window_Base#--------------------------------------------------------------------------# * Object Initialization#-------------------------------------------------------------------------- def initialize(line_number = 2)  super((Graphics.width - width) / 2, self.y = ((Graphics.height - height) / 2)-fitting_height(line_number), 160, fitting_height(line_number)) endend
 
Last edited by a moderator:

brettdmason

Villager
Member
Joined
Jul 4, 2014
Messages
18
Reaction score
0
First Language
English
Primarily Uses
You may wanna add this:

class Window_Help < Window_Base#--------------------------------------------------------------------------# * Object Initialization#-------------------------------------------------------------------------- def initialize(line_number = 2) super((Graphics.width - width) / 2, self.y = ((Graphics.height - height) / 2)-fitting_height(line_number), 160, fitting_height(line_number)) endend
I actually just solved this part, and that also results in an error.
 

brettdmason

Villager
Member
Joined
Jul 4, 2014
Messages
18
Reaction score
0
First Language
English
Primarily Uses
This is how it looks after I updated the positioning, but I am still unhappy with the left-aligned text.

 

skymen

Veteran
Veteran
Joined
Aug 26, 2013
Messages
46
Reaction score
5
First Language
French
Primarily Uses
Well, You could trick the whole thing, keep your Help window exactly as it is right now, and set both window opacities down to 0 (or only the help window's).
That would give us the impression that th text is centered whil it is not.
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
Try just using this:



class Window_GameEnd < Window_Command  def make_command_list    add_command("Back",   :cancel)    add_command("Quit", :shutdown)  end  def alignment    return 1  end  def update_placement    self.x = (Graphics.width - width) / 2    self.y = (Graphics.height - height) / 2 + 12  endendclass Scene_Map < Scene_Base  def call_menu    Sound.play_ok    SceneManager.call(Scene_End)  endendclass Scene_End < Scene_MenuBase  def start    super    create_bg_window    create_command_window  end  def close_command_window    @command_window.hide    @back_window.close    update until @back_window.close?  end  def create_command_window    @command_window = Window_GameEnd.new    @command_window.set_handler:)cancel,   method:)return_scene))    @command_window.set_handler:)shutdown, method:)command_shutdown))    @command_window.opacity = 0    @command_window.z = 999  end  def create_bg_window    bgwidth = 160    bgheight = 128    centerx = (Graphics.width - bgwidth) / 2     centery = (Graphics.height - bgheight) / 2    @back_window = Window_Base.new(centerx,centery,bgwidth,bgheight)    @text = "Game Paused"    @back_window.draw_text(0,0,bgwidth-24,24, @text, 1)  endendedit:

fixed the window closing part to make it pretty. please use the new version above
 
Last edited by a moderator:

brettdmason

Villager
Member
Joined
Jul 4, 2014
Messages
18
Reaction score
0
First Language
English
Primarily Uses
Try just using this:



class Window_GameEnd < Window_Command  def make_command_list    add_command("Back",   :cancel)    add_command("Quit", :shutdown)  end  def alignment    return 1  end  def update_placement    self.x = (Graphics.width - width) / 2    self.y = (Graphics.height - height) / 2 + 12  endendclass Scene_Map < Scene_Base  def call_menu    Sound.play_ok    SceneManager.call(Scene_End)    Window_MenuCommand::init_command_position  endendclass Scene_End < Scene_MenuBase  def start    super    create_bg_window    create_command_window  end  def close_command_window    @command_window.hide    @back_window.close    update until @back_window.close?  end  def create_command_window    @command_window = Window_GameEnd.new    @command_window.set_handler:)cancel,   method:)return_scene))    @command_window.set_handler:)shutdown, method:)command_shutdown))    @command_window.opacity = 0    @command_window.z = 999  end  def create_bg_window    bgwidth = 160    bgheight = 128    centerx = (Graphics.width - bgwidth) / 2     centery = (Graphics.height - bgheight) / 2    @back_window = Window_Base.new(centerx,centery,bgwidth,bgheight)    @text = "Game Paused"    @back_window.draw_text(0,0,bgwidth-24,24, @text, 1)  endendedit:

fixed the window closing part to make it pretty. please use the new version above
While I appreciate this and like the way this looks, I'm running into a strange error involving "init_command_position" under Scene_Map.

Well, You could trick the whole thing, keep your Help window exactly as it is right now, and set both window opacities down to 0 (or only the help window's).

That would give us the impression that th text is centered whil it is not.
Would you happen to know how to make the frame on the window disappear?
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
that script should work alone by itself. remove all your other "fix" you are currently doing.

or try that in a new project.
 

skymen

Veteran
Veteran
Joined
Aug 26, 2013
Messages
46
Reaction score
5
First Language
French
Primarily Uses
Yep, and that would give you that (just modify your Scene_Menu) And MeowFace's Menu is better I think, so if you happen to make his work, use it :D :
 

Code:
class Scene_Menu < Scene_MenuBase  def start    super    create_command_window    create_help_window  end  def create_help_window    @help_window = Window_Help.new(1)    @help_window.set_text(help_window_text)    @help_window.opacity = 0 # THIS IS WHAT I ADDED  end  def help_window_text    return "Game Paused"  endend
 

brettdmason

Villager
Member
Joined
Jul 4, 2014
Messages
18
Reaction score
0
First Language
English
Primarily Uses
So, I'm gonna go through, reset all base scripts because I messed something up in one of them and retry Meow's. If it still doesn't work, this ended up working for me. Got some more help from here.

Code:
#==============================================================================# ** Title Window#------------------------------------------------------------------------------class Window_TitleCommand < Window_Command  def alignment    return 1  endend#------------------------------------------------------------------------------# ** Menu Window#------------------------------------------------------------------------------class Window_MenuCommand < Window_Command  def update_placement    self.x = (Graphics.width - width) / 2    self.y = (Graphics.height - height) / 2  end  def make_command_list    add_cancel_command    add_game_end_command  end  def make_command_list    add_command(Vocab::cancel,   :cancel)    add_command(Vocab::game_end, :game_end)  end  def alignment    return 1  endend#------------------------------------------------------------------------------# ** Game End Window#------------------------------------------------------------------------------class Window_GameEnd < Window_Command  def alignment    return 1  end  def make_command_list    add_command(Vocab::cancel,   :cancel)    add_command(Vocab::to_title, :to_title)    add_command(Vocab::shutdown, :shutdown)  endend#------------------------------------------------------------------------------# ** Help Window#------------------------------------------------------------------------------class Window_Help < Window_Base  def initialize(line_number = 2)    super(199, 125, 145, fitting_height(line_number))  endend#------------------------------------------------------------------------------# ** Menu Scene#------------------------------------------------------------------------------class Scene_Menu < Scene_MenuBase  def start    super    create_command_window    create_help_window  end  def create_help_window    @help_window = Window_Help.new(1)    @help_window.set_text(help_window_text)  end  def help_window_text    return "Game Paused"  endend  #------------------------------------------------------------------------------# ** Window_Base#------------------------------------------------------------------------------class Window_Base < Window  def initialize(x, y, width, height)    super    self.opacity = 0    self.windowskin = Cache.system("Window2")    update_padding    update_tone    create_contents    @opening = @closing = false  endend
 

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

Latest Threads

Latest Posts

Latest Profile Posts

On my journey of character rework: I had this character, she was meant to be just a princess that joins your party. And at long term she was just uninteresting... So I tweaked her to be a rebel agaisn't the royalty before meeting up with the party.

Quick tip for any other ametuer pixel artists! When trying to create a colour palette, enabling Antialiasing can speed up the process of creating different shades! Just place your lightest colour and your darkest colour next to each other, select both pixels, and stretch it out!
Revolutionizing the JRPG Industry: Knocking on Doors.

Take that, murderhobos.
Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.

Forum statistics

Threads
106,054
Messages
1,018,580
Members
137,843
Latest member
Betwixt000
Top