Steps and Time in Menu
Version: 1.0
Author: Modern-Day-Pirate
Release Date: September 8
th 2008
Exclusive Script at RPG RPG RevolutionIntroduction My first script! yayz! This is a little something I threw together to show player step count and playtime on the menu.
Script CODE
#------------------------------------------------------------------------------
# Author : Modern-Day-Pirate
# How to use:
# Just place above main
#------------------------------------------------------------------------------
#==============================================================================
# ** Window_PlayTime
#------------------------------------------------------------------------------
# This window displays play time on the menu screen.
#==============================================================================
class Window_PlayTime < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 160, 80)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(-18, -10, self.width-40, 32, "Play Time",1)
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, 20, 120, 36, text, 2)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
#==============================================================================
# ** Window_Steps
#------------------------------------------------------------------------------
# This window displays step count on the menu screen.
#==============================================================================
class Window_Steps < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 160, 80)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, -10, self.width-40, 32, "Step Count")
self.contents.font.color = normal_color
self.contents.draw_text(4, 20, 120, 32, $game_party.steps.to_s, 2)
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs the menu screen processing.
#==============================================================================
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias pirate_playtime_start start
alias pirate_playtime_terminate terminate
alias pirate_playtime_update update
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
# The usual
pirate_playtime_start
# Create @play_window
@play_window = Window_PlayTime.new(@gold_window.x, @gold_window.y - 80)
# Create @steps_window
@steps_window = Window_Steps.new(@gold_window.x, @gold_window.y - 160)
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
# The usual
pirate_playtime_terminate
# Dispose @play_window
@play_window.dispose
# Dispose @steps_window
@steps_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# The usual
pirate_playtime_update
# Update @play_window
@play_window.update
# Update @steps_window
@steps_window.update
end
end
Customizationline18 super(x, y, 160, 80)
line57 super(x, y, 160, 80)
change '160' and '80' to set the size of the windows(first # is width second is height).
line91 @play_window = Window_PlayTime.new(
@gold_window.x, @gold_window.y - 80)
line93 @steps_window = Window_Steps.new(
@gold_window.x, @gold_window.y - 160)
change
red text to (x,y) coordinates for where to display window
Compatibility RPG Maker VX
Screenshot
DEMO Not needed.
Installation Just place above main.
Terms and Conditions Give credit where credit is due.
CreditsME! Modern-Day-Pirate
Bug Report?Please give me this information:
QUOTE
- What is it says in error window?
- When is it get error? (Right after run game, when you choose something, etc.)
- Do you have any other scripts running in your game that may crash with this script?