SHOW:
|
|
- or go back to the newest paste.
| 1 | #=============================================================================== | |
| 2 | - | # ICF-Soft Time Utility Version 1.0 |
| 2 | + | # ICF-Soft Time Utility Versión 1.0 |
| 3 | - | # For XP to Ace versions. |
| 3 | + | # Para las versiones de XP hasta Ace. |
| 4 | #------------------------------------------------------------------------------- | |
| 5 | - | # It uses game variables to store and count time. |
| 5 | + | # Usa las variables del juego para almacenar y contar el tiempo. |
| 6 | - | # Time is stored as minutes. |
| 6 | + | # El tiempo se guarda en minutos. |
| 7 | - | # Also stores date on variables and update when map changes. |
| 7 | + | # Además guarda la fecha en variables y se actualiza al cambiar de mapa. |
| 8 | #------------------------------------------------------------------------------- | |
| 9 | - | # Scripted by ICF-Soft [http://icfsoft.blogspot.com.es/] |
| 9 | + | # Hecho por ICF-Soft [http://icfsoft.blogspot.com.es/] |
| 10 | - | # Commercial use avaiable. |
| 10 | + | # Se permite el uso comercial. |
| 11 | - | # Credit to ICF-Soft. |
| 11 | + | # Se debe incluir a ICF-Soft en los créditos. |
| 12 | #=============================================================================== | |
| 13 | - | # This header must be included with script, in english or spanish. |
| 13 | + | # Esta cabecera debe incluirse en el script, ya sea en inglés o en español. |
| 14 | #=============================================================================== | |
| 15 | - | # Usage: |
| 15 | + | # Uso: |
| 16 | - | # -To store a time into a variable use ICFUTIL::GetTime(varid) |
| 16 | + | # -Para almacenar el tiempo en una variable usar ICFUTIL::GetTime(varid) |
| 17 | - | # -To check how much time has passed use ICFUTIL::GetTimeSince(varid,resid) |
| 17 | + | # -Para comprobar el tiempo que ha pasado usar ICFUTIL::GetTimeSince(varid,resid) |
| 18 | - | # -To check how much hours has passed use ICFUTIL::GetHoursSince(varid,resid) |
| 18 | + | # -Para comprobar las horas que han pasado usar ICFUTIL::GetHoursSince(varid,resid) |
| 19 | - | # -To check how much days has passed use ICFUTIL::GetDaysSince(varid,resid) |
| 19 | + | # -Para comprobar los días que han pasado usar ICFUTIL::GetDaysSince(varid,resid) |
| 20 | # | |
| 21 | - | # Params: |
| 21 | + | # Parámetros: |
| 22 | - | # -varid: the variable where store and check the time. |
| 22 | + | # -varid: la variable donde vas a almacenar o de donde compruebas el tiempo. |
| 23 | - | # -resid: the variable where store the result of time passed. If omited returns |
| 23 | + | # -resid: la variable donde almacenas el tiempo que ha pasado. Si se omite |
| 24 | - | # the value directly (for scripting purposes). |
| 24 | + | # devuelve el valor directamente (para diversos propósitos). |
| 25 | #=============================================================================== | |
| 26 | module ICFUTIL | |
| 27 | #=============================================================================== | |
| 28 | ||
| 29 | - | # Do not touch this |
| 29 | + | # No tocar esto |
| 30 | Scripts = {} unless defined? (Scripts)
| |
| 31 | Scripts["time"] = 1.0 | |
| 32 | ||
| 33 | - | # Configuration |
| 33 | + | # Configuración |
| 34 | ||
| 35 | - | # Aditional variables where store full date. Usefull for map events. |
| 35 | + | # Variables adicionales donde almacenar la fecha. Muy útil para los eventos del mapa. |
| 36 | - | # Format is [Year,Month,Day,Hour,Minute,Weekday,Month-Day]. |
| 36 | + | # El formato es [Año,Mes,Día,Hora,Minuto,Día de la semana,Mes-Día]. |
| 37 | - | # To skip a param put 0. |
| 37 | + | # Para saltar un parámetro poner 0. |
| 38 | ||
| 39 | DateVars = [6,0,0,3,2,4,5] | |
| 40 | ||
| 41 | - | # Weekday starts with sunday as 0, monday as 1 ... and saturday as 6 |
| 41 | + | # El día de la semana empieza con Domingo como 0, Lunes como 1 ... y Sábado como 6 |
| 42 | - | # Month-Day is a special format because events can use only one variable |
| 42 | + | # Mes-Día está en un formato especial porque los eventos sólo usan una variable |
| 43 | - | # per page. So it needs a combined one. Is Month*100 + Day |
| 43 | + | # por página, así que necesita una combinación. Es Mes*100 + Día |
| 44 | - | # Some Month-Day Examples: |
| 44 | + | # Algunos ejemplos: |
| 45 | - | # - 101: January 1st |
| 45 | + | # - 101: 1 de Enero |
| 46 | - | # - 102: January 2nd |
| 46 | + | # - 102: 2 de Enero |
| 47 | - | # - 201: February 1st |
| 47 | + | # - 201: 1 de Febrero |
| 48 | - | # - 211: February 11th |
| 48 | + | # - 211: 11 de Febrero |
| 49 | - | # - 1001: October 1st |
| 49 | + | # - 1001: 1 de OCtubre |
| 50 | - | # - 1010: October 10th |
| 50 | + | # - 1010: 10 de Octubre |
| 51 | ||
| 52 | #------------------------------------------------------------------------------- | |
| 53 | def self.GetTime(varid) | |
| 54 | $game_variables[varid] = Time.now.to_i / 60 | |
| 55 | end | |
| 56 | ||
| 57 | def self.GetTimeSince(varid, resid=0) | |
| 58 | return Time.now.to_i / 60 - $game_variables[varid] if resid == 0 | |
| 59 | $game_variables[resid] = Time.now.to_i / 60 - $game_variables[varid] | |
| 60 | end | |
| 61 | ||
| 62 | def self.GetHoursSince(varid, resid=0) | |
| 63 | return GetTimeSince(varid)/60 if resid == 0 | |
| 64 | $game_variables[resid] = (Time.now.to_i / 60 - $game_variables[varid])/60 | |
| 65 | end | |
| 66 | ||
| 67 | def self.GetDaysSince(varid, resid=0) | |
| 68 | return GetTimeSince(varid)/1440 if resid == 0 | |
| 69 | $game_variables[resid] = (Time.now.to_i / 60 - $game_variables[varid])/1440 | |
| 70 | end | |
| 71 | ||
| 72 | def self.GetDate | |
| 73 | $game_variables[DateVars[4]] = Time.now.min if DateVars[4] > 0 | |
| 74 | $game_variables[DateVars[3]] = Time.now.hour if DateVars[3] > 0 | |
| 75 | $game_variables[DateVars[2]] = Time.now.day if DateVars[2] > 0 | |
| 76 | $game_variables[DateVars[1]] = Time.now.month if DateVars[1] > 0 | |
| 77 | $game_variables[DateVars[0]] = Time.now.year if DateVars[0] > 0 | |
| 78 | $game_variables[DateVars[5]] = Time.now.wday if DateVars[5] > 0 | |
| 79 | $game_variables[DateVars[6]] = (Time.now.month*100 + Time.now.day) if DateVars[6] > 0 | |
| 80 | end | |
| 81 | ||
| 82 | end | |
| 83 | #=============================================================================== | |
| 84 | #=============================================================================== | |
| 85 | class Game_Map | |
| 86 | alias pre_time_setup setup | |
| 87 | def setup(map_id) | |
| 88 | pre_time_setup(map_id) | |
| 89 | ICFUTIL::GetDate() | |
| 90 | end | |
| 91 | end |