[XP] Advanced Time and Environment System

Started by fugibo, March 09, 2008, 11:08:36 pm

Previous topic - Next topic

Blizzard

There actually is a RMX-OS plugin. *points to Global DNS for RMX-OS topic*
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

element

Quote from: jragyn00 on February 02, 2010, 05:54:01 am
Could this script be modified in some way to project REAL time into the game, versus implanted 5 minute days, 5 minute nights (or whatever they are set to)?

I currently use a script I butchered and modified for use from VX...for XP!
Spoiler: ShowHide
#==============================================================================
# � Kylock's Time System VX 1.5 MOD V.1.1
#     6.3.2008                 30.5.2009
#------------------------------------------------------------------------------
#  Script by: Kylock
#  MOD by reijubv
#===============================================================================
# Credit mainly goes to Kylock
# and then.  reijubv
# (Cuz I think I deserve something better than just a "thanks"..)
# Have a nice day!
#===============================================================================
# ? Auto-tone Instructions
#------------------------------------------------------------------------------
#    Maps designated as outdoors are the only maps to be affected by this
#  scripts use of auto-toning.  To signify a map to be "outdoors", you must
#  include [KTS] In the name of the map.  For example, you world map could be
#  named "World Map [KTS]" or "[KTS] World Map".  Provisions are made later in
#  the script to remove [KTS] from the map name when it's read by another
#  script.  This means that "[KTS]" won't show up in your Map Name Popup
#  windows.
#==============================================================================
# ? Game Database Setup
#------------------------------------------------------------------------------
#    This script, by defult, uses the following game variables and switches:
#  Database Variables:
#    [1] The Current Time
#    [2] The Current Second
#    [3] The Current Minute
#    [4] The Current Hour
#    [5] The Current Day
#    [6] Name of the Current Day (abbreviated)
#    [7] The Current Day index in one week (0-6) a week starts from sunday
#    [8] The Current Month
#    [9] The Current Month's name (abbreviated)
#    [10]The Current Day Id in this Month (1-32,or 1-30,or 1-29)
#    [11]The Current Year
#    [12]Season's name
#    [13]Weather's Name
#    [14]Weather Id, 0 is clear weather..
#  Database Switches
#    [1] ON during night hours   (2200-0400)(10pm-4am)
#    [2] ON during dawn hours    (0500-0800)( 5am-8am)
#    [3] ON during daytime hours (0900-1800)( 9am-6pm)
#    [4] ON during sunset hours  (1900-2100)( 7pm-9pm)
#    [5] ON during spring season
#    [6] ON during summer season
#    [7] ON during fall season
#    [8] ON during winter season
#==============================================================================

$kylockTIME = true


#==============================================================================
# Stores variables and user defined settings for the time system.
#==============================================================================
module KTS
  #-----------------------------------------------------------------------
  # Settings for Time Periods
  #-----------------------------------------------------------------------
  T1 = [ 0,4 ] # Night         # Sets time periods for tinting effects
  T2 = [ 5,8 ] # Dawn          # [Start Hour, End Hour] for time period
  T3 = [ 9,17] # Day           # Use 24-hour values for time periods
  T4 = [18,21] # Sunset
  T5 = [22,24] # Night         # <- Ex: Night is between 23:00 and 24:00
  #-----------------------------------------------------------------------
  # Settings for Output to Game Variables option.
  #-----------------------------------------------------------------------
  # Set this to true to output the current time to game variables.
  DATABASE_OUTPUT = true 
    # Game Variable to be used for time output.
    TIME    = 12 #(Time in string format. Ex: "2:48 AM" or "02:48")
    SECONDS = 13 # 1 to 59
    MINUTES = 14 # 1 to 59
    HOURS   = 15 # 1 to 24
    DAYS    = 16 # 1 to 366
    DAYNAME = 17 # Sun, Mon, etc..
    WEEKDAY = 18 # 0 to 6 (Day index in one week)
    MONTH   = 20 # 1 to 12
    MONTHNAM= 19 # Jan, Feb, May, etc..
    MONTHDAY= 21# 1 to 31
    YEAR    = 22# 1994, 2009, etc
    SEASON  = 23# Season Name (Spring, Summer, Fall, Winter)
    WEATHERN= 24# Weather's name
    WEATHER = 25# Weather Id, 0 is clear weather
   
    # Game Switches to be used for time output.
    NIGHT   = 55 # This switch is on during night hours   (2200-0400)(10pm-4am)
    DAWN    = 56 # This switch is on during dawn hours    (0500-0800)( 5am-8am)
    DAY     = 57 # This switch is on during daytime hours (0900-1800)( 9am-6pm)
    SUNSET  = 58 # This switch is on during sunset hours  (1900-2100)( 7pm-9pm)

    # Season Switches.
    SPRING  = 59 # This switch is on during spring season
    SUMMER  = 60 # This switch is on during summer season
    FALL    = 61 # This switch is on during fall season
    WINTER  = 62 # This switch is on during winter season
  #-----------------------------------------------------------------------
  # Settings for time controlled screen toning
  #-----------------------------------------------------------------------
  # True will enable screen toning to be used by the script.
  USE_TONE = true
  # Sets the duration of tone changes (in frames)
  FADE_LENGTH = 240
  # Defines tones to be used in the corresponding time periods defined above.
  #              RED, GREEN, BLUE, GREY
  C1 = Tone.new(-187,  -119,  -17,  68)
  C2 = Tone.new(  17,   -51, -102,   0)
  C3 = Tone.new(   0,     0,    0,   0)
  C4 = Tone.new( -68,  -136,  -34,   0)
  C5 = Tone.new(-187,  -119,  -17,  68)
  # Defines anti-tones
  A1 = Tone.new( 187,   119,   17, -68)
  A2 = Tone.new( -17,    51,  102,   0)
  A3 = Tone.new(   0,     0,    0,   0)
  A4 = Tone.new(  68,   136,   34,   0)
  A5 = Tone.new( 187,   119,   17, -68)
  #-----------------------------------------------------------------------
  # MOD
  #-----------------------------------------------------------------------
  #-----------------------------------------------------------------------
  # Settings for season periods
  #-----------------------------------------------------------------------
  S1 = [1,3]  # Spring        # Sets month periods for season system
  S2 = [4,6]  # Summer        # [Start Month, End Month] for time period
  S3 = [7,9] # Fall          #
  S4 = [10,12] # Winter        # <- Ex: Winter is between 10th - 12th (Oct - Dec)
  # Use automatic weather?
  WEATHER_SYSTEM = true
  # Sets the duration of weather changes (in frames)
  WEATHER_LENGTH = 240
  # Time before changing weather (in hours)
  WEATHER_COOLDOWN = 3
  # Weather names (Must be the same order as weather's Id) adds as many as required
  #                   0       1        2         3
  WEATHER_NAME = ["Clear", "Rain" , "Storm" , "Snowy"] # VX default only have these 3
  #-----------------------------------------------------------------------
  # Settings for possible weather
  # To add more weathers, just add more weather ids there
  # ex = W[#] = [ WeatherId, .....]
  # S[#] means, season number #
  # Weathers only occurs when entering map with [KTS] on it's name.
  # Those weathers will be randomly occurs, but snowy weather only spawns
  # during Winter.
  #-----------------------------------------------------------------------
  W = {}
  W[1] = [0, 1, 2 ] # [ WeatherId, .....]
  W[2] = [0, 1, 2 ] # [ WeatherId, .....]
  W[3] = [0, 1, 2 ] # [ WeatherId, .....]
  W[4] = [0, 1, 3 ] # [ WeatherId, .....]
  #-----------------------------------------------------------------------
  # Settings for weather bgs
  # WeatherId => "filename", file must be in Audio/BGS/ folder
  #-----------------------------------------------------------------------
  WEATHERSOUND_OK = true
  # If true, setup the BGS on line 385
  # Remember. BGS only changes when you enter/exit a map, but weather can change
  # even if you stay inside a map for a long time....
