Ben Urban wrote:I have an idea how that might be implemented, though.
Now that I've partially caught up to the posts from today (that took way too long...), I'll explain my idea:
It involves two new script functions, and an addition to the directory structure. The functions first:
(I will refer to the slot system that is currently used in Egoboo as "global", and the new slot system as "local" to distinguish them.)
StoreTarget:
Accepts a value in tmpargument, as well as a target. Stores the target object into the specified local slot (inside the object that called the function), and poofs the target. Does not work on objects that cannot be poofed, or cannot be carried. Fails if there is already something stored in that slot.
UnstoreTarget:
Accepts a value in tmpargument. Loads the object stored in the specified local slot (from the object that called the function), and removes it from the local slot. Fails if the slot is empty.
The local slot system consists of a series of directories inside an object's directory whose names resemble a player's inventory (0.obj, 1.obj, etc.). All objects stored inside an object are carried with the containing object whenever the containing object is moved or copied somewhere. They would not need to be assigned an global slot number, since they can only spawn once, and they are only accessed by the local slot number. The minimum local slot number would be 0, and there would not be a maximum (other than the limitations of tmpargument).
A few things I can think of offhand that might complicate matters:
• Obviously the local slots would not really be represented as directories until the container exports, but I suspect it would be reasonably possible to merely add a couple of extra fields to the data structure in memory to indicate that an object is no longer in play, but is to be stored in another object's slot if it exports.
• It would require dynamic allocation of objects in memory. That might be difficult (but not impossible), from what I've seen. I suspect I will be able to help with modifying the code to implement that, but it will probably be very difficult at first, because of how broad the changes would be.
• Enchantments and scripts would probably have to be paused while an object is stored, and resumed when unstored. They would probably have to be unenchanted when exported.
• If player scripts are allowed to use this, it would interfere with (or possibly enhance!) the inventory system.
• A third function might be needed to allow a script to determine whether a slot is occupied or not.
• A container would have to store its contents every time it is picked up by a player, in case the player quits while carrying it. It would then have to unstore its contents when it is put down.
• Alternative functions might be needed, to provide equivalents to the spawning functions.
Can anyone think of any other potential complications that this might cause?