An example script for dumping all the items from the player into a container using an activator. Requires one container in the world and an activator with the script attached and the properties set correctly.
This script requires the use of two SKSE functions, http://www.creationkit.com/GetNumItems_-_ObjectReference and http://www.creationkit.com/GetNthForm_-_ObjectReference.
Scriptname _t_Test_Item_Dump extends ObjectReference ObjectReference Property _t_ref_chest AutoActor Property PlayerRef AutoEvent OnActivate(ObjectReference akActionRef) If akActionRef == PlayerRef Unburden(PlayerRef, _t_ref_chest) _t_ref_chest.Activate(PlayerRef) EndIfEndEventFunction Unburden(ObjectReference FromCont, ObjectReference ToCont) Global Int iFormIndex = FromCont.GetNumItems() int iDifItems = iFormIndex int iTotalItems = 0 Game.DisablePlayerControls() ; make player wait for all items to be removed Debug.Trace("Begin Removing Items") While iFormIndex > 0 iFormIndex -= 1 Form kForm = FromCont.GetNthForm(iFormIndex) int num_items = FromCont.GetItemCount(kForm) iTotalItems += num_items ; String FormName = kForm.GetName() ; Debug.Trace("Removing " + num_items + " of " + FormName) ; a trace for every item slows it down FromCont.RemoveItem(kForm, num_items, true, ToCont) EndWhile Debug.Trace("Number of Different Items: " + iDifItems) Debug.Trace("Total Item Count: " + iTotalItems) Game.EnablePlayerControls()EndFunction
This was a starting point for a dynamic sort script I am writing and I will post that later once I have tested it thoroughly.
After testing various methods and coming up with http://www.gamesas.com/topic/1498760-handling-inventory-items/#entry23584043, I have released a mod that allows the player to quickly stash items into any container. This does not sort, but merely "unburdens" the player of inventory items not immediately needed. http://www.nexusmods.com/skyrim/mods/53103/?
Edit: Added additional info.
Edit Again: Reformatted and Added additional info. I will likely update this entry to keep updated info at the top.