Notice: fwrite(): Write of 44 bytes failed with errno=28 No space left on device in /home/rmrk/domains/rmrk.net/public_html/Sources/Cache/APIs/FileBased.php on line 96
[Request] Display Day, Month and Date of variable on screen - Page 2
Main Menu
  • Welcome to The RPG Maker Resource Kit.

[Request] Display Day, Month and Date of variable on screen

Started by Palsa, August 08, 2010, 11:24:38 PM

0 Members and 2 Guests are viewing this topic.

TDS

I've been watching this request for some days now.

I usually make most requests in requests forums to keep my skills good, and I've had this request done for a while now.

If the person who took it on doesnt mind, I could give you my version of it.

Mitsarugi


TDS

Here it is then.


#------------------------------------------------------------------------------
# * Constants
#------------------------------------------------------------------------------
  # Initial X Position
  INITIAL_X_POSTION = 290
  # Initial Y Position
  INITIAL_Y_POSTION = 0
  # Font names for display
  FONT_NAME = ["Tahoma", "Arial"]
  # Font size for display
  FONT_SIZE = 22
  # Month Vriable ID
  MONTH_VARIABLE = 273
  # Date information hash 
  DATE_MONTH_INFORMATION = {
  # Month ID => [Month name, Days Variable ID]
  1 =>  [ "January",   261],
  2 =>  [ "February",  262],
  3 =>  [ "March",     263],
  4 =>  [ "April",     264],
  5 =>  [ "May",       265],
  6 =>  [ "June",      266],
  7 =>  [ "July",      267],
  8 =>  [ "August",    268], 
  9 =>  [ "September", 269], 
  10 => [ "October",   270], 
  11 => [ "November",  271], 
  12 => [ "December",  272],   
  }
  # Day Variable ID
  DAY_VARIABLE = 274
  # Date day information
  DATE_DAY_INFORMATION = {
  1 => "Sunday", 
  2 => "Monday",
  3 => "Tuesday", 
  4 => "Wednesday",
  5 => "Thursday",
  6 => "Friday", 
  7 => "Saturday",
  } 


#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
#  An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================

class Game_Interpreter 
  #--------------------------------------------------------------------------
  # * Set Display Date Position
  #     x : New display X coordinate
  #     y : New display Y coordinate
  #--------------------------------------------------------------------------
  def set_display_date_position(x, y)     
    # Set Date Display Positions
    $game_map.date_display_x, $game_map.date_display_y = x, y
    # Update Date Display
    update_date_display         
  end     
  #--------------------------------------------------------------------------
  # * Enable Date Display
  #--------------------------------------------------------------------------
  def enable_date_display
    # Set Date Display Visibility to true
    $game_map.date_display_visible = true
    # Update Date Display
    update_date_display     
  end   
  #--------------------------------------------------------------------------
  # * Disable Date Display
  #--------------------------------------------------------------------------
  def disable_date_display
    # Set Date Display Visibility to false
    $game_map.date_display_visible = false
    # Update Date Display
    update_date_display     
  end 
  #--------------------------------------------------------------------------
  # * Update Date Display
  #--------------------------------------------------------------------------
  def update_date_display     
    # Return if not on scene map
    return if !$scene.is_a?(Scene_Map)
    # Update Date Display
    $scene.update_date_display
  end 
end

#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
#  This class handles maps. It includes scrolling and passage determination
# functions. The instance of this class is referenced by $game_map.
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :date_display_x           # date display X position
  attr_accessor :date_display_y           # date display Y position
  attr_accessor :date_display_visible     # date display visibility flag
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias tds_date_display_game_map_initialize initialize
  def initialize
    tds_date_display_game_map_initialize
    @date_display_x = INITIAL_X_POSTION
    @date_display_y = INITIAL_Y_POSTION
    @date_display_visible = true
  end 
  #--------------------------------------------------------------------------
  # * Get Day of the Week Date Display
  #--------------------------------------------------------------------------
  def get_day_name_date_display   
    # Get Day Name
    day = DATE_DAY_INFORMATION[$game_variables[DAY_VARIABLE]]
    return day == nil ? "" : day
  end 
  #--------------------------------------------------------------------------
  # * Get Day Number Date Display
  #--------------------------------------------------------------------------
  def get_day_number_date_display   
    # Get Day Number
    var = DATE_MONTH_INFORMATION[$game_variables[MONTH_VARIABLE]]
    day = var == nil ? nil : $game_variables[var[1]]       
    return day == nil ? "" : day
  end   
  #--------------------------------------------------------------------------
  # * Get Day of the Week Date Display
  #--------------------------------------------------------------------------
  def get_month_date_display
    # Get Month Name
    month = DATE_MONTH_INFORMATION[$game_variables[MONTH_VARIABLE]]
    return month == nil ? "" : month[0]
  end 
end


#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs the map screen processing.
#==============================================================================

