test
(http://koti.mbnet.fi/tk-/img/RTFM.gif), because it's quite clearly stated in there:
AddInventory
(Formerly known as global function AddInventory, which is now obsolete)
(Formerly known as global function AddInventoryToCharacter, which is now obsolete)
Character.AddInventory(InventoryItem *item, optional int addAtIndex)
Adds the specified item to the character's inventory. This ensures that the item gets added to the character's inventory list, and that any on-screen inventory display gets updated if appropriate.
The first parameter is the inventory item's Script O-Name from the editor (for example, iPoster).
By default, the new item is added to the end of the character's inventory list. However, you can insert it in a particular position in the list by supplying the second parameter. The new item is inserted before the current item at addAtIndex. Indexes are numbered from 0, so to add the item at the start of the list, pass 0 as the second parameter.
Example:
character[EGO].AddInventory(iKey);
will give inventory item iKey to character EGO.
If you want to use an integer index, you can do it like this:
cEgo.AddInventory(inventory[1]);