A typical bin in the items.dat looks like this:
#name ID min max flags bin's cog fists 1 0 1 0x024 cog=weap_fists.cogBin properties:
Name
Bin ID
Min
Max
Flags
Cog
Available
Activated
Bins don't have to be in order of number, and you can skip numbers. I.e., you
could create bin 120 in the middle of the items.dat and it would work correctly (though your hotkeys may be messed up).
The Minimum Value
The minimum value of a bin is the amount that you will always have in it. So if you set the minimum of bin 60 to 100, then you
would always have 100 shields. SetInv() and ChangeInv() cannot
set the value of a bin below the minimum of a bin.
Say a bin has a minimum of 10 and a current value of 20. When SetInv() sets the value of that bin to 0, the value of the bin
will be reduced to 10 because the bin value cannot be set below the minimum. Use GetInvMin()
to return the minimum bin value.
The Maximum Value
The maximum value is the most you can have in a bin. If SetInv() or ChangeInv()
tries to set the value of the bin over its max limit, then the bin will be given the maximum value. Use GetInvMax()
to return the maximum bin value.
The Flags of a Bin
A bin's flags tell the engine whether the bin is a hotkey, force power, weapon, or item and decide what messages the bin should
receive. These flags are optional. A bin with only placeholder flags (0x000) will simply hold a value. Use SetInvFlags()
to set a bin's flags through Cog. Read the Inventory Flags
document in the Flags section for a description of each flag.
A Bin's Cog
A bin's cog performs a different function depending on the flags of the bin. If the bin is flagged as a weapon, then the cog will
act as a weapon cog and process messages like selected, deselected,
and fire for the weapon. Cogs listed in the items.dat
also receive messages from the local player. When you need to send a message to a cog via
SendMessage(), you will need a reference to it. Assigning a cog to a bin and using
GetInvCog() is the easiest way to get a reference to the cog. Assigning a cog to a bin is optional.
Available
When a bin is available, the item of that bin is usable. You can have an amount greater than zero in the bin, and yet it won't
be available. Availability makes forces and items show up in their selection boxes. Use IsInvAvailable()
to check if the bin is available or not. A bin must be available for its hotkey to work. If a force or item is available,
but you don't have anything in the bin, the selection boxes will flicker when they view the force or item; however, the cog
will still work.
Activated
When a bin is "activated," its icon (if it has one) will be displayed in the top-right corner of the screen. Use SetInvActivated()
to activate or deactivate the bin. Use IsInvActivated() to check if the bin is activated or not. The
verb, SetBinWait(), is used to pause the activation of a bin until a delay has ended.