Gameday to int: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Bale
r8942 & r8944 adds time_to_string() and now_to_string()
imported>Bale
m markup fix
 
Line 38: Line 38:
}}
}}
== Notes ==
== 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.
The value returned prints actual game date, so it is influenced by rollover. {{f|today_to_string}} is determined by your computer's own clock.
{{SeeAlso|today_to_string|gameday_to_string|time_to_string|now_to_string}}
{{SeeAlso|today_to_string|gameday_to_string|time_to_string|now_to_string}}


[[Category:Miscellaneous Functions]]
[[Category:Miscellaneous Functions]]

Latest revision as of 08:56, 27 April 2011

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()