class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  alias tds_date_display_scene_map_start start
  def start
    tds_date_display_scene_map_start       
    # Create Date Display Sprite
    @date_display = Sprite.new
    @date_display.bitmap = Bitmap.new(200, 200)   
    # Update Date Display
    update_date_display
  end
  #--------------------------------------------------------------------------
  # * Update Date Display
  #--------------------------------------------------------------------------
  def update_date_display
    # Set visibility
    @date_display.visible = $game_map.date_display_visible
    # Set display positions
    @date_display.x, @date_display.y = $game_map.date_display_x, $game_map.date_display_y
    # Set Display Font   
    @date_display.bitmap.font.name = FONT_NAME
    # Set Display font size
    @date_display.bitmap.font.size = FONT_SIZE   
    # Clear Bitmap Contents
    @date_display.bitmap.clear
    # Draw Weekday
    @date_display.bitmap.draw_text(0, 0, 190, FONT_SIZE + 6, $game_map.get_day_name_date_display, 1)
    # Text for date display
    text = sprintf("%s %s", $game_map.get_month_date_display, $game_map.get_day_number_date_display)   
    # Draw Month
    @date_display.bitmap.draw_text(0, 28, 190, FONT_SIZE + 6, text, 1)
  end 
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  alias tds_date_display_scene_map_terminate terminate
  def terminate
    tds_date_display_scene_map_terminate
    # Dispose of date display sprite and bitmap
    @date_display.bitmap.dispose
    @date_display.dispose
  end 
end


Since it's a time system that was made with event, I decided to make it as simple as possible with basic commands such as disable, enable and update.

To disable and enable the date display, use this in a call script:

Disable:

disable_date_display


Enable:

enable_date_display


To update the contents of the date display use this in a call script.


update_date_display


To set the position of the date display use this in a call script.


set_display_date_position(X, Y)


X and Y are the positions on the screen.

Example:


set_display_date_position(300, 100)


Let me know if it works for you or want anything changed and have a nice day.

Palsa

Awesome, it works very well! ^_^
[spoiler]


[/spoiler]
There's just one thing I forgot to mention, I'm using Yanfly's Common Event Menu script for the world map, and the day and month seems to disappear when the menu is called up:
[spoiler][/spoiler]
Would it be possible to add a switch function that would disable it from disappearing while other menu's are up?

TDS

It's not that it disappears.

The display date is a sprite that's added to the scene map to display information.

To make it work with other scripts it has to be added onto those scripts.

If you provide the script I will add it into it.

Palsa

Quote from: Zanaziel on August 21, 2010, 09:12:38 PM
It's not that it disappears.

The display date is a sprite that's added to the scene map to display information.

To make it work with other scripts it has to be added onto those scripts.

If you provide the script I will add it into it.

K, here's the script:

[spoiler]
#===============================================================================
#
# Yanfly Engine RD - Common Event Menu
# Last Date Updated: 2009.06.12
# Level: Normal, Hard
#
# Similar to the Common Event Shop, the Common Event Menu lets you create your
# menus to list various common event options. Now, you don't have to use all of
# those obnoxiously tedious Show Choice branches and conditional branches just
# to let the player get somewhere in range.
#
# This script lets you create your own generated common event menus with ease.
# Set the style of the menu, the nature of the menu, and the contents of the
# menu. Afterwards, set the switches (if required) for the common events to
# even appear, any pictures to go along with it, and descriptions on what the
# common event can do for the player.
#
#===============================================================================
# Updates:
# ----------------------------------------------------------------------------
# o 2009.06.12 - Finished script.
# o 2009.06.11 - Started script.
#===============================================================================
# Instructions
#===============================================================================
#
# First, bind CE_MENU_VARIABLE to the variable you wish to launch common event
# menus with.
#
# Scroll down and edit the CE_MENU_HASH. This will reflect what common events
# appear in those menus, the style of the menu, and the title associated with
# the menu.
#
# Scroll down and edit the CE_MENU_ITEMS. This will determine how common events
# can be shown, what switches they require, and if it will display any pictures
# along with it.
#
# Then, to launch the menu, just change the CE_MENU_VARIABLE variable to the
# menu ID you want to launch. Simple as that.
#
#===============================================================================
# Style Names
# "General" - A very normal kind of menu.
# "Compact" - A smaller version of the General style.
# "Double"  - Displays two columns for the menu.
# "Bottom"  - Aligns the choices at the bottom of the screen.
# "Lefty"   - Aligns the choices to the left side of the screen.
# "Righty"  - Aligns the choices to the right side of the screen.
# "Gimmick" - A pretty gimmicky style.
#===============================================================================
#
# Compatibility
# - Alias: Game_Interpreter: command_122
#
#===============================================================================

$imported = {} if $imported == nil
$imported["CommonEventMenu"] = true

