ResourceProperty class: Difference between revisions
From Catglobe Wiki
More actions
Created page with "{{CGscriptClass_Template|Name=<nowiki>ResourceProperty</nowiki>|Description=<nowiki>Represents a resource property constant with its current value.</nowiki>|InheritsFrom=Array|Methods={{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Description=<nowiki>The string representation of the object.</nowiki>}} {{CGscriptMethods_Template|ReturnType=object|Name=<nowiki>this[] { get; }</nowiki>|Parameters= {{CGscriptParameters_Template|Type=int|Name=<now..." Â |
No edit summary  |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
{{CGscriptClass_Template|Name=<nowiki>ResourceProperty</nowiki>|Description=<nowiki>Represents a resource property constant with its current value.</nowiki>|InheritsFrom=Array|Methods={{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Description=<nowiki>The string representation of the object.</nowiki>}} | {{CGscriptClass_Template | ||
|Name=<nowiki>ResourceProperty</nowiki> | |||
|Description=<nowiki>Represents a resource property constant with its current value.</nowiki> | |||
|InheritsFrom=Array|Methods= | |||
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Description=<nowiki>The string representation of the object.</nowiki>}} | |||
{{CGscriptMethods_Template|ReturnType=object|Name=<nowiki>this[] { get; }</nowiki>|Parameters= | {{CGscriptMethods_Template|ReturnType=object|Name=<nowiki>this[] { get; }</nowiki>|Parameters= | ||
{{CGscriptParameters_Template|Type=int|Name=<nowiki>index</nowiki>|Description=<nowiki>Index</nowiki>}} | {{CGscriptParameters_Template|Type=int|Name=<nowiki>index</nowiki>|Description=<nowiki>Index</nowiki>}} | ||
| Line 5: | Line 9: | ||
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>this[] { get; }</nowiki>|Parameters= | {{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>this[] { get; }</nowiki>|Parameters= | ||
{{CGscriptParameters_Template|Type=int|Name=<nowiki>index</nowiki>|Description=<nowiki>Index</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=object|Name=<nowiki>value</nowiki>|Description=<nowiki>Value to set</nowiki>}} | {{CGscriptParameters_Template|Type=int|Name=<nowiki>index</nowiki>|Description=<nowiki>Index</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=object|Name=<nowiki>value</nowiki>|Description=<nowiki>Value to set</nowiki>}} | ||
|Description=<nowiki>Backward-compatible indexer</nowiki>}}|Properties={{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>Average</nowiki>|HasGetter=1|Description=<nowiki>Average of the objects in the Array object. Can only use if all the elements are of type Number</nowiki>}} | |Description=<nowiki>Backward-compatible indexer</nowiki>}} | ||
|Properties= | |||
{{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>Average</nowiki>|HasGetter=1|Description=<nowiki>Average of the objects in the Array object. Can only use if all the elements are of type Number</nowiki>}} | |||
{{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>Max</nowiki>|HasGetter=1|Description=<nowiki>Largest of all the objects in the Array object. Can only use if all the elements are of type Number</nowiki>}} | {{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>Max</nowiki>|HasGetter=1|Description=<nowiki>Largest of all the objects in the Array object. Can only use if all the elements are of type Number</nowiki>}} | ||
{{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>Min</nowiki>|HasGetter=1|Description=<nowiki>Smallest of all the objects in the Array object. Can only use if all the elements are of type Number</nowiki>}} | {{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>Min</nowiki>|HasGetter=1|Description=<nowiki>Smallest of all the objects in the Array object. Can only use if all the elements are of type Number</nowiki>}} | ||
| Line 14: | Line 20: | ||
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>Type</nowiki>|HasGetter=1|Description=<nowiki>Constant-option type (see RESOURCE_PROPERTY_TYPE constants)</nowiki>}} | {{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>Type</nowiki>|HasGetter=1|Description=<nowiki>Constant-option type (see RESOURCE_PROPERTY_TYPE constants)</nowiki>}} | ||
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}} | {{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}} | ||
{{CGscriptProperties_Template|ReturnType=object|Name=<nowiki>Value</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Current value of the constant</nowiki>}}|StaticMethods={{CGscriptMethods_Template|ReturnType=array|Name=<nowiki> | {{CGscriptProperties_Template|ReturnType=object|Name=<nowiki>Value</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Current value of the constant</nowiki>}} | ||
|StaticMethods= | |||
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>ResourceProperty_getResourcesProperties</nowiki>|Parameters= | |||
{{CGscriptParameters_Template|Type=int|Name=<nowiki>resource unique id</nowiki>|Description=<nowiki>Resource unique id</nowiki>}} | {{CGscriptParameters_Template|Type=int|Name=<nowiki>resource unique id</nowiki>|Description=<nowiki>Resource unique id</nowiki>}} | ||
|Description=<nowiki>Returns the | |Description=<nowiki>Returns the resource properties of multiple resources.</nowiki>}} | ||
{{CGscriptMethods_Template|ReturnType=Dictionary|Name=<nowiki>ResourceProperty_getResourcesProperties</nowiki>|Parameters= | {{CGscriptMethods_Template|ReturnType=Dictionary|Name=<nowiki>ResourceProperty_getResourcesProperties</nowiki>|Parameters= | ||
{{CGscriptParameters_Template|Type=array|Name=<nowiki> | {{CGscriptParameters_Template|Type=array|Name=<nowiki>resource unique ids</nowiki>|Description=<nowiki>Array of resource unique ids</nowiki>}} | ||
|Description=<nowiki>Returns | |Description=<nowiki>Returns the resource properties of multiple resources.</nowiki>}} | ||
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>ResourceProperty_saveResourceProperties</nowiki>|Parameters= | {{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>ResourceProperty_saveResourceProperties</nowiki>|Parameters= | ||
{{CGscriptParameters_Template|Type=int|Name=<nowiki>resource unique id</nowiki>|Description=<nowiki>Resource unique id</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>propertyArray</nowiki>|Description=<nowiki>Array of resource property objects</nowiki>}} | {{CGscriptParameters_Template|Type=int|Name=<nowiki>resource unique id</nowiki>|Description=<nowiki>Resource unique id</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>propertyArray</nowiki>|Description=<nowiki>Array of resource property objects</nowiki>}} | ||
|Description=<nowiki>Saves resource properties | |Description=<nowiki>Saves resource properties for the specified resource.</nowiki>}} | ||
}} | |||
 | |||
=== <span style="color:#DF8621">'''Examples'''</span> === | |||
 | |||
<source lang="javascript"> | |||
number qnaire; | |||
array a = ResourceProperty_getResourcesProperties(qnaire); | |||
array p; | |||
for(i for 0; a.Count){ | |||
  ResourceProperty r = a[i]; | |||
  if(r.Type == RESOURCE_PROPERTY_TYPE_NUMBER && r.Name == "PanelType") { | |||
    r.Value=1; | |||
    p.Add(r); | |||
  } | |||
} | |||
ResourceProperty_saveResourceProperties(qnaire, p); | |||
</source> | |||
Latest revision as of 04:43, 24 July 2026
ResourceProperty
Represents a resource property constant with its current value.
Parent class
Inherits from Array
Methods
Properties
- number Average { get; } - Average of the objects in the Array object. Can only use if all the elements are of type Number
- number Max { get; } - Largest of all the objects in the Array object. Can only use if all the elements are of type Number
- number Min { get; } - Smallest of all the objects in the Array object. Can only use if all the elements are of type Number
- string Name { get; } - Display label of the constant option
- string ObjectTypeName { get; } - The name of the type of object.
- int OptionId { get; } - Primary key of the constant option
- number Sum { get; } - Sum of all the objects in the Array object. Can only use if all the elements are of type Number
- int Type { get; } - Constant-option type (see RESOURCE_PROPERTY_TYPE constants)
- TypeInformation TypeInformation { get; } - Get information about this class.
- object Value { get; set; } - Current value of the constant
Static Methods
- array ResourceProperty_getResourcesProperties(int resource unique id "Resource unique id") - Returns the resource properties of multiple resources.
- Dictionary ResourceProperty_getResourcesProperties(array resource unique ids "Array of resource unique ids") - Returns the resource properties of multiple resources.
- Empty ResourceProperty_saveResourceProperties(int resource unique id "Resource unique id", array propertyArray "Array of resource property objects") - Saves resource properties for the specified resource.
Examples
number qnaire;
array a = ResourceProperty_getResourcesProperties(qnaire);
array p;
for(i for 0; a.Count){
ResourceProperty r = a[i];
if(r.Type == RESOURCE_PROPERTY_TYPE_NUMBER && r.Name == "PanelType") {
r.Value=1;
p.Add(r);
}
}
ResourceProperty_saveResourceProperties(qnaire, p);