Skip to content
Konclan edited this page Sep 3, 2022 · 1 revision

ConfigGroup

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, infinity 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. If UseTimer 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

String widgets are the most basic, providing a textbox for entering arbitary text. No additional configuration is required.

Checkbox, Bool, Boolean

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.

Color, Colour, RGB

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.

Range, Slider

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.

Timer, MinuteSeconds

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.

ItemVariant, Variant

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.

Dropdown

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"
	}
Clone this wiki locally