module YE
  module EVENT
   
    # This is the variable that triggers the kind of shop you want to open.
    CE_MENU_VARIABLE = 70
   
    #-------------------------------------------------------------------------
    # Use the following hash to determine what common events you can launch
    # from that menu ID. You can set the style, whether or not the player can
    # cancel out of the menu, and the title of the menu. Of course, you also
    # set what common events can be launched from this menu, too.
    #
    # Style Name - Style name used. Look in the instructions to view styles.
    # Cancel     - Can the player cancel out of the menu?
    # Title      - Title used for the menu.
    # [Array]    - Common events allowed to be choosen in the menu.
    #-------------------------------------------------------------------------
    CE_MENU_HASH ={ # Follow the example.
    # MenuID => [ Style Name, Cancel, Title
           1 => [  "Map Screen",   false, "World Map",
                [11, 25, 13, 14, 32, 15, 33, 24, 39, 40, 35, 36, 37, 38, 34, 26, 27, 28, 29, 30, 31,]
                ], # The above array lists the common events selectable.
               
           2 => [  "Synthesis",   true, "Item Synthesis",
                [1, 2, 3, 4, 5, 6, 7, 8]
                ], # The above array lists the common events selectable.
               
           3 => [  "Double",   true, "Double the columns!",
                [15, 16, 17]
                ], # The above array lists the common events selectable.
    } # Do not remove this.
   
    #-------------------------------------------------------------------------
    # Use the following hash to determine how you want your common events to
    # appear. To hide some items, set a switch number to the value shown. To
    # display a picture along with the common event, include the picture name.
    # To change the font size used, set the size. And finally, you can adjust
    # the description given to the common event to be launched.
    #
    # Switch  - Switch required to be on for it to appear. nil for no switch.
    # Picture - Picture shown in the display window. nil for no picture shown.
    # Size    - Font size used for the display window.
    # Descrip - Description used for event. Use | to create a new line.
    #-------------------------------------------------------------------------
    CE_MENU_ITEMS ={ # Follow the example.
    # ItemID => [Switch,  Picture, Size, Description]
           1 => [   nil, "Items1",   16, "Items"],
           2 => [   nil, "Materials1",   16, "Materials"],
           3 => [   nil, "Ingredients1",   16, "Ingredients"],
           4 => [   nil, "Garments1",   16, "Garments"],
           5 => [   nil, "Weapons1",   16, "Weapons"],
           6 => [   nil, "Accessories1",   16, "Accessories"],
           7 => [   nil, "Special1",   16, "Special"],
           8 => [   nil, "Recipes1",   16, "Recipes"],
           11 => [   nil, "LN-Elirica Atelier",   16, "Elirica's Atelier"],
           25 => [   nil, "LN-Brume Forest",   16, "Brume Forest"],
           13 => [   nil, "LN-Ceresburg",   16, "Ceresburg"],
           14 => [   nil, "LN-Galetown",   16, "Galetown"],
           15 => [   nil, "LN-Chiharu Village",   16, "Chiharu Village"],
           24 => [   nil, "LN-Larisa Landing",   16, "Larisa Landing"],
           32 => [   nil, "LN-Alvina Village",   16, "Alvina Village"],
           33 => [   nil, "LN-Elf Village",   16, "Elf Village"],
           34 => [   185, "LN-Puni Caravan",   16, "Puni Caravan"],
           35 => [   nil, "LN-Tamarind Beach",   16, "Tamarind Beach"],
           36 => [   nil, "LN-Old Mine",   16, "Old Mine"],
           37 => [   nil, "LN-Amaterasu Highlands",   16, "Amaterasu Highlands"],
           38 => [   nil, "LN-Ornella Marsh",   16, "Ornella Marsh"],
           26 => [   nil, "LN-Air Mana",   16, "Air Mana Shrine"],
           27 => [   nil, "LN-Earth Mana",   16, "Earth Mana Shrine"],
           28 => [   nil, "LN-Water Mana",   16, "Water Mana Shrine"],
           29 => [   nil, "LN-Fire Mana",   16, "Fire Mana Shrine"],
           30 => [   nil, "LN-Light Mana",   16, "Light Mana Shrine"],
           31 => [   nil, "LN-Darkness Mana",   16, "Darkness Mana Shrine"],
           39 => [   nil, "LN-Ernesta Colosseum",   16, "Ernesta Colosseum"],
           40 => [   nil, "LN-Azazel Tower",   16, "Azazel Tower"],
    } # Do not remove this.
   
  end # EVENT
end # YE

#===============================================================================
# Editting anything past this point may potentially result in causing computer
# damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
# Therefore, edit at your own risk.
#===============================================================================

#===============================================================================
# Game_Interpreter
#===============================================================================

class Game_Interpreter

  #--------------------------------------------------------------------------
  # alias control variables
  #--------------------------------------------------------------------------
  alias command_122_cemenu command_122 unless $@
  def command_122
    n = command_122_cemenu
    if @params[0] == YE::EVENT::CE_MENU_VARIABLE and !$game_temp.in_battle and
    $game_variables[YE::EVENT::CE_MENU_VARIABLE] != 0
      $scene = Scene_Common_Event_Menu.new
    end
    return n
  end
 
end # Game_Interpreter

#===============================================================================
# Scene_Common_Event_Menu
#===============================================================================