end

#==============================================================================
# Core Time System Engine (MODDED)
#==============================================================================
class Kylock_Time_System
  if $kylockTIME = true
  # sets instance variables
  def initialize
    $kts_map_data = load_data("Data/MapInfos.rxdata")
    @event_offset = (Time.now.strftime("%H").to_i * 3600) + (Time.now.strftime("%w").to_i * 86400)
    $kts_event_tone = false
    $kts_event_weather = false
    $kts_battle_tone = true
    $kts_anti_tone = Tone.new(0,0,0,0)
    @startingweatherdelay = 0
    @curweather = 0
    @played = false
  end
  # Computes current time and updates variables if used
  def update
    if !@kts_stop
      # for scripters
      @total_seconds = Graphics.frame_count + @event_offset
      @total_minutes = @total_seconds / 60
      @total_hours = @total_minutes / 60
      @total_days = @total_hours / 24
      @total_weeks = @total_days / 7
      @total_months = @total_weeks / 4
      @total_years = @total_months/12
      #
      @seconds = Time.now.sec
      @minutes = Time.now.min
      @hours   = Time.now.hour
      @days    = Time.now.strftime("%j").to_i
      @weekday = Time.now.strftime("%w").to_i
      @month = Time.now.strftime("%m").to_i
      @monthname = Time.now.strftime("%b")
      @monthday = Time.now.strftime("%d")
      @year = Time.now.strftime("%Y").to_i
      update_tint
      update_weather
      if KTS::DATABASE_OUTPUT
        $game_variables[KTS::TIME]    = getTime
      end
    end
  end
  #
  def update_variables
    $game_variables[KTS::SECONDS] = @seconds
    $game_variables[KTS::MINUTES] = @minutes
    $game_variables[KTS::HOURS]   = @hours
    $game_variables[KTS::DAYS]    = @days
    $game_variables[KTS::DAYNAME] = getDayName
    $game_variables[KTS::WEEKDAY] = @weekday
    $game_variables[KTS::MONTH] = @month
    $game_variables[KTS::MONTHNAM] = @monthname
    $game_variables[KTS::YEAR] = @year
    if KTS::WEATHER_SYSTEM == true
      $game_variables[KTS::WEATHER] = $game_screen.weather_type #@weather
    if $game_variables[25] == 0
      $game_variables[KTS::WEATHERN] = "Clear" #getWeatherName
    elsif $game_variables[25] == 1
      $game_variables[KTS::WEATHERN] = "Raining" #getWeatherName
    elsif $game_variables[25] == 2
      $game_variables[KTS::WEATHERN] = "Deluge" #getWeatherName
    elsif $game_variables[25] == 3
      $game_variables[KTS::WEATHERN] = "Snowy" #getWeatherName
    end
    end
    $game_variables[KTS::SEASON] = getSeasonName
    $game_variables[KTS::MONTHDAY] = @monthday
  end
  #
  def update_switches
    if @period == 1 || @period == 5
      $game_switches[KTS::NIGHT] = true
    else
      $game_switches[KTS::NIGHT] = false
    end
    if @period == 2
      $game_switches[KTS::DAWN] = true
    else
      $game_switches[KTS::DAWN] = false
    end
    if @period == 3
      $game_switches[KTS::DAY] = true
    else
      $game_switches[KTS::DAY] = false
    end
    if @period == 4
      $game_switches[KTS::SUNSET] = true
    else
      $game_switches[KTS::SUNSET] = false
    end
  end
  #
  def update_season_swithces
    if @month >= KTS::S1[0] and @month <= KTS::S1[1]
      @speriod = 1
      $game_switches[KTS::SPRING] = true
    else
      $game_switches[KTS::SPRING] = false
    end
    if @month >= KTS::S2[0] and @month <= KTS::S2[1]
      @speriod = 2
      $game_switches[KTS::SUMMER] = true
    else
      $game_switches[KTS::SUMMER] = false
    end
    if @month >= KTS::S3[0] and @month <= KTS::S3[1]
      @speriod = 3
      $game_switches[KTS::FALL] = true
    else
      $game_switches[KTS::FALL] = false
    end
    if @month >= KTS::S4[0] and @month <= KTS::S4[1]
      @speriod = 4
      $game_switches[KTS::WINTER] = true
    else
      $game_switches[KTS::WINTER] = false
    end
  end
  #-----------------------------------------------------------------------
  # Script Support/Misc Functions (MODDED)
  #-----------------------------------------------------------------------
  def getTime
    time = Time.now.strftime("%H:%M %p")
    return time
  end
  def getSeasonName
    sname = "Spring" if @speriod == 1
    sname = "Summer" if @speriod == 2
    sname = "Fall"   if @speriod == 3
    sname = "Winter" if @speriod == 4
    return sname
  end
  def getMonthName
    monthname = Time.now.strftime('%b')
    return monthname
  end
  def getDayName
    weekday = Time.now.strftime('%a')
    return weekday
  end
  def getWeatherName
#    weathername = KTS::WEATHER_NAME[@weather]
#    return weathername
  end
 
  #-----------------------------------------------------------------------
  # Screen Tone Functions
  #-----------------------------------------------------------------------
  def update_tint(duration = KTS::FADE_LENGTH)
    return if $BTEST
    if KTS::USE_TONE && !$kts_event_tone && $kts_map_data[$game_map.map_id].outside_tint?
      if @hours >= KTS::T1[0] and @hours <= KTS::T1[1]
        @period = 1   
        $game_screen.start_tone_change(KTS::C1,duration)
        $kts_anti_tone = KTS::A1
      elsif @hours >= KTS::T2[0] and @hours <= KTS::T2[1]
        @period = 2
        $game_screen.start_tone_change(KTS::C2,duration)
        $kts_anti_tone = KTS::A2
      elsif @hours >= KTS::T3[0] and @hours <= KTS::T3[1]
        @period = 3
        $game_screen.start_tone_change(KTS::C3,duration)
        $kts_anti_tone = KTS::A3
      elsif @hours >= KTS::T4[0] and @hours <= KTS::T4[1]
        @period = 4
        $game_screen.start_tone_change(KTS::C4,duration)
        $kts_anti_tone = KTS::A4
      elsif @hours >= KTS::T5[0] and @hours <= KTS::T5[1]
        @period = 5
        $game_screen.start_tone_change(KTS::C5,duration)
        $kts_anti_tone = KTS::A5
      end
    else
      # no tone if indoors
        if !$kts_map_data[$game_map.map_id].outside_tint?
          $game_screen.start_tone_change(Tone.new(0,0,0,0),duration)
        end
    end
  end
  # Set weather
  def setweather(duration)
    if ((@startingweatherdelay - @hours) >= KTS::WEATHER_COOLDOWN) or
       ((@startingweatherdelay - @hours) <= -KTS::WEATHER_COOLDOWN)
      @startingweatherdelay = Time.now.hour
      the_weatherset = KTS::W[@speriod]
      @curweather = the_weatherset[rand(KTS::W[@speriod].length)]
      @weather = @curweather
    else
      @weather = @curweather
    end
    $game_screen.weather(@weather, 9 , duration)
  end
   
  #-----------------------------------------------------------------------
  # Season/weather update
  #-----------------------------------------------------------------------
  def update_weather(duration = KTS::WEATHER_LENGTH)
    return if $BTEST
    if KTS::WEATHER_SYSTEM && !$kts_event_weather && $kts_map_data[$game_map.map_id].outside_tint?
      if @month >= KTS::S1[0] and @month <= KTS::S1[1]
        @speriod = 1
      elsif @month >= KTS::S2[0] and @month <= KTS::S2[1]
        @speriod = 2
      elsif @month >= KTS::S3[0] and @month <= KTS::S3[1]
        @speriod = 3
      elsif @month >= KTS::S4[0] and @month <= KTS::S4[1]
        @speriod = 4
      end
      setweather(duration)
    else
      # no weather if indoors
        if !$kts_map_data[$game_map.map_id].outside_tint?
          Audio.bgs_stop #Stop BGS
          $game_screen.weather(0, 0, 0)
        end
    end
  end
=begin
  def screen
    if $game_temp.in_battle
      return $game_troop.screen
    else
      return $game_map.screen
    end
  end
=end
  # Extra Feature; Change BGS
  def start_bgs
    return if !$kts_map_data[$game_map.map_id].outside_tint?
     if $kts_map_data[$game_map.map_id].outside_tint?
      if  KTS::WEATHER_SYSTEM == true
        if KTS::WEATHERSOUND_OK == true
          if @weather == 1
            Audio.bgs_play("Audio/BGS/Rain", 70, 100)
          elsif @weather == 2
            Audio.bgs_play("Audio/BGS/Storm", 70, 100)
            # ADD MORE IF YOU WANT to play BGS when weather with Id @weather occurs!
            # Like this :
            # elsif @weather == Id
            #  Audio.bgs_play("Audio/BGS/SomeBGS", 70, 100)
          else
            Audio.bgs_stop
          end
        end
      end
    end
  end
end
end

class Spriteset_Map
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias kts_initialize initialize
  def initialize
    $kts.update_switches if KTS::DATABASE_OUTPUT
    $kts.update_variables if KTS::DATABASE_OUTPUT
    $kts.update_season_swithces if KTS::DATABASE_OUTPUT
    kts_initialize
  end
end

#==============================================================================
# Instantly updates screen tone when a new map is loaded.
#==============================================================================
class Game_Map
  alias kts_setup setup
  def setup(map_id)
    kts_setup(map_id)
    $kts_event_tone = false
    $kts.update
    $kts.update_tint(0)
    $kts.update_weather(0) if KTS::WEATHER_SYSTEM
    $kts.start_bgs
  end
end
=begin
#==============================================================================
# Instantly updates screen tone when a battle starts.
#==============================================================================
class Spriteset_Battle
  alias kts_create_battleback create_battleback
  def create_battleback
    $kts.update_tint(0)
    kts_create_battleback
  end
end

#==============================================================================
# Temporarily disables auto-toning if an event tints the screen.
#==============================================================================
class Game_Interpreter
  alias kts_Interpreter_command_223 command_223
  def command_223
    $kts_event_tone = true
    kts_Interpreter_command_223
  end
  alias kts_Interpreter_command_236 command_236
  def command_236
    $kts_event_weather = true
    kts_Interpreter_command_226
  end
end
=end
#==============================================================================
# Integrates the Time System into the Game System.
#==============================================================================
class Game_System
  # inits a KTS object
  alias kts_initialize initialize
  def initialize
    $kts=Kylock_Time_System.new
    kts_initialize
  end
  # Updates kts every game frame
  alias kts_update update
  def update
    $kts.update
    kts_update
  end
end

#==============================================================================
# Scans Map Names for Toning
#==============================================================================
class RPG::MapInfo
  def name # Definition prevents location scripts from reading anything within
    return @name.gsub(/\[.*\]/) {""} # brackets, including the brackets
  end
  def original_name
    return @name
  end
  def outside_tint?
    return @name.scan(/\[KTS\]/).size > 0
    # old regexp: return @name.scan(/[\KTS]/).size > 0
  end
