I want to organize my display case

masterZ

New member
So, how do you move items around shelves with a script?
I can see there's an put_display( int, item) and take_display( int,item) but no move functio
 

Bale

Minion
After looking at managecollectionshelves.php I find myself at a loss on how to do this myself. Apparently the page uses javascript and... well, it's a bit beyond my html/java knowlege to assemble a functional visit_url().

I also have a script that puts items in the display case when I ascend and if they are the only one of their kind it might be nice if it would move them to the correct shelf. I see why masterZ wants to do this and I also would appreciate help now that I have the idea in my head.
 

Spiny

Member
Ok I tried to deduce some things using Mafia's built-in display case GUI. Turning debug on yielded the following results:

To transfer my Summer Nights onto my Shelf called Skills and Things Saving for Later:

My shelve names are currently numbered as follows:
Code:
<script>var shelves = {"0":"-none-","1":"Tiny Plastic Collection","2":"Mr. Klaw Stuffies","3":"Skills and Things Saving for Later","4":"Food, Booze, and Spleen","5":"Rockabye Bedtime","6":"Super Klaw Stuffies","7":"Eggs!","8":"Pool!"};</script>

Skills and Things Saving for Later is shelf 3. Summer Nights is Item #3244

The transfer URL was:
Code:
/managecollectionshelves.php?action=arrange&whichshelf3244=3

To transfer Zu Mannkäse Dienen in the same manner. Item #4409.:

Code:
/managecollectionshelves.php?action=arrange&whichshelf4409=3

I took a single urinal cake out of my DC. Item #1201:

Code:
/managecollection.php?action=take&whichitem1=1201&howmany1=1

To put the urinal cake into my DC:

Code:
/managecollection.php?action=put&whichitem1=1201&howmany1=1

Obviously there are CLI/ash commands to take and put from the DC already, but for thoroughness I included the URLs here.

It dawned me after doing this that transferring items between shelves don't require quantities, as all are moved to keep them together, which is why they aren't shown in the URLs. For any other people who might be having the same brain fart I did, I thought it worth mentioning :)
 
Last edited:

Bale

Minion
Great! With that information it becomes trivial to figure out the visit_url(). It will only take a little string manipulation to figure out the shelf number. (Or if it's a simple script only for my personal use I can just hardcode that.)

Code:
void display_it(int q, item i) {
	string name;
	if(q > 1)
		name = to_plural(i);
	else name = i.to_string();
	print("Display: "+q+ " "+ name+".", "blue");
	put_display(q, i);
}

foreach doodad, qty in get_inventory()
	switch(doodad) {
	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(qty, doodad);
		visit_url("managecollectionshelves.php?action=arrange&pwd&whichshelf" +to_int(doodad)+ "=2");
		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[villainous scythe]:
		display_it(qty, doodad);
		visit_url("managecollectionshelves.php?action=arrange&pwd&whichshelf" +to_int(doodad)+ "=3");
		break;
	}
That should work, though my final version will be a tiny bit more involved, saving the item names to be moved after batch_close(). Thanks, Spiny.
 

icon315

Member
Script

Ok uploaded it to make it easier for everyone
 

Attachments

  • mover.ash
    2.7 KB · Views: 39
Last edited:
Top