Echo Hollow

Gender-Bending Interactive Stories! :D

User Tools

Site Tools


smutbook:classes:persistence:persistentobject

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
smutbook:classes:persistence:persistentobject [2023/08/08 14:41] leesmutbook:classes:persistence:persistentobject [2023/08/08 18:39] (current) lee
Line 1: Line 1:
 ====== PersistentObject ====== ====== PersistentObject ======
  
-**Inherits from:** Nothing+**Extends:** 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. 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.
Line 18: Line 18:
   * Don't use strict equality because objects may be reallocated differently between game moments, because of the way SugarCube's game state history works.   * Don't use strict equality because objects may be reallocated differently between game moments, because of the way SugarCube's game state history works.
  
-===== Static Properties and Member Functions =====+===== Static Properties/Functions =====
  
 Two static utility functions are defined on PersistentObject.  These are called through the global class name rather than through specific instances of objects. Two static utility functions are defined on PersistentObject.  These are called through the global class name rather than through specific instances of objects.
Line 61: Line 61:
  
  
-===== Constructor =====+===== Constructor( id ) =====
  
-//**ALERT!  MAKE NOTE!  ALERT!**//+//**ALERT!  TAKE 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.**// //**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.**//
Line 70: Line 70:
  
 //**Again, do not ever use "new" to instantiate a PersistentObject.  Instead, store the result of PersistentObject.define() somewhere and reference it when needed, or fetch the object by its 'id' with PersistentObject.fetch().**// //**Again, do not ever use "new" to instantiate a PersistentObject.  Instead, store the result of PersistentObject.define() somewhere and reference it when needed, or fetch the object by its 'id' with PersistentObject.fetch().**//
- None. + 
-===== Properties and Member Functions =====+===== Properties/Functions =====
  
 ==== .id ==== ==== .id ====
Line 114: Line 114:
   * **Throws:** Nothing   * **Throws:** Nothing
  
-Example:<code> +==== .AName() ==== 
-FIXME +Same as .aName(), but with the first character capitalized.
-</code>+
  
-==== .AName ==== +  * **Type:** Function 
-Same as .aName, but with the first character capitalized.+  * **Arguments:**  None 
 +  * **Returns:** String 
 +  * **Throws:** Nothing
  
