Display In Game time in DNS

This script replaces the "Playtime" window with a Time window that displays the ingame time... This is only for people with Near Fantasticas Day and Night script.

All you have to do is replace these lines in your DNS script...
(Line 103 in my copy of Near Fantasticas script)
class Window_Time < Window_Base

#--------------------------------------------------------------------------
def initialize
  super(0, 0, 160, 96)
  self.contents = Bitmap.new(width - 32, height - 32)
  self.contents.font.name = $defaultfonttype  # "Time" window font
  self.contents.font.size = $defaultfontsize
  refresh
end

#--------------------------------------------------------------------------
def refresh
  self.contents.clear
  @total_sec = Graphics.frame_count / Graphics.frame_rate
  @minute=$game_time.get_minute.floor
  hour = $game_time.get_hour
  pm_flag= hour >=12 ? true : false
  hour= hour >= 12 ? hour-12 : hour
  day=$game_time.get_day
  month=$game_time.get_month
  year=$game_time.get_year
  if hour.floor==0
    text=sprintf("%02d:%02d",12,@minute)
  else
    text=sprintf("%02d:%02d",hour,@minute)
  end
  if pm_flag
    text += " PM"
  else
    text += " AM"
  end
  self.contents.font.color = normal_color
  self.contents.draw_text(4, 0, 120, 32, text, 2)
  text = sprintf("%02d-%02d-%02d", month, day, year)
  self.contents.font.color=system_color
  self.contents.draw_text(4,32,120,32,text)
end

#--------------------------------------------------------------------------
def update
  if $game_time.get_minute.floor != @minute
    refresh
  end
end
end # of class
Expand to see the code.


With these lines
class Window_PlayTime < Window_Base

#--------------------------------------------------------------------------
def initialize
  super(0, 0, 160, 96)
  self.contents = Bitmap.new(width - 32, height - 32)
  self.contents.font.name = $fontface  # "Time" window font
  self.contents.font.size = $fontsize
  refresh
end

#--------------------------------------------------------------------------
def refresh
  self.contents.clear
  @total_sec = Graphics.frame_count / Graphics.frame_rate
  @minute=$game_time.get_minute.floor
  hour = $game_time.get_hour
  pm_flag= hour >=12 ? true : false
  hour= hour >= 12 ? hour-12 : hour
  day=$game_time.get_day
  month=$game_time.get_month
  year=$game_time.get_year
  if hour.floor==0
    text=sprintf("%02d:%02d",12,@minute)
  else
    text=sprintf("%02d:%02d",hour,@minute)
  end
  if pm_flag
    text += " PM"
  else
    text += " AM"
  end
  self.contents.font.color = normal_color
  self.contents.draw_text(0, 32, 120, 32, text)
  text = sprintf("%02d-%02d-%02d", month, day, year)
  self.contents.font.color=system_color
  self.contents.draw_text(4,0,120,32,'Time')
end

#--------------------------------------------------------------------------
def update
  if $game_time.get_minute.floor != @minute
    refresh
  end
end
end # of class
Expand to see the code.


To do this easily select the lines (line 103 to 148 for me) and press control and V.

And there you have it!!!
Thanks Dubious. This makes the game more "real".
Hm. Doesn't change anything at all in mine. I'm using the Tales of Symphonia menu system, if that changes things. :-\
I think they have difenrent time windows...
that's why it doesn't work.
Any way I can edit it so it can work? What would I have to customize, here?
Bump!

EDIT: I've figured out how to make it display time in there, but it doesn't update, basically. It just either shows 00:00, or 12:00.. it won't change.
If you post both your editted version of the script and the menu system script i can check it out and see if i can be of any help. My scriptings a bit rusty, i've just found time to get back to the RMXP community recently so....if you still need help i'll see what i can do
Dude, have you seen how old this thread is ? 6 months old, almost 7, I don't think psiclone wants it doing now, or he would keep bumping, Or at least made a request.
Can you post your Edit of the DNS, so I can check it out,
if not I'll see the common event one I got, so I have no more lag :D

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=6738