Last known item number?

caphector

Member
Is there a way to pull the last known item number programmatically? I'm working on a script that iterates through all items and throws them in my DC if they aren't in there, but I'd like to avoid having to update it as item numbers continue increasing.

I don't see a way to pull the last item number or stop at the last known-existing item.
 

Bale

Minion
I think you want to do something like this...


Code:
foreach doodad in $items[]
   if(is_displayable(doodad) && display_amount(doodad) == 0)
      put_display(1, doodad);

KoLmafia provides $items[] as a map of all known items in the game.
 

lostcalpolydude

Developer
Staff member
Code:
foreach it in $items[]
{
	if ( display_amount( it ) == 0 )
	{
		put_display( 1, it );
	}
}
You need some other checking, like whether it can be put in your display case and whether you have the item, but the key thing there is that $items[] is an array of all items that mafia knows about.
 

caphector

Member
That's so obvious now that it's been pointed out. I was able to slot the foreach directly into my existing script and it works perfectly. Thanks!
 

fronobulax

Developer
Staff member
Is there a way to pull the last known item number programmatically? I'm working on a script that iterates through all items and throws them in my DC if they aren't in there, but I'd like to avoid having to update it as item numbers continue increasing.

I don't see a way to pull the last item number or stop at the last known-existing item.

You might be interested in DCQuest which will tell what you have in inventory but not in the DC. it will not automatically move stuff just because I have some +adv gear that is worth more to me as pajamas than in my DC and I have not invested the meat to get duplicates. A side effect of DCQuest is a file with items that exist but you do not have in your DC. I have an unpublished script that will buy things on that list that can be bought. it is unpublished because it has a couple if annoyances I have not ironed out but I can share if there is interest.
 
Top