end
=begin
#==============================================================================
# Sets up the time window for the menu. (MODDED)
#==============================================================================
class Window_KTS < Window_Base
  def initialize(x, y)
    super(x, y, 160, WLH+32)
    refresh
  end
  def refresh
    self.contents.clear
    self.contents.draw_text(0, -6, 120, 32,$kts.getDayName+" "+$kts.getTime, 2)
  end
  def update
    super
    $kts.update
    self.contents.clear
    self.contents.draw_text(0, -6, 120, 32, $kts.getDayName+" "+$kts.getTime, 2)
  end
end

#==============================================================================
# Adds the time window to the menu.
#==============================================================================
class Scene_Menu < Scene_Base
  alias kts_start start
  def start
    kts_start
    @kts_window = Window_KTS.new(0,304)
  end
  alias kts_terminate terminate
  def terminate
    kts_terminate
    @kts_window.dispose
  end
  alias kts_update update
  def update
    kts_update
    @kts_window.update
  end
end
=end
#==============================================================================
# Saves and Loads game time to/from save game file.
#==============================================================================
class Scene_Save
  alias kts_write_save_data write_save_data
  def write_save_data(file)
    kts_write_save_data(file)
    Marshal.dump($kts, file)
  end
end

class Scene_Load
  alias kts_read_save_data read_save_data
  def read_save_data(file)
    kts_read_save_data(file)
    $kts = Marshal.load(file)
  end
end


And well, honestly, I just feel like if it was made FOR XP, and not just me hacking up the script until it functions as I need it, mayhaps the world could utilize this script as well as me :D

Just a thought.



I have 2 questions about this :

Does it reads the actual Time setted up on the PC or just you configuring the scrip ?
Is this 100% compatible with XP ?

lilbrudder917

Quote from: elementisland on February 06, 2010, 12:01:52 pm
Quote from: jragyn00 on February 02, 2010, 05:54:01 am
Could this script be modified in some way to project REAL time into the game, versus implanted 5 minute days, 5 minute nights (or whatever they are set to)?

I currently use a script I butchered and modified for use from VX...for XP!
Spoiler: ShowHide
#==============================================================================
# � Kylock's Time System VX 1.5 MOD V.1.1
#     6.3.2008                 30.5.2009
#------------------------------------------------------------------------------
#  Script by: Kylock
#  MOD by reijubv
#===============================================================================
# Credit mainly goes to Kylock
# and then.  reijubv
# (Cuz I think I deserve something better than just a "thanks"..)
# Have a nice day!
#===============================================================================
# ? Auto-tone Instructions
#------------------------------------------------------------------------------
#    Maps designated as outdoors are the only maps to be affected by this
#  scripts use of auto-toning.  To signify a map to be "outdoors", you must
#  include [KTS] In the name of the map.  For example, you world map could be
#  named "World Map [KTS]" or "[KTS] World Map".  Provisions are made later in
#  the script to remove [KTS] from the map name when it's read by another
#  script.  This means that "[KTS]" won't show up in your Map Name Popup
#  windows.
#==============================================================================
# ? Game Database Setup
#------------------------------------------------------------------------------
#    This script, by defult, uses the following game variables and switches:
#  Database Variables:
#    [1] The Current Time
#    [2] The Current Second
#    [3] The Current Minute
#    [4] The Current Hour
#    [5] The Current Day
#    [6] Name of the Current Day (abbreviated)
#    [7] The Current Day index in one week (0-6) a week starts from sunday
#    [8] The Current Month
#    [9] The Current Month's name (abbreviated)
#    [10]The Current Day Id in this Month (1-32,or 1-30,or 1-29)
#    [11]The Current Year
#    [12]Season's name
#    [13]Weather's Name
#    [14]Weather Id, 0 is clear weather..
#  Database Switches
#    [1] ON during night hours   (2200-0400)(10pm-4am)
#    [2] ON during dawn hours    (0500-0800)( 5am-8am)
#    [3] ON during daytime hours (0900-1800)( 9am-6pm)
#    [4] ON during sunset hours  (1900-2100)( 7pm-9pm)
#    [5] ON during spring season
#    [6] ON during summer season
#    [7] ON during fall season
#    [8] ON during winter season
#==============================================================================

$kylockTIME = true


