Feature - Implemented Improve ASH batching

Veracity

Developer
Staff member
ASH lets you do the following:

batch_open();
take_closet( item1 );
take_closet( item2);
batch_close();

at which point, a single command is submitted to the CLI:

closet take item1, item2

batching works for many ASH functions that are implemented in terms of CLI commands. In particular, it will batch commands of the general form:

<command> <prefix> <rest>

While you are batching, multiple functions that go to the same <command> are saved up until you do batch_close. The catch is, it currently only saves up a single <prefix>; you can batch multiple "closet take" commands, but if you mix in a "closet put", it is executed immediately.

It doesn't have to be that way. It should allow multiple commands (as now) and also multiple prefixes within each command, so that when you do batch_close(), all your "closet take" will be grouped together AND all your "closet put" will be grouped together.
 

Veracity

Developer
Staff member
Revision 13272 does this.

Code:
boolean [item] starteritems;

foreach it in $items[seal-skull helmet, seal-clubbing club, helmet turtle, turtle totem, ravioli hat, pasta spoon, Hollandaise helmet, saucepan, disco mask, disco ball, mariachi hat, stolen accordion, old sweatpants] {
    if (item_amount(it) > 0)
	starteritems[ it ] = true;
}

batch_open();
print( "batchopen" );
foreach it in starteritems
    put_closet(1, it);
print( "put closet done" );
foreach it in starteritems
    take_closet(1, it);
print( "take closet done" );
print( "batchclose" );
batch_close();
yields:

> sgtest

batchopen
put closet done
take closet done
batchclose
Placing items into closet (request 1 of 13)...
Placing items into closet (request 2 of 13)...
Placing items into closet (request 3 of 13)...
Placing items into closet (request 4 of 13)...
Placing items into closet (request 5 of 13)...
Placing items into closet (request 6 of 13)...
Placing items into closet (request 7 of 13)...
Placing items into closet (request 8 of 13)...
Placing items into closet (request 9 of 13)...
Placing items into closet (request 10 of 13)...
Placing items into closet (request 11 of 13)...
Placing items into closet (request 12 of 13)...
Placing items into closet (request 13 of 13)...
Removing items from closet (request 1 of 13)...
You acquire an item: disco ball
Removing items from closet (request 2 of 13)...
You acquire an item: disco mask
Removing items from closet (request 3 of 13)...
You acquire an item: helmet turtle
Removing items from closet (request 4 of 13)...
You acquire an item: Hollandaise helmet
Removing items from closet (request 5 of 13)...
You acquire an item: mariachi hat
Removing items from closet (request 6 of 13)...
You acquire an item: old sweatpants
Removing items from closet (request 7 of 13)...
You acquire an item: pasta spoon
Removing items from closet (request 8 of 13)...
You acquire an item: ravioli hat
Removing items from closet (request 9 of 13)...
You acquire an item: saucepan
Removing items from closet (request 10 of 13)...
You acquire an item: seal-clubbing club
Removing items from closet (request 11 of 13)...
You acquire an item: seal-skull helmet
Removing items from closet (request 12 of 13)...
You acquire an item: stolen accordion
Removing items from closet (request 13 of 13)...
You acquire an item: turtle totem
Requests complete.
 
Top