Turns played

From Kolmafia
Revision as of 07:14, 22 November 2015 by imported>Eliteofdelete (Fixed some types in the code sample)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function Syntax

int turns_played()

This function returns the total number of adventures used thus far by the logged-in character during the current ascension.

This exactly duplicates the function my_turncount(). Indications are that it was added as part at attempt to support semirare counters, but nothing ever came of it. Oops. Discussion here.

Code Samples

The following example is a function that saves relevant ascension info into a text file called "Ascension History" located in Data. It should be called after, and only after, the Naughty Sorc was defeated.

void ascension_tracker() {
   if (get_property("questL13Final") == "finished") {
      string[int] info;
      string class2;
      if (my_class() == $class[Accordion Thief])
         class2 = "an Accordion Thief";
         class2 = "a "+my_class()+"";
      file_to_map("Ascension History.txt", info);   
      string ascension_tracker = ""+my_name()+" completed a "+my_turncount()+" adventure ascension in "+my_daycount()+" days as "+class2+" with path "+my_path()+" on "+now_to_string("MM/dd/yyyy")+".";
      print(ascension_trackr, "green");
      info [count(info)] = ascension_tracker;
      map_to_file(info, "Ascension History.txt", false);
//Insert Code to kill Naughty Sorc, or kill her by hand
//Call ascension_tracker

See Also



When not logged in, this function returns 0.