Inventory cleanup script - in progress, help needed. (cleanup.ash)

Equestrian

New member
Here's the thread in the KoL forums.

Anyways, what this is is an inventory cleanup script, designed to be used at the end of each ascension. It autosells some items, mallsells, some items, and dumps some in your DC. All this needs right now is for more items to be added to it; however, it appears that this could be combined with a queueing script (DisplayAdd.ash) to make it more database-friendly. I've attempted combine the two scripts (cleanup2.ash), but even after I've read about maps and keys, I still have no idea how I'm supposed to do it. Cleanup2.ash only has very limited functionality, and when I run it when nothing on the autosell list is in my inventory, it gives me an error, stating that "item []" is not in the database.

I have a very limited understanding of why this is happening, which is to say I'm completely baffled. Can someone help me out with this? If you're going to make changes, I'd appreciate it if you'd make changes in cleanup.ash instead of cleanup2.ash. Thanks in advance.
 

Attachments

  • cleanup.ash
    30.1 KB · Views: 109
  • cleanup2.ash
    25.5 KB · Views: 75
  • DisplayAdd.ash
    1.2 KB · Views: 68

macman104

Member
You are getting that issue, because like you said if you don't have any of those items, then your command that will get execute is "autosell", but there is no item after that. You can avoid this issue by changing
Code:
	cli_execute(autosell);
	cli_execute(mallsell);
	cli_execute(display);
to
Code:
	if(autosell != "autosell ")
	{
		cli_execute(autosell);
	}
	if(mallsell != "mallsell ")
	{
		cli_execute(mallsell);
	}
	if(display != "display put ")
	{
		cli_execute(display);
	}
This will only run the command if the initial string has been altered. That error is just because you are trying to run an empty command.
 

Atan

New member
This script is not working for me on Mafia v5592. Mallsell from the script gives an "Unexpected error". Copy-pasting a shorter mallsell command and fiddling in the cli showed me that on this (the latest as of this post) version of mafia, mallsell doesn't accpt a comma-separated list unless a space is added after each comma. However, adding the comma in the script leads to a different error message: "For input string: "-224-16-931216313022""

My temporary change in the script code:
mallsell = mallsell + mallsell_queue[item] + " " + item + ", ";
(space after comma)

The full result:
[color=goldenrod]> Executing: mallsell 1 brain-meltingly-hot chicken wings, 2 brown sugar cane, 2 cactus fruit, 4 can-shaped gelatinous cranberry sauce, 1 candied yams, 6 extra-spicy bloody mary, 9 fishy fish casserole, 3 flute of flat champagne, 1 green candy heart, 2 green snowcone, 1 herbal stuffing, 6 hot wad, 3 jumbo olive, 1 large cocoa eggshell fragment, 30 sleaze wad, 2 tofurkey gravy, 2 tofurkey leg,[/color]
[color=red]For input string: "-224-16-931216313022"[/color]


Result without the extra space:
[color=goldenrod]> Executing: mallsell 1 brain-meltingly-hot chicken wings,2 brown sugar cane,2 cactus fruit,4 can-shaped gelatinous cranberry sauce,1 candied yams,6 extra-spicy bloody mary,9 fishy fish casserole,3 flute of flat champagne,1 green candy heart,2 green snowcone,1 herbal stuffing,6 hot wad,3 jumbo olive,1 large cocoa eggshell fragment,30 sleaze wad,2 tofurkey gravy,2 tofurkey leg,[/color]
Unexpected error, debug log printed.
KoLmafia is done cleaning up your inventory.

(debug log attached just in case)

But then, I'm neither an expert of ash nor of mafia, so I might have screwed something up before....
 

Attachments

  • DEBUG_20080122.txt
    12.1 KB · Views: 59

Veracity

