So I need a little help on this as I'm kind of stuck. So far I have this:
module MenuManager
MENU_DESCRIPTIONS ={ main_message: 'What will you do?', }
def self.method_wait_for_message=(method)
@method_wait_for_message = method
end
def self.wait_for_message
@method_wait_for_message.call if @method_wait_for_message
end
def self.menu_open
$game_message.add(MENU_DESCRIPTIONS[:main_message])
wait_for_message
end
end
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
# This window displays party member status on the menu screen.
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :pending_index # Pending position (for formation)
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, window_width, window_height)
@pending_index = -1
refresh
end
def window_width
Graphics.width
end
def window_height
fitting_height(6)
end
def item_max
$game_party.members.size
end
def item_height
(height - standard_padding * 2) / 6
end
def draw_item(index, *args)
actor_id = index
return unless actor_id
actor = $game_party.members[actor_id]
rect = item_rect(index)
draw_actor_simple_status(actor, rect.x, rect.y)
end
def draw_actor_simple_status(actor, x, y)
draw_actor_name(actor, x+25, y)
draw_actor_icons(actor, x+120, y + 1, 122)
draw_actor_hp(actor, x + 260, y - 3)
draw_actor_mp(actor, x + 390, y - 3)
end
end
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
class Window_MenuMessage < Window_Message
def window_height
fitting_height(9)
end
def update_placement
self.y = fitting_height(7) + 4
self.opacity = 0
end
end
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
class Scene_Menu
def start
super
create_all_windows
init_windows
MenuManager.method_wait_for_message = method(:wait_for_message)
end
def post_start
super
MenuManager.menu_open
end
def update_for_wait
update_basic
end
def wait_for_message
@message_window.update
update_for_wait while $game_message.visible
end
def create_all_windows
create_status_window
create_message_window
create_info_window
create_command_window
end
def init_windows
end
def create_status_window
@status_window = Window_MenuStatus.new(0, 0)
end
def create_message_window
@message_window = Window_MenuMessage.new
@message_back = Window_Base.new(0, @status_window.height+24, Graphics.width, 56)
end
def create_info_window
@info_viewport = Viewport.new
@info_viewport.rect.y = Graphics.height - @status_window.height
@info_viewport.rect.height = @status_window.height
@info_viewport.z = 100
@info_viewport.ox = 64
@status_window.viewport = @info_viewport
end
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_MenuCommand.new
@command_window.set_handler(:cancel, method(:return_scene))
end
end
My problem is that if I click enter to select a command, it will first remove the message window. Then if you click again then the command window will select the command. This is obviously what it is pre-programmed to do. I need it so that it does this:
(https://db.tt/rUHu1dAa)
As you can see from the gif above, both the message window and command window are both sync instead of how it is in the script above.
So if that made sense, just need help on how to proceed with recreating that menu system.
Isn't this idea of a "message window" in the main menu actually just a glorified help window?
If it isn't, I'd say adding it to the base menu would probably be where I would take it.
The help window and the message window are to different windows, so not really. As you see in the screenshot gif the words appear on screen character by character like the message system does. The help window does not do that. I've been trying to sync the command windows to the message_window, but I kept running into issues.
Quote from: Jragyn on August 25, 2015, 03:34:16 pm
Isn't this idea of a "message window" in the main menu actually just a glorified help window?
This.
I'm assuming that the reason the message window closes is because there's no more messages to be displayed. That is how it functions normally afterall. Why can't you just make another Window_Message copy (e.g. class Window_MenuMessage) and move on from there?
Also the script you posted does me absolutely no good.
I fixed the script up above, my math was wrong apparently :<_<:. The script should be plug and play.
Anyways, I know that the message disappears after you click it that is not the issue, I apologize if that was not clear. If you click enter instead of going to the next command it will first remove the message window and then you will have to click enter again to click the command.
Hope the screenshot below makes more sense:
(https://dl.dropboxusercontent.com/u/56514130/message%20in%20menu2.gif)
The Window_MenuMessage is being processed/updated first before the Window_MenuCommand. In Window_Message, the method
input_pause is called from
process_input and yields the Fiber (i.e. halts further processing of the message) until the player inputs B or C. Immediately after that, there's an
Input.update. So after updating Window_MenuMessage, Window_MenuCommand (and subsequently all the other windows in your scene) do not know that the player triggered the C button during that frame, requiring a second press of the button on the next frame or later.
The obvious solution is to comment out that
Input.update but I don't know what consequences that can create.
EDIT:
Played with it a bit more. This is what I was able to come up with:
module MenuManager
MENU_DESCRIPTIONS ={ main_message: 'What will you do?'}
def self.method_wait_for_message=(method)
@method_wait_for_message = method
end
def self.wait_for_message
@method_wait_for_message.call if @method_wait_for_message
end
def self.menu_open
$game_message.add(MENU_DESCRIPTIONS[:main_message])
#MenuManager.wait_for_message
end
end
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
# This window displays party member status on the menu screen.
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :pending_index # Pending position (for formation)
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, window_width, window_height)
@pending_index = -1
refresh
end
def window_width
Graphics.width
end
def window_height
fitting_height(6)
end
def item_max
$game_party.members.size
end
def item_height
(height - standard_padding * 2) / 6
end
def draw_item(index, *args)
actor_id = index
return unless actor_id
actor = $game_party.members[actor_id]
rect = item_rect(index)
draw_actor_simple_status(actor, rect.x, rect.y)
end
def draw_actor_simple_status(actor, x, y)
draw_actor_name(actor, x+25, y)
draw_actor_icons(actor, x+120, y + 1, 122)
draw_actor_hp(actor, x + 260, y - 3)
draw_actor_mp(actor, x + 390, y - 3)
end
end
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
class Game_Message
attr_accessor :all_text_drawn
def done_drawing?
@all_text_drawn == true
end
end
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
class Window_MenuMessage < Window_Message
def window_height
fitting_height(9)
end
def update_placement
self.y = fitting_height(7) + 4
self.opacity = 0
end
#--------------------------------------------------------------------------
# * Main Processing of Fiber
#--------------------------------------------------------------------------
def fiber_main
$game_message.visible = true
update_background
update_placement
loop do
if $game_message.has_text?
$game_message.all_text_drawn = false
process_all_text
else
$game_message.all_text_drawn = true
end
process_input
$game_message.clear
Fiber.yield
break if Input.trigger?(:C) && !text_continue?
end
close_and_wait
$game_message.visible = false
@fiber = nil
end
#--------------------------------------------------------------------------
# * Input Processing
#--------------------------------------------------------------------------
def process_input
if $game_message.choice?
input_choice
elsif $game_message.num_input?
input_number
elsif $game_message.item_choice?
input_item
end
end
end
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
class Window_MenuCommand < Window_Command
def update
return unless $game_message.done_drawing?
super
end
end
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
class Scene_Menu
def start
super
create_all_windows
init_windows
end
def post_start
super
#MenuManager.method_wait_for_message = method(:wait_for_message)
MenuManager.menu_open
end
#def update_for_wait
#update_basic
#end
#def wait_for_message
#@message_window.update
#update_for_wait while $game_message.visible
#end
def create_all_windows
create_status_window
create_message_window
create_info_window
create_command_window
end
def init_windows
end
def create_status_window
@status_window = Window_MenuStatus.new(0, 0)
end
def create_message_window
@message_window = Window_MenuMessage.new
@message_back = Window_Base.new(0, @status_window.height+24, Graphics.width, 56)
end
def create_info_window
@info_viewport = Viewport.new
@info_viewport.rect.y = Graphics.height - @status_window.height
@info_viewport.rect.height = @status_window.height
@info_viewport.z = 100
@info_viewport.ox = 64
@status_window.viewport = @info_viewport
end
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_MenuCommand.new
@command_window.set_handler(:item, method(:command_item))
@command_window.set_handler(:cancel, method(:return_scene))
end
end
Thanks, I'll test that in a bit, I was thinking of something similar before in the Window_Message, but I kept getting an error which why I post here right after.
Edit:
But what you did work, so time to move onto the next thing.