Registrarse

[pokeruby] RTC - determinar qué hora es

Jason

PkPower déjame poner tildes en mi nick ¬¬
Hola,
Investigando para saber si el evento del reloj (ponerle uno la hora) es o no prescindible, me topé con dos cosas:
1. Por una razón muy importante, no se puede no hacer sin más.
2. No necesitamos fijar nosotros la hora.

En resumen fui a "include/macros/event.inc" y con "Ctrl + F" busqué "time" y encontré el comando "gettime".
Código:
	@ Sets the values of variables 0x8000, 0x8001, and 0x8002 to the current hour, minute, and second. In FRLG, this command sets those variables to zero.
	.macro gettime
	.byte 0x2e
	.endm
Si miramos en "include/constants/vars.h" veremos esto:
Código:
// special vars
// They are commonly used as parameters to commands, or return values from commands.
#define VAR_SPECIAL_0     0x8000
#define VAR_SPECIAL_1     0x8001
#define VAR_SPECIAL_2     0x8002
¿Qué hacemos para saber si funciona? Pues simple, seguimos mi anterior tutorial para mostrar como texto el valor de variables numéricas y elaboramos el siguiente script sencillo:

Código:
ScriptSencillo::
	gettime
	buffernumberstring 0, VAR_SPECIAL_0
	buffernumberstring 1, VAR_SPECIAL_1
	buffernumberstring 2, VAR_SPECIAL_2
	msgbox LadyClock, 2
	end
Código:
LadyClock::
	.string "Son las {STR_VAR_1}:{STR_VAR_2}:{STR_VAR_3} horas.$"
Aquí el resultado.


PD: es necesario tener la opción del real time clock del vba activada.
 
Arriba