Gameday to int

From Kolmafia
Jump to navigation Jump to search

Function Syntax

int gameday_to_int()

Returns the current KoL game date using the in game calendar as an integer from 0 to 95 where "Jarlsuary 1" is 0 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.

See Also

today_to_string() | gameday_to_string() | time_to_string() | now_to_string()