Gameday to int: Difference between revisions
Jump to navigation
Jump to search
imported>Bale This was in r8594, even though it was missing from the changelog. |
imported>Bale Oops. Fixed return type |
||
Line 1: | Line 1: | ||
{{ | {{ | ||
#vardefine:name|gameday_to_int}}{{ | #vardefine:name|gameday_to_int}}{{ | ||
#vardefine:return_type| | #vardefine:return_type|int}}{{ | ||
FunctionPage| | FunctionPage| |
Revision as of 08:36, 13 September 2010
Function Syntax
int gameday_to_int()
Returns the current KoL game date using the in game calendar as an integer from 1 to 95 where "Jarlsuary 1" is 1 and "Dougtember 8" is 95.
Code Samples
This code will tell you how many game days it has been since you last logged into KoL.
int last = get_property("currentLogin").to_int();
if(last == gameday_to_int())
print("You've already logged in today.");
else if((last + 1) % 96 == gameday_to_int())
print("There has been one rollover since your last login.");
else {
int interval;
if(gameday_to_int() > last)
interval = gameday_to_int() - last;
else
interval = 95 - last + gameday_to_int();
print("It has been "+interval +" days since last your login.");
}
set_property("currentLogin", gameday_to_int());
CLI Equivalent
The CLI command "moon" will also print the current game date along with other information.
Notes
The value returned prints actual game date, so it is influenced by rollover. today_to_string() is determined by your computer's own clock.