Display Case Commands

Darzil

Developer
Is there an Ash (or command line) command to move an item between shelves in a display case ?

I'd like to write a pair of scripts that I can run that'll move a list of items from my inventory to my display case, on specific shelves, and that'll take them out again. The idea is to enable me to keep a categorised set of items from events, whilst still letting me use them in aftercore, without having to manually move them around each time.
 

Bale

Minion
Nothing in ASH or CLI to move shelves, but it be done with visit_url(). Fortunately I have an example for you about how to do it. An excerpt from my preAscensionScript...

Code:
void search_displayables() {
	if(my_name() != "bale") return;
	
	int [item] shelving;
	void shelve() {
		if(count(shelving) > 0) {
			string reshelf = "managecollectionshelves.php?action=arrange&pwd";
			foreach it, s in shelving
				reshelf += "&whichshelf" +to_int(it)+ "="+s;
			print("Reshelving collection.", "blue");
			visit_url(reshelf);
		}
	}

	void display_it(int q, item it) {
		print("Display: "+q+ " "+ (q> 1? to_plural(it): to_string(it)) +".", "blue");
		put_display(q, it);
	}

	void display_it(int q, item it, int shelf) {
		display_it(q, it);
		if(shelf >= 0)
			shelving [it] = shelf;
	}

	batch_open();
	
	foreach doodad in get_inventory() if(is_displayable(doodad))
		switch(doodad) {
		case $item[gift-a-pult]:
		case $item[The Necbromancer's Hat]:
		case $item[The Necbromancer's Shorts]:
		case $item[The Necbromancer's Stein]:
		case $item[The Necbromancer's Wizard Staff]:
		case $item[Uncle Hobo's belt]:
		case $item[Uncle Hobo's epic beard]:
		case $item[Uncle Hobo's tinsel gloves]:
		case $item[Uncle Hobo's gift baggy pants]:
		case $item[Uncle Hobo's highest bough]:
		case $item[Uncle Hobo's stocking cap]:
			display_it(item_amount(doodad), doodad, 2);
			break;
		case $item[Chester's Aquarius medallion]:
		case $item[Chester's bag of candy]:
		case $item[Chester's cutoffs]:
		case $item[Chester's moustache]:
		case $item[Chester's muscle shirt]:
		case $item[Chester's sunglasses]:
		case $item[Frosty's arm]:
		case $item[Frosty's carrot]:
		case $item[Frosty's iceball]:
		case $item[Frosty's nailbat]:
		case $item[Frosty's old silk hat]:
		case $item[Frosty's snowball sack]:
		case $item[Hodgman's almanac]:
		case $item[Hodgman's bow tie]:
		case $item[Hodgman's cane]:
		case $item[Hodgman's disgusting technicolor overcoat]:
		case $item[Hodgman's garbage sticker]:
		case $item[Hodgman's harmonica]:
		case $item[Hodgman's imaginary hamster]:
		case $item[Hodgman's lobsterskin pants]:
		case $item[Hodgman's lucky sock]:
		case $item[Hodgman's metal detector]:
		case $item[Hodgman's porkpie hat]:
		case $item[Hodgman's varcolac paw]:
		case $item[Hodgman's whackin' stick]:
		case $item[Ol' Scratch's ash can]:
		case $item[Ol' Scratch's infernal pitchfork]:
		case $item[Ol' Scratch's manacles]:
		case $item[Ol' Scratch's ol' britches]:
		case $item[Ol' Scratch's stove door]:
		case $item[Ol' Scratch's stovepipe hat]:
		case $item[Oscus's dumpster waders]:
		case $item[Oscus's flypaper pants]:
		case $item[Oscus's garbage can lid]:
		case $item[Oscus's neverending soda]:
		case $item[Oscus's pelt]:
		case $item[Staff of the Deepest Freeze]:
		case $item[Wand of Oscus]:
		case $item[Zombo's empty eye]:
		case $item[Zombo's grievous greaves]:
		case $item[Zombo's shield]:
		case $item[Zombo's shoulder blade]:
		case $item[Zombo's skull ring]:
		case $item[Zombo's skullcap]:
			display_it(item_amount(doodad), doodad, 3);
			break;
		case $item[baneful bandolier]:
		case $item[caustic slime nodule]:
		case $item[corroded breeches]:
		case $item[corrosive cowl]:
		case $item[diabolical crossbow]:
		case $item[grisly shield]:
		case $item[hardened slime belt]:
		case $item[hardened slime hat]:
		case $item[hardened slime pants]:
		case $item[malevolent medallion]:
		case $item[pernicious cudgel]:
		case $item[slime-covered club]:
		case $item[slime-covered compass]:
		case $item[slime-covered greaves]:
		case $item[slime-covered helmet]:
		case $item[slime-covered lantern]:
		case $item[slime-covered necklace]:
		case $item[slime-covered shovel]:
		case $item[slime-covered speargun]:
		case $item[slime-covered staff]:
		case $item[villainous scythe]:
			display_it(item_amount(doodad), doodad, 4);
			break;
		default:
			if(display_amount(doodad) > 0)
				display_it(item_amount(doodad), doodad);
		}
	
	batch_close();
	shelve();
}
 

Darzil

Developer
Is there an ash command to refresh the display case?

Have got something working, but the display case in mafia doesn't change til you move an item in or out another way.
 

Veracity

Developer
Staff member
No.

We are supposed to notice requests that manipulate the display case and update our state. Perhaps that is not working correctly.
 

Darzil

Developer
Anything I can do to help pinpoint the issue? It doesn't update when I'm using take_display() and put_display().

When I move things using the GUI, I see in the CLI Placing items in display case, or Removing items from display case, followed by Updating display case (and the case updates).

Using a batched (or unbatched) take_display() or put_display() (or moving to shelf with visit_url()) I see the Placing items in display case or removing items from display case, but not the updating display case.

Script is here : http://kolmafia.us/showthread.php?11568-Display-Shelver-and-Unshelver
 

Bale

Minion
We are supposed to notice requests that manipulate the display case and update our state. Perhaps that is not working correctly.

If you highlight an item in the item manager and click the "put in closet" button, it fails to update the display case. I have noticed that in the past. Now I try to use the display case manager which always updates the dc appropriately,
 

lostcalpolydude

Developer
Staff member
The display case manager apparently uses 2 separate server hits, with the second one actually refreshing everything there. There is code to move items between the inventory and display case lists just from transferring an item, but apparently that isn't working right.
 

Veracity

Developer
Staff member
The display case code is old and complicated. We know a lot more now about how to write a request class that works correctly either when called internally or when invoked externally than when that was first written.

The display case is additionally complicated in that it's not just a single "place" that you put stuff into or take stuff out of; it has a number of shelves. It's like a place with sub-places.

The code could stand a long, hard look. With associated bug-fixing. :)
 

Darzil

Developer
Nothing in ASH or CLI to move shelves, but it be done with visit_url(). Fortunately I have an example for you about how to do it. An excerpt from my preAscensionScript...

Thanks for the help, pushed me to write my first ash script, and I can now move around 120 useful items from my inventory to the right shelves in my display case in a few seconds with one script, and back again with another.
 
Top