Call ParaObject::GetAttributeObject() or ParaObject::GetAttributeObject() to get an instance of this object. e.g. In NPL, one can write local att = player:GetAttributeObject(); local bGloble = att:GetField("global", true); local facing = att:GetField("facing", 0); att:SetField("facing", facing+3.14); local pos = att:GetField("position", {0,0,0}); pos[1] = pos[1]+100;pos[2] = 0;pos[3] = 10; att:SetField("position", pos); att:PrintObject("test.txt");
the following shows objects and their supported attributes.
================================ CAutoCamera ================================ # field num:14 ClassID int 17 ClassName string CAutoCamera PrintMe void action NearPlane float 0.500000 FarPlane float 150.000000 FieldOfView float 1.047198 InvertPitch bool false SmoothFramesNum int 2 Eye position vector3 <200.007645,121.440521,90.311409> Lookat position vector3 <202.129654,120.518433,94.743881> AlwaysRun bool false Reset void action FreeCameraMode void action FollowMode void action
================================ CGlobalTerrain ================================ # field num:5 ClassID int 10 ClassName string CGlobalTerrain PrintMe void action IsModified bool true RenderTerrain bool true
================================ COceanManager ================================ # field num:7 ClassID int 15 ClassName string COceanManager PrintMe void action DrawOcean bool false WaterLevel float 0.000000 OceanColor vector3 <1.000000,1.000000,1.000000> UnderWater bool false
================================ CSceneObject ================================ # field num:33 ClassID int 9 ClassName string CSceneObject PrintMe void action name identifier of the object string global whether object is global bool false facing facing in the range [-PI,PI] float 0.000000 position global position of the character vector3 <500.000000,0.000000,500.000000> render_tech render technique (shader) handle in range [0,2048] int 0 progress how much the object is being constructed in percentage range [0,1] float 1.000000 reset reset object void action IsModified bool true FullScreenGlow bool false EnableSunLight bool true EnableLight bool true ShowLights bool true MaxLightsNum int 4 SetShadow bool true MaxNumShadowCaster int 50 MaxNumShadowReceiver int 0 EnableFog bool true FogColor vector3 <1.000000,1.000000,1.000000> FogStart float 40.000000 FogEnd float 120.000000 FogDensity float 0.700000 MinPopUpDistance float 50.000000 ShowSky bool true PasueScene bool false EnableScene bool true ShowBoundingBox bool true GenerateReport bool true Save ReflectionMap void action Save ShadowMap void action Save GlowMap void action
================================ CSkyMesh ================================ # field num:11 ClassID int 8 ClassName string CSkyMesh PrintMe void action name identifier of the object string MySkyBox global whether object is global bool false facing facing in the range [-PI,PI] float 0.000000 position global position of the character vector3 <200.686813,121.931450,81.580879> render_tech render technique (shader) handle in range [0,2048] int 9 progress how much the object is being constructed in percentage range [0,1] float 1.000000 reset reset object void action SkyColor vector3 <1.000000,1.000000,1.000000>
================================ CTerrain ================================ # field num:11 ClassID int 11 ClassName string CTerrain PrintMe void action IsModified bool false IsEmpty bool false Size bool true OnloadScript string sample/script/sample_0_0.onload.lua height map string sample/elev/sample_0_0.raw ConfigFile string sample/config/sample_0_0.config.txt Base Texture string terrain/data/LlanoTex.jpg CommonTexture string terrain/data/dirt2.jpg
================================ ParaEngineSettings ================================ # field num:9 ClassID int 12 ClassName string ParaEngineSettings PrintMe void action script editor string C:\Program Files\UltraEdit\uedit32.exe Ctor Color vector3 <5.000000,5.000000,5.000000> Ctor Height float 0.200000 Ctor Speed float 1.000000 Is Debugging bool true Effect Level int 0
================================ RPG Character ================================ # field num:60 ClassID int 5 ClassName string RPG Character PrintMe void action name identifier of the object string ass global whether object is global bool true facing facing in the range [-PI,PI] float -1.287883 position global position of the character vector3 <175.763016,119.188156,125.751930> render_tech render technique (shader) handle in range [0,2048] int 8 progress how much the object is being constructed in percentage range [0,1] float 1.000000 reset reset object void action IsModified bool true persistent whether object is persistent bool true Save void action OnLoadScript string IsLoaded bool true On_EnterSentientArea string On_LeaveSentientArea string On_Click string On_Event string On_Perception string On_FrameMove string On_Net_Send string On_Net_Receive string Sentient whether object is sentient bool true AlwaysSentient bool false Sentient Radius float 50.000000 PerceptiveRadius float 7.000000 GroupID int 1 SentientField int 1 Physics Radius float 0.350000 Size Scale float 1.000000 Density float 1.200000 Speed Scale float 1.000000 Animation ID current animation ID int 0 Dump BVH anims dump all animations to BVH files void action Character ID int -1 Character type int 4 state0 int 0 state1 int 0 state2 int 0 state3 int 0 life point float 1.000000 Age float 1.000000 Height float 1.000000 Weight float 1.000000 Occupation int 1 RaceSex int 1 Strength float 1.000000 Dexterity float 1.000000 Intelligence float 1.000000 Base Defense float 1.000000 Defense float 1.000000 Defense flat float 1.000000 Defense Mental float 1.000000 Base Attack float 1.000000 Attack Melee float 1.000000 Attack Ranged float 1.000000 Attack Mental float 1.000000 MaxLifeLoad float 1.000000 Hero Points int 1
Public Member Functions | |
ParaAttributeObject (IAttributeFields *pAttribute, CAttributeClass *pAttClass) | |
ParaAttributeObject (IAttributeFields *pAttribute) | |
ParaAttributeObject | GetAttributeObject () |
get the attribute object. | |
bool | equals (const ParaAttributeObject &obj) const |
return true, if this object is the same as the given object. | |
bool | IsValid () const |
check if the object is valid | |
int | GetClassID () const |
class ID | |
const char * | GetClassName () const |
class name | |
const char * | GetClassName1 () const |
const char * | GetClassDescription () const |
class description | |
void | SetOrder (int order) |
Set which order fields are saved. | |
int | GetOrder () |
get which order fields are saved. | |
int | GetFieldNum () |
get the total number of field. | |
const char * | GetFieldName (int nIndex) |
get field at the specified index. | |
int | GetFieldIndex (const char *sFieldname) |
get field index of a given field name. | |
const char * | GetFieldType (int nIndex) |
get the field type as string | |
bool | IsFieldReadOnly (int nIndex) |
whether the field is read only. | |
const char * | GetFieldSchematics (int nIndex) |
Get Field Schematics string. | |
const char * | GetSchematicsType (int nIndex) |
parse the schema type from the schema string. | |
void | GetSchematicsMinMax (int nIndex, float &fMin, float &fMax) |
parse the schema min max value from the schema string. | |
object | GetField (const char *sFieldname, const object &output) |
get field by name. | |
const char * | GetStringField (const char *sFieldname) |
similar to GetField(). | |
double | GetValueField (const char *sFieldname, int nIndex=0) |
similar to GetField(). | |
void | SetField (const char *sFieldname, const object &input) |
set field by name e.g. | |
void | SetStringField (const char *sFieldname, const char *input) |
similar to SetField(). | |
void | SetValueField (const char *sFieldname, int nIndex, double value) |
similar to SetField(). | |
void | CallField (const char *sFieldname) |
call field by name. | |
void | PrintObject (const char *file) |
print attribute to file | |
bool | ResetField (int nFieldID) |
Reset the field to its initial or default value. | |
bool | InvokeEditor (int nFieldID, const char *sParameters) |
Invoke an (external) editor for a given field. | |
object | GetDynamicField (const char *sFieldname, const object &output) |
get field by name. | |
object | GetDynamicField_ (int nIndex, const object &output) |
Get a dynamic field with a given index. | |
const char * | GetDynamicFieldNameByIndex (int nIndex) |
get field name by index | |
int | GetDynamicFieldCount () |
how many dynamic field this object currently have. | |
void | SetDynamicField (const char *sFieldname, const object &input) |
set field by name e.g. | |
void | RemoveAllDynamicFields () |
remove all dynamic fields | |
Public Attributes | |
IAttributeFields * | m_pAttribute |
CAttributeClass * | m_pAttClass |
ParaAttributeObject ParaAttributeObject::GetAttributeObject | ( | ) |
get the attribute object.
This function return a clone of this object.
void ParaAttributeObject::SetOrder | ( | int | order | ) |
Set which order fields are saved.
enum Field_Order { Sort_ByName, Sort_ByCategory, Sort_ByInstallOrder, };
int ParaAttributeObject::GetOrder | ( | ) |
get which order fields are saved.
int ParaAttributeObject::GetFieldNum | ( | ) |
get the total number of field.
const char * ParaAttributeObject::GetFieldName | ( | int | nIndex | ) |
get field at the specified index.
"" will be returned if index is out of range.
int ParaAttributeObject::GetFieldIndex | ( | const char * | sFieldname | ) |
get field index of a given field name.
-1 will be returned if name not found.
sFieldname |
const char * ParaAttributeObject::GetFieldType | ( | int | nIndex | ) |
get the field type as string
nIndex | : index of the field |
bool ParaAttributeObject::IsFieldReadOnly | ( | int | nIndex | ) |
whether the field is read only.
a field is ready only if and only if it has only a get method.
nIndex | : index of the field |
const char * ParaAttributeObject::GetFieldSchematics | ( | int | nIndex | ) |
Get Field Schematics string.
nIndex,: | index of the field |
const char * ParaAttributeObject::GetSchematicsType | ( | int | nIndex | ) |
parse the schema type from the schema string.
void ParaAttributeObject::GetSchematicsMinMax | ( | int | nIndex, | |
float & | fMin, | |||
float & | fMax | |||
) |
parse the schema min max value from the schema string.
nIndex,: | index of the field | |
fMin | : [in|out] default value | |
fMax | : [in|out] default value |
object ParaAttributeObject::GetField | ( | const char * | sFieldname, | |
const object & | output | |||
) |
get field by name.
e.g. suppose att is the attribute object. local bGloble = att:GetField("global", true); local facing = att:GetField("facing", 0); local pos = att:GetField("position", {0,0,0}); pos[1] = pos[1]+100;pos[2] = 0;pos[3] = 10;
sFieldname,: | field name | |
output,: | default value. if field type is vectorN, output is a table with N items. |
const char * ParaAttributeObject::GetStringField | ( | const char * | sFieldname | ) |
similar to GetField().
except that the output is a string. Used for API exporting. not thread safe.
double ParaAttributeObject::GetValueField | ( | const char * | sFieldname, | |
int | nIndex = 0 | |||
) |
similar to GetField().
except that the output is a value. Used for API exporting. not thread safe.
nIndex,: | if the value has multiple component, such as a vector3. this is the index of the componet. |
void ParaAttributeObject::SetField | ( | const char * | sFieldname, | |
const object & | input | |||
) |
set field by name e.g.
suppose att is the attribute object. att:SetField("facing", 3.14); att:SetField("position", {100,0,0});
sFieldname,: | field name | |
input,: | input value. if field type is vectorN, input is a table with N items. |
void ParaAttributeObject::SetStringField | ( | const char * | sFieldname, | |
const char * | input | |||
) |
similar to SetField().
except that the input is a string. Used for API exporting. not thread safe.
void ParaAttributeObject::SetValueField | ( | const char * | sFieldname, | |
int | nIndex, | |||
double | value | |||
) |
similar to SetField().
except that the input is a string. Used for API exporting. not thread safe.
nIndex,: | if the value has multiple component, such as a vector3. this is the index of the component. |
void ParaAttributeObject::CallField | ( | const char * | sFieldname | ) |
call field by name.
This function is only valid when The field type is void. It simply calls the function associated with the field name.
void ParaAttributeObject::PrintObject | ( | const char * | file | ) |
print attribute to file
file,: | file name to save the manual to. |
bool ParaAttributeObject::ResetField | ( | int | nFieldID | ) |
Reset the field to its initial or default value.
nFieldID | : field ID |
bool ParaAttributeObject::InvokeEditor | ( | int | nFieldID, | |
const char * | sParameters | |||
) |
Invoke an (external) editor for a given field.
This is usually for NPL script field
nFieldID | : field ID | |
sParameters | : the parameter passed to the editor |
object ParaScripting::ParaAttributeObject::GetDynamicField | ( | const char * | sFieldname, | |
const object & | output | |||
) |
get field by name.
e.g. suppose att is the attribute object. local bGloble = att:GetField("URL", nil); local facing = att:GetField("Title", "default one");
sFieldname,: | field name | |
output,: | default value. if field type is vectorN, output is a table with N items. |
int ParaScripting::ParaAttributeObject::GetDynamicFieldCount | ( | ) |
how many dynamic field this object currently have.
void ParaScripting::ParaAttributeObject::SetDynamicField | ( | const char * | sFieldname, | |
const object & | input | |||
) |
set field by name e.g.
suppose att is the attribute object. att:SetDynamicField("URL", 3.14); att:SetDynamicField("Title", {100,0,0});
sFieldname,: | field name | |
input,: | input value. can be value or string type |