CFD

From HEWIKI
Jump to: navigation, search

Contents

Create Field Definition

CFD <field_name>, <fieldtype>; [description=<field description>] [+/-reflect] [writestrategy=<write strategy>] [watchingscript=<watching script name>] [+/-private] package=<distribution package>


Arguments

<field_name> 
A one-word name for the new field. The maximum length is 250 characters.
<fieldtype> 
Describes what kind of data will be contained in the field. Must be either a list definition, or from the list of Field data types. Valid examples are integer or list of class foo or lookup list of list of class fruit, etc. There is no maximum size.
[<field description>] 
(optional) A comment describing the field
[<+/- reflect>] 
(optional) For in-house development only (specifically by graphics programmers writing the client/server interaction). Defaults to false. This controls the ghost class communication to the client about this field. When set, it causes any changes in the value of this field to be reflected to the ghost class spun up for the archetype of the node that was created. This allows the programmer to send down the updated value to the client in a way that makes sense for that interaction on the client, by changing the appearance of the GUICONTROL.
[<write strategy>] 
(optional) How often the field's data will probably be saved if it is changed. These strategies are flexible (for more information, see write strategy), but basically boil down to three states:
  • NEVER : Changed data in the field is only saved to disk if the player logs off (or disconnects, or moves to another area)
  • LAZY : (default value) The field's data is entered into a save queue with other fields needing to be saved. For example, as of this writing, 5 changed fields are saved with each game "pump" (the game "pumps" many times each second).
  • IMMEDIATE : Causes the changed field's data to be saved with the next game "pump". This write strategy should be used rarely, but is appropriate for certain situations (such as saving the current balance in a player's bank account).
[<watching script name>] 
(optional) The script to be called when this field, on any node, is modified in any way. The FieldChangeNotification() function will be called in this script.
[<+/- private>] 
(optional) Defaults to FALSE. If true, this field is only allowed to be modified by a class method script of any class containing this field. This protection is not currently implented.
[<distribution package>
(optional) One of the following distribution packages:
  • Required
  • Optional
  • OptionalGame
  • Game (default)

Description

This command creates a field definition of the given type.

Example

: cfd "main_script"; scriptref
 
: cfd "buttons", integer
 
: cfd "social_security_number",ID
 
: cfd "trigger", timer ; description="Timer field for one-time timed events"
 
: cfd "candle_timer" , class candle ; writestrategy=NEVER
 
: cfd "fruit_list" , list of class "fruit" ; writestrategy=LAZY
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox