version 9 by Jon Ingold
- Example: * A Basic Holdall - Skeleton code for a working holdall.
- Example: *** Tomb Raider - An adventurer, with one backpack of varying size and a thigh-holster that
For a long time now, Inform games have provided a "stashing" mechanism, to aid kleptomaniac players with limited carrying capacities take as much as possible with a single TAKE ALL command. This mechanism frees up space in the player's hands by moving something already carried into the "player's holdall". Considerate Holdall is designed to make this mechanism more intelligent, so that less-recently used items are stashed before recently-used items. It also allows for multiple holdalls, and offers some flexibility over what will be automatically stashed into which.
The extension's primary work - stashing neglected items first - will happen merely by including the extension and providing a holdall. Furthermore, the extension allows us to declare some objects "never stashable" - good for pet dogs, flaming torches and so forth. The idea of this tag is to minimise the number of times the games automatic stashing fails due to the game making poor choices.
Other objects can be declared "stashable" if they are - regardless of circumstance - good for stashing. For the third case (the most frequent) there is a rulebook to decide whether an object can be stashed.
A stashing rule for the burning torch: disallow stashing.
A stashing rule for a lit thing: disallow stashing.
A stashing rule for an animal (called the pet in question):
if the pet in question is the lizard, allow stashing; otherwise disallow stashing.
These rules can reference the "considered holdall" if necessary, if there are limitations on where certain objects can go (see the example).
Possibly less usefully, the extension also provides a rulebook for choosing viable holdall's into which to stash. By default, this precludes closed or full rucksacks, and ensures that a player who types TAKE ALL FROM RUCKSACK will not find himself putting things back into the rucksack to make more room! Should more rules be needed, the holdall rules follow the same format as the stashing rules.
A holdall rule for a burning player's holdall: disallow stashing.
By default, any carried holdall and any carried object are viable for stashing. Note that this rulebook is _not_ a sensible place to put a default-opening rule: these rules are about the possibility of stashing somewhere - the remaining code may yet reject any particular holdall in favour of another one.