Prototypes

From HEWIKI
(Redirected from Prototype)
Jump to: navigation, search

Contents

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.

The client also has prototypes which work much the same way. All GUIXML definitions give rise to prototypes to facilitate instancing them as GUI control nodes.

For more information, please see:

Related CLI Commands

Prototypes can only be created via the CLI.

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).

Related functions

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.

Get Prototype

  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.

Query Prototypes

Client Only

  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.


Example

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"

See also

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox