SetMetadataTask ​
Inherits: BehaviorTask < Resource
Set, modify, or manipulate entity metadata with flexible operations
Properties ​
String | metadata_key | "" |
MetadataOperation | operation | MetadataOperation.SET |
String | value | "" |
String | secondary_value | "" |
ValueType | force_type | ValueType.AUTO |
bool | create_if_missing | true |
Methods ​
void | execute_task_start() |
void | execute_task_complete() |
void | execute_task_interrupt() |
void | execute_task_fail() |
void | setup_set( key: String, val: String, type: ValueType = ValueType.AUTO ) |
void | setup_increment( key: String, amount: String = "1" ) |
void | setup_toggle( key: String ) |
void | setup_append( key: String, text: String ) |
void | setup_array_add( key: String, item: String ) |
void | setup_clamp( key: String, min_val: String, max_val: String ) |
void | setup_random( key: String, min_val: String, max_val: String ) |
void | setup_timestamp( key: String ) |
void | setup_copy( target_key: String, source_key: String ) |
Enumerations ​
enum MetadataOperation ​
The options of metadata operation: set, delete, increment, decrement, multiply, append, prepend, toggle, array add, array remove ....
- SET =
0 - DELETE =
1 - INCREMENT =
2 - DECREMENT =
3 - MULTIPLY =
4 - APPEND =
5 - PREPEND =
6 - TOGGLE =
7 - ARRAY_ADD =
8 - ARRAY_REMOVE =
9 - ARRAY_CLEAR =
10 - CLAMP =
11 - RANDOM_INT =
12 - TIMESTAMP =
13
enum ValueType ​
The options of value type: auto, string, int, float, bool, array.
- AUTO =
0 - STRING =
1 - INT =
2 - FLOAT =
3 - BOOL =
4
Property descriptions ​
Target
String metadata_key = "" ​
Metadata key to modify
Operation
MetadataOperation operation = MetadataOperation.SET ​
What operation to perform
String value = "" ​
Primary value for the operation
String secondary_value = "" ​
Secondary value (for range operations, copy source, etc.)
Type Handling
ValueType force_type = ValueType.AUTO ​
Force value to be treated as specific type
bool create_if_missing = true ​
Create key if it doesn't exist
Method descriptions ​
void execute_task_start() ​
Execute the metadata operation
void execute_task_complete() ​
Task completed successfully
void execute_task_interrupt() ​
Nothing to interrupt for metadata operations
void execute_task_fail() ​
Nothing to clean up for metadata operations
void setup_set( key: String, val: String, type: ValueType = ValueType.AUTO ) ​
Quick setup methods for common operations
void setup_increment( key: String, amount: String = "1" ) ​
Makes the task add to a number of the metadata.
void setup_toggle( key: String ) ​
Makes the task flip a yes/no value of the metadata.
void setup_append( key: String, text: String ) ​
Makes the task append text to a value of the metadata.
void setup_array_add( key: String, item: String ) ​
Makes the task add an item to a list of the metadata.
void setup_clamp( key: String, min_val: String, max_val: String ) ​
Makes the task keep a number of the metadata between a minimum and a maximum.
void setup_random( key: String, min_val: String, max_val: String ) ​
Makes the task set a random whole number between a minimum and a maximum.
void setup_timestamp( key: String ) ​
Makes the task store the current time.
void setup_copy( target_key: String, source_key: String ) ​
Makes the task copy a value of the metadata into another.