Main Menu
  • Welcome to The RPG Maker Resource Kit.

(RMVXA) Scene_Menu show Playtime

Started by &&&&&&&&&&&&&, April 25, 2013, 07:17:11 AM

0 Members and 2 Guests are viewing this topic.

&&&&&&&&&&&&&

Hello.
So far with my editing of scripts, I've followed a simple plan-
1. Make changes/Add stuff
2. Get error message
3. Figure out why I got said error message
4. Fix it (A lot of the time, I go back to 2 at this point. Eventually I move on to 5)
5. Refine script

This time however... I'm getting no such error message... so I don't know what I'm doing wrong.

I added this to Scene_Menu.

  def create_playtime_window
    @playtime_window = Window_Playtime.new
    @playtime_window.x = 384
    @playtime_window.y = 272
  end


Then I added this little copy pasted and edited script -

#==============================================================================
# ** Window_Playtime
#------------------------------------------------------------------------------
#  This window displays the party's playtime.
#==============================================================================

class Window_Playtime < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, window_width, fitting_height(1))
    refresh
  end
  #--------------------------------------------------------------------------
  # * Get Window Width
  #--------------------------------------------------------------------------
  def window_width
    return 160
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear

  end
  #--------------------------------------------------------------------------
  # * Draw Play Time
  #--------------------------------------------------------------------------
  def draw_playtime(x, y, width, align)
    draw_currency_value(value, currency_unit, 4, 0, contents.width - 8)
    header = DataManager.load_header(@file_index)
    return unless header
  end
  #--------------------------------------------------------------------------
  # * Get Party Playtime
  #--------------------------------------------------------------------------
  def value
    $game_timer
  end
  #--------------------------------------------------------------------------
  # Get Currency Unit
  #--------------------------------------------------------------------------
  def currency_unit
    Vocab::playtime_unit
  end
  #--------------------------------------------------------------------------
  # * Open Window
  #--------------------------------------------------------------------------
  def open
    refresh
    super
  end
end


When I run the game and open the menus... it's just an empty window. Idk wut i did rong

[spoiler][/spoiler]

maybe u no wut is rong w/it
&&&&&&&&&&&&&&&&

D&P3

it's your refresh method.
You're telling it to clear the window, but not to draw anything afterwards which leaves it empty. :)
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

&&&&&&&&&&&&&

Times like this make me wonder, what the hell am I even doing here?
I don't know what I'm doing. I'm not a scientician.

Anyway, this is what I have... and it's still not doing anything. ;___;

I think this is the point where I put the keyboard down and walk away.

#==============================================================================
# ** Window_Playtime
#------------------------------------------------------------------------------
#  This window displays the party's playtime.
#==============================================================================

class Window_Playtime < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, window_width, fitting_height(1))
    refresh
  end
  #--------------------------------------------------------------------------
  # * Get Window Width
  #--------------------------------------------------------------------------
  def window_width
    return 160
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
    def refresh
    contents.clear
    change_color(normal_color)
    draw_playtime(0, contents.height - line_height, contents.width - 4, 2)
  end
  #--------------------------------------------------------------------------
  # * Draw Play Time
  #--------------------------------------------------------------------------
  def draw_playtime(x, y, width, align)
    header = DataManager.load_header(@file_index)
    return unless header
    draw_text(x, y, width, line_height, header[:playtime_s], 2)
  end
  #--------------------------------------------------------------------------
  # * Get Party Playtime
  #--------------------------------------------------------------------------
  def value
    $game_timer
  end
  #--------------------------------------------------------------------------
  # Get Currency Unit
  #--------------------------------------------------------------------------
  def play_time
    Vocab::playtime_unit
  end
  #--------------------------------------------------------------------------
  # * Open Window
  #--------------------------------------------------------------------------
  def open
    refresh
    super
  end
end
&&&&&&&&&&&&&&&&

D&P3

Well, just a guess but I believe the issue is caused with your draw_playtime method.
You tell it not to draw anything when there is no header.
You should have it draw something if that's not the case regardless.


  #--------------------------------------------------------------------------
  # * Draw Play Time
  #--------------------------------------------------------------------------
  def draw_playtime(x, y, width, align)
    header = DataManager.load_header(@file_index)
    if header
      draw_text(x, y, width, line_height, header[:playtime_s], 2)
    else
      draw_text(x, y, width, line_height, "Fucked if I know?!", 2)
    end
  end
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3