[VX] skrypt godziny - Wersja do druku
Ultima Forum
[VX] skrypt godziny - Wersja do druku

+- Ultima Forum (https://forum.ultimateam.pl)
+-- Dział: RPG Maker (/Forum-RPG-Maker)
+--- Dział: Wsparcie (/Forum-Wsparcie)
+--- Wątek: [VX] skrypt godziny (/Thread-VX-skrypt-godziny)



skrypt godziny - szevaa - 28-11-13 16:27

Hej!

Na innym forum znalazłem taki skrypt godziny i kroki chciałem go oddzieli i da tylko godzinę ale mi nie wyszło jak by stok go oddzielił to bym był wdzięczny a jeszcze jakby dal go wyżej (tam gdzie kroki) to już w ogolę wielki podziw

z góry dziękuje wam za pomoc :)

===
Kod:
#------------------------------------------------------------------------------
# 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
===


RE: skrypt godziny - Ayene - 28-11-13 19:02

Łapaj:
Kod:
#------------------------------------------------------------------------------
# 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
#==============================================================================
# ** 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(@command_window.x, @command_window.y + @command_window.height)
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    # The usual
    pirate_playtime_terminate
    # Dispose @play_window
    @play_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # The usual
    pirate_playtime_update
    # Update @play_window
    @play_window.update
  end
end