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.ClassName
DATABASE.Clients
DATABASE.ClientsAlive
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:ForEach(IteratorFunction, arg, Set)

Interate the DATABASE and call an interator function for the given set, providing the Object for each element within the set and optional parameters.

DATABASE:ForEachClient(IteratorFunction, ...)

Interate the DATABASE and call an interator function for each client, providing the Client to the function and optional parameters.

DATABASE:ForEachDCSUnitAlive(IteratorFunction, ...)

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

DATABASE:ForEachPlayer(IteratorFunction, ...)

Interate the DATABASE and call an interator function for each alive player, providing the Unit of the player 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.GroupsAlive
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.PlayersAlive
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.Templates
DATABASE:TraceDatabase()

Traces the current database contents in the log ...

DATABASE.Units
DATABASE.UnitsAlive
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:_EventOnPlayerEnterUnit(Event)

Handles the OnPlayerEnterUnit event to fill the active players table (with the unit filter applied).

DATABASE:_EventOnPlayerLeaveUnit(Event)

Handles the OnPlayerLeaveUnit event to clean the active players table.

DATABASE:_IsAliveDCSGroup(DCSGroup)
DATABASE:_IsAliveDCSUnit(DCSUnit)
DATABASE:_IsIncludeDCSUnit(DCSUnit)
DATABASE:_RegisterDatabase()

Private method that registers all datapoints within in the mission.

DATABASE:_RegisterGroup(GroupTemplate)

Private method that registers new Group Templates within the DATABASE Object.

DATABASE:_RegisterPlayers()

Private method that registers all alive players in the mission.

Global(s)

#DATABASE DATABASE

Type Database

Type DATABASE

DATABASE class

Field(s)

#string DATABASE.ClassName
DATABASE.Clients
DATABASE.ClientsAlive
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:ForEach(IteratorFunction, arg, Set)

Interate the DATABASE and call an interator function for the given set, providing the Object for each element within the set and optional parameters.

Parameters

  • #function IteratorFunction : The function that will be called when there is an alive player in the database.

  • arg :

  • Set :

Return value

#DATABASE: self

DATABASE:ForEachClient(IteratorFunction, ...)

Interate the DATABASE and call an interator function for each client, providing the Client to the function and optional parameters.

Parameters

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

  • ... :

Return value

#DATABASE: self

DATABASE:ForEachDCSUnitAlive(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:ForEachPlayer(IteratorFunction, ...)

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

Parameters

  • #function IteratorFunction : The function that will be called when there is an alive player 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.GroupsAlive
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.PlayersAlive
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

  • #table SpawnTemplate :

Return value

#DATABASE: self

DATABASE.Statics
DATABASE.Templates
DATABASE:TraceDatabase()

Traces the current database contents in the log ...

(for debug reasons).

Return value

#DATABASE: self

DATABASE.Units
DATABASE.UnitsAlive
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:_EventOnPlayerEnterUnit(Event)

Handles the OnPlayerEnterUnit event to fill the active players table (with the unit filter applied).

Parameter

DATABASE:_EventOnPlayerLeaveUnit(Event)

Handles the OnPlayerLeaveUnit event to clean the active players table.

Parameter

DATABASE:_IsAliveDCSGroup(DCSGroup)

Parameter

Return value

#DATABASE: self

DATABASE:_IsAliveDCSUnit(DCSUnit)

Parameter

Return value

#DATABASE: self

DATABASE:_IsIncludeDCSUnit(DCSUnit)

Parameter

Return value

#DATABASE: self

DATABASE:_RegisterDatabase()

Private method that registers all datapoints within in the mission.

Return value

#DATABASE: self

DATABASE:_RegisterGroup(GroupTemplate)

Private method that registers new Group Templates within the DATABASE Object.

Parameter

  • #table GroupTemplate :

Return value

#DATABASE: self

DATABASE:_RegisterPlayers()

Private method that registers all alive players in the mission.

Return value

#DATABASE: self