Difference between revisions of "Turns played"

From Kolmafia
Jump to navigation Jump to search
imported>Eliteofdelete
imported>Eliteofdelete
(Fixed some types in the code sample)
 
Line 31: Line 31:
 
       file_to_map("Ascension History.txt", info);   
 
       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")+".";
 
       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_track, "green");
+
       print(ascension_trackr, "green");
       info [count(info)] = eod_ascension_tracker;
+
       info [count(info)] = ascension_tracker;
 
       map_to_file(info, "Ascension History.txt", false);
 
       map_to_file(info, "Ascension History.txt", false);
 
   }
 
   }

Latest revision as of 07:14, 22 November 2015

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";
      else
         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
ascension_tracker();

See Also

my_turncount()

Special

When not logged in, this function returns 0.