Prototypes are a type of node template. Other nodes can then be created based on those prototypes. The new node will be based on the class or classes of the prototype, and its field data will be initialized from the values on that prototype.
Prototypes are also nodes themselves, but have special behavior. For example, they cannot have associations. All prototypes are universal, in that if a prototype is modified, that modification is synchronized to all servers (something not to be done on live servers as this is a DOM Coordination step). There is no manual step required to load a prototype, since they load on demand. And unlike normal nodes, can exist loaded into memory on any number of servers at the same time.
For more information, please see:
Related CLI Commands
Prototypes can only be created via the CLI.
- CNFP - Create Node From Prototype
- CPFC - Create Prototype from Class
- DP - Delete Prototype
- MP - Modify Prototype - For changing the values of fields that are NOT lists or lookuplists.
- SP - Show Prototype - Describes a prototype and shows its values.
- QP - Query Prototypes - A command that lists created prototypes. If no class argument is included, this will list all prototypes (which could be a lengthy list, but should not cause any noticeable performance problems).
- MPP - Modify Prototype package
- MPD - Modify Prototype description
- MPN - Modify Prototype name
- MLP - Modify list on Prototype - For changing the values of fields that ARE lists or lookuplists.
Creating a Prototype with HeroBlade
In HeroBlade, there exists a Prototype Organizer Panel to help keep track of prototypes. Whenever a prototype is created, it should also be added to the organizer (but if it is not, it can still be used).
- Use the CLI to create prototype
- In the Prototype Organizer Panel, right-click on the folder in which to place the prototype
- On the popup menu, choose "Add Existing Prototype"
- Select the new prototype as the one to be added
In general, prototypes are manipulated via the CLI. It is permissible and encouraged to write HSL development tools to facilitate the editing and creation of prototypes in a development world, see the Spec Oracle System.
Important: In a production(live) world, HeroScript should only be used to access prototype information, and *not* to modify them due to the coordinated change that results when prototypes are modified.
To read the values off of a prototype, you can use these external functions to set a noderef variable to point at a prototype. It is important to remember that the noderef is a prototype, and cannot be used where a regular node is needed, such as with associations.
function GetPrototype(prototypeName as string) as noderef
It is possible to set a noderef to a prototype. This function will lookup a prototype name, and set the noderef to the node that is the prototype.
Get Prototype by ID
function GetPrototypeByID(prototypeID as ID) as noderef
Looks up a prototype by its ID, and returns a noderef to the node that is the prototype.
Get Prototype Name
function GetPrototypeName(prototypeNode as noderef) as string
If you have noderef which is a reference to a prototype, this will return its name.
Get Prototype Description
GetPrototypeDescription(prototypeNode as noderef) as string
If you have noderef which is a reference to a prototype, this will return its description.
function QueryPrototypes(prototypeNodes references list of noderef, type as string)
This built-in function is only used for GUI work on the client. Calling this function will cause all prototypes to load.
This CLI syntax creates a prototype, "tree_prototype", from the "tree" class, using the "Create Prototype From Class" CLI command, CPFC:
: CPFC "tree", "tree_prototype"