RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

help with script [xp] (making a varible from time.now)

Started by kathis, November 11, 2007, 11:47:26 PM

0 Members and 1 Guest are viewing this topic.

kathis

This is just confusing me mostly. I think I have everything correct but saddly I am not sure. It doesn't seem to work and I have no idea why the devil not.

I took this code and pasted it above Main

[spoiler]
class Game_System
   
   attr_accessor :time
   
   alias init_time_system initialize
   def initialize
     init_time_system
     @time = Time.now
   end
   
   def update_time
     @time = Time.now
    $game_variables[101] = @time.min if $game_variables != nil
     $game_variables[102] = @time.hour if $game_variables != nil
     $game_variables[103] = @time.mday if $game_variables != nil
      $game_variables[104] = @time.wday if $game_variables != nil
      $game_variables[105] = @time.mon if $game_variables != nil
       $game_variables[106]= @time.year if $game_variables != nil
      end
 
end
[/spoiler]

yes I have tried smaller varibles like " $game_variables[1] "

I tried removing @time and replacing it to something like

$game_variables[101] = Time.now.min

I even tried removing  " if $game_variables != nil " however this one liked giving me some errors.

so if anyone know what is incorrect please help me figure it out. Thank you


Btw I did look up in the search bar, unable to find anything that would help with "Time.now" "time , varibles"

- Kathis
Project
New project. The other dimention DND
RPG makers challenge http://rmrk.net/index.php/topic,13503.0.html

tSwitch


class Game_System
  alias init_time_system initialize
  def initialize
   init_time_system
   @time = Time.now
  end
  def update_time
    @time = Time.now
    if $game_variables != nil
      $game_variables[101] = @time.min
      $game_variables[102] = @time.hour
      $game_variables[103] = @time.mday
      $game_variables[104] = @time.wday
      $game_variables[105] = @time.mon
      $game_variables[106]= @time.year
    end
  end
end
class Scene_Map
  alias update_old update
  def update
    $game_system.update_time
    update_old
  end
end


that'll update the time constantly on the map
should work the way you want it to

all I did was have it call update_time every time the map refreshed


FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon