My adventures: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Zarqon
m more links
imported>Bale
mNo edit summary
 
(10 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[[int]] [[my_adventures()]]
{{
#vardefine:name|my_adventures}}{{
#vardefine:return_type|int}}{{


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:
FunctionPage|
name={{#var:name}}|


<code>
function1={{Function|
  [[adventure()|adventure]]([[my_adventures()]],$[[location]][giant's castle]);
name={{#var:name}}|
</code>
aggregate={{#var:aggregate}}|
return_type={{#var:return_type}}|
return_also={{#var:return_also}}|
}}|


2) Checking to see if you can adventure before doing something:
function_description=Returns the logged-in character's number of adventures remaining.|


<code>
code1={{CodeSample|
  if ([[my_adventures()]] == 0) abort("You can't run this script without adventures.");
title=Code Samples|
</code>
description=Using this function to spend all of your adventures farming the Castle:|
code=
<syntaxhighlight>
adventure(my_adventures() , $location[giant's castle]);
</syntaxhighlight>}}
{{CodeSample|
description=Checking to see if you have adventures left before doing something:|
code=
<syntaxhighlight>
if (my_adventures() == 0) abort("You can't run this script without adventures.");
</syntaxhighlight>}}
{{CodeSample|
description=Making sure you have enough adventures to perform a set of actions:|
code=
<syntaxhighlight>
location farming_location = $location[giant's castle];
while (my_adventures() >= 4) {
  if (use(1 , $item[dance card])) {
      adventure(3 , farming_location);
      adventure(1 , $location[Haunted Ballroom]);
  } else break;
}
</syntaxhighlight>}}|


And 3) making sure you have enough adventures to perform a set of actions:
see_also={{SeeAlso|adventure|use}}|
 
special=When not logged in, this function returns 0.
<code>
}}
while ([[my_adventures()]] >= 4) {
  if ([[use()|use]](1,$[[item]][dance card])) {
    [[adventure()|adventure]](3,$[[location]][Haunted Gallery]);
    [[adventure()|adventure]](1,$[[location]][Haunted Ballroom]);
  } else break;
}</code>
[[Category:Your Character | My adventures()]]
[[Category:Ash Functions |My adventures()]]


When not logged in, this function returns 0.
[[Category:Your Character]]

Latest revision as of 21:32, 21 May 2010

Function Syntax

int my_adventures()

Returns the logged-in character's number of adventures remaining.

Code Samples

Using this function to spend all of your adventures farming the Castle:

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

Checking to see if you have adventures left before doing something:

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

Making sure you have enough adventures to perform a set of actions:

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

See Also

adventure() | use()

Special

When not logged in, this function returns 0.