This is the desired output, middens was made in MV to my knowledge, so I'm afraid I can't simply ape it, thanks for your time.
How can I add a display of Playtime and Steps in the menu? (VXAce)
RPG Maker VXAce Support
Ruby:
#==============================================================================
# Window Steps Script
#------------------------------------------------------------------------------
# Allows you to show the current amount of steps in the status menu when you
# open up the menu via esc on the keyboard.
#
# Author: Adam Balan (Adrien., A.)
# Incomptaibility?: Nothing.
# Notes: plug and play.
# Version 1.1
#==============================================================================
#==============================================================================
# Module WindowVocab
#------------------------------------------------------------------------------
# STEPS = name of the steps vocab.
#==============================================================================
module WindowVocab
STEPS = "Steps" #name of the steps
end
#==============================================================================
# Window_Steps
#------------------------------------------------------------------------------
# Window Steps shows a steps window above the gold in the menu.
#==============================================================================
class Window_Steps < Window_Base
#--------------------------------------------------------------------------
# Initialize the class.
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, fitting_height(1))
refresh
end
#--------------------------------------------------------------------------
# Refresh the box.
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_currency_value(value, currency_unit, 4, 0, contents.width - 8)
end
#--------------------------------------------------------------------------
# Get the value of the steps.
#--------------------------------------------------------------------------
def value
$game_party.steps
end
#--------------------------------------------------------------------------
# Define the Vocab.
#--------------------------------------------------------------------------
def currency_unit
WindowVocab::STEPS
end
end
#==============================================================================
# Scene_Menu
#------------------------------------------------------------------------------
# Create the Menu - we are only editing one method and adding a new.
#
# Alias: start method to add the steps window.
#==============================================================================
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# Alias: start method.
#--------------------------------------------------------------------------
alias start_a start
def start
start_a
create_steps_window
end
#--------------------------------------------------------------------------
# Create the window.
#--------------------------------------------------------------------------
def create_steps_window
@steps_window = Window_Steps.new
@steps_window.x = 0
@steps_window.y = (Graphics.height - @steps_window.height) - 50
end
end
Ruby:
=begin
===============================================================================
Playtime in Menu v2.1 (03/9/2014)
-------------------------------------------------------------------------------
Created By: Shadowmaster/Shadowmaster9000/Shadowpasta
(www.crimson-castle.co.uk)
===============================================================================
Information
-------------------------------------------------------------------------------
This script places the total playtime you see on the file screens on your
menu. The playtime on the menu will also update every second. The window and
font size for the playtime should automatically match the gold's window and
font size.
===============================================================================
How to Use
-------------------------------------------------------------------------------
Place this script under Materials, preferably below by menu altering scripts.
Nothing else is needed to be done.
===============================================================================
Required
-------------------------------------------------------------------------------
Nothing.
===============================================================================
Change log
-------------------------------------------------------------------------------
v2.1: Fixed error with other scenes that displayed gold also displaying time.
(03/9/2014)
v2.0: Added ability to move playtime display above or below gold window. As
well as the feature to make playtime and party gold share the same window.
(27/05/2014)
v1.5: Reduced number of lines used for improved efficiency. (21/08/2013)
v1.0: First release. (13/01/2013)
===============================================================================
Terms of Use
-------------------------------------------------------------------------------
* Free to use for both commercial and non-commerical projects.
* Credit me if used.
* Do not claim this as your own.
* You're free to post this on other websites, but please credit me and keep
the header intact.
* If you want to release any modifications/add-ons for this script, the
add-on script must use the same Terms of Use as this script uses. (But you
can also require any users of your add-on script to credit you in their game
if they use your add-on script.)
* If you're making any compatibility patches or scripts to help this script
work with other scripts, the Terms of Use for the compatibility patch does
not matter so long as the compatibility patch still requires this script to
run.
* If you want to use your own seperate Terms of Use for your version or
add-ons of this script, you must contact me at http://www.rpgmakervxace.net
or www.crimson-castle.co.uk
===============================================================================
=end
$imported = {} if $imported.nil?
$imported["MenuPlaytime"] = true
module MenuPlaytime
#==============================================================================
# ** Display Playtime above Gold
#------------------------------------------------------------------------------
# If set to true, playtime will always be shown above the party gold,
# regardless of whether the two share the same window or use separate windows.
# If set to false, playtime will be displayed below the party gold.
#==============================================================================
DisplayPlaytimeAboveGold = true
#==============================================================================
# ** Insert Playtime into Gold Window
#------------------------------------------------------------------------------
# If set to true, instead of using its own separate window above the gold
# window, both the playtime and party gold will be displayed within the
# same window.
#==============================================================================
PlaytimeInGoldWindow = false
#==============================================================================
# ** DO NOT edit anything below this unless if you know what you're doing!
#==============================================================================
end
#==============================================================================
# ** Window Time
#------------------------------------------------------------------------------
# Display Game Time
#==============================================================================
class Window_Time < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(dx, dy, width)
super(dx, dy, width, fitting_height(1))
@play_time = $game_system.playtime_s
refresh
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
@play_time = $game_system.playtime_s
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
change_color(normal_color)
draw_text(4, 0, contents.width - 8, line_height, @play_time, 2)
end
end
#==============================================================================
# ** Window_MenuGold
#------------------------------------------------------------------------------
# This window displays the party's gold.
#==============================================================================
class Window_MenuGold < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, window_width, fitting_height(2))
@play_time = $game_system.playtime_s
refresh
end
#--------------------------------------------------------------------------
# * Get Window Width
#--------------------------------------------------------------------------
def window_width
return 160
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
@play_time = $game_system.playtime_s
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
if MenuPlaytime::DisplayPlaytimeAboveGold == true
draw_currency_value(value, currency_unit, 4, line_height, contents.width - 8)
change_color(normal_color)
draw_text(4, 0, contents.width - 8, line_height, @play_time, 2)
else
draw_currency_value(value, currency_unit, 4, 0, contents.width - 8)
change_color(normal_color)
draw_text(4, line_height, contents.width - 8, line_height, @play_time, 2)
end
end
#--------------------------------------------------------------------------
# * Get Party Gold
#--------------------------------------------------------------------------
def value
$game_party.gold
end
#--------------------------------------------------------------------------
# Get Currency Unit
#--------------------------------------------------------------------------
def currency_unit
Vocab::currency_unit
end
#--------------------------------------------------------------------------
# * Open Window
#--------------------------------------------------------------------------
def open
refresh
super
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs the menu screen processing.
#==============================================================================
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# * Alias Start
#--------------------------------------------------------------------------
alias menu_windowtime_start start
def start
menu_windowtime_start
create_time_window if MenuPlaytime::PlaytimeInGoldWindow == false
end
#--------------------------------------------------------------------------
# * Create Time Window
#--------------------------------------------------------------------------
def create_time_window
@time_window = Window_Time.new(0, 0, @gold_window.width)
if MenuPlaytime::DisplayPlaytimeAboveGold == true
@time_window.y = Graphics.height - @time_window.height - @gold_window.height
else
@time_window.y = Graphics.height - @time_window.height
end
end
#--------------------------------------------------------------------------
# * Create Gold Window
#--------------------------------------------------------------------------
alias create_gold_window_time create_gold_window
def create_gold_window
if MenuPlaytime::PlaytimeInGoldWindow == true
@gold_window = Window_MenuGold.new
@gold_window.x = 0
@gold_window.y = Graphics.height - @gold_window.height
else
create_gold_window_time
@gold_window.y -= @gold_window.height if MenuPlaytime::DisplayPlaytimeAboveGold == false
end
end
end
Awesome! Those work great. However, there's one more thing I'm trying to do right now.
Is it possible to shift "Steps Taken" onto a new line below, so it was more neatly organized?
Line 43 has " draw_currency_value(value, currency_unit, 4, 0, contents.width - 8) " which i think is relevant, but I can't figure out how to make it break lines \n isn't working.
desired output
Is it possible to shift "Steps Taken" onto a new line below, so it was more neatly organized?
# Module WindowVocab
#------------------------------------------------------------------------------
# STEPS = name of the steps vocab.
#==============================================================================
module WindowVocab
STEPS = "Steps taken" #name of the steps
end
#==============================================================================
# Window_Steps
#------------------------------------------------------------------------------
# Window Steps shows a steps window above the gold in the menu.
#==============================================================================
class Window_Steps < Window_Base
#--------------------------------------------------------------------------
# Initialize the class.
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, fitting_height(2))
refresh
end
#--------------------------------------------------------------------------
# Refresh the box.
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_currency_value(value, currency_unit, 4, 0, contents.width - 8)
end
#--------------------------------------------------------------------------
# Get the value of the steps.
#--------------------------------------------------------------------------
def value
$game_party.steps
end
#--------------------------------------------------------------------------
# Define the Vocab.
#--------------------------------------------------------------------------
def currency_unit
WindowVocab::STEPS
end
end
#==============================================================================
# Scene_Menu
#------------------------------------------------------------------------------
# Create the Menu - we are only editing one method and adding a new.
#
# Alias: start method to add the steps window.
#==============================================================================
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# Alias: start method.
#--------------------------------------------------------------------------
alias start_a start
def start
start_a
create_steps_window
end
#--------------------------------------------------------------------------
# Create the window.
#--------------------------------------------------------------------------
def create_steps_window
@steps_window = Window_Steps.new
@steps_window.x = 0
@steps_window.y = (Graphics.height - @steps_window.height) - 96
end
end
#------------------------------------------------------------------------------
# STEPS = name of the steps vocab.
#==============================================================================
module WindowVocab
STEPS = "Steps taken" #name of the steps
end
#==============================================================================
# Window_Steps
#------------------------------------------------------------------------------
# Window Steps shows a steps window above the gold in the menu.
#==============================================================================
class Window_Steps < Window_Base
#--------------------------------------------------------------------------
# Initialize the class.
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, fitting_height(2))
refresh
end
#--------------------------------------------------------------------------
# Refresh the box.
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_currency_value(value, currency_unit, 4, 0, contents.width - 8)
end
#--------------------------------------------------------------------------
# Get the value of the steps.
#--------------------------------------------------------------------------
def value
$game_party.steps
end
#--------------------------------------------------------------------------
# Define the Vocab.
#--------------------------------------------------------------------------
def currency_unit
WindowVocab::STEPS
end
end
#==============================================================================
# Scene_Menu
#------------------------------------------------------------------------------
# Create the Menu - we are only editing one method and adding a new.
#
# Alias: start method to add the steps window.
#==============================================================================
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# Alias: start method.
#--------------------------------------------------------------------------
alias start_a start
def start
start_a
create_steps_window
end
#--------------------------------------------------------------------------
# Create the window.
#--------------------------------------------------------------------------
def create_steps_window
@steps_window = Window_Steps.new
@steps_window.x = 0
@steps_window.y = (Graphics.height - @steps_window.height) - 96
end
end
desired output
You have a few options.
1. you can change the draw_currency_value to just a draw_text and add a second one for the next line
2. you can add the method to the script and edit is a bit.
If you searched you would find that draw_currency_value is in Window_Base
So to have it change for this window and no where else we simply copy the method into the script.
Then all you have to do is change the y value for the second draw_text. y + 24 would push it to the next line.
Then you may find that you have other things you can do.
change the 2 to a 1 and the text and numbers move to the middle, but you should also change the width part in the first one to just width.
You can choose.
1. you can change the draw_currency_value to just a draw_text and add a second one for the next line
2. you can add the method to the script and edit is a bit.
If you searched you would find that draw_currency_value is in Window_Base
So to have it change for this window and no where else we simply copy the method into the script.
Ruby:
#--------------------------------------------------------------------------
# * Draw Number (Gold Etc.) with Currency Unit
#--------------------------------------------------------------------------
def draw_currency_value(value, unit, x, y, width)
cx = text_size(unit).width
change_color(normal_color)
draw_text(x, y, width - cx - 2, line_height, value, 2)
change_color(system_color)
draw_text(x, y, width, line_height, unit, 2)
end
Then you may find that you have other things you can do.
change the 2 to a 1 and the text and numbers move to the middle, but you should also change the width part in the first one to just width.
You can choose.
Original thread: https://forums.rpgmakerweb.com/threads/how-can-i-add-a-display-of-playtime-and-steps-in-the-menu-vxace.166885/