Group Reference

From Creation Kit
Jump to: navigation, search

A group is a collection of properties that show up in the editor and in-game collectively for organizational purposes. They have no effect on how the script is written or behaves. Groups and properties in groups are the only time order of items in the source code is preserved in Papyrus.

Group Definition

<group> ::= 'Group' <identifier> <flags>
                 (<property>)+
               'endGroup'

A group must contain at least one property, and its name must be unique in the same source file. If its name matches a group in a parent script, then the contents of the two groups will be merged. The order of groups in the source file is preserved when displayed in the editor and game, as well as the order of properties inside the groups.

Examples

Group MyGroup
  {A group containing properties}
  int Property FirstProperty auto
  float Property SecondProperty auto
EndGroup


Group MyOtherGroup CollapsedOnRef
  {Another group, which will appear collapsed by default when viewed on a ref in the editor}
  int Property TheFirstOne auto  ;Will appear first, even though it alphabetically sorts second
  int Property SecondOne auto
EndGroup

Ordering

The order of groups in the source file will be preserved, as will the order of properties inside the group. Any properties outside a group will not have their order preserved (and are implicitly in the "ungrouped group" with no name). By default, the game and editor will sort groups appearing in the parent script first, then in the child script. And if two groups are merged (due to having the same name), again the parent properties will appear first.

Flags

Flags control behavior of groups in the properties window of the editor.

Examples

Scriptname ParentScript
Group ParentGroup
  int Property ParentProperty auto
EndGroup


Scriptname ChildScript extends ParentScript
Group ChildGroup
  int Property ChildProperty auto
  float Property AProperty auto
EndGroup
 
Group ParentGroup
  int Property ChildProperty1 auto
EndGroup

In the editor and game, they will appear as follows (sorting parent first):

ParentGroup
  ParentProperty
  ChildProperty1
ChildGroup
  ChildProperty
  AProperty