Marble Docs
Search
K

Attributes

What are Attributes?

Attributes are key-value pairs that can be assigned to individual Marble items to represent any kind of numerical value associated with an item. Since attributes are attached to individual items they will travel with changes in ownership.
Below are a few sample Attributes and their associated point values.
Attribute Name
Attribute Points
level
5
experience
750
strength
18
height
74
bananas
3
modifier
-5
Note that Attributes have specific actions that allow the point values to be manipulated directly, as opposed to Tags that can only be overwritten.

Shared Attributes

The Attributes layer also includes Shared Attributes that are assigned to a group rather than an individual item. Use Shared Attributes to apply attributes to all items in a group or to save RAM costs.

Table Breakdown

Table Name: attributes
Table Scope: item.serial
Field Name
Field Type
Description
attribute_name
name
Attribute name identifier (Primary Key).
points
uint64_t
Point value for attribute.
locked
bool
Attribute locked state.

No extra indices.

Creating an Attribute

To assign a new attribute to an Item call the newattribute() action.
Required Authority: group.manager

Action Parameters

Name
Type
Example
Description
serial
uint64_t
5
The serial number of the Item to be assigned the attribute.
attribute_name
name
health
The name of the new attribute to assign.
initial_points
int64_t
true
The initial points value the attribute will start with.
shared
bool
true
Create shared attribute if true.

Examples

Cleos
Marble CLI
cleos push action {account} newattribute '[ {params} ]' -p {manager}
marble make attribute ...

Set Attribute Points

To set an attribute's points to a specific value call the setpoints() action.
Required Authority: group.manager

Action Parameters

Name
Type
Example
Description
serial
uint64_t
5
The serial number of the item with the attribute to affect.
attribute_name
name
health
The name of the attribute to affect.
new_points
int64_t
25
The new point value of the attribute.
shared
bool
true
Set points for a shared attribute if true.

Examples

Cleos
Marble CLI
cleos push action {account} setpoints '[ {params} ]' -p {manager}
marble modify ...

Increase Points

To increase an attribute's points call theincreasepts() action.
Required Authority: group.manager

Action Parameters

Name
Type
Example
Description
serial
uint64_t
5
The serial number of the Item with the attribute to affect.
attribute_name
name
health
The name of the attribute to affect.
points_to_add
uint64_t
10
The number of points to add to the current attribute points.
shared
bool
false
Increase points for a shared attribute if true.

Examples

Cleos
Marble CLI
cleos push action {account} increasepts '[ {params} ]' -p {manager}
marble modify ...

Decrease Points

To decrease an attribute's points call the decreasepts() action.
Required Authority: group.manager

Action Parameters

Name
Type
Example
Description
serial
uint64_t
5
The serial number of the Item to affect.
attribute_name
name
health
The name of the attribute to affect.
points_to_subtract
uint64_t
10
The number of points to subtract from the current points.
shared
bool
true
Decrease points of shared attribute if true.

Examples

Cleos
Marble CLI
cleos push action {account} decreasepts '[ {params} ]' -p {manager}
marble modify ...

Lock an Attribute

Lock an attribute and prevent future updates with the lockattr() action.
Required Authority: group.manager

Action Parameters

Name
Type
Example
Description
serial
uint64_t
5
The serial number of the Item with the behavior to lock.
attribute_name
name
level
The name of the attribute to lock.
shared
bool
true
Lock a shared attribute if true.

Examples

Cleos
Marble CLI
cleos push action {account} lockattr '[ ... ]' -p {account}
marble lock ...

Remove an Attribute

To remove an attribute from an Item call the rmvattribute() action.
Required Authority: group.manager

Action Parameters

Name
Type
Example
Description
serial
uint64_t
5
The serial number of the Item with the attribute to remove.
attribute_name
name
health
The name of the attribute to remove.
shared
bool
false
Remove a shared attribute if true.

Examples

Cleos
Marble CLI
cleos push action {account} rmvattribute '[ {params} ]' -p {manager}
marble remove ...
Last modified 3yr ago