SortedItemCollection (object)

From GCAWiki

Jump to: navigation, search

The SortedItemCollection object is primarily found in the Items property and ItemsByType property of the Character object. It is used to contain collections of character traits.

Contents

Properties & functions

Count

Description: Returns the number of traits in the collection.

Prototype: Count

Parameters: none

Returns: [Long] The number of traits in the collection.

Example:

Char.Items.Count
Char.ItemsByType(TYPE_AD).Count

Item

Description: Returns a reference to the selected character trait.

Prototype: Item(TraitIdKey)

Parameters:

TraitIdKey 
[Variant] The numeric index (Long) or the collection key (String) of the trait to return.

Returns: [Object Reference] A reference to the Item (object) which contains the selected trait.

Notes: Item is the default property of the SortedItemCollection object, so you may exclude it when accessing the collection.

Example (implicit usage as the default property; common usage):

Char.Items(ListId).TagItem("name")
Char.ItemsByType(TYPE_AD)(ListId).TagItem("name")

Example (explicit usage):

Char.Items.Item(ListId).TagItem("name")
Char.ItemsByType(TYPE_AD).Item(ListId).TagItem("name")

OrderBy

Description: Sets the sorting order used when accessing the collection via the OrderedItem property.

Prototype: OrderBy SortOrder

Parameters:

SortOrder 
[String] A a comma separated list of tag names, each of which may be suffixed with an optional order sigil, + (ascending) or - (descending), and an optional data type sigil, $ (string/text) or # (numeric); e.g. "points-#,fullname+$". The default order and data type settings, if one and/or both sigils are missing, are ascending and text.

Returns: nothing

Example:

Char.Items.OrderBy "points-#,fullname+$"
Char.ItemsByType(TYPE_AD).OrderBy "points-#,fullname+$"

OrderedItem

Description: Returns a reference to the selected character trait using a sorted index. Must be used after calls to the OrderBy property, to set the sorting order, and OrderItems property, to execute the sorting order, respectively.

Prototype: OrderedItem(TraitIndex)

Parameters:

TraitIndex 
[Long] The numeric index of the trait to return. A collection key is not generated for use by the OrderedItem property.

Returns: [Object Reference] A reference to the Item (object) which contains the selected trait.

Example:

Char.Items.OrderedItem(ListIdx).TagItem("name")
Char.ItemsByType(TYPE_AD).OrderedItem(ListIdx).TagItem("name")

OrderItems

Description: Executes the sorting order set via the OrderBy property.

Prototype: OrderItems

Parameters: none

Returns: nothing

Example:

Char.Items.OrderItems
Char.ItemsByType(TYPE_AD).OrderItems

See also