Spielerando

Add items to a bag by filling stacks, then empty slots, and report the rest

Picking up 25 potions when the bag has two half-full stacks should not delete five of them or create a stack of 25. This entry fills the right places in the right order and tells you what did not fit, so nothing silently disappears.

Why this works

Players trust a bag when nothing ever disappears. Filling partly used stacks before empty slots saves space, and always reporting what did not fit lets the game decide where the rest goes instead of losing it silently.

When not to use it

Do not stack items that differ in ways players care about, such as quality, wear or an owner's mark. Merging them hides the difference. Keep such pieces as single items, each in its own slot.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 4 common mistakes and the fix
  • 28 lines of example code with 3 checks that pass
  • How your AI shows you that it works

Say this to your AI

Use the Spielerando entry "Add items to a bag by filling stacks, then empty slots, and report the rest" (read_entry stack-items-and-split-the-overflow) in my game. Build it step by step, and show me how you checked that it works.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP