-
Notifications
You must be signed in to change notification settings - Fork 46
Config Group
ConfigGroup allows for defining customisable widgets which appear in the "Item Properties" section of the app. These let you offer config settings for items, styles, etc. They are organised into groups, which generally correspond to a package, and then you can have multiple widgets inside that. For item-specific configuration, widgets can be specified to have 30 different value sets, which are picked via the item's timer widget in the editor. In vbsp_config
files, the chosen value can be tested using the ItemConfig
flag, or by using the GetItemConfig
result to retrieve it into a $fixup
value.
The general layout is as follows in info.txt
:
"ConfigGroup"
{
"ID" "GROUP_ID"
"Name" "Name of group"
"Widget"
{
"ID" "WidgetID"
"Type" "checkbox"
"Default" "1"
"UseTimer" "0"
"Label" "Some Option"
"Tooltip" "A long description of this item."
}
"Widget"
{
"ID" "SecondWidgetID"
"Type" "string"
"Label" "Some Option"
"UseTimer" "1"
"HasInf" "1"
"Default"
{
"inf" "Infinite"
"3" "Three"
"4" "Four"
"5" "Five"
"6" "Six"
"7" "Seven"
...
"27" "Twenty-Seven"
"28" "Twenty-Eight"
"29" "Twenty-Nine"
"30" "Thirty"
}
"Tooltip" "A long description of this item."
}
...
}
-
ID
: This is the ID of the group of widgets, used to organise them and access them later. If another definition shares the ID, they will be merged. -
Name
: A friendly name for the group to display in the UI. -
Widget
: Each Widget block specifies a widget which is added to the UI.-
ID
: The ID of each widget should be unique for the group, since it's used to store the value. -
Type
: This specifies what sort of widget is added, and must be one of the values in the below headings. Depending on the type additional options may be available. -
UseTimer
: If set, either 28 or 29 widgets will be displayed in the UI, to pick one value for each valid value in the in-editor timer property. -
HasInf
: If set, in addition to values from 3-30,inf
inity will have a widget also. You may alternatively want to use that value for some special selection. -
Default
: Specifies the starting value of the widget, which should be a valid value. IfUseTimer
is on, this can be a block of values to specify each timer's initial value. -
Label
: Short set of text placed next to the widget to identify it. -
Tooltip
: Optional additional explanation, shown when the user hovers over the widget.
-
String widgets are the most basic, providing a textbox for entering arbitary text. No additional configuration is required.
Checkbox widgets provide a checkbox, allowing selecting a yes (1
) or no (0
) value. This widget has a special compact layout when set to timer mode, and no additional configuration is required.
Colour widgets provide a small colour "swatch", which can be clicked to bring up a colour selector. The values are output as r g b
strings, where each is a number from 0-255, but can also be supplied in #rrggbb
hex format. This widget has a special compact layout when set to timer mode, and no additional configuration is required.
This produces a bar slider, allowing picking a numeric value in a constrained range.
-
Min
: The smallest valid value. -
Max
: The largest valid value. -
Step
: The difference between each valid value, which also controls if fractional values are allowed.
This produces a specialised widget, allowing picking a duration value in minute:seconds
format. The result is output as a value in seconds. This widget has a special compact layout when set to timer mode.
-
Min
: The smallest duration allowed, in seconds. -
Max
: The largest duration allowed, in seconds.
This is a special option. Instead of setting a specific value, this produces a dropdown which allows selecting which "version" an item is using.
-
ItemID
: Required value, the ID of the item this controls.
Dropdowns allow selecting from a fixed set of values.
Options
: This block specifies the options available, where each key name is the value stored, and the value is then displayed in the UI. For example:
"Options"
{
"-1" "Infinite"
"1" "One"
"3" "Three"
"5" "Five"
}