#==============================================================================
# Stores variables and user defined settings for the time system.
#==============================================================================
module KTS
  #-----------------------------------------------------------------------
  # Settings for Time Periods
  #-----------------------------------------------------------------------
  T1 = [ 0,4 ] # Night         # Sets time periods for tinting effects
  T2 = [ 5,8 ] # Dawn          # [Start Hour, End Hour] for time period
  T3 = [ 9,17] # Day           # Use 24-hour values for time periods
  T4 = [18,21] # Sunset
  T5 = [22,24] # Night         # <- Ex: Night is between 23:00 and 24:00
  #-----------------------------------------------------------------------
  # Settings for Output to Game Variables option.
  #-----------------------------------------------------------------------
  # Set this to true to output the current time to game variables.
  DATABASE_OUTPUT = true 
    # Game Variable to be used for time output.
    TIME    = 12 #(Time in string format. Ex: "2:48 AM" or "02:48")
    SECONDS = 13 # 1 to 59
    MINUTES = 14 # 1 to 59
    HOURS   = 15 # 1 to 24
    DAYS    = 16 # 1 to 366
    DAYNAME = 17 # Sun, Mon, etc..
    WEEKDAY = 18 # 0 to 6 (Day index in one week)
    MONTH   = 20 # 1 to 12
    MONTHNAM= 19 # Jan, Feb, May, etc..
    MONTHDAY= 21# 1 to 31
    YEAR    = 22# 1994, 2009, etc
    SEASON  = 23# Season Name (Spring, Summer, Fall, Winter)
    WEATHERN= 24# Weather's name
    WEATHER = 25# Weather Id, 0 is clear weather
   
    # Game Switches to be used for time output.
    NIGHT   = 55 # This switch is on during night hours   (2200-0400)(10pm-4am)
    DAWN    = 56 # This switch is on during dawn hours    (0500-0800)( 5am-8am)
    DAY     = 57 # This switch is on during daytime hours (0900-1800)( 9am-6pm)
    SUNSET  = 58 # This switch is on during sunset hours  (1900-2100)( 7pm-9pm)

    # Season Switches.
    SPRING  = 59 # This switch is on during spring season
    SUMMER  = 60 # This switch is on during summer season
    FALL    = 61 # This switch is on during fall season
    WINTER  = 62 # This switch is on during winter season
  #-----------------------------------------------------------------------
  # Settings for time controlled screen toning
  #-----------------------------------------------------------------------
  # True will enable screen toning to be used by the script.
  USE_TONE = true
  # Sets the duration of tone changes (in frames)
  FADE_LENGTH = 240
  # Defines tones to be used in the corresponding time periods defined above.
  #              RED, GREEN, BLUE, GREY
  C1 = Tone.new(-187,  -119,  -17,  68)
  C2 = Tone.new(  17,   -51, -102,   0)
  C3 = Tone.new(   0,     0,    0,   0)
  C4 = Tone.new( -68,  -136,  -34,   0)
  C5 = Tone.new(-187,  -119,  -17,  68)
  # Defines anti-tones
  A1 = Tone.new( 187,   119,   17, -68)
  A2 = Tone.new( -17,    51,  102,   0)
  A3 = Tone.new(   0,     0,    0,   0)
  A4 = Tone.new(  68,   136,   34,   0)
  A5 = Tone.new( 187,   119,   17, -68)
  #-----------------------------------------------------------------------
  # MOD
  #-----------------------------------------------------------------------
  #-----------------------------------------------------------------------
  # Settings for season periods
  #-----------------------------------------------------------------------
  S1 = [1,3]  # Spring        # Sets month periods for season system
  S2 = [4,6]  # Summer        # [Start Month, End Month] for time period
  S3 = [7,9] # Fall          #
  S4 = [10,12] # Winter        # <- Ex: Winter is between 10th - 12th (Oct - Dec)
  # Use automatic weather?
  WEATHER_SYSTEM = true
  # Sets the duration of weather changes (in frames)
  WEATHER_LENGTH = 240
  # Time before changing weather (in hours)
  WEATHER_COOLDOWN = 3
  # Weather names (Must be the same order as weather's Id) adds as many as required
  #                   0       1        2         3
  WEATHER_NAME = ["Clear", "Rain" , "Storm" , "Snowy"] # VX default only have these 3
  #-----------------------------------------------------------------------
  # Settings for possible weather
  # To add more weathers, just add more weather ids there
  # ex = W[#] = [ WeatherId, .....]
  # S[#] means, season number #
  # Weathers only occurs when entering map with [KTS] on it's name.
  # Those weathers will be randomly occurs, but snowy weather only spawns
  # during Winter.
  #-----------------------------------------------------------------------
  W = {}
  W[1] = [0, 1, 2 ] # [ WeatherId, .....]
  W[2] = [0, 1, 2 ] # [ WeatherId, .....]
  W[3] = [0, 1, 2 ] # [ WeatherId, .....]
  W[4] = [0, 1, 3 ] # [ WeatherId, .....]
  #-----------------------------------------------------------------------
  # Settings for weather bgs
  # WeatherId => "filename", file must be in Audio/BGS/ folder
  #-----------------------------------------------------------------------
  WEATHERSOUND_OK = true
  # If true, setup the BGS on line 385
  # Remember. BGS only changes when you enter/exit a map, but weather can change
  # even if you stay inside a map for a long time....
end

#==============================================================================
# Core Time System Engine (MODDED)
#==============================================================================
class Kylock_Time_System
  if $kylockTIME = true
  # sets instance variables
  def initialize
    $kts_map_data = load_data("Data/MapInfos.rxdata")
    @event_offset = (Time.now.strftime("%H").to_i * 3600) + (Time.now.strftime("%w").to_i * 86400)
    $kts_event_tone = false
    $kts_event_weather = false
    $kts_battle_tone = true
    $kts_anti_tone = Tone.new(0,0,0,0)
    @startingweatherdelay = 0
    @curweather = 0
    @played = false
  end
  # Computes current time and updates variables if used
  def update
    if !@kts_stop
      # for scripters
      @total_seconds = Graphics.frame_count + @event_offset
      @total_minutes = @total_seconds / 60
      @total_hours = @total_minutes / 60
      @total_days = @total_hours / 24
      @total_weeks = @total_days / 7
      @total_months = @total_weeks / 4
      @total_years = @total_months/12
      #
      @seconds = Time.now.sec
      @minutes = Time.now.min
      @hours   = Time.now.hour
      @days    = Time.now.strftime("%j").to_i
      @weekday = Time.now.strftime("%w").to_i
      @month = Time.now.strftime("%m").to_i
      @monthname = Time.now.strftime("%b")
      @monthday = Time.now.strftime("%d")
      @year = Time.now.strftime("%Y").to_i
      update_tint
      update_weather
      if KTS::DATABASE_OUTPUT
        $game_variables[KTS::TIME]    = getTime
      end
    end
  end
  #
  def update_variables
    $game_variables[KTS::SECONDS] = @seconds
    $game_variables[KTS::MINUTES] = @minutes
    $game_variables[KTS::HOURS]   = @hours
    $game_variables[KTS::DAYS]    = @days
    $game_variables[KTS::DAYNAME] = getDayName
    $game_variables[KTS::WEEKDAY] = @weekday
    $game_variables[KTS::MONTH] = @month
    $game_variables[KTS::MONTHNAM] = @monthname
    $game_variables[KTS::YEAR] = @year
    if KTS::WEATHER_SYSTEM == true
      $game_variables[KTS::WEATHER] = $game_screen.weather_type #@weather
    if $game_variables[25] == 0
      $game_variables[KTS::WEATHERN] = "Clear" #getWeatherName
    elsif $game_variables[25] == 1
      $game_variables[KTS::WEATHERN] = "Raining" #getWeatherName
    elsif $game_variables[25] == 2
      $game_variables[KTS::WEATHERN] = "Deluge" #getWeatherName
    elsif $game_variables[25] == 3
      $game_variables[KTS::WEATHERN] = "Snowy" #getWeatherName
    end
    end
    $game_variables[KTS::SEASON] = getSeasonName
    $game_variables[KTS::MONTHDAY] = @monthday
  end
  #
  def update_switches
    if @period == 1 || @period == 5
      $game_switches[KTS::NIGHT] = true
    else
      $game_switches[KTS::NIGHT] = false
    end
    if @period == 2
      $game_switches[KTS::DAWN] = true
    else
      $game_switches[KTS::DAWN] = false
    end
    if @period == 3
      $game_switches[KTS::DAY] = true
    else
      $game_switches[KTS::DAY] = false
    end
    if @period == 4
      $game_switches[KTS::SUNSET] = true
    else
      $game_switches[KTS::SUNSET] = false
    end
  end
  #
  def update_season_swithces
    if @month >= KTS::S1[0] and @month <= KTS::S1[1]
      @speriod = 1
      $game_switches[KTS::SPRING] = true
    else
      $game_switches[KTS::SPRING] = false
    end
    if @month >= KTS::S2[0] and @month <= KTS::S2[1]
      @speriod = 2
      $game_switches[KTS::SUMMER] = true
    else
      $game_switches[KTS::SUMMER] = false
    end
    if @month >= KTS::S3[0] and @month <= KTS::S3[1]
      @speriod = 3
      $game_switches[KTS::FALL] = true
    else
      $game_switches[KTS::FALL] = false
    end
    if @month >= KTS::S4[0] and @month <= KTS::S4[1]
      @speriod = 4
      $game_switches[KTS::WINTER] = true
    else
      $game_switches[KTS::WINTER] = false
    end
  end
  #-----------------------------------------------------------------------
  # Script Support/Misc Functions (MODDED)
  #-----------------------------------------------------------------------
  def getTime
    time = Time.now.strftime("%H:%M %p")
    return time
  end
  def getSeasonName
    sname = "Spring" if @speriod == 1
    sname = "Summer" if @speriod == 2
    sname = "Fall"   if @speriod == 3
    sname = "Winter" if @speriod == 4
    return sname
  end
  def getMonthName
    monthname = Time.now.strftime('%b')
    return monthname
  end
  def getDayName
    weekday = Time.now.strftime('%a')
    return weekday
  end
  def getWeatherName