Developer
Staff member
[quote author=Atan link=topic=1463.msg6783#msg6783 date=1201025153]
This script is not working for me on Mafia v5592. Mallsell from the script gives an "Unexpected error". Copy-pasting a shorter mallsell command and fiddling in the cli showed me that on this (the latest as of this post) version of mafia, mallsell doesn't accpt a comma-separated list unless a space is added after each comma. However, adding the comma in the script leads to a different error message: "For input string: "-224-16-931216313022""[/quote]
That string is your entire input list with the letters removed...

I was unable to reproduce that error, but I just checked in revision 5593, which doesn't require any spaces around commas in the mallsell command.
 
I might be able to help you get past all the errors. Holatuwol re-wrote what I was trying to do at one point, and I cannot find the topic on here right now, but this is a modified version. The basics are still there.

item_cleanup.ash is the script,

item_cleanup.txt is the data map containing a list of all the items, and what to do with them. the format is:

Code:
(item name)	(what to do with it)
separated by tabs Something like:

pile of candy use
penultimate fantasy chest use
large box use
small box use
Frozen Mob Penguin use
Fruit basket use
Warm Subject gift certificate use

Valid options for what to do with the items:

  • [li]use: use the item (warm subject gift certificates etc)[/li]
    [li]display_items: Put it in your DC[/li]
    [li]mallsell: Put it in your mall store (price will not be set)[/li]
    [li]crush: pulverize it[/li]
    [li]autosell: of course![/li]

Has worked very well since the day Holatuwol wrote it. You will only need to modify item_cleanup.txt to make it handle the items your way.

edit



[quote author=Atan link=topic=1463.msg6783#msg6783 date=1201025153]
This script is not working for me on Mafia v5592. Mallsell from the script gives an "Unexpected error". Copy-pasting a shorter mallsell command and fiddling in the cli showed me that on this (the latest as of this post) version of mafia, mallsell doesn't accpt a comma-separated list unless a space is added after each comma. However, adding the comma in the script leads to a different error message: "For input string: "-224-16-931216313022""

My temporary change in the script code:
mallsell = mallsell + mallsell_queue[item] + " " + item + ", ";
(space after comma)

The full result:
[color=goldenrod]> Executing: mallsell 1 brain-meltingly-hot chicken wings, 2 brown sugar cane, 2 cactus fruit, 4 can-shaped gelatinous cranberry sauce, 1 candied yams, 6 extra-spicy bloody mary, 9 fishy fish casserole, 3 flute of flat champagne, 1 green candy heart, 2 green snowcone, 1 herbal stuffing, 6 hot wad, 3 jumbo olive, 1 large cocoa eggshell fragment, 30 sleaze wad, 2 tofurkey gravy, 2 tofurkey leg,[/color]
[color=red]For input string: "-224-16-931216313022"[/color]


Result without the extra space:
[color=goldenrod]> Executing: mallsell 1 brain-meltingly-hot chicken wings,2 brown sugar cane,2 cactus fruit,4 can-shaped gelatinous cranberry sauce,1 candied yams,6 extra-spicy bloody mary,9 fishy fish casserole,3 flute of flat champagne,1 green candy heart,2 green snowcone,1 herbal stuffing,6 hot wad,3 jumbo olive,1 large cocoa eggshell fragment,30 sleaze wad,2 tofurkey gravy,2 tofurkey leg,[/color]
Unexpected error, debug log printed.
KoLmafia is done cleaning up your inventory.

(debug log attached just in case)

But then, I'm neither an expert of ash nor of mafia, so I might have screwed something up before....
[/quote]

see the extra comma? the one with no item beyond it (after tofurkey leg)? Well that is probably the problem...kolmafia expects another item beyond the comma. This issue is addressed in the script I posted.
 

Attachments

  • item_cleanup.txt
    9.7 KB · Views: 257
  • item_cleanup.ash
    1.4 KB · Views: 80

Atan

New member
[quote author=efilnikufecin link=topic=1463.msg6788#msg6788 date=1201044515]
I might be able to help you get past all the errors. Holatuwol re-wrote what I was trying to do at one point, and I cannot find the topic on here right now, but this is a modified version. The basics are still there.
[/quote]

I downloaded your script, and had to change the "itemset" types into "int [item]" types to make it work. But after that, it was perfect! And I really like to see the item definitions in a completely separate file from the script itself. I might at some point try to modify this so that different item definition files are used for different characters, which I find would be a useful extra customisation possibility. In any case, thanks a lot for digging that script from wherever it was buried. And yes, the extra comma seems to have been the main problem in Equestrian's script, fixable right there as per your example (I still prefer yours, though, for the separate file design).
 

Equestrian

New member
I tried adding some Pulverize functionality. The script attempts to add it to the pulverize queue if you have the skill, if you don't it adds it to the autosell queue. However, when I run the script (attatched), I get an error:

Unknown variable 'pulverize' (cleanup.ash, line 89)

I don't think I should be getting this.
 

Attachments

  • cleanup.ash
    26.7 KB · Views: 70

Veracity

Developer
Staff member
Try putting that if statement inside the block where the variable is defined, rather than outside the function.
 
[quote author=Equestrian link=topic=1463.msg6793#msg6793 date=1201054023]
I tried adding some Pulverize functionality. The script attempts to add it to the pulverize queue if you have the skill, if you don't it adds it to the autosell queue. However, when I run the script (attatched), I get an error:

Unknown variable 'pulverize' (cleanup.ash, line 89)

I don't think I should be getting this.
[/quote]

Sorry about that, itemset was declared in another file which I removed to simplify it. The original scripts (there were 3 or 4) would keep huge logs of everything coming to the account using the pulverize command and use command. A lot of people do not want that functionality, and those logs began to fragment very badly on my computer. I fixed the problem above, and re-uploaded, but it looks like the Original Poster has got their own script working now so doesn't matter much anyway. :) I wasn't intending to snipe the topic, just wanted to help them either fix what they had, or get something going that does what they wanted :)
 

xxmatt3232xx

New member
efilnikufecin, is there a way to edit your script so that the pulverize command sent the items to wadbot? i know very little about ash or i would do it myself

taking a look at the item_cleanup.ash you might be able to do it by just changing
Code:
crush_items.do_dump( "pulverize " );

would
Code:
crush_items.do_dump( "send " + " to wadbot" );
work?

also since when sending items to someone through a script mafia adds a message to the body which confuses wadbot and causes him to send you back your items. So you would also have to tell it not to put anything in the body or put "pulverize" as the body. The cli command for this is:
Code:
send * twinkly nugget to wadbot || pulverize
 
Last edited:
Top