Module Database

Manage sets of units and groups.

#Database class

Mission designers can use the DATABASE class to build sets of units belonging to certain:

  • Coalitions
  • Categories
  • Countries
  • Unit types
  • Starting with certain prefix strings.

This list will grow over time. Planned developments are to include filters and iterators. Additional filters will be added around Zone#ZONEs, Radiuses, Active players, ... More iterators will be implemented in the near future ...

Administers the Initial Sets of the Mission Templates as defined within the Mission Editor.

DATABASE construction methods:

Create a new DATABASE object with the DATABASE.New method:

DATABASE filter criteria:

You can set filter criteria to define the set of units within the database. Filter criteria are defined by:

Once the filter criteria have been set for the DATABASE, you can start filtering using:

Planned filter criteria within development are (so these are not yet available):

DATABASE iterators:

Once the filters have been defined and the DATABASE has been built, you can iterate the database with the available iterator methods. The iterator methods will walk the DATABASE set, and call for each element within the set a function that you provide. The following iterator methods are currently available within the DATABASE:

Planned iterators methods in development are (so these are not yet available):


Global(s)

DATABASE

Type DATABASE

DATABASE.AlivePlayers
DATABASE.ClassName
DATABASE.ClientsByID
DATABASE.ClientsByName
DATABASE.DCSGroups
DATABASE.DCSGroupsAlive
DATABASE.DCSUnits
DATABASE.DCSUnitsAlive
DATABASE.Filter
DATABASE:FilterCategories(Categories)

Builds a set of units out of categories.

DATABASE:FilterCoalitions(Coalitions)

Builds a set of units of coalitons.

DATABASE:FilterCountries(Countries)

Builds a set of units of defined countries.

DATABASE:FilterGroupPrefixes(Prefixes)

Builds a set of units of defined group prefixes.

DATABASE.FilterMeta
DATABASE:FilterStart()

Starts the filtering.

DATABASE:FilterTypes(Types)

Builds a set of units of defined unit types.

DATABASE:FilterUnitPrefixes(Prefixes)

Builds a set of units of defined unit prefixes.

DATABASE:ForEachAliveUnit(IteratorFunction, ...)

Interate the DATABASE and call an interator function for each alive unit, providing the Unit and optional parameters.

DATABASE:GetStatusGroup(GroupName)

Get a status to a Group within the Database, this to check crossing events for example.

DATABASE.Groups
DATABASE.NavPoints
DATABASE:New()

Creates a new DATABASE object, building a set of units belonging to a coalitions, categories, countries, types or with defined prefix names.

DATABASE.Players
DATABASE:ScanEnvironment()
DATABASE:SetStatusGroup(GroupName, Status)

Set a status to a Group within the Database, this to check crossing events for example.

DATABASE:Spawn(SpawnTemplate)

Instantiate new Groups within the DCSRTE.

DATABASE.Statics
DATABASE:TraceDatabase()

Traces the current database contents in the log ...

DATABASE.Units
DATABASE:_EventOnBirth(Event)

Handles the OnBirth event for the alive units set.

DATABASE:_EventOnDeadOrCrash(Event)

Handles the OnDead or OnCrash event for alive units set.

DATABASE:_IsAliveDCSUnit(DCSUnit)
DATABASE:_IsIncludeDCSUnit(DCSUnit)
DATABASE:_RegisterGroup(GroupTemplate)

Registers new Group Templates within the DATABASE Object.

Global(s)

#DATABASE DATABASE

Type Database

Type DATABASE

DATABASE class

Field(s)

DATABASE.AlivePlayers
#string DATABASE.ClassName
DATABASE.ClientsByID
DATABASE.ClientsByName
DATABASE.DCSGroups
DATABASE.DCSGroupsAlive
DATABASE.DCSUnits
DATABASE.DCSUnitsAlive
DATABASE.Filter
DATABASE:FilterCategories(Categories)

Builds a set of units out of categories.

Possible current categories are plane, helicopter, ground, ship.

Parameter

  • #string Categories : Can take the following values: "plane", "helicopter", "ground", "ship".

Return value

#DATABASE: self

DATABASE:FilterCoalitions(Coalitions)

Builds a set of units of coalitons.

Possible current coalitions are red, blue and neutral.

Parameter

  • #string Coalitions : Can take the following values: "red", "blue", "neutral".

Return value

#DATABASE: self

DATABASE:FilterCountries(Countries)

Builds a set of units of defined countries.

Possible current countries are those known within DCS world.

Parameter

  • #string Countries : Can take those country strings known within DCS world.

Return value

#DATABASE: self

DATABASE:FilterGroupPrefixes(Prefixes)

Builds a set of units of defined group prefixes.

All the units starting with the given group prefixes will be included within the set.

Parameter

  • #string Prefixes : The prefix of which the group name where the unit belongs to starts with.

Return value

#DATABASE: self

DATABASE.FilterMeta
DATABASE:FilterStart()

Starts the filtering.

Return value

#DATABASE: self

DATABASE:FilterTypes(Types)

Builds a set of units of defined unit types.

Possible current types are those types known within DCS world.

Parameter

  • #string Types : Can take those type strings known within DCS world.

Return value

#DATABASE: self

DATABASE:FilterUnitPrefixes(Prefixes)

Builds a set of units of defined unit prefixes.

All the units starting with the given prefixes will be included within the set.

Parameter

  • #string Prefixes : The prefix of which the unit name starts with.

Return value

#DATABASE: self

DATABASE:ForEachAliveUnit(IteratorFunction, ...)

Interate the DATABASE and call an interator function for each alive unit, providing the Unit and optional parameters.

Parameters

  • #function IteratorFunction : The function that will be called when there is an alive unit in the database. The function needs to accept a UNIT parameter.

  • ... :

Return value

#DATABASE: self

DATABASE:GetStatusGroup(GroupName)

Get a status to a Group within the Database, this to check crossing events for example.

Parameter

  • GroupName :

DATABASE.Groups
DATABASE.NavPoints
DATABASE:New()

Creates a new DATABASE object, building a set of units belonging to a coalitions, categories, countries, types or with defined prefix names.

Return value

#DATABASE:

Usage:

-- Define a new DATABASE Object. This DBObject will contain a reference to all Group and Unit Templates defined within the ME and the DCSRTE.
DBObject = DATABASE:New()
DATABASE.Players
DATABASE:ScanEnvironment()
DATABASE:SetStatusGroup(GroupName, Status)

Set a status to a Group within the Database, this to check crossing events for example.

Parameters

  • GroupName :

  • Status :

DATABASE:Spawn(SpawnTemplate)

Instantiate new Groups within the DCSRTE.

This method expects EXACTLY the same structure as a structure within the ME, and needs 2 additional fields defined: SpawnCountryID, SpawnCategoryID This method is used by the SPAWN class.

Parameter

  • SpawnTemplate :

DATABASE.Statics
DATABASE:TraceDatabase()

Traces the current database contents in the log ...

(for debug reasons).

Return value

#DATABASE: self

DATABASE.Units
DATABASE:_EventOnBirth(Event)

Handles the OnBirth event for the alive units set.

Parameter

DATABASE:_EventOnDeadOrCrash(Event)

Handles the OnDead or OnCrash event for alive units set.

Parameter

DATABASE:_IsAliveDCSUnit(DCSUnit)

Parameter

Return value

#DATABASE: self

DATABASE:_IsIncludeDCSUnit(DCSUnit)

Parameter

Return value

#DATABASE: self

DATABASE:_RegisterGroup(GroupTemplate)

Registers new Group Templates within the DATABASE Object.

Parameter

  • GroupTemplate :