#    weathername = KTS::WEATHER_NAME[@weather]
#    return weathername
  end
 
  #-----------------------------------------------------------------------
  # Screen Tone Functions
  #-----------------------------------------------------------------------
  def update_tint(duration = KTS::FADE_LENGTH)
    return if $BTEST
    if KTS::USE_TONE && !$kts_event_tone && $kts_map_data[$game_map.map_id].outside_tint?
      if @hours >= KTS::T1[0] and @hours <= KTS::T1[1]
        @period = 1   
        $game_screen.start_tone_change(KTS::C1,duration)
        $kts_anti_tone = KTS::A1
      elsif @hours >= KTS::T2[0] and @hours <= KTS::T2[1]
        @period = 2
        $game_screen.start_tone_change(KTS::C2,duration)
        $kts_anti_tone = KTS::A2
      elsif @hours >= KTS::T3[0] and @hours <= KTS::T3[1]
        @period = 3
        $game_screen.start_tone_change(KTS::C3,duration)
        $kts_anti_tone = KTS::A3
      elsif @hours >= KTS::T4[0] and @hours <= KTS::T4[1]
        @period = 4
        $game_screen.start_tone_change(KTS::C4,duration)
        $kts_anti_tone = KTS::A4
      elsif @hours >= KTS::T5[0] and @hours <= KTS::T5[1]
        @period = 5
        $game_screen.start_tone_change(KTS::C5,duration)
        $kts_anti_tone = KTS::A5
      end
    else
      # no tone if indoors
        if !$kts_map_data[$game_map.map_id].outside_tint?
          $game_screen.start_tone_change(Tone.new(0,0,0,0),duration)
        end
    end
  end
  # Set weather
  def setweather(duration)
    if ((@startingweatherdelay - @hours) >= KTS::WEATHER_COOLDOWN) or
       ((@startingweatherdelay - @hours) <= -KTS::WEATHER_COOLDOWN)
      @startingweatherdelay = Time.now.hour
      the_weatherset = KTS::W[@speriod]
      @curweather = the_weatherset[rand(KTS::W[@speriod].length)]
      @weather = @curweather
    else
      @weather = @curweather
    end
    $game_screen.weather(@weather, 9 , duration)
  end
   
  #-----------------------------------------------------------------------
  # Season/weather update
  #-----------------------------------------------------------------------
  def update_weather(duration = KTS::WEATHER_LENGTH)
    return if $BTEST
    if KTS::WEATHER_SYSTEM && !$kts_event_weather && $kts_map_data[$game_map.map_id].outside_tint?
      if @month >= KTS::S1[0] and @month <= KTS::S1[1]
        @speriod = 1
      elsif @month >= KTS::S2[0] and @month <= KTS::S2[1]
        @speriod = 2
      elsif @month >= KTS::S3[0] and @month <= KTS::S3[1]
        @speriod = 3
      elsif @month >= KTS::S4[0] and @month <= KTS::S4[1]
        @speriod = 4
      end
      setweather(duration)
    else
      # no weather if indoors
        if !$kts_map_data[$game_map.map_id].outside_tint?
          Audio.bgs_stop #Stop BGS
          $game_screen.weather(0, 0, 0)
        end
    end
  end
=begin
  def screen
    if $game_temp.in_battle
      return $game_troop.screen
    else
      return $game_map.screen
    end
  end
=end
  # Extra Feature; Change BGS
  def start_bgs
    return if !$kts_map_data[$game_map.map_id].outside_tint?
     if $kts_map_data[$game_map.map_id].outside_tint?
      if  KTS::WEATHER_SYSTEM == true
        if KTS::WEATHERSOUND_OK == true
          if @weather == 1
            Audio.bgs_play("Audio/BGS/Rain", 70, 100)
          elsif @weather == 2
            Audio.bgs_play("Audio/BGS/Storm", 70, 100)
            # ADD MORE IF YOU WANT to play BGS when weather with Id @weather occurs!
            # Like this :
            # elsif @weather == Id
            #  Audio.bgs_play("Audio/BGS/SomeBGS", 70, 100)
          else
            Audio.bgs_stop
          end
        end
      end
    end
  end
end
end

class Spriteset_Map
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias kts_initialize initialize
  def initialize
    $kts.update_switches if KTS::DATABASE_OUTPUT
    $kts.update_variables if KTS::DATABASE_OUTPUT
    $kts.update_season_swithces if KTS::DATABASE_OUTPUT
    kts_initialize
  end
end

#==============================================================================
# Instantly updates screen tone when a new map is loaded.
#==============================================================================
class Game_Map
  alias kts_setup setup
  def setup(map_id)
    kts_setup(map_id)
    $kts_event_tone = false
    $kts.update
    $kts.update_tint(0)
    $kts.update_weather(0) if KTS::WEATHER_SYSTEM
    $kts.start_bgs
  end
end
=begin
#==============================================================================
# Instantly updates screen tone when a battle starts.
#==============================================================================
class Spriteset_Battle
  alias kts_create_battleback create_battleback
  def create_battleback
    $kts.update_tint(0)
    kts_create_battleback
  end
end