class Scene_Common_Event_Menu < Scene_Base
 
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize
    menu_id = $game_variables[YE::EVENT::CE_MENU_VARIABLE]
    @style  = YE::EVENT::CE_MENU_HASH[menu_id][0]
    @cancel = YE::EVENT::CE_MENU_HASH[menu_id][1]
    @title  = YE::EVENT::CE_MENU_HASH[menu_id][2]
    @items  = YE::EVENT::CE_MENU_HASH[menu_id][3]
  end
 
  #--------------------------------------------------------------------------
  # start
  #--------------------------------------------------------------------------
  def start
    super
    @spriteset = Spriteset_Map.new
    create_windows
    refresh_display
  end
 
  #--------------------------------------------------------------------------
  # create_windows
  #--------------------------------------------------------------------------
  def create_windows
    #---
    if @style == "General" # General Style
      @title_window = Window_Base.new(0, 0, 544, 56)
      @title_window.contents.draw_text(4, 0, 504, 24, @title, 1)
      @command_width = 272
      @columns = 1
      create_command_window
      @command_window.x = 0
      @command_window.y = 56
      @command_window.height = 360
      @display_window = Window_Event_Display.new(272, 56, 272, 360, "tall")
      return
    end
    #---
    if @style == "Compact" # Compact Style
      @title_window = Window_Base.new(48, 48, 448, 56)
      @title_window.contents.draw_text(4, 0, 408, 24, @title, 1)
      @command_width = 224
      @columns = 1
      create_command_window
      @command_window.x = 48
      @command_window.y = 104
      @command_window.height = 264
      @display_window = Window_Event_Display.new(272, 104, 224, 264, "tall")
      return
    end
    #---
    if @style == "Double" # Double Style
      @title_window = Window_Base.new(0, 0, 544, 56)
      @title_window.contents.draw_text(4, 0, 504, 24, @title, 1)
      @command_width = Graphics.width
      @columns = 2
      create_command_window
      @command_window.x = 0
      @command_window.y = 56
      @command_window.height = 232
      @display_window = Window_Event_Display.new(0, 288, 544, 128, "wide")
      return
    end
    #---
    if @style == "Bottom" # Bottom Style
      @title_window = Window_Base.new(0, 0, Graphics.width, 56)
      @title_window.contents.draw_text(4, 0, Graphics.width-40, 24, @title, 1)
      @command_width = Graphics.width
      @columns = 2
      create_command_window
      @command_window.x = 0
      @command_window.y = Graphics.height - 128
      @command_window.height = 128
      return
    end
    #---
    if @style == "Lefty" # Lefty Style
      @title_window = Window_Base.new(0, 0, 200, 56)
      @title_window.contents.draw_text(4, 0, 160, 24, @title, 1)
      @command_width = 200
      @columns = 1
      create_command_window
      @command_window.x = 0
      @command_window.y = 56
      @command_window.height = Graphics.height - 56 - 128
      @display_window = Window_Event_Display.new(0, 288, 200, 128, "no text")
      return
    end
    #---
    if @style == "Righty" # Righty Style
      @title_window = Window_Base.new(344, 0, 200, 56)
      @title_window.contents.draw_text(4, 0, 160, 24, @title, 1)
      @command_width = 200
      @columns = 1
      create_command_window
      @command_window.x = 344
      @command_window.y = 56
      @command_window.height = Graphics.height - 56 - 128
      @display_window = Window_Event_Display.new(344, 288, 200, 128, "no text")
      return
    end
    #---
    if @style == "Gimmick" # Compact Style
      @title_window = Window_Base.new(48, 48, 448, 56)
      @title_window.contents.draw_text(4, 0, 408, 24, @title, 1)
      @dummy_window = Window_Base.new(48, 104, 448, 264)
      @command_width = 224
      @columns = 1
      create_command_window
      @command_window.x = 48
      @command_window.y = 104
      @command_window.height = 264
      @display_window = Window_Event_Display.new(272, 104, 224, 264, "tall")
      @command_window.opacity = 0
      @display_window.opacity = 0
      return
    end
   #---
    if @style == "Town" # Town Style
      @title_window = Window_Base.new(0, 0, Graphics.width, 56)
      @title_window.contents.draw_text(4, 0, Graphics.width-40, 24, @title, 1)
      @command_width = Graphics.width
      @columns = 2
      create_command_window
      @command_window.x = 0
      @command_window.y = Graphics.height - 108
      @command_window.height = 108
      return
    end
   #---
    if @style == "Synthesis" # Synthesis Menu
      @title_window = Window_Base.new(0, 0, 544, 56)
      @title_window.contents.draw_text(4, 0, 504, 24, @title, 1)
      @dummy_window = Window_Base.new(0, 56, 544, 80)
      @dummy_window_2 = Window_Base.new(0, 136, 384, 280)
      @dummy_window_3 = Window_Base.new(384, 136, 160, 140)
      @dummy_window_4 = Window_Base.new(384, 276, 160, 140)
      @command_width = 500
      @columns = 4
      create_command_window
      @command_window.x = 16
      @command_window.y = 56
      @command_window.height = 264
      @display_window = Window_Event_Display.new(416, 148, 324, 364, "tall")
      @command_window.opacity = 0
      @display_window.opacity = 0
      return
    end
    #---
    if @style == "Map Screen" # Map Screen
      @title_window = Window_Base.new(0, 0, 200, 56)
      @title_window.contents.draw_text(4, 0, 160, 24, @title, 1)
      @command_width = 200
      @columns = 1
      create_command_window
      @command_window.x = 0
      @command_window.y = 56
      @command_window.height = Graphics.height - 56 - 0
      @display_window = Window_Event_Display.new(184, -22, 376, 454, "no text")
      @display_window.opacity = 0
      return
    end
  end
 
  #--------------------------------------------------------------------------
  # create_command_window
  #--------------------------------------------------------------------------
  def create_command_window
    commands = []
    @data = []
    for item_id in @items
      next unless YE::EVENT::CE_MENU_ITEMS.include?(item_id)
      next if YE::EVENT::CE_MENU_ITEMS[item_id][0] != nil and
      !$game_switches[YE::EVENT::CE_MENU_ITEMS[item_id][0]]
      item_name = $data_common_events[item_id].name
      commands.push(item_name)
      @data.push(item_id)
    end
    @command_window = Window_Command.new(@command_width, commands, @columns)
    @last_id = commands.size + 1
  end
 
  #--------------------------------------------------------------------------
  # terminate
  #--------------------------------------------------------------------------
  def terminate
    super
    @spriteset.dispose
    @title_window.dispose if @title_window != nil
    @command_window.dispose if @command_window != nil
    @display_window.dispose if @display_window != nil
    @dummy_window.dispose if @dummy_window != nil
    @dummy_window_2.dispose if @dummy_window_2 != nil
    @dummy_window_3.dispose if @dummy_window_3 != nil
    @dummy_window_4.dispose if @dummy_window_4 != nil
  end
 
  #--------------------------------------------------------------------------
  # update
  #--------------------------------------------------------------------------
  def update
    super
    @spriteset.update
    $game_map.update
    update_input
  end
 
  #--------------------------------------------------------------------------
  # update_input
  #--------------------------------------------------------------------------
  def update_input
    @command_window.update
    if @last_id != @command_window.index
      @last_id = @command_window.index
      refresh_display
    end
    if Input.trigger?(Input::B) and @cancel
      Sound.play_cancel
      $game_variables[YE::EVENT::CE_MENU_VARIABLE] = 0
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      if @data == []
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      $game_temp.common_event_id = @data[@command_window.index]
      $game_variables[YE::EVENT::CE_MENU_VARIABLE] = 0
      $scene = Scene_Map.new
    end
  end
 
  #--------------------------------------------------------------------------
  # refresh_display
  #--------------------------------------------------------------------------
  def refresh_display
    return if @display_window == nil
    @display_window.refresh(@data[@command_window.index])
  end
 
