So I wrote my first ash script, and . . .

jim

New member
After dealing with the inevitable syntax errors and such, I got the message:
Location The Hidden Temple not found in database at line [etc.]

I didn't realize the temple was that well hidden!

The line in question was:
if (adventure(count, $location[The Hidden Temple])

What am I doing wrong?
 

Tirian

Member
You need to match the location names with the names KoLmafia uses, which you can find most easily in the "Location" drop-down list of the Adventure window. In this case, the name of the location you want is just "Hidden Temple" (and you can do it all in lowercase if you rather).

There are a few exceptions to the rule. "Pirate Cove" and "Pirate Cove In Disguise" are identical, and which one you actually get depends on whether you are wearing the outfit or not. But, on the third hand, I'm pretty sure that "Unlucky Sewer" and "Sewer With Clovers" will do different things with your disassembled clovers.
 

jim

New member
Oddly, it occurred to me to try that and I did and now I have to actually debug the semantics! Is there any kind of formatted print statement to output values?
 

jim

New member
My script is running great (you were all waiting to hear this) with the exception of:
buy(3, $item[Doc Galaktik's Pungent Unguent]);
This statement seems to fail every time. The name of the item seems to be correct, and I have enough meat. Any ideas?
 
[quote author=jim link=topic=237.msg1185#msg1185 date=1151249752]
My script is running great (you were all waiting to hear this) with the exception of:
buy(3, $item[Doc Galaktik's Pungent Unguent]);
This statement seems to fail every time. The name of the item seems to be correct, and I have enough meat. Any ideas?
[/quote]

I am glad to hear that your script is running well.

Of hand, I can not say I know why that line is failing.

What I can do is offer you an alternative - also known as a work around, that might work.

instead of:
Code:
buy(3, $item[Doc Galaktik's Pungent Unguent]);

try:
Code:
buy(3, int_to_item( 231));


It means the exact same thing, but it will rule out if there is a problem with the item name in mafias database.
 

Tirian

Member
Another option would be
Code:
cli_execute("buy 3 unguent");

since CLI will take steps to rectify incomplete item names.
 

jim

New member
So, now I want to make my script fancier. Is there a way it can accept inoput? e.g. how many adventure?

And is there any documentation for cli_execute()?

Thanks.
 
As far as I know, thee is no way to accept input.

I am not sure if there is documentation for cli_execute(), but I can tell you this:
The full command is cli_execute("[string]") where [string] is the cli command you wish to execute. (And do not forget the semicolon afterwards. ;)) All cli commands are supported.

Is there anything else you need to know?
 
Top