#==============================================================================
# Temporarily disables auto-toning if an event tints the screen.
#==============================================================================
class Game_Interpreter
  alias kts_Interpreter_command_223 command_223
  def command_223
    $kts_event_tone = true
    kts_Interpreter_command_223
  end
  alias kts_Interpreter_command_236 command_236
  def command_236
    $kts_event_weather = true
    kts_Interpreter_command_226
  end
end
=end
#==============================================================================
# Integrates the Time System into the Game System.
#==============================================================================
class Game_System
  # inits a KTS object
  alias kts_initialize initialize
  def initialize
    $kts=Kylock_Time_System.new
    kts_initialize
  end
  # Updates kts every game frame
  alias kts_update update
  def update
    $kts.update
    kts_update
  end
end

#==============================================================================
# Scans Map Names for Toning
#==============================================================================
class RPG::MapInfo
  def name # Definition prevents location scripts from reading anything within
    return @name.gsub(/\[.*\]/) {""} # brackets, including the brackets
  end
  def original_name
    return @name
  end
  def outside_tint?
    return @name.scan(/\[KTS\]/).size > 0
    # old regexp: return @name.scan(/[\KTS]/).size > 0
  end
end
=begin
#==============================================================================
# Sets up the time window for the menu. (MODDED)
#==============================================================================
class Window_KTS < Window_Base
  def initialize(x, y)
    super(x, y, 160, WLH+32)
    refresh
  end
  def refresh
    self.contents.clear
    self.contents.draw_text(0, -6, 120, 32,$kts.getDayName+" "+$kts.getTime, 2)
  end
  def update
    super
    $kts.update
    self.contents.clear
    self.contents.draw_text(0, -6, 120, 32, $kts.getDayName+" "+$kts.getTime, 2)
  end
end

#==============================================================================
# Adds the time window to the menu.
#==============================================================================
class Scene_Menu < Scene_Base
  alias kts_start start
  def start
    kts_start
    @kts_window = Window_KTS.new(0,304)
  end
  alias kts_terminate terminate
  def terminate
    kts_terminate
    @kts_window.dispose
  end
  alias kts_update update
  def update
    kts_update
    @kts_window.update
  end
end
=end
#==============================================================================
# Saves and Loads game time to/from save game file.
#==============================================================================
class Scene_Save
  alias kts_write_save_data write_save_data
  def write_save_data(file)
    kts_write_save_data(file)
    Marshal.dump($kts, file)
  end
end

class Scene_Load
  alias kts_read_save_data read_save_data
  def read_save_data(file)
    kts_read_save_data(file)
    $kts = Marshal.load(file)
  end
end


And well, honestly, I just feel like if it was made FOR XP, and not just me hacking up the script until it functions as I need it, mayhaps the world could utilize this script as well as me :D

Just a thought.



I have 2 questions about this :

Does it reads the actual Time setted up on the PC or just you configuring the scrip ?
Is this 100% compatible with XP ?

Spoiler: ShowHide

       @seconds = Time.now.sec 
      @minutes = Time.now.min
      @hours   = Time.now.hour
      @days    = Time.now.strftime("%j").to_i
      @weekday = Time.now.strftime("%w").to_i
      @month = Time.now.strftime("%m").to_i
      @monthname = Time.now.strftime("%b")
      @monthday = Time.now.strftime("%d")
      @year = Time.now.strftime("%Y").to_i

    $game_variables[KTS::SECONDS] = @seconds
    $game_variables[KTS::MINUTES] = @minutes
    $game_variables[KTS::HOURS]   = @hours
    $game_variables[KTS::DAYS]    = @days
    $game_variables[KTS::DAYNAME] = getDayName
    $game_variables[KTS::WEEKDAY] = @weekday
    $game_variables[KTS::MONTH] = @month
    $game_variables[KTS::MONTHNAM] = @monthname
    $game_variables[KTS::YEAR] = @year


From what I see, it reads the time set up on the PC.

Alton Wyte

Quote from: Jackolas on November 21, 2009, 08:11:57 am
to Alton Wyte:
QuoteAll I did was put in the configuration. And also I noticed at 6:30 it changes back to night and begins to fade to daytime.


hearing the problem i think the problem lies in a other script that is causing errors with this 1.
can you write up the scripts you use?

Thanks for wanting to help, but I started a new game and now there are no issues.

element

March 04, 2010, 02:09:31 pm #164 Last Edit: March 04, 2010, 02:11:44 pm by Trainer Element
Can I use the code breloom showed me in keylocks script in ates.
and if yes can someone show me where to implement this code ?

In other words:
I need to know if i can makes ates work with real time,day year,... set up on PC

lilbrudder917

Quote from: Trainer Element on March 04, 2010, 02:09:31 pm
Can I use the code breloom showed me in keylocks script in ates.
and if yes can someone show me where to implement this code ?

In other words:
I need to know if i can makes ates work with real time,day year,... set up on PC


I'm not 100% sure about this script because I haven't used it, but this is what I like to do.

Spoiler: ShowHide
class RealTime
  def initialize
        @time_stamp = Time.new
          $game_variables[1]        = @time_stamp.strftime("%y").to_i # XX in Year YYXX
          $game_variables[2]        = @time_stamp.strftime("%m").to_i # Jan = 1 cont.
          $game_variables[3]        = @time_stamp.strftime("%W").to_i # Week #, Starts Mon.
          $game_variables[4]        = @time_stamp.strftime("%w").to_i # Day of Week, S Sun.
          $game_variables[5]        = @time_stamp.strftime("%d").to_i # Day of Month
          $game_variables[6]        = @time_stamp.strftime("%H").to_i # 24 Hour
          $game_variables[7]        = @time_stamp.strftime("%I").to_i # 12 Hour
          $game_variables[8]        = @time_stamp.strftime("%M").to_i # 2-Digit Minute
  end
end

RealTime.new


and then in a Common Event...

Spoiler: ShowHide
Conditional Branch : Switch [Inside] is OFF
Conditional Branch : HOURVARIABLE = x to x
Change Screen Color Tone
end Conditional Branch
end Conditional Branch


...Basically, it changes Screen Color Tone if you are outside. When going inside (or in a cutscene), turn the Inside switch on.

element

Quote from: Breloom Trainer Brudder on March 04, 2010, 02:32:28 pm
Quote from: Trainer Element on March 04, 2010, 02:09:31 pm
Can I use the code breloom showed me in keylocks script in ates.
and if yes can someone show me where to implement this code ?

In other words:
I need to know if i can makes ates work with real time,day year,... set up on PC


I'm not 100% sure about this script because I haven't used it, but this is what I like to do.

