Difference between revisions of "Total free rests"

From Kolmafia
Jump to navigation Jump to search
imported>Fluxxdog
(Creation)
 
imported>Bale
(add category, seealso and formatting help)
Line 3: Line 3:
 
#vardefine:return_type|int}}
 
#vardefine:return_type|int}}
  
==Function Syntax==
+
{{FunctionPage|
{{Function|
+
name={{#var:name}}|
name=total_free_rests|
 
return_type=int|
 
}}This function will the total number of free rests available to your character. These rest can come from multiple sourses, such as skills or familiars.<br>
 
This can be compared against the preference ''timesRested'' to see how many free rests you have remaining.|
 
  
{{CodeSample|
+
function1={{Function|
 +
name={{#var:name}}|
 +
aggregate={{#var:aggregate}}|
 +
return_type={{#var:return_type}}|
 +
return_also={{#var:return_also}}|
 +
}}|
 +
 
 +
function_description=This function will the total number of free rests available to your character. These rests can come from multiple sources, such as skills or familiars.</p>
 +
<p>This can be compared against the preference ''timesRested'' to see how many free rests you have remaining.|
 +
 
 +
code1={{CodeSample|
 
title=Code Sample|
 
title=Code Sample|
 
description=Show how many free rests you have remaining.|
 
description=Show how many free rests you have remaining.|
Line 17: Line 23:
 
int rests_used=get_property("timesRested").to_int();
 
int rests_used=get_property("timesRested").to_int();
 
int rests_left=total_free_rests()-rests_used;
 
int rests_left=total_free_rests()-rests_used;
print("You have "+rests_left+" remaining");
+
print("You have "+rests_left+" remaining.");
</syntaxhighlight>
+
</syntaxhighlight>}}|
 +
 
 +
see_also={{SeeAlso|my_adventures|have_skill}}|
 
}}
 
}}
 +
 +
[[Category:Your Character]]

Revision as of 22:10, 26 November 2014


Function Syntax

int total_free_rests()

This function will the total number of free rests available to your character. These rests can come from multiple sources, such as skills or familiars.

This can be compared against the preference timesRested to see how many free rests you have remaining.

Code Sample

Show how many free rests you have remaining.

int rests_used=get_property("timesRested").to_int();
int rests_left=total_free_rests()-rests_used;
print("You have "+rests_left+" remaining.");

See Also

my_adventures() | have_skill()