Difference between revisions of "Lib Config"
From Elite Wiki
(Documentation) |
m |
||
Line 1: | Line 1: | ||
[[Image:IconLib.png|100px|right]] | [[Image:IconLib.png|100px|right]] | ||
==Overview== | ==Overview== | ||
− | Lib_Config (part of [[Library]]) is a Interface to give AddOns the possibility to let users change settings in the game. It's really easy to implement the data and usually only needs a few lines of code. | + | Lib_Config (part of [[Library]]) is a Interface to give AddOns the possibility to let users change settings in the game. It's really easy to implement the data and usually only needs a few lines of code. AddOns can also register multiple entries if they need some more options. |
Line 42: | Line 42: | ||
==Full Dataset== | ==Full Dataset== | ||
The members: | The members: | ||
− | :Name | + | :;Name: Required. String. worldScript name, usually simply this.name. |
− | + | :;Display: Required. String. Identifier for this specific settings Object, e.g. "Planets". Name and Display are used to sort and group settings Objects. | |
− | :Display | + | :;Alive: Required. String. Path to settings Object, e.g. "$mySettings". |
− | + | :;Notify: Optional. String. Path to global notification function when user leaves the OXP screen. | |
− | :Alive | + | :;Reset: Optional. Boolean. If set allows "Reset to defaults" option. |
− | |||
− | :Notify | ||
− | |||
− | :Reset | ||
− | |||
and at least one of | and at least one of | ||
− | :Bool | + | :;Bool: Boolean handling. |
− | + | ::;B0: Up to 9 unique Objects. | |
− | ::B0 | + | :::;Name: Required. String. Path to boolean property, e.g. "$switchOn". |
− | + | :::;Def: Required. Boolean. Default value. | |
− | :::Name | + | :::;Desc: Required. String. Short description, e.g. "Add planets". |
− | + | :::;Hide: Optional. Boolean. Hide from display. | |
− | :::Def | + | :::;Notify: Optional. String. Path to notification function when user changes this property. |
− | |||
− | :::Desc | ||
− | |||
− | :::Hide | ||
− | |||
− | :::Notify | ||
− | |||
::}, | ::}, | ||
− | ::Info | + | ::;Info: Optional. String. Description for the boolean settings. If prefixed with '^' points to a missiontext key. |
− | + | ::;Notify: Optional. String. Path to group notification function when user leaves the boolean screen. | |
− | ::Notify | ||
− | |||
:}, | :}, | ||
− | :SInt | + | :;SInt: Number handling. Integer or Float. Used values can be in range -16777215...16777215 (or -0xffffff...0xffffff). |
− | + | ::;S0: Up to 9 unique Objects. | |
− | ::S0 | + | :::;Name: Required. String. Path to integer or float property, e.g. "$amountMoons". |
− | + | :::;Def: Required. Number. Default value. | |
− | :::Name | + | :::;Min: Required. Number. Minimum value, e.g. -43. |
− | + | :::;Max: Required. Number. Maximum value, e.g. 0xfffffe. | |
− | :::Def | + | :::;Desc: Required. String. Short description, e.g. "Max planets". |
− | + | :::;Float: Optional. Boolean. If true floating point input allowed. | |
− | :::Min | + | :::;Hide: Optional. Boolean. Hide from display. |
− | + | :::;Notify: Optional. String. Path to notification function when user changes this property. | |
− | :::Max | ||
− | |||
− | :::Desc | ||
− | |||
− | :::Float | ||
− | |||
− | :::Hide | ||
− | |||
− | :::Notify | ||
− | |||
::}, | ::}, | ||
− | ::Info | + | ::;Info: Optional. String. Description for the number settings. If prefixed with '^' points to a missiontext key. |
− | + | ::;Notify: Optional. String. Path to group notification function when user leaves the number screen. | |
− | ::Notify | ||
− | |||
:}, | :}, | ||
− | :EInt | + | :;EInt: Bitmask handling. Positive Integer. Used values can be in range 0...16777215 (or 0x0...0xffffff). |
− | + | ::;E0: 1 object. | |
− | ::E0 | + | :::;Name: Required. String. Path to bitmask property, e.g. "$myBitmask". |
− | + | :::;Def: Required. Number. Default value. | |
− | :::Name | + | :::;Min: Required. Number. Minimum value. |
− | + | :::;Max: Required. Number. Maximum value. | |
− | :::Def | + | :::;Desc: Required. Array. Contains Strings, describing the single elements. |
− | + | :::;Hide: Optional. Boolean. Hide from display. | |
− | :::Min | + | :::;Notify: Optional. String. Path to notification function when user changes this property. |
− | + | :::;OneOf: Optional. Boolean. Selects only one bit at a time. | |
− | :::Max | + | :::;OneOfZero: Optional. Boolean. Selects only one bit or none at a time. |
− | |||
− | :::Desc | ||
− | |||
− | :::Hide | ||
− | |||
− | :::Notify | ||
− | |||
− | :::OneOf | ||
− | |||
− | :::OneOfZero | ||
− | |||
::}, | ::}, | ||
− | ::Info | + | ::;Info: Optional. String. Description for the bitmask settings. If prefixed with '^' points to a missiontext key. |
− | + | ::;Notify: Optional. String. Path to group notification function when user leaves the bitmask screen. | |
− | ::Notify | ||
− | |||
:} | :} | ||
Revision as of 13:13, 4 August 2016
Overview
Lib_Config (part of Library) is a Interface to give AddOns the possibility to let users change settings in the game. It's really easy to implement the data and usually only needs a few lines of code. AddOns can also register multiple entries if they need some more options.
Methods
_registerSet
_registerSet: function( obj ) |
Register a data set on .startUpComplete or later.
Parameters:
- obj
- Object. See Full Dataset for its members.
Returns:
- n
- Number. Errorcode. If OK 0 (zero).
_unregisterSet
_unregisterSet: function( obj ) |
Unregister a data set.
Parameters:
- obj
- Object. See Full Dataset for its members.
Returns:
- n
- Number. Errorcode. If OK 0 (zero).
Examples
A very simple one with 1 boolean property to stare at:
this.$log = false; this.$myOXPC = {Name:this.name, Display:"Example A", Alive:"$myOXPC", Bool:{ B0:{Name:"$log", Def:false, Desc:"Blurp."}, Info:"Hmmm." } }; worldScripts.Lib_Config._registerSet(this.$my.oxpc);
Full Dataset
The members:
- Name
- Required. String. worldScript name, usually simply this.name.
- Display
- Required. String. Identifier for this specific settings Object, e.g. "Planets". Name and Display are used to sort and group settings Objects.
- Alive
- Required. String. Path to settings Object, e.g. "$mySettings".
- Notify
- Optional. String. Path to global notification function when user leaves the OXP screen.
- Reset
- Optional. Boolean. If set allows "Reset to defaults" option.
and at least one of
- Bool
- Boolean handling.
- B0
- Up to 9 unique Objects.
- Name
- Required. String. Path to boolean property, e.g. "$switchOn".
- Def
- Required. Boolean. Default value.
- Desc
- Required. String. Short description, e.g. "Add planets".
- Hide
- Optional. Boolean. Hide from display.
- Notify
- Optional. String. Path to notification function when user changes this property.
- },
- Info
- Optional. String. Description for the boolean settings. If prefixed with '^' points to a missiontext key.
- Notify
- Optional. String. Path to group notification function when user leaves the boolean screen.
- },
- SInt
- Number handling. Integer or Float. Used values can be in range -16777215...16777215 (or -0xffffff...0xffffff).
- S0
- Up to 9 unique Objects.
- Name
- Required. String. Path to integer or float property, e.g. "$amountMoons".
- Def
- Required. Number. Default value.
- Min
- Required. Number. Minimum value, e.g. -43.
- Max
- Required. Number. Maximum value, e.g. 0xfffffe.
- Desc
- Required. String. Short description, e.g. "Max planets".
- Float
- Optional. Boolean. If true floating point input allowed.
- Hide
- Optional. Boolean. Hide from display.
- Notify
- Optional. String. Path to notification function when user changes this property.
- },
- Info
- Optional. String. Description for the number settings. If prefixed with '^' points to a missiontext key.
- Notify
- Optional. String. Path to group notification function when user leaves the number screen.
- },
- EInt
- Bitmask handling. Positive Integer. Used values can be in range 0...16777215 (or 0x0...0xffffff).
- E0
- 1 object.
- Name
- Required. String. Path to bitmask property, e.g. "$myBitmask".
- Def
- Required. Number. Default value.
- Min
- Required. Number. Minimum value.
- Max
- Required. Number. Maximum value.
- Desc
- Required. Array. Contains Strings, describing the single elements.
- Hide
- Optional. Boolean. Hide from display.
- Notify
- Optional. String. Path to notification function when user changes this property.
- OneOf
- Optional. Boolean. Selects only one bit at a time.
- OneOfZero
- Optional. Boolean. Selects only one bit or none at a time.
- },
- Info
- Optional. String. Description for the bitmask settings. If prefixed with '^' points to a missiontext key.
- Notify
- Optional. String. Path to group notification function when user leaves the bitmask screen.
- }