Enumerated Commodities in Adv3

I feel like someone MUST have been down this path before but a quick trip through ifarchive didn’t show any relevant libraries, and I am blocking on what might be a tight, insightful search term here.

What I am looking for is an implementation of numbered commodities - Ie objects that can combine and separate mathematically without needing object-by-object code. Ideally, I’d like to have say 5 widgets that could be divided arbitrarily into 2 and 3, 4 and 1, whatever. Some could be left in one spot, others carted elsewhere. If collected up, they would sum back into their superset of 5. The numbers I want to deal with are larger than object-by-object makes sense - I am thinking of dynamically created and destroyed objects to manage.

Before I go down the path of creating such divisible/assemblable enumerated objects, has anyone seen/done this before?

2 Likes

Posted too soon! Among the interesting challenges:

  1. matching vocabulary up to the complete amount. Ie >DROP 3 WIDGETS should resolve to widgets in inventory, as long as it numbers 3 or more. Error message if not enough
  2. automatically combining amounts when in the same location
  3. automatically creating mathematically correct instances when dividing amounts
  4. disambiguation between multiple in-scope piles of amounted items

probably more than that, but that’s my starting list.

1 Like

Yes. Yes I have. It was either a nightmare or a problem-solver’s dream.

3 Likes

Not exactly what you’re talking about, but I’ve been working on something that’s kinda adjacent to what you’re talking about.

I’ve been refactoring the code I wrote for crafting systems, and specifically fiddling around with how crafting recipes are declared. And instead of having longer, all-in-one recipes I’m leaning more toward having every step involving a change be its own “recipe”, and the overall recipe just chains them together.

So for example making pancakes goes something like: put flour, milk, egg, and so on in a bowl; mix them; preheat a skillet; add the mixture around 1/4 cup at a time; cook until done on one side (bubbles will form, they’re done when they stop closing immediately); flip; cook until done on the other side.

Instead of declaring this as a all-in-one recipe, this is (now) a bunch of individual transformations: Put milk and flour in a bowl, and you get a milk-flour mix. Add the other bits and you end up with pancake batter. And so on.

This is following the line of thought that putting flour and milk together in a bowl is generally irreversible—you can’t then change your mind and just put everything back where it was.

But I think the same sorta thing could be done for what you’re taking about, only you’d need an additional “recipe” for re-separating a group of n widgets.

1 Like