This is an old revision of the document!
Inherits from: Nothing
The PersistentObject is the class from which all of the more complex persistent data types are derived. People, Apparel, Transformable attributes, Inventories of various sorts, and many other classes of objects, are all are ultimately derived from PersistentObject.
ALERT! MAKE NOTE! ALERT!
You should never instantiate a PersistentObject directly! Instead, you must define it with PersistentObject.define(), and then either store the result somewhere or re-fetch it with PersistentObject.fetch() when you want to use it.
If you try to instantiate a PersistentObject directly, rather than wrapping it in a call to fetch(), the Proxy object will get confused about what to do with properties that are set in subclass constructors, and you'll have an unhappy day. fetch() wraps things up with some hackery-magic and makes things behave as you'd expect for the most part.
Two static utility functions are defined on PersistentObject. These are called through the global class name rather than through specific instances of objects.
Defines the default data for a PersistentObject (or subclass thereof) within your game. PersistentObject.define() must only be called at initialization time, from story javascript or initialization passages. The results of trying to use this function after the game has started are undefined.
See the Tutorial for more details.