end # Scene_Common_Event_Menu

#===============================================================================
# Window_Event_Display
#===============================================================================

class Window_Event_Display < Window_Base
 
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(x, y, w, h, type = "tall")
    super(x, y, w, h)
    @type = type
    menu_id = $game_variables[YE::EVENT::CE_MENU_VARIABLE]
    first_item = YE::EVENT::CE_MENU_VARIABLE[menu_id]
  end
 
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh(id = nil)
    self.contents.clear
    return if id == nil
    return unless YE::EVENT::CE_MENU_ITEMS.include?(id)
    txsize = YE::EVENT::CE_MENU_ITEMS[id][2]
    self.contents.font.size = txsize
    if YE::EVENT::CE_MENU_ITEMS[id][1] != nil # Draw a picture.
      name = YE::EVENT::CE_MENU_ITEMS[id][1]
      bitmap = Cache.picture(name)
      rect = Rect.new(0, 0, bitmap.width, bitmap.height)
      self.contents.blt(0, 6, bitmap, rect)
      if @type == "tall"
        dy = bitmap.height + (txsize / 2)
        dx = 0
      elsif @type == "wide"
        dx = bitmap.width + (txsize / 2)
        dy = 0
      end
      bitmap.dispose
    else
      dy = 0
      dx = 0
    end
    return if @type == "no text"
    text = YE::EVENT::CE_MENU_ITEMS[id][3]
    nwidth = Graphics.width
    buf = text.gsub(/\\N(\[\d+\])/i) { "\\__#{$1}" }
    lines = buf.split(/(?:[|]|\\n)/i)
    lines.each_with_index { |l, i|
      l.gsub!(/\\__(\[\d+\])/i) { "\\N#{$1}" }
      self.contents.draw_text(dx, i * txsize + dy, nwidth, WLH, l, 0) }
  end
 
end # Window_Event_Display

#===============================================================================
#
# END OF FILE
#
#===============================================================================


[/spoiler]

[Edit]

Oop's, wrong script, fixed.

TDS

The script you provided was not really any use at all, since it's configured to your game and resources.

Next time please provide a script that can work without your resources.

I did the edit by aliasing methods, so in theory  it should work even though I could not test it.

Replace your other script with this one and place it below the one you provided.


