Originally Posted by FrauBlake
Anyway, bookkeeping and reuse of handles is the only way to go, every operating system would be unable to run for a longer time if they never reused values of released file handles. Blowing up the data type for handles only pushes a limit further away but the limit will be reached at some point.


I've thought about using Osiris itself for such book keeping, with basically a DB_RecycledHandle(UUID,handle). You can get the handles even for local objects in Osiris by catching a CharacterItemHandleEvent() (these are triggered even for local objects, and you can send them to CHARACTER:NULL). However, communicating a handle from Osiris back to an item script seems to be impossible. There is no Item/CharacterSetVarItemHandle(), no CharacterItemHandleSetEvent(), and using *SetVarInteger() or *SetVarItem() does not work with handles.

BTW: watch out when dealing with handles for local objects in Osiris. The Divinity Engine crashes with a segmentation fault if you try to do certain things with these handles, presumably because in general it only sees global objects (I forgot the exact code I used, but watch out if you try to reproduce this: if this is done in code that runs automatically when your mod is started, you'll have to remove the offending code using an external editor because the Divinity Engine will immediately crash when loading your mod).