Spoiler: ShowHide
class RealTime
  def initialize
        @time_stamp = Time.new
          $game_variables[1]        = @time_stamp.strftime("%y").to_i # XX in Year YYXX
          $game_variables[2]        = @time_stamp.strftime("%m").to_i # Jan = 1 cont.
          $game_variables[3]        = @time_stamp.strftime("%W").to_i # Week #, Starts Mon.
          $game_variables[4]        = @time_stamp.strftime("%w").to_i # Day of Week, S Sun.
          $game_variables[5]        = @time_stamp.strftime("%d").to_i # Day of Month
          $game_variables[6]        = @time_stamp.strftime("%H").to_i # 24 Hour
          $game_variables[7]        = @time_stamp.strftime("%I").to_i # 12 Hour
          $game_variables[8]        = @time_stamp.strftime("%M").to_i # 2-Digit Minute
  end
end

RealTime.new


and then in a Common Event...

Spoiler: ShowHide
Conditional Branch : Switch [Inside] is OFF
Conditional Branch : HOURVARIABLE = x to x
Change Screen Color Tone
end Conditional Branch
end Conditional Branch


...Basically, it changes Screen Color Tone if you are outside. When going inside (or in a cutscene), turn the Inside switch on.


Can you make this work in ATES ? Or do you want to show me where to implement it :p

lilbrudder917

March 06, 2010, 09:22:26 am #167 Last Edit: March 06, 2010, 09:28:39 am by Breloom Trainer Brudder
Well, when I said
QuoteI'm not 100% sure about this script because I haven't used it


I was referring to ATES. I'll attempt to make a plugin if nobody else is up to it.

EDIT: I just opened up a new project to try it out.

On line 309, replace:
@time = ATES::Time.new(0,0)

with
@time = Time.new


and it'll use real time from the internal clock.

EDIT2: It won't update on its own, though.

element

Jheej ! it gives the real time for 1 sec !!!  :haha:

And then it gives me a error like you said
Quote from: Breloom Trainer Brudder on March 06, 2010, 09:22:26 am
EDIT2: It won't update on its own, though.


I'm totally requesting this XD

Blizzard

Quote from: Breloom Trainer Brudder on March 06, 2010, 09:22:26 am
EDIT2: It won't update on its own, though.


If you change line 325, it will.

@frame_count += 1


@time = Time.now


BTW, Time.new and Time.now do the same. I prefer .now because it's more descriptive of what it actually does.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

lilbrudder917

March 08, 2010, 07:07:32 am #170 Last Edit: March 08, 2010, 07:12:45 am by Breloom Trainer Brudder
Uh.. you sure about that, Blizzard? I just tried that out, the clock didn't change.

Also, I know Time.new and Time.now are the same.

EDIT: Ah, it's because @active is false by default. But when I changed it to true, it crashed.

Blizzard

Then the other method that's being called when @active is one should be disabled.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

lilbrudder917

Quote from: Champion Blizzard on March 08, 2010, 10:40:48 am
Then the other method that's being called when @active is one should be disabled.


There's only one method that's being called when @active is on. There is no other one.

Anyway, I found out how to make it automatically update.

Spoiler: ShowHide

  alias update_ates_later update
  def update
    $game_system.ates.update
    update_ates_later
    if $game_system.show_clock
      @clock = Clock_Sprite.new if @clock == nil
      @clock.draw if ATES.active? && $game_system.ates.frame_count % 40 == 0
    elsif @clock != nil
      @clock.dispose
      @clock = nil
    end
  end


to

  alias update_ates_later update
  def update
    $game_system.ates.update
    update_ates_later
    if $game_system.show_clock
      @clock = Clock_Sprite.new if @clock == nil
      @clock.bitmap.clear
      @clock.draw if ATES.active? && Time.sec == 0
    elsif @clock != nil
      @clock.dispose
      @clock = nil
    end
  end


and

Spoiler: ShowHide

def update
    if @active
      update_progress
      update_ates_progress
    end
    update_switches
    update_screen
  end


to

  def update
    @time = Time.new
    Clock_Sprite.new
    if @active
      update_progress
      update_ates_progress
    end
    update_switches
    update_screen
  end


There's probably a different way to do it. That's just one I got working.

element

It works !
Initially it didn't but then I removed the parralel event that turns on ATES
Dous that mean that coloring doesnt work ?

Blizzard

March 09, 2010, 02:45:07 am #174 Last Edit: March 09, 2010, 02:54:03 am by Blizzard
CONGRATULATIONS! YOU JUST CAUSED A HEAVY MEMORY LEAK.

Clock_Sprite.new will make your game run so slowly so quickly that you won't even realize what hit you. You're instantiating a sprite there each frame, you're not destroying it and you're not even storing it into a variable.

    if @active # condition check
     update_progress # first method
     update_ates_progress # second method
   end # maybe you wanna count again just to be sure
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Magus

I have a question:

What happens if the character is in the inside of a building, especially a lit up one. Is there anyway you can adjust it to temporarily turn off  the script when a character walks inside a building.
LEVEL ME DOWN. THE ANTI-BLIZZ GROUP IS AMONG YOU... Do it for the chick below...She watches..<br />

Alton Wyte

Quote

#     ATES.tint_on
#   Turns ATES's screen tinting on.
#
#     ATES.tint_off
#   Turns ATES's screen tinting off.

lilbrudder917

Quote from: Champion Blizzard on March 09, 2010, 02:45:07 am
CONGRATULATIONS! YOU JUST CAUSED A HEAVY MEMORY LEAK.

Clock_Sprite.new will make your game run so slowly so quickly that you won't even realize what hit you. You're instantiating a sprite there each frame, you're not destroying it and you're not even storing it into a variable.

    if @active # condition check
     update_progress # first method
     update_ates_progress # second method
   end # maybe you wanna count again just to be sure



Odd, my game didn't lag much at all and used just as much memory as it normally does.

Also, I misunderstood you when you said the other method. I thought you meant elsewhere in the script it checks if @active = true. In any case, sorry.

Blizzard

No problem. Just make sure to double check next time. When I look for the appearance of a variable, I check for @variable, .variable and :variable. :)
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

happyman

How can I set up this script so that I call a common event at midnight?

I want everything to pause and the screen to fade to black, where big words say "Day 2" or something like that.  Also, certain variables in my game will change at this time.  Right now I have a parallel common event, but it's slowing down my game because it's constantly checking for midnight.  Obviously, this is stupid, so I would like the script to call a common event at midnight.

Or is there a better way?