#------------------------------------------------------------------------------
# * Constants
#------------------------------------------------------------------------------
  # Initial X Position
  INITIAL_X_POSTION = 290
  # Initial Y Position
  INITIAL_Y_POSTION = 0
  # Font names for display
  FONT_NAME = ["Tahoma", "Arial"]
  # Font size for display
  FONT_SIZE = 22
  # Month Vriable ID
  MONTH_VARIABLE = 273
  # Date information hash
  DATE_MONTH_INFORMATION = {
  # Month ID => [Month name, Days Variable ID]
  1 =>  [ "January",   261],
  2 =>  [ "February",  262],
  3 =>  [ "March",     263],
  4 =>  [ "April",     264],
  5 =>  [ "May",       265],
  6 =>  [ "June",      266],
  7 =>  [ "July",      267],
  8 =>  [ "August",    268],
  9 =>  [ "September", 269],
  10 => [ "October",   270],
  11 => [ "November",  271],
  12 => [ "December",  272],   
  }
  # Day Variable ID
  DAY_VARIABLE = 274
  # Date day information
  DATE_DAY_INFORMATION = {
  1 => "Sunday",
  2 => "Monday",
  3 => "Tuesday",
  4 => "Wednesday",
  5 => "Thursday",
  6 => "Friday",
  7 => "Saturday",
  }


#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
#  An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================

class Game_Interpreter
  #--------------------------------------------------------------------------
  # * Set Display Date Position
  #     x : New display X coordinate
  #     y : New display Y coordinate
  #--------------------------------------------------------------------------
  def set_display_date_position(x, y)     
    # Set Date Display Positions
    $game_map.date_display_x, $game_map.date_display_y = x, y
    # Update Date Display
    update_date_display         
  end     
  #--------------------------------------------------------------------------
  # * Enable Date Display
  #--------------------------------------------------------------------------
  def enable_date_display
    # Set Date Display Visibility to true
    $game_map.date_display_visible = true
    # Update Date Display
    update_date_display     
  end   
  #--------------------------------------------------------------------------
  # * Disable Date Display
  #--------------------------------------------------------------------------
  def disable_date_display
    # Set Date Display Visibility to false
    $game_map.date_display_visible = false
    # Update Date Display
    update_date_display     
  end
  #--------------------------------------------------------------------------
  # * Update Date Display
  #--------------------------------------------------------------------------
  def update_date_display     
    # Return if not on scene map
    return if !$scene.is_a?(Scene_Map) or !$scene.is_a?(Scene_Common_Event_Menu)
    # Update Date Display
    $scene.update_date_display
  end
end

#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
#  This class handles maps. It includes scrolling and passage determination
# functions. The instance of this class is referenced by $game_map.
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :date_display_x           # date display X position
  attr_accessor :date_display_y           # date display Y position
  attr_accessor :date_display_visible     # date display visibility flag
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias tds_date_display_game_map_initialize initialize
  def initialize
    tds_date_display_game_map_initialize
    @date_display_x = INITIAL_X_POSTION
    @date_display_y = INITIAL_Y_POSTION
    @date_display_visible = true
  end
  #--------------------------------------------------------------------------
  # * Get Day of the Week Date Display
  #--------------------------------------------------------------------------
  def get_day_name_date_display   
    # Get Day Name
    day = DATE_DAY_INFORMATION[$game_variables[DAY_VARIABLE]]
    return day == nil ? "" : day
  end
  #--------------------------------------------------------------------------
  # * Get Day Number Date Display
  #--------------------------------------------------------------------------
  def get_day_number_date_display   
    # Get Day Number
    var = DATE_MONTH_INFORMATION[$game_variables[MONTH_VARIABLE]]
    day = var == nil ? nil : $game_variables[var[1]]       
    return day == nil ? "" : day
  end   
  #--------------------------------------------------------------------------
  # * Get Day of the Week Date Display
  #--------------------------------------------------------------------------
  def get_month_date_display
    # Get Month Name
    month = DATE_MONTH_INFORMATION[$game_variables[MONTH_VARIABLE]]
    return month == nil ? "" : month[0]
  end
end


#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs the map screen processing.
#==============================================================================

class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  alias tds_date_display_scene_map_start start
  def start
    tds_date_display_scene_map_start       
    # Create Date Display Sprite
    @date_display = Sprite.new
    @date_display.bitmap = Bitmap.new(200, 200)   
    # Update Date Display
    update_date_display
  end
  #--------------------------------------------------------------------------
  # * Update Date Display
  #--------------------------------------------------------------------------
  def update_date_display
    # Set visibility
    @date_display.visible = $game_map.date_display_visible
    # Set display positions
    @date_display.x, @date_display.y = $game_map.date_display_x, $game_map.date_display_y
    # Set Display Font   
    @date_display.bitmap.font.name = FONT_NAME
    # Set Display font size
    @date_display.bitmap.font.size = FONT_SIZE   
    # Clear Bitmap Contents
    @date_display.bitmap.clear
    # Draw Weekday
    @date_display.bitmap.draw_text(0, 0, 190, FONT_SIZE + 6, $game_map.get_day_name_date_display, 1)
    # Text for date display
    text = sprintf("%s %s", $game_map.get_month_date_display, $game_map.get_day_number_date_display)   
    # Draw Month
    @date_display.bitmap.draw_text(0, 28, 190, FONT_SIZE + 6, text, 1)
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  alias tds_date_display_scene_map_terminate terminate
  def terminate
    tds_date_display_scene_map_terminate
    # Dispose of date display sprite and bitmap
    @date_display.bitmap.dispose
    @date_display.dispose
  end
