Difference between revisions of "My adventures"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
m
imported>StDoodle
m
Line 5: Line 5:
 
}}
 
}}
  
This function returns the logged-in character's amount of remaining adventures as an [[int]].  Common uses include 1) spending all of your adventures in one place:
+
This function returns the logged-in character's amount of remaining adventures as an [[int]].  Common uses include:
 
+
1) spending all of your adventures in one place:
 
<code>
 
<code>
 
   [[adventure()|adventure]]([[my_adventures()]],$[[location]][giant's castle]);
 
   [[adventure()|adventure]]([[my_adventures()]],$[[location]][giant's castle]);
Line 12: Line 12:
  
 
2) Checking to see if you can adventure before doing something:
 
2) Checking to see if you can adventure before doing something:
 
 
<code>
 
<code>
 
   if ([[my_adventures()]] == 0) [[abort()|abort]]("You can't run this script without adventures.");
 
   if ([[my_adventures()]] == 0) [[abort()|abort]]("You can't run this script without adventures.");

Revision as of 20:52, 22 February 2010

[[Data Types#{{{return_type}}}|{{{return_type}}}]] my_adventures()


This function returns the logged-in character's amount of remaining adventures as an int. Common uses include: 1) spending all of your adventures in one place:

  adventure(my_adventures(),$location[giant's castle]);

2) Checking to see if you can adventure before doing something:

  if (my_adventures() == 0) abort("You can't run this script without adventures.");

And 3) making sure you have enough adventures to perform a set of actions:

while (my_adventures() >= 4) {
  if (use(1,$item[dance card])) {
    adventure(3,$location[Haunted Gallery]);
    adventure(1,$location[Haunted Ballroom]);
  } else break;
}

When not logged in, this function returns 0.