Create States

API 2.0

States can be created on runtime using by sending a "createState" message to Touch Portal with the given information.

{
  "type":"createState",
  "id":"horseCount",
  "desc":"Number of horses",
  "defaultValue":"0",
  "forceUpdate":false
}
Key Type Req. API Description
type Text yes 2.0 The type of message.
id Text yes 2.0 The id of the newly created plug-in state. Please ensure unique names, otherwise you may corrupt other plug-ins.
desc Text Yes 2.0 The displayed name within Touch Portal which represents the state.
defaultValue Text Yes 2.0 The default value the state will have on creation.
parentGroup Text No 6.0 The name of the parent group of this state. The parent group of this state will be used to group the state in the menus used throughout Touch Portal. Every state belonging to the same parent group name will be in the same selection menu.
forceUpdate Switch No 7.0 This will force the update of the state if it is already created or existing and will trigger the state changed event even if the value is the same as the already existing one.