end

#===============================================================================
# Scene_Common_Event_Menu
#===============================================================================

class Scene_Common_Event_Menu < Scene_Base
  #--------------------------------------------------------------------------
  # start
  #-------------------------------------------------------------------------
  alias tds_date_display_scene_common_event_menu_start start
  def start
    tds_date_display_scene_common_event_menu_start
    # Create Date Display Sprite
    @date_display = Sprite.new
    @date_display.bitmap = Bitmap.new(200, 200)   
    # Update Date Display
    update_date_display   
  end
  #--------------------------------------------------------------------------
  # * Update Date Display
  #--------------------------------------------------------------------------
  def update_date_display
    # Set visibility
    @date_display.visible = $game_map.date_display_visible
    # Set display positions
    @date_display.x, @date_display.y = $game_map.date_display_x, $game_map.date_display_y
    # Set Display Font   
    @date_display.bitmap.font.name = FONT_NAME
    # Set Display font size
    @date_display.bitmap.font.size = FONT_SIZE   
    # Clear Bitmap Contents
    @date_display.bitmap.clear
    # Draw Weekday
    @date_display.bitmap.draw_text(0, 0, 190, FONT_SIZE + 6, $game_map.get_day_name_date_display, 1)
    # Text for date display
    text = sprintf("%s %s", $game_map.get_month_date_display, $game_map.get_day_number_date_display)   
    # Draw Month
    @date_display.bitmap.draw_text(0, 28, 190, FONT_SIZE + 6, text, 1)
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  alias tds_date_display_scene_common_event_menu_terminate terminate
  def terminate
    tds_date_display_scene_common_event_menu_terminate
    # Dispose of date display sprite and bitmap
    @date_display.bitmap.dispose
    @date_display.dispose
  end
end

Palsa

Thanks, it's appearing now, and sorry about that.
[spoiler][/spoiler]
But now, none of the script commands are working.
When I use the script command 'enable_date_display', it only appears after the common event menu has displayed, and the script commands for disabling, changing position and updating don't seem to work anymore.

TDS

This should fix it.


#------------------------------------------------------------------------------
# * Constants
#------------------------------------------------------------------------------
  # Initial X Position
  INITIAL_X_POSTION = 290
  # Initial Y Position
  INITIAL_Y_POSTION = 0
  # Font names for display
  FONT_NAME = ["Tahoma", "Arial"]
  # Font size for display
  FONT_SIZE = 22
  # Month Vriable ID
  MONTH_VARIABLE = 273
  # Date information hash
  DATE_MONTH_INFORMATION = {
  # Month ID => [Month name, Days Variable ID]
  1 =>  [ "January",   261],
  2 =>  [ "February",  262],
  3 =>  [ "March",     263],
  4 =>  [ "April",     264],
  5 =>  [ "May",       265],
  6 =>  [ "June",      266],
  7 =>  [ "July",      267],
  8 =>  [ "August",    268],
  9 =>  [ "September", 269],
  10 => [ "October",   270],
  11 => [ "November",  271],
  12 => [ "December",  272],   
  }
  # Day Variable ID
  DAY_VARIABLE = 274
  # Date day information
  DATE_DAY_INFORMATION = {
  1 => "Sunday",
  2 => "Monday",
  3 => "Tuesday",
  4 => "Wednesday",
  5 => "Thursday",
  6 => "Friday",
  7 => "Saturday",
  }


#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
#  An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================

class Game_Interpreter
  #--------------------------------------------------------------------------
  # * Set Display Date Position
  #     x : New display X coordinate
  #     y : New display Y coordinate
  #--------------------------------------------------------------------------
  def set_display_date_position(x, y)     
    # Set Date Display Positions
    $game_map.date_display_x, $game_map.date_display_y = x, y
    # Update Date Display
    update_date_display         
  end     
  #--------------------------------------------------------------------------
  # * Enable Date Display
  #--------------------------------------------------------------------------
  def enable_date_display
    # Set Date Display Visibility to true
    $game_map.date_display_visible = true
    # Update Date Display
    update_date_display     
  end   
  #--------------------------------------------------------------------------
  # * Disable Date Display
  #--------------------------------------------------------------------------
  def disable_date_display
    # Set Date Display Visibility to false
    $game_map.date_display_visible = false
    # Update Date Display
    update_date_display     
  end
  #--------------------------------------------------------------------------
  # * Update Date Display
  #--------------------------------------------------------------------------
  def update_date_display     
    # Return if not on scene map or scene common event menu
     if $scene.is_a?(Scene_Map) or $scene.is_a?(Scene_Common_Event_Menu)
       # Update Date Display
       $scene.update_date_display
     end     
  end
end