-  * Type: String (getterFIXME change to function so it can be overridden in story code more easily+==== .theName() ==== 
-  * Automatic+The display name of the object, with the "the" prepended unless the object is proper. For example: "Joe", "the ancient relic", "the pair of gloves"
 + 
 +These rules do not always work. For example, "the European swallow". In this case, the .nameIsProper field may be used to manually specify the behavior of this field. 
 + 
 +  * **Type:** Function 
 +  * **Arguments:**  None 
 +  * **Returns:** String 
 +  * **Throws:** Nothing 
 + 
 +==== .TheName() ==== 
 +Identical to .theName(), but with the first character capitalized. 
 + 
 +  * **Type:** Function 
 +  * **Arguments:**  None 
 +  * **Returns:** String 
 +  * **Throws:** Nothing
  
 ==== .genericName === ==== .genericName ===
-This is the generic non-detailed name of the object, without any article.  This name is used when the item can be detected, but its exact details are unavailable.  For example, the genericName is used when an article of apparel is "showing an outline through" an article of thin but non-transparent apparel on a more outer layer.  It might also be used when interacting with objects in the dark, where you can feel what they are but cannot see specific details.+This is the generic non-detailed name of the object, without any article.  This name is used when the item can be detected, but its exact details are unavailable.  For example, the genericName is used when an article of apparel is "printing through" an article of thin but non-transparent apparel on a more outer layer.  It might also be used when interacting with objects in the dark, where you can feel what they are but cannot see specific details.
  
-  * Type: String +  * **Type:** String
-  Required+
  
 ==== .genericNameIsProper ==== ==== .genericNameIsProper ====
 Same as .nameIsProper, but operates on the genericName instead. Same as .nameIsProper, but operates on the genericName instead.
  
-  * Type: Boolean +  * **Type:** Boolean
-  Optional+
  
 ==== .genericNameIrregularArticle ==== ==== .genericNameIrregularArticle ====
 Same as .nameIrregularArticle, but operates on the genericName instead. Same as .nameIrregularArticle, but operates on the genericName instead.
  
-  * Type: String +  * **Type:** String
-  Optional+
  
-==== .aGenericName ==== +==== .aGenericName() ==== 
-Same as .aName, but operates on the genericName instead.+Same as .aName(), but operates on the genericName instead.
  
-  * Type: String (getter) FIXME change to function so it can be overridden in story code more easily. +  * **Type:** Function 
-  * Automatic+  * **Arguments:**  None 
 +  * **Returns:** String 
 +  * **Throws:** Nothing
  
-==== .AGenericName ==== +==== .AGenericName() ==== 
-Same as .AName, but operates on the genericName instead.+Same as .AName(), but operates on the genericName instead.
  
-  * Type: String (getter) FIXME change to function so it can be overridden in story code more easily. +  * **Type:** Function 
-  * Automatic+  * **Arguments:**  None 
 +  * **Returns:** String 
 +  * **Throws:** Nothing
  
-==== .theName ==== +==== .theGenericName() ==== 
-The display name of the object, with the "the" prepended unless the object is properFor example: "Joe", "the ancient relic""the pair of gloves".+Same as .theName()but operates on the genericName instead.
  
-These rules do not always work. For example, "the European swallow". In this case, the .nameIsProper field may be used to manually specify the behavior of this field.+  * **Type:** Function 
 +  * **Arguments:**  None 
 +  * **Returns:** String 
 +  * **Throws:** Nothing
  
-  * Type: String (getterFIXME change to function so it can be overridden in story code more easily. +==== .TheGenericName() ==== 
-  * Automatic+Same as .TheName(), but operates on the genericName instead.
  
-==== .TheName ==== +  * **Type:** Function 
-Identical to .theName, but with the first character capitalized. +  * **Arguments:**  None 
- +  * **Returns:** String 
-  * Type: String (getter) FIXME change to function so it can be overridden in story code more easily. +  * **Throws:** Nothing
-  * Automatic +
- +
-==== .theGenericName ==== +
-Same as .theName, but operates on the genericName instead. +
- +
-  * Type: String (getter) FIXME change to function so it can be overridden in story code more easily. +
-  * Automatic +
- +
-==== .TheGenericName ==== +
-Same as .TheName, but operates on the genericName instead. +
- +
-  TypeString (getter) FIXME change to function so it can be overridden in story code more easily. +
-  Automatic+
  
 ==== .image ==== ==== .image ====
-A detail image name for the object (used in object details displays, and in inventory thumbnails if no thumbnail is defined).+A detail image name for the object (used in object details displays, and in inventory thumbnails if no thumbnail is defined.
  
-FIXME Make this work with external images instead of just image passages. +  * **Type:** String
- +
-  * Type: String +
-  Required (if you use the Inventory and Apparel UIs)+
  
 ==== .thumbnail ==== ==== .thumbnail ====
-A thumbnail image name for the object (used in inventory displays).  If a thumbnail image is not definedcode should use the value of .image instead.+A thumbnail image name for the object (used in inventory displays).  By defaultit just returns the value of .image, but you can override it in subclasses or set it in PersistentObject.define() to use a thumbnail image that is different from the main detail image above.
  
-FIXME Make this work with external images instead of just image passages. +  * **Type:** Getter returning String
- +
-  * Type: String (getter) FIXME change to function so it can be overridden in story code more easily. +
-  Optional+
  
 ==== .description ==== ==== .description ====
 FIXME unimplemented FIXME unimplemented
  
-The name of a passage to display with the detail description of the object.  Links within can be used to manipulate the object.+The name of a passage to display with the detail description of the object. 
 + 
 +By default it will use some variant of the object id (FIXME what exactly?), but this can be overridden to make multiple objects use the same description passage.
  
   * Type: String   * Type: String
Line 221: Line 224:
 ==== .toJSON() ==== ==== .toJSON() ====
 Overridden to provide a reviveWrapper that grabs an instantiated copy of the object via PersistentObject.fetch(). Overridden to provide a reviveWrapper that grabs an instantiated copy of the object via PersistentObject.fetch().
- 
- 
- 
- 
- 
- 
-==== .someProperty ==== 
-Description. 
- 
-  * **Type:** void 
-  * **Automatic** 
-  * **ReadOnly** 
- 
-==== .someFunction( arg1, ... ) ==== 
-Description. 
- 
-  * **Type:** Function 
-  * **Arguments:**  
-    * //arg1//: desc 
-    * //arg2//: desc 
-    * //arg3//: desc 
-    * //arg4//: desc 
-    * //arg5//: desc 
-    * //arg6//: desc 
-  * **Returns:** void 
-  * **Throws:** Nothing 
- 
-Example:<code> 
-FIXME 
-</code> 
- 
- 
  
smutbook/classes/persistence/persistentobject.1691530893.txt.gz · Last modified: 2023/08/08 14:41 by lee