My adventures: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Heeheehee
m Minor fix because wiki-formatting is retarded. >.<
imported>Bale
mNo edit summary
 
(One intermediate revision by one other user not shown)
Line 5: Line 5:
FunctionPage|
FunctionPage|
name={{#var:name}}|
name={{#var:name}}|
function_category=Your Character|


function1={{Function|
function1={{Function|
Line 22: Line 21:
<syntaxhighlight>
<syntaxhighlight>
adventure(my_adventures() , $location[giant's castle]);
adventure(my_adventures() , $location[giant's castle]);
</syntaxhighlight>}}|
</syntaxhighlight>}}
 
{{CodeSample|
code2={{CodeSample|
description=Checking to see if you have adventures left before doing something:|
description=Checking to see if you have adventures left before doing something:|
code=
code=
<syntaxhighlight>
<syntaxhighlight>
if (my_adventures() == 0) abort("You can't run this script without adventures.");
if (my_adventures() == 0) abort("You can't run this script without adventures.");
</syntaxhighlight>}}|
</syntaxhighlight>}}
 
{{CodeSample|
code3={{CodeSample|
description=Making sure you have enough adventures to perform a set of actions:|
description=Making sure you have enough adventures to perform a set of actions:|
code=
code=
Line 37: Line 34:
location farming_location = $location[giant's castle];
location farming_location = $location[giant's castle];
while (my_adventures() >= 4) {
while (my_adventures() >= 4) {
</syntaxhighlight>
<syntaxhighlight>
   if (use(1 , $item[dance card])) {
   if (use(1 , $item[dance card])) {
       adventure(3 , farming_location);
       adventure(3 , farming_location);
Line 49: Line 44:
special=When not logged in, this function returns 0.
special=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.