#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
#  This class handles maps. It includes scrolling and passage determination
# functions. The instance of this class is referenced by $game_map.
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :date_display_x           # date display X position
  attr_accessor :date_display_y           # date display Y position
  attr_accessor :date_display_visible     # date display visibility flag
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias tds_date_display_game_map_initialize initialize
  def initialize
    tds_date_display_game_map_initialize
    @date_display_x = INITIAL_X_POSTION
    @date_display_y = INITIAL_Y_POSTION
    @date_display_visible = true
  end
  #--------------------------------------------------------------------------
  # * Get Day of the Week Date Display
  #--------------------------------------------------------------------------
  def get_day_name_date_display   
    # Get Day Name
    day = DATE_DAY_INFORMATION[$game_variables[DAY_VARIABLE]]
    return day == nil ? "" : day
  end
  #--------------------------------------------------------------------------
  # * Get Day Number Date Display
  #--------------------------------------------------------------------------
  def get_day_number_date_display   
    # Get Day Number
    var = DATE_MONTH_INFORMATION[$game_variables[MONTH_VARIABLE]]
    day = var == nil ? nil : $game_variables[var[1]]       
    return day == nil ? "" : day
  end   
  #--------------------------------------------------------------------------
  # * Get Day of the Week Date Display
  #--------------------------------------------------------------------------
  def get_month_date_display
    # Get Month Name
    month = DATE_MONTH_INFORMATION[$game_variables[MONTH_VARIABLE]]
    return month == nil ? "" : month[0]
  end
end


#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs the map screen processing.
#==============================================================================

class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  alias tds_date_display_scene_map_start start
  def start
    tds_date_display_scene_map_start       
    # Create Date Display Sprite
    @date_display = Sprite.new
    @date_display.bitmap = Bitmap.new(200, 200)   
    # Update Date Display
    update_date_display
  end
  #--------------------------------------------------------------------------
  # * Update Date Display
  #--------------------------------------------------------------------------
  def update_date_display
    # Set visibility
    @date_display.visible = $game_map.date_display_visible
    # Set display positions
    @date_display.x, @date_display.y = $game_map.date_display_x, $game_map.date_display_y
    # Set Display Font   
    @date_display.bitmap.font.name = FONT_NAME
    # Set Display font size
    @date_display.bitmap.font.size = FONT_SIZE   
    # Clear Bitmap Contents
    @date_display.bitmap.clear
    # Draw Weekday
    @date_display.bitmap.draw_text(0, 0, 190, FONT_SIZE + 6, $game_map.get_day_name_date_display, 1)
    # Text for date display
    text = sprintf("%s %s", $game_map.get_month_date_display, $game_map.get_day_number_date_display)   
    # Draw Month
    @date_display.bitmap.draw_text(0, 28, 190, FONT_SIZE + 6, text, 1)
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  alias tds_date_display_scene_map_terminate terminate
  def terminate
    tds_date_display_scene_map_terminate
    # Dispose of date display sprite and bitmap
    @date_display.bitmap.dispose
    @date_display.dispose
  end
end

#===============================================================================
# Scene_Common_Event_Menu
#===============================================================================

class Scene_Common_Event_Menu < Scene_Base
  #--------------------------------------------------------------------------
  # start
  #-------------------------------------------------------------------------
  alias tds_date_display_scene_common_event_menu_start start
  def start
    tds_date_display_scene_common_event_menu_start
    # Create Date Display Sprite
    @date_display = Sprite.new
    @date_display.bitmap = Bitmap.new(200, 200)   
    # Update Date Display
    update_date_display   
  end
  #--------------------------------------------------------------------------
  # * Update Date Display
  #--------------------------------------------------------------------------
  def update_date_display
    # Set visibility
    @date_display.visible = $game_map.date_display_visible
    # Set display positions
    @date_display.x, @date_display.y = $game_map.date_display_x, $game_map.date_display_y
    # Set Display Font   
    @date_display.bitmap.font.name = FONT_NAME
    # Set Display font size
    @date_display.bitmap.font.size = FONT_SIZE   
    # Clear Bitmap Contents
    @date_display.bitmap.clear
    # Draw Weekday
    @date_display.bitmap.draw_text(0, 0, 190, FONT_SIZE + 6, $game_map.get_day_name_date_display, 1)
    # Text for date display
    text = sprintf("%s %s", $game_map.get_month_date_display, $game_map.get_day_number_date_display)   
    # Draw Month
    @date_display.bitmap.draw_text(0, 28, 190, FONT_SIZE + 6, text, 1)
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  alias tds_date_display_scene_common_event_menu_terminate terminate
  def terminate
    tds_date_display_scene_common_event_menu_terminate
    # Dispose of date display sprite and bitmap
    @date_display.bitmap.dispose
    @date_display.dispose
  end
end

Palsa

Awesome, everything is working great now! ^_^
Thank you very much! ^_^

Solomonghull

I'm not sure you said if it does seasons, I don't think so. But would it be difficult add them in? If not I'd be extremely grateful. Thanks!

Sol.

Mitsarugi

Quote from: Solomonghull on April 17, 2012, 08:33:21 PM
I'm not sure you said if it does seasons, I don't think so. But would it be difficult add them in? If not I'd be extremely grateful. Thanks!

Sol.
Sol you might not need it anymore by the time you read this but i have this for you :)
http://www.rpgmakervx.net/index.php?showtopic=43374