Level based area chooser

Heya

Working on a side script to burn adventures above 140 (so, if I forget to play or go away, i can script it up to play those that would have been lost due to capping.)

Am going to put in some smarts to eat/drink if available, but for now, just the basics.

but!

Code:
print("This script farms money areas, roughly based on level.");

outfit("fighting"); 

string where_to_burn ;

switch (my_level())
{
case 1:
case 2:
case 3:
case 4:
    where_to_burn = $location[Spooky Forest];
    break;
case 5:
case 6:
    outfit ("meat");
    where_to_burn = $location[Knob Goblin Treasury];
    break;
case 7:
case 8:
    outfit ("meat");
    where_to_burn = $location[Friar's Gate];
    break;
default:
    outfit ("meat");
    where_to_burn = $location[Giant's Castle];
    break;
}

print ("Adventuring at: " + where_to_burn);

use_familiar($familiar[Leprechaun]);
if(adventure(my_adventures(), where_to_burn)) {}

The error I get is:

Function 'adventure( int, string )' undefined (farm_money.ash, line 35)

Thanks!
 
The adventure function you're looking for is adventure(int, location), not adventure(int, string). Change the third line to 'location where_to_burn;' and it should work (although I have not tested it).
 

mredge73

Member
the error is how you declared where_to_burn

adventure requires a location type:
boolean adventure( int, location )
boolean adventure( int, location, string )

To Fix it declare where_to_burn as a location type instead of a string type:
location where_to_burn;

Edit: Damn Ninjas!
 

fronobulax

Developer
Staff member
Well if you look at the new and improved wiki entry for adventuring you will see that the function adventure either takes a integer and a location as parameters or an integer, location and a string. I'm guessing that you don't care about combat action filtering, so the error is that you are calling adventure with a string when it is expecting a location.

I'm not in a position to check this by running myself, but the first thing I would do would be to declare where_to_burn to be a location as in
Code:
location where_to_burn;
for the third non blank line. After that I would expect things to work.

Edit: Well no one else posted the link to the wiki ....
 
Last edited:

slyz

Developer
How's this for a helpful community?
And oooh, shiny wiki!

Since I don't want to be left out, here's a general tip when you encounter a Function 'foo' undefined error: if you were trying to use a built-in function, you can type ashref foo to find out what parameters types you need to use. It also helps you check for mistypes etc...
 

StDoodle

Minion
How's this for a helpful community?
And oooh, shiny wiki!

Thanks, we're working on making it so!

Since I don't want to be left out, here's a general tip when you encounter a Function 'foo' undefined error: if you were trying to use a built-in function, you can type ashref foo to find out what parameters types you need to use. It also helps you check for mistypes etc...

Any other suggestions for things that should be noted on the wiki would be appreciated; I'd like to make it into a one-stop-shopping guide to both KoLmafia's core & ASH, once I'm "done."
 

Ethelred

Member
You may also want to add
Code:
case 9:
immediately after
Code:
case 8:
because you can't open the Giant's Castle until you're level 10.
 
Top