Banner Image

Module Sound.SRS

Sound - Simple Radio Standalone (SRS) Integration and Text-to-Speech.


Main Features:

  • Incease immersion of your missions with more sound output
  • Play sound files via SRS
  • Play text-to-speech via SRS

Youtube Videos: None yet


Example Missions: GitHub.


Sound files: MOOSE Sound Files


The goal of the SRS project is to bring VoIP communication into DCS and to make communication as frictionless as possible.


Author: funkyfranky

Global(s)

Global MSRS

It is a very sad thing that nowadays there is so little useless information. - Oscar Wilde


The MSRS Concept

This class allows to broadcast sound files or text via Simple Radio Standalone (SRS).

#MSRS MSRS

It is a very sad thing that nowadays there is so little useless information. - Oscar Wilde


The MSRS Concept

This class allows to broadcast sound files or text via Simple Radio Standalone (SRS).

Prerequisites

  • This script needs SRS version >= 1.9.6
  • You need to de-sanitize os, io and lfs in the missionscripting.lua
  • Optional: DCS-gRPC as backend to communicate with SRS (vide infra)

Knwon Issues

Pop-up Window

The text-to-speech conversion of SRS is done via an external exe file. When this file is called, a windows cmd window is briefly opended. That puts DCS out of focus, which is annoying, expecially in VR but unavoidable (if you have a solution, please feel free to share!).

NOTE that this is not an issue if the mission is running on a server. Also NOTE that using DCS-gRPC as backend will avoid the pop-up window.

Play Sound Files

local soundfile=SOUNDFILE:New("My Soundfile.ogg", "D:\\Sounds For DCS")
local msrs=MSRS:New("C:\\Path To SRS", 251, radio.modulation.AM)
msrs:PlaySoundFile(soundfile)

Play Text-To-Speech

Basic example:

-- Create a SOUNDTEXT object.
local text=SOUNDTEXT:New("All Enemies destroyed")

-- MOOSE SRS
local msrs=MSRS:New("D:\\DCS\\_SRS\\", 305, radio.modulation.AM)

-- Text-to speech with default voice after 2 seconds.
msrs:PlaySoundText(text, 2)

Set Gender

Use a specific gender with the MSRS.SetGender function, e.g. SetGender("male") or :SetGender("female").

Set Culture

Use a specific "culture" with the MSRS.SetCulture function, e.g. :SetCulture("en-US") or :SetCulture("de-DE").

Set Voice

Use a specific voice with the MSRS.SetVoice function, e.g, :SetVoice("Microsoft Hedda Desktop"). Note that this must be installed on your windows system.

Note that you can set voices for each provider via the MSRS.SetVoiceProvider function. Also shortcuts are available, i.e. MSRS.SetVoiceWindows, MSRS.SetVoiceGoogle, MSRS.SetVoiceAzure and MSRS.SetVoiceAmazon.

For voices there are enumerators in this class to help you out on voice names:

MSRS.Voices.Microsoft -- e.g. MSRS.Voices.Microsoft.Hedda - the Microsoft enumerator contains all voices known to work with SRS
MSRS.Voices.Google -- e.g. MSRS.Voices.Google.Standard.en_AU_Standard_A or MSRS.Voices.Google.Wavenet.de_DE_Wavenet_C - The Google enumerator contains voices for EN, DE, IT, FR and ES.

Set Coordinate

Use MSRS.SetCoordinate to define the origin from where the transmission is broadcasted. Note that this is only a factor if SRS server has line-of-sight and/or distance limit enabled.

Set SRS Port

Use MSRS.SetPort to define the SRS port. Defaults to 5002.

Set SRS Volume

Use MSRS.SetVolume to define the SRS volume. Defaults to 1.0. Allowed values are between 0.0 and 1.0, from silent to loudest.

Config file for many variables, auto-loaded by Moose

See MSRS.LoadConfigFile for details on how to set this up.

TTS Providers

The default provider for generating speech from text is the native Windows TTS service. Note that you need to install the voices you want to use.

Pro-Tip - use the command line with power shell to call DCS-SR-ExternalAudio.exe - it will tell you what is missing and also the Google Console error, in case you have missed a step in setting up your Google TTS. For example, .\DCS-SR-ExternalAudio.exe -t "Text Message" -f 255 -m AM -c 2 -s 2 -z -G "Path_To_You_Google.Json" plays a message on 255 MHz AM for the blue coalition in-game.

Google

In order to use Google Cloud for TTS you need to use MSRS.SetProvider and MSRS.SetProviderOptionsGoogle functions:

msrs:SetProvider(MSRS.Provider.GOOGLE)
msrs:SetProviderOptionsGoogle(CredentialsFile, AccessKey)

The parameter CredentialsFile is used with the default 'DCS-SR-ExternalAudio.exe' backend and must be the full path to the credentials JSON file. The AccessKey parameter is used with the DCS-gRPC backend (see below).

You can set the voice to use with Google via MSRS.SetVoiceGoogle.

When using Google it also allows you to utilize SSML in your text for more flexibility. For more information on setting up a cloud account, visit: https://cloud.google.com/text-to-speech Google's supported SSML reference: https://cloud.google.com/text-to-speech/docs/ssml

Amazon Web Service [Only DCS-gRPC backend]

In order to use Amazon Web Service (AWS) for TTS you need to use MSRS.SetProvider and MSRS.SetProviderOptionsAmazon functions:

msrs:SetProvider(MSRS.Provider.AMAZON)
msrs:SetProviderOptionsAmazon(AccessKey, SecretKey, Region)

The parameters AccessKey and SecretKey are your AWS access and secret keys, respectively. The parameter Region is your AWS region.

You can set the voice to use with AWS via MSRS.SetVoiceAmazon.

Microsoft Azure [Only DCS-gRPC backend]

In order to use Microsoft Azure for TTS you need to use MSRS.SetProvider and MSRS.SetProviderOptionsAzure functions:

msrs:SetProvider(MSRS.Provider.AZURE)
msrs:SetProviderOptionsAmazon(AccessKey, Region)

The parameter AccessKey is your Azure access key. The parameter Region is your Azure region.

You can set the voice to use with Azure via MSRS.SetVoiceAzure.

Backend

The default interface to SRS is via calling the 'DCS-SR-ExternalAudio.exe'. As noted above, this has the unavoidable drawback that a pop-up briefly appears and DCS might be put out of focus.

DCS-gRPC as an alternative to 'DCS-SR-ExternalAudio.exe' for TTS

Another interface to SRS is DCS-gRPC. This does not call an exe file and therefore avoids the annoying pop-up window. In addition to Windows and Google cloud, it also offers Microsoft Azure and Amazon Web Service as providers for TTS.

Use MSRS.SetDefaultBackendGRPC to enable DCS-gRPC as an alternate backend for transmitting text-to-speech over SRS. This can be useful if 'DCS-SR-ExternalAudio.exe' cannot be used in the environment or to use Azure or AWS clouds for TTS. Note that DCS-gRPC does not (yet?) support all of the features and options available with 'DCS-SR-ExternalAudio.exe'. Of note, only text-to-speech is supported and it it cannot be used to transmit audio files.

DCS-gRPC must be installed and configured per the DCS-gRPC documentation and already running via either the 'autostart' mechanism or a Lua call to 'GRPC.load()' prior to use of the alternate DCS-gRPC backend. If a cloud TTS provider is being used, the API key must be set via the 'Config\dcs-grpc.lua' configuration file prior DCS-gRPC being started. DCS-gRPC can be used both with DCS dedicated server and regular DCS installations.

To use the default local Windows TTS with DCS-gRPC, Windows 2019 Server (or newer) or Windows 10/11 are required. Voices for non-local languages and dialects may need to be explicitly installed.

To set the MSRS class to use the DCS-gRPC backend for all future instances, call the function MSRS.SetDefaultBackendGRPC().

Note - When using other classes that use MSRS with the alternate DCS-gRPC backend, pass them strings instead of nil values for non-applicable fields with filesystem paths, such as the SRS path or Google credential path. This will help maximize compatibility with other classes that were written for the default backend.

Basic Play Text-To-Speech example using alternate DCS-gRPC backend (DCS-gRPC not previously started):

-- Start DCS-gRPC
GRPC.load()
-- Select the alternate DCS-gRPC backend for new MSRS instances
MSRS.SetDefaultBackendGRPC()
-- Create a SOUNDTEXT object.
local text=SOUNDTEXT:New("All Enemies destroyed")
-- MOOSE SRS
local msrs=MSRS:New('', 305.0)
-- Text-to speech with default voice after 30 seconds.
msrs:PlaySoundText(text, 30)

Basic example of using another class (ATIS) with SRS and the DCS-gRPC backend (DCS-gRPC not previously started):

-- Start DCS-gRPC
GRPC.load()
-- Select the alternate DCS-gRPC backend for new MSRS instances
MSRS.SetDefaultBackendGRPC()
-- Create new ATIS as usual
atis=ATIS:New("Nellis", 251, radio.modulation.AM)
-- ATIS:SetSRS() expects a string for the SRS path even though it is not needed with DCS-gRPC
atis:SetSRS('')
-- Start ATIS
atis:Start()

Global MSRSQUEUE

Type(s)

MSRS , extends Core.Base#BASE
Fields and Methods inherited from MSRS Description

MSRS:AddFrequencies(Frequencies)

Add frequencies.

MSRS:AddModulations(Modulations)

Add modulations.

MSRS.Backend

MSRS.ClassName

Name of the class.

MSRS.ConfigFileName

Name of the standard config file.

MSRS.ConfigFilePath

Path to the standard config file.

MSRS.ConfigLoaded

If true if config file was loaded.

MSRS:GetBackend()

Get currently set backend.

MSRS:GetCoalition()

Get coalition.

MSRS:GetFrequencies()

Get frequencies.

MSRS:GetLabel()

Get label.

MSRS:GetModulations()

Get modulations.

MSRS:GetPath()

Get path to SRS directory.

MSRS:GetPort()

Get port.

MSRS:GetProvider()

Get provider.

MSRS:GetProviderOptions(Provider)

Get provider options.

MSRS:GetVoice(Provider)

Get voice.

MSRS:GetVolume()

Get SRS volume.

MSRS:Help()

Print SRS help to DCS log file.

MSRS.Label

Label showing up on the SRS radio overlay. Default is "ROBOT". No spaces allowed.

MSRS:LoadConfigFile(Path, Filename)

Get central SRS configuration to be able to play tts over SRS radio using the DCS-SR-ExternalAudio.exe.

MSRS:New(Path, Frequency, Modulation, Backend)

Create a new MSRS object.

MSRS:PlaySoundFile(Soundfile, Delay)

Play sound file (ogg or mp3) via SRS.

MSRS:PlaySoundText(SoundText, Delay)

Play a SOUNDTEXT text-to-speech object.

MSRS:PlayText(Text, Delay, Coordinate)

Play text message via MSRS.

MSRS:PlayTextExt(Text, Delay, Frequencies, Modulations, Gender, Culture, Voice, Volume, Label, Coordinate)

Play text message via MSRS with explicitly specified options.

MSRS:PlayTextFile(TextFile, Delay)

Play text file via MSRS.

MSRS.Provider

MSRS:SetBackend(Backend)

Set backend to communicate with SRS.

MSRS:SetBackendGRPC()

Set DCS-gRPC as backend to communicate with SRS.

MSRS:SetBackendSRSEXE()

Set DCS-SR-ExternalAudio.exe as backend to communicate with SRS.

MSRS:SetCoalition(Coalition)

Set coalition.

MSRS:SetCoordinate(Coordinate)

Set the coordinate from which the transmissions will be broadcasted.

MSRS:SetCulture(Culture)

Set culture.

MSRS:SetDefaultBackend(Backend)

Set the default backend.

MSRS:SetDefaultBackendGRPC()

Set DCS-gRPC to be the default backend.

MSRS:SetFrequencies(Frequencies)

Set frequencies.

MSRS:SetGender(Gender)

Set gender.

MSRS:SetGoogle(PathToCredentials)

[Deprecated] Use google text-to-speech credentials.

MSRS:SetGoogleAPIKey(APIKey)

[Deprecated] Use google text-to-speech set the API key (only for DCS-gRPC).

MSRS:SetLabel(Label)

Set label.

MSRS:SetModulations(Modulations)

Set modulations.

MSRS:SetPath(Path)

Set path to SRS install directory.

MSRS:SetPort(Port)

Set port.

MSRS:SetProvider(Provider)

Set provider used to generate text-to-speech.

MSRS:SetProviderOptions(Provider, CredentialsFile, AccessKey, SecretKey, Region)

Set provider options and credentials.

MSRS:SetProviderOptionsAmazon(AccessKey, SecretKey, Region)

Set provider options and credentials for Amazon Web Service (AWS).

MSRS:SetProviderOptionsAzure(AccessKey, Region)

Set provider options and credentials for Microsoft Azure.

MSRS:SetProviderOptionsGoogle(CredentialsFile, AccessKey)

Set provider options and credentials for Google Cloud.

MSRS:SetTTSProviderAmazon()

Use Amazon Web Service (AWS) to provide text-to-speech.

MSRS:SetTTSProviderAzure()

Use Microsoft Azure to provide text-to-speech.

MSRS:SetTTSProviderGoogle()

Use Google to provide text-to-speech.

MSRS:SetTTSProviderMicrosoft()

Use Microsoft to provide text-to-speech.

MSRS:SetVoice(Voice)

Set to use a specific voice.

MSRS:SetVoiceAmazon(Voice)

Set to use a specific voice if Amazon Web Service is use as provider (only DCS-gRPC backend).

MSRS:SetVoiceAzure(Voice)

Set to use a specific voice if Microsoft Azure is use as provider (only DCS-gRPC backend).

MSRS:SetVoiceGoogle(Voice)

Set to use a specific voice if Google is use as provider.

MSRS:SetVoiceProvider(Voice, Provider)

Set to use a specific voice for a given provider.

MSRS:SetVoiceWindows(Voice)

Set to use a specific voice if Microsoft Windows' native TTS is use as provider.

MSRS:SetVolume(Volume)

Set SRS volume.

MSRS.Voices

MSRS._CreateProviderOptions(Provider, CredentialsFile, AccessKey, SecretKey, Region)

Create MSRS.ProviderOptions.

MSRS:_DCSgRPCtts(Text, Frequencies, Gender, Culture, Voice, Volume, Label, Coordinate)

Make DCS-gRPC API call to transmit text-to-speech over SRS.

MSRS:_ExecCommand(command)

Execute SRS command to play sound using the DCS-SR-ExternalAudio.exe.

MSRS:_GetCommand(freqs, modus, coal, gender, voice, culture, volume, speed, port, label, coordinate)

Get SRS command to play sound using the DCS-SR-ExternalAudio.exe.

MSRS:_GetLatLongAlt(Coordinate)

Get lat, long and alt from coordinate.

MSRS.backend

Backend used as interface to SRS (MSRS.Backend.SRSEXE or MSRS.Backend.GRPC).

MSRS.coalition

Coalition of the transmission.

MSRS.coordinate

Coordinate from where the transmission is send.

MSRS.culture

Culture. Default "en-GB".

MSRS.frequencies

Frequencies used in the transmissions.

MSRS.gender

Gender. Default "female".

MSRS.getSpeechTime(length, speed, isGoogle)

Function returns estimated speech time in seconds.

MSRS.lid

Class id string for output to DCS log file.

MSRS.modulations

Modulations used in the transmissions.

MSRS.name

Name. Default "MSRS".

MSRS.path

Path to the SRS exe.

MSRS.poptions

Provider options. Each element is a data structure of type MSRS.ProvierOptions.

MSRS.port

Port. Default 5002.

MSRS.provider

Provider of TTS (win, gcloud, azure, amazon).

MSRS.uuid()

Function for UUID.

MSRS.version

MSRS class version.

MSRS.voice

Specific voice. Only used if no explicit provider voice specified.

MSRS.volume

Volume between 0 (min) and 1 (max). Default 1.

Fields and Methods inherited from BASE Description

MSRS.ClassID

The ID number of the class.

MSRS.ClassName

The name of the class.

MSRS.ClassNameAndID

The name of the class concatenated with the ID number of the class.

MSRS:ClearState(Object, StateName)

Clear the state of an object.

MSRS:CreateEventBirth(EventTime, Initiator, IniUnitName, place, subplace)

Creation of a Birth Event.

MSRS:CreateEventCrash(EventTime, Initiator, IniObjectCategory)

Creation of a Crash Event.

MSRS:CreateEventDead(EventTime, Initiator, IniObjectCategory)

Creation of a Dead Event.

MSRS:CreateEventPlayerEnterAircraft(PlayerUnit)

Creation of a S_EVENT_PLAYER_ENTER_AIRCRAFT event.

MSRS:CreateEventRemoveUnit(EventTime, Initiator)

Creation of a Remove Unit Event.

MSRS:CreateEventTakeoff(EventTime, Initiator)

Creation of a Takeoff Event.

MSRS:CreateEventUnitLost(EventTime, Initiator)

Creation of a Crash Event.

MSRS:E(Arguments)

Log an exception which will be traced always.

MSRS:EventDispatcher()

Returns the event dispatcher

MSRS:EventRemoveAll()

Remove all subscribed events

MSRS:F(Arguments)

Trace a function call.

MSRS:F2(Arguments)

Trace a function call level 2.

MSRS:F3(Arguments)

Trace a function call level 3.

MSRS:GetClassID()

Get the ClassID of the class instance.

MSRS:GetClassName()

Get the ClassName of the class instance.

MSRS:GetClassNameAndID()

Get the ClassName + ClassID of the class instance.

MSRS:GetEventPriority()

Get the Class Core.Event processing Priority.

MSRS:GetParent(Child, FromClass)

This is the worker method to retrieve the Parent class.

MSRS:GetState(Object, Key)

Get a Value given a Key from the Object.

MSRS:HandleEvent(EventID, EventFunction)

Subscribe to a DCS Event.

MSRS:I(Arguments)

Log an information which will be traced always.

MSRS:Inherit(Child, Parent)

This is the worker method to inherit from a parent class.

MSRS:IsInstanceOf(ClassName)

This is the worker method to check if an object is an (sub)instance of a class.

MSRS:IsTrace()

Enquires if tracing is on (for the class).

MSRS:New()

BASE constructor.

MSRS:OnEvent(EventData)

Occurs when an Event for an object is triggered.

MSRS:OnEventBDA(EventData)

BDA.

MSRS:OnEventBaseCaptured(EventData)

Occurs when a ground unit captures either an airbase or a farp.

MSRS:OnEventBirth(EventData)

Occurs when any object is spawned into the mission.

MSRS:OnEventCrash(EventData)

Occurs when any aircraft crashes into the ground and is completely destroyed.

MSRS:OnEventDead(EventData)

Occurs when an object is dead.

MSRS:OnEventDetailedFailure(EventData)

Unknown precisely what creates this event, likely tied into newer damage model.

MSRS:OnEventDiscardChairAfterEjection(EventData)

Discard chair after ejection.

MSRS:OnEventEjection(EventData)

Occurs when a pilot ejects from an aircraft Have a look at the class Core.Event#EVENT as these are just the prototypes.

MSRS:OnEventEngineShutdown(EventData)

Occurs when any aircraft shuts down its engines.

MSRS:OnEventEngineStartup(EventData)

Occurs when any aircraft starts its engines.

MSRS:OnEventHit(EventData)

Occurs whenever an object is hit by a weapon.

MSRS:OnEventHumanFailure(EventData)

Occurs when any system fails on a human controlled aircraft.

MSRS:OnEventKill(EventData)

Occurs on the death of a unit.

MSRS:OnEventLand(EventData)

Occurs when an aircraft lands at an airbase, farp or ship Have a look at the class Core.Event#EVENT as these are just the prototypes.

MSRS:OnEventLandingAfterEjection(EventData)

Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up.

MSRS:OnEventLandingQualityMark(EventData)

Landing quality mark.

MSRS:OnEventMarkAdded(EventData)

Occurs when a new mark was added.

MSRS:OnEventMarkChange(EventData)

Occurs when a mark text was changed.

MSRS:OnEventMarkRemoved(EventData)

Occurs when a mark was removed.

MSRS:OnEventMissionEnd(EventData)

Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes.

MSRS:OnEventMissionStart(EventData)

Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes.

MSRS:OnEventParatrooperLanding(EventData)

Weapon add.

MSRS:OnEventPilotDead(EventData)

Occurs when the pilot of an aircraft is killed.

MSRS:OnEventPlayerEnterAircraft(EventData)

Occurs when a player enters a slot and takes control of an aircraft.

MSRS:OnEventPlayerEnterUnit(EventData)

Occurs when any player assumes direct control of a unit.

MSRS:OnEventPlayerLeaveUnit(EventData)

Occurs when any player relieves control of a unit to the AI.

MSRS:OnEventRefueling(EventData)

Occurs when an aircraft connects with a tanker and begins taking on fuel.

MSRS:OnEventRefuelingStop(EventData)

Occurs when an aircraft is finished taking fuel.

MSRS:OnEventScore(EventData)

Occurs when any modification to the "Score" as seen on the debrief menu would occur.

MSRS:OnEventShootingEnd(EventData)

Occurs when any unit stops firing its weapon.

MSRS:OnEventShootingStart(EventData)

Occurs when any unit begins firing a weapon that has a high rate of fire.

MSRS:OnEventShot(EventData)

Occurs whenever any unit in a mission fires a weapon.

MSRS:OnEventTakeoff(EventData)

Occurs when an aircraft takes off from an airbase, farp, or ship.

MSRS:OnEventTriggerZone(EventData)

Trigger zone.

MSRS:OnEventUnitLost(EventData)

Occurs when the game thinks an object is destroyed.

MSRS:ScheduleOnce(Start, SchedulerFunction, ...)

Schedule a new time event.

MSRS:ScheduleRepeat(Start, Repeat, RandomizeFactor, Stop, SchedulerFunction, ...)

Schedule a new time event.

MSRS:ScheduleStop(SchedulerID)

Stops the Schedule.

MSRS.Scheduler

MSRS:SetEventPriority(EventPriority)

Set the Class Core.Event processing Priority.

MSRS:SetState(Object, Key, Value)

Set a state or property of the Object given a Key and a Value.

MSRS:T(Arguments)

Trace a function logic level 1.

MSRS:T2(Arguments)

Trace a function logic level 2.

MSRS:T3(Arguments)

Trace a function logic level 3.

MSRS:TraceAll(TraceAll)

Trace all methods in MOOSE

MSRS:TraceClass(Class)

Set tracing for a class

MSRS:TraceClassMethod(Class, Method)

Set tracing for a specific method of class

MSRS:TraceLevel(Level)

Set trace level

MSRS:TraceOff()

Set trace off.

MSRS:TraceOn()

Set trace on.

MSRS:TraceOnOff(TraceOnOff)

Set trace on or off Note that when trace is off, no BASE.Debug statement is performed, increasing performance! When Moose is loaded statically, (as one file), tracing is switched off by default.

MSRS:UnHandleEvent(EventID)

UnSubscribe to a DCS event.

MSRS._

MSRS:_F(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function call.

MSRS:_Serialize(Arguments)

(Internal) Serialize arguments

MSRS:_T(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function logic.

MSRS.__

MSRS:onEvent(event)

The main event handling function...

Fields and Methods inherited from MSRS.Backend Description

MSRS.Backend.GRPC

Use DCS-gRPC.

MSRS.Backend.SRSEXE

Use DCS-SR-ExternalAudio.exe.

Fields and Methods inherited from MSRS.Provider Description

MSRS.Provider.AMAZON

Amazon Web Service (aws). Only possible with DCS-gRPC backend.

MSRS.Provider.AZURE

Microsoft Azure (azure). Only possible with DCS-gRPC backend.

MSRS.Provider.GOOGLE

Google (gcloud).

MSRS.Provider.WINDOWS

Microsoft windows (win).

Fields and Methods inherited from MSRS.ProviderOptions Description

MSRS.ProviderOptions.credentials

Google credentials JSON file (full path).

MSRS.ProviderOptions.defaultVoice

Default voice (not used).

MSRS.ProviderOptions.key

Access key (DCS-gRPC with Google, AWS, AZURE as provider).

MSRS.ProviderOptions.provider

Provider.

MSRS.ProviderOptions.region

Region.

MSRS.ProviderOptions.secret

Secret key (DCS-gRPC with AWS as provider)

MSRS.ProviderOptions.voice

Voice used.

Fields and Methods inherited from MSRS.Voices Description

MSRS.Voices.Google

MSRS.Voices.Microsoft

MSRS.Voices.MicrosoftGRPC

Fields and Methods inherited from MSRSQUEUE Description

MSRSQUEUE:AddTransmission(transmission)

Add a transmission to the radio queue.

MSRSQUEUE:Broadcast(transmission)

Broadcast radio message.

MSRSQUEUE:CalcTransmisstionDuration()

Calculate total transmission duration of all transmission in the queue.

MSRSQUEUE.ClassName

Name of the class "MSRSQUEUE".

MSRSQUEUE:Clear()

Clear the radio queue.

MSRSQUEUE.Debugmode

MSRSQUEUE:New(alias)

Create a new MSRSQUEUE object for a given radio frequency/modulation.

MSRSQUEUE:NewTransmission(text, duration, msrs, tstart, interval, subgroups, subtitle, subduration, frequency, modulation, gender, culture, voice, volume, label, coordinate)

Create a new transmission and add it to the radio queue.

MSRSQUEUE.PlayerSet

MSRSQUEUE:SetTransmitOnlyWithPlayers(Switch)

Switch to only transmit if there are players on the server.

MSRSQUEUE.Tlast

Time (abs) when the last transmission finished.

MSRSQUEUE.TransmitOnlyWithPlayers

MSRSQUEUE:_CheckRadioQueue(delay)

Check radio queue for transmissions to be broadcasted.

MSRSQUEUE.alias

Name of the radio queue.

MSRSQUEUE.checking

If true, the queue update function is scheduled to be called again.

MSRSQUEUE.dt

Time interval in seconds for checking the radio queue.

MSRSQUEUE.lid

ID for dcs.log.

MSRSQUEUE.queue

The queue of transmissions.

Fields and Methods inherited from BASE Description

MSRSQUEUE.ClassID

The ID number of the class.

MSRSQUEUE.ClassName

The name of the class.

MSRSQUEUE.ClassNameAndID

The name of the class concatenated with the ID number of the class.

MSRSQUEUE:ClearState(Object, StateName)

Clear the state of an object.

MSRSQUEUE:CreateEventBirth(EventTime, Initiator, IniUnitName, place, subplace)

Creation of a Birth Event.

MSRSQUEUE:CreateEventCrash(EventTime, Initiator, IniObjectCategory)

Creation of a Crash Event.

MSRSQUEUE:CreateEventDead(EventTime, Initiator, IniObjectCategory)

Creation of a Dead Event.

MSRSQUEUE:CreateEventPlayerEnterAircraft(PlayerUnit)

Creation of a S_EVENT_PLAYER_ENTER_AIRCRAFT event.

MSRSQUEUE:CreateEventRemoveUnit(EventTime, Initiator)

Creation of a Remove Unit Event.

MSRSQUEUE:CreateEventTakeoff(EventTime, Initiator)

Creation of a Takeoff Event.

MSRSQUEUE:CreateEventUnitLost(EventTime, Initiator)

Creation of a Crash Event.

MSRSQUEUE:E(Arguments)

Log an exception which will be traced always.

MSRSQUEUE:EventDispatcher()

Returns the event dispatcher

MSRSQUEUE:EventRemoveAll()

Remove all subscribed events

MSRSQUEUE:F(Arguments)

Trace a function call.

MSRSQUEUE:F2(Arguments)

Trace a function call level 2.

MSRSQUEUE:F3(Arguments)

Trace a function call level 3.

MSRSQUEUE:GetClassID()

Get the ClassID of the class instance.

MSRSQUEUE:GetClassName()

Get the ClassName of the class instance.

MSRSQUEUE:GetClassNameAndID()

Get the ClassName + ClassID of the class instance.

MSRSQUEUE:GetEventPriority()

Get the Class Core.Event processing Priority.

MSRSQUEUE:GetParent(Child, FromClass)

This is the worker method to retrieve the Parent class.

MSRSQUEUE:GetState(Object, Key)

Get a Value given a Key from the Object.

MSRSQUEUE:HandleEvent(EventID, EventFunction)

Subscribe to a DCS Event.

MSRSQUEUE:I(Arguments)

Log an information which will be traced always.

MSRSQUEUE:Inherit(Child, Parent)

This is the worker method to inherit from a parent class.

MSRSQUEUE:IsInstanceOf(ClassName)

This is the worker method to check if an object is an (sub)instance of a class.

MSRSQUEUE:IsTrace()

Enquires if tracing is on (for the class).

MSRSQUEUE:New()

BASE constructor.

MSRSQUEUE:OnEvent(EventData)

Occurs when an Event for an object is triggered.

MSRSQUEUE:OnEventBDA(EventData)

BDA.

MSRSQUEUE:OnEventBaseCaptured(EventData)

Occurs when a ground unit captures either an airbase or a farp.

MSRSQUEUE:OnEventBirth(EventData)

Occurs when any object is spawned into the mission.

MSRSQUEUE:OnEventCrash(EventData)

Occurs when any aircraft crashes into the ground and is completely destroyed.

MSRSQUEUE:OnEventDead(EventData)

Occurs when an object is dead.

MSRSQUEUE:OnEventDetailedFailure(EventData)

Unknown precisely what creates this event, likely tied into newer damage model.

MSRSQUEUE:OnEventDiscardChairAfterEjection(EventData)

Discard chair after ejection.

MSRSQUEUE:OnEventEjection(EventData)

Occurs when a pilot ejects from an aircraft Have a look at the class Core.Event#EVENT as these are just the prototypes.

MSRSQUEUE:OnEventEngineShutdown(EventData)

Occurs when any aircraft shuts down its engines.

MSRSQUEUE:OnEventEngineStartup(EventData)

Occurs when any aircraft starts its engines.

MSRSQUEUE:OnEventHit(EventData)

Occurs whenever an object is hit by a weapon.

MSRSQUEUE:OnEventHumanFailure(EventData)

Occurs when any system fails on a human controlled aircraft.

MSRSQUEUE:OnEventKill(EventData)

Occurs on the death of a unit.

MSRSQUEUE:OnEventLand(EventData)

Occurs when an aircraft lands at an airbase, farp or ship Have a look at the class Core.Event#EVENT as these are just the prototypes.

MSRSQUEUE:OnEventLandingAfterEjection(EventData)

Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up.

MSRSQUEUE:OnEventLandingQualityMark(EventData)

Landing quality mark.

MSRSQUEUE:OnEventMarkAdded(EventData)

Occurs when a new mark was added.

MSRSQUEUE:OnEventMarkChange(EventData)

Occurs when a mark text was changed.

MSRSQUEUE:OnEventMarkRemoved(EventData)

Occurs when a mark was removed.

MSRSQUEUE:OnEventMissionEnd(EventData)

Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes.

MSRSQUEUE:OnEventMissionStart(EventData)

Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes.

MSRSQUEUE:OnEventParatrooperLanding(EventData)

Weapon add.

MSRSQUEUE:OnEventPilotDead(EventData)

Occurs when the pilot of an aircraft is killed.

MSRSQUEUE:OnEventPlayerEnterAircraft(EventData)

Occurs when a player enters a slot and takes control of an aircraft.

MSRSQUEUE:OnEventPlayerEnterUnit(EventData)

Occurs when any player assumes direct control of a unit.

MSRSQUEUE:OnEventPlayerLeaveUnit(EventData)

Occurs when any player relieves control of a unit to the AI.

MSRSQUEUE:OnEventRefueling(EventData)

Occurs when an aircraft connects with a tanker and begins taking on fuel.

MSRSQUEUE:OnEventRefuelingStop(EventData)

Occurs when an aircraft is finished taking fuel.

MSRSQUEUE:OnEventScore(EventData)

Occurs when any modification to the "Score" as seen on the debrief menu would occur.

MSRSQUEUE:OnEventShootingEnd(EventData)

Occurs when any unit stops firing its weapon.

MSRSQUEUE:OnEventShootingStart(EventData)

Occurs when any unit begins firing a weapon that has a high rate of fire.

MSRSQUEUE:OnEventShot(EventData)

Occurs whenever any unit in a mission fires a weapon.

MSRSQUEUE:OnEventTakeoff(EventData)

Occurs when an aircraft takes off from an airbase, farp, or ship.

MSRSQUEUE:OnEventTriggerZone(EventData)

Trigger zone.

MSRSQUEUE:OnEventUnitLost(EventData)

Occurs when the game thinks an object is destroyed.

MSRSQUEUE:ScheduleOnce(Start, SchedulerFunction, ...)

Schedule a new time event.

MSRSQUEUE:ScheduleRepeat(Start, Repeat, RandomizeFactor, Stop, SchedulerFunction, ...)

Schedule a new time event.

MSRSQUEUE:ScheduleStop(SchedulerID)

Stops the Schedule.

MSRSQUEUE.Scheduler

MSRSQUEUE:SetEventPriority(EventPriority)

Set the Class Core.Event processing Priority.

MSRSQUEUE:SetState(Object, Key, Value)

Set a state or property of the Object given a Key and a Value.

MSRSQUEUE:T(Arguments)

Trace a function logic level 1.

MSRSQUEUE:T2(Arguments)

Trace a function logic level 2.

MSRSQUEUE:T3(Arguments)

Trace a function logic level 3.

MSRSQUEUE:TraceAll(TraceAll)

Trace all methods in MOOSE

MSRSQUEUE:TraceClass(Class)

Set tracing for a class

MSRSQUEUE:TraceClassMethod(Class, Method)

Set tracing for a specific method of class

MSRSQUEUE:TraceLevel(Level)

Set trace level

MSRSQUEUE:TraceOff()

Set trace off.

MSRSQUEUE:TraceOn()

Set trace on.

MSRSQUEUE:TraceOnOff(TraceOnOff)

Set trace on or off Note that when trace is off, no BASE.Debug statement is performed, increasing performance! When Moose is loaded statically, (as one file), tracing is switched off by default.

MSRSQUEUE:UnHandleEvent(EventID)

UnSubscribe to a DCS event.

MSRSQUEUE._

MSRSQUEUE:_F(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function call.

MSRSQUEUE:_Serialize(Arguments)

(Internal) Serialize arguments

MSRSQUEUE:_T(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function logic.

MSRSQUEUE.__

MSRSQUEUE:onEvent(event)

The main event handling function...

Fields and Methods inherited from MSRSQUEUE.Transmission Description

MSRSQUEUE.Transmission.PlayerSet

PlayerSet created when TransmitOnlyWithPlayers == true

MSRSQUEUE.Transmission.Tplay

Mission time (abs) in seconds when the transmission should be played.

MSRSQUEUE.Transmission.TransmitOnlyWithPlayers

If true, only transmit if there are alive Players.

MSRSQUEUE.Transmission.Tstarted

Mission time (abs) in seconds when the transmission started.

MSRSQUEUE.Transmission.coordinate

Coordinate for this transmission

MSRSQUEUE.Transmission.culture

Voice culture

MSRSQUEUE.Transmission.duration

Duration in seconds.

MSRSQUEUE.Transmission.frequency

Frequency.

MSRSQUEUE.Transmission.gender

Voice gender

MSRSQUEUE.Transmission.interval

Interval in seconds before next transmission.

MSRSQUEUE.Transmission.isplaying

If true, transmission is currently playing.

MSRSQUEUE.Transmission.label

Label to be used

MSRSQUEUE.Transmission.modulation

Modulation.

MSRSQUEUE.Transmission.msrs

MOOSE SRS object.

MSRSQUEUE.Transmission.subduration

Duration of the subtitle being displayed.

MSRSQUEUE.Transmission.subgroups

Groups to send subtitle to.

MSRSQUEUE.Transmission.subtitle

Subtitle of the transmission.

MSRSQUEUE.Transmission.text

Text to be transmitted.

MSRSQUEUE.Transmission.voice

Voice if any

MSRSQUEUE.Transmission.volume

Volume

MSRS class.

Field(s)

#string MSRS.ClassName

Name of the class.

#string MSRS.ConfigFileName

Name of the standard config file.

#string MSRS.ConfigFilePath

Path to the standard config file.

#boolean MSRS.ConfigLoaded

If true if config file was loaded.

#string MSRS.Label

Label showing up on the SRS radio overlay. Default is "ROBOT". No spaces allowed.

#string MSRS.backend

Backend used as interface to SRS (MSRS.Backend.SRSEXE or MSRS.Backend.GRPC).

#number MSRS.coalition

Coalition of the transmission.

Core.Point#COORDINATE MSRS.coordinate

Coordinate from where the transmission is send.

#string MSRS.culture

Culture. Default "en-GB".

#table MSRS.frequencies

Frequencies used in the transmissions.

#string MSRS.gender

Gender. Default "female".

#string MSRS.lid

Class id string for output to DCS log file.

#table MSRS.modulations

Modulations used in the transmissions.

#string MSRS.name

Name. Default "MSRS".

#string MSRS.path

Path to the SRS exe.

#table MSRS.poptions

Provider options. Each element is a data structure of type MSRS.ProvierOptions.

#number MSRS.port

Port. Default 5002.

#string MSRS.provider

Provider of TTS (win, gcloud, azure, amazon).

#string MSRS.version

MSRS class version.

#string MSRS.voice

Specific voice. Only used if no explicit provider voice specified.

#number MSRS.volume

Volume between 0 (min) and 1 (max). Default 1.

Function(s)

Add frequencies.

Defined in:

MSRS

Parameter:

#table Frequencies

Frequencies in MHz. Can also be given as a #number if only one frequency should be used.

Return value:

self

Add modulations.

Defined in:

MSRS

Parameter:

#table Modulations

Modulations. Can also be given as a #number if only one modulation should be used.

Return value:

self

Get currently set backend.

Defined in:

MSRS

Return value:

#string:

Backend.

Get coalition.

Defined in:

MSRS

Return value:

#number:

Coalition.

Get frequencies.

Defined in:

MSRS

Return value:

#table:

Frequencies in MHz.

Get label.

Defined in:

MSRS

Return value:

#number:

Label.

Get modulations.

Defined in:

MSRS

Return value:

#table:

Modulations.

Get path to SRS directory.

Defined in:

MSRS

Return value:

#string:

Path to the directory. This includes the final slash "/".

Get port.

Defined in:

MSRS

Return value:

#number:

Port.

Get provider.

Defined in:

MSRS

Return value:

self

Get provider options.

Defined in:

MSRS

Parameter:

#string Provider

Provider. Default is as set via MSRS.SetProvider.

Return value:

Provider options.

Get voice.

Defined in:

MSRS

Parameter:

#string Provider

Provider. Default is the currently set provider (self.provider).

Return value:

#string:

Voice.

Get SRS volume.

Defined in:

MSRS

Return value:

#number:

Volume Volume - 1.0 is max, 0.0 is silence

Print SRS help to DCS log file.

Defined in:

MSRS

Return value:

self

Get central SRS configuration to be able to play tts over SRS radio using the DCS-SR-ExternalAudio.exe.

Defined in:

MSRS

Parameters:

#string Path

Path to config file, defaults to "C:\Users\\Saved Games\DCS\Config"

#string Filename

File to load, defaults to "Moose_MSRS.lua"

Return value:

#boolean:

success

Usage:

 0) Benefits: Centralize configuration of SRS, keep paths and keys out of the mission source code, making it safer and easier to move missions to/between servers,
 and also make config easier to use in the code.
 1) Create a config file named "Moose_MSRS.lua" at this location "C:\Users\<yourname>\Saved Games\DCS\Config" (or wherever your Saved Games folder resides).
 2) The file needs the following structure:

    -- Moose MSRS default Config
    MSRS_Config = {
      Path = "C:\\Program Files\\DCS-SimpleRadio-Standalone", -- Path to SRS install directory.
      Port = 5002,            -- Port of SRS server. Default 5002.
      Backend = "srsexe",     -- Interface to SRS: "srsexe" or "grpc".
      Frequency = {127, 243}, -- Default frequences. Must be a table 1..n entries!
      Modulation = {0,0},     -- Default modulations. Must be a table, 1..n entries, one for each frequency!
      Volume = 1.0,           -- Default volume [0,1].
      Coalition = 0,          -- 0 = Neutral, 1 = Red, 2 = Blue (only a factor if SRS server has encryption enabled).
      Coordinate = {0,0,0},   -- x, y, alt (only a factor if SRS server has line-of-sight and/or distance limit enabled).
      Culture = "en-GB",
      Gender = "male",
      Voice = "Microsoft Hazel Desktop", -- Voice that is used if no explicit provider voice is specified.
      Label = "MSRS",   
      Provider = "win", --Provider for generating TTS (win, gcloud, azure, aws).      
      -- Windows
      win = {
        voice = "Microsoft Hazel Desktop",
      },
      -- Google Cloud
      gcloud = {
        voice = "en-GB-Standard-A", -- The Google Cloud voice to use (see https://cloud.google.com/text-to-speech/docs/voices).
        credentials="C:\\Program Files\\DCS-SimpleRadio-Standalone\\yourfilename.json", -- Full path to credentials JSON file (only for SRS-TTS.exe backend)
        key="Your access Key", -- Google API access key (only for DCS-gRPC backend)
      },
      -- Amazon Web Service
      aws = {
        voice = "Brian", -- The default AWS voice to use (see https://docs.aws.amazon.com/polly/latest/dg/voicelist.html).
        key="Your access Key",  -- Your AWS key.
        secret="Your secret key", -- Your AWS secret key.
        region="eu-central-1", -- Your AWS region (see https://docs.aws.amazon.com/general/latest/gr/pol.html).
      },
      -- Microsoft Azure
      azure = {
        voice="en-US-AriaNeural",  --The default Azure voice to use (see https://learn.microsoft.com/azure/cognitive-services/speech-service/language-support).
        key="Your access key", -- Your Azure access key.
        region="westeurope", -- The Azure region to use (see https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/regions).
      },
    }

 3) The config file is automatically loaded when Moose starts. You can also load the config into the MSRS raw class manually before you do anything else:

        MSRS.LoadConfigFile() -- Note the "." here

 Optionally, your might want to provide a specific path and filename:

        MSRS.LoadConfigFile(nil,MyPath,MyFilename) -- Note the "." here

 This will populate variables for the MSRS raw class and all instances you create with e.g. `mysrs = MSRS:New()`
 Optionally you can also load this per **single instance** if so needed, i.e.

    mysrs:LoadConfigFile(Path,Filename)

 4) Use the config in your code like so, variable names are basically the same as in the config file, but all lower case, examples:

        -- Needed once only
        MESSAGE.SetMSRS(MSRS.path,MSRS.port,nil,127,rado.modulation.FM,nil,nil,nil,nil,nil,"TALK")

        -- later on in your code

        MESSAGE:New("Test message!",15,"SPAWN"):ToSRS(243,radio.modulation.AM,nil,nil,MSRS.Voices.Google.Standard.fr_FR_Standard_C)

        -- Create new ATIS as usual
        atis=ATIS:New(AIRBASE.Caucasus.Batumi, 123, radio.modulation.AM)
        atis:SetSRS(nil,nil,nil,MSRS.Voices.Google.Standard.en_US_Standard_H)
        --Start ATIS
        atis:Start()

Create a new MSRS object.

Required argument is the frequency and modulation. Other parameters are read from the Moose_MSRS.lua config file. If you do not have that file set up you must set up and use the DCS-SR-ExternalAudio.exe (not DCS-gRPC) as backend, you need to still set the path to the exe file via MSRS.SetPath.

Defined in:

MSRS

Parameters:

#string Path

Path to SRS directory. Default C:\\Program Files\\DCS-SimpleRadio-Standalone.

#number Frequency

Radio frequency in MHz. Default 143.00 MHz. Can also be given as a #table of multiple frequencies.

#number Modulation

Radio modulation: 0=AM (default), 1=FM. See radio.modulation.AM and radio.modulation.FM enumerators. Can also be given as a #table of multiple modulations.

#string Backend

Backend used: MSRS.Backend.SRSEXE (default) or MSRS.Backend.GRPC.

Return value:

self

Play sound file (ogg or mp3) via SRS.

Defined in:

MSRS

Parameters:

Sound file to play.

#number Delay

Delay in seconds, before the sound file is played.

Return value:

self

Play a SOUNDTEXT text-to-speech object.

Defined in:

MSRS

Parameters:

Sound text.

#number Delay

Delay in seconds, before the sound file is played.

Return value:

self

Play text message via MSRS.

Defined in:

MSRS

Parameters:

#string Text

Text message.

#number Delay

Delay in seconds, before the message is played.

Coordinate.

Return value:

self

Play text message via MSRS with explicitly specified options.

Defined in:

MSRS

Parameters:

#string Text

Text message.

#number Delay

Delay in seconds, before the message is played.

#table Frequencies

Radio frequencies.

#table Modulations

Radio modulations.

#string Gender

Gender.

#string Culture

Culture.

#string Voice

Voice.

#number Volume

Volume.

#string Label

Label.

Coordinate.

Return value:

self

Play text file via MSRS.

Defined in:

MSRS

Parameters:

#string TextFile

Full path to the file.

#number Delay

Delay in seconds, before the message is played.

Return value:

self

Set backend to communicate with SRS.

There are two options:

  • MSRS.Backend.SRSEXE: This is the default and uses the DCS-SR-ExternalAudio.exe.
  • MSRS.Backend.GRPC: Via DCS-gRPC.

Defined in:

MSRS

Parameter:

#string Backend

Backend used. Default is MSRS.Backend.SRSEXE.

Return value:

self

Set DCS-gRPC as backend to communicate with SRS.

Defined in:

MSRS

Return value:

self

Set DCS-SR-ExternalAudio.exe as backend to communicate with SRS.

Defined in:

MSRS

Return value:

self

Set coalition.

Defined in:

MSRS

Parameter:

#number Coalition

Coalition. Default 0.

Return value:

self

Set the coordinate from which the transmissions will be broadcasted.

Note that this is only a factor if SRS has line-of-sight or distance enabled.

Defined in:

MSRS

Parameter:

Origin of the transmission.

Return value:

self

Set culture.

Defined in:

MSRS

Parameter:

#string Culture

Culture, e.g. "en-GB".

Return value:

self

Set the default backend.

Defined in:

MSRS

Parameter:

Backend

Set DCS-gRPC to be the default backend.

Defined in:

MSRS

Set frequencies.

Defined in:

MSRS

Parameter:

#table Frequencies

Frequencies in MHz. Can also be given as a #number if only one frequency should be used.

Return value:

self

Set gender.

Defined in:

MSRS

Parameter:

#string Gender

Gender: "male" or "female" (default).

Return value:

self

[Deprecated] Use google text-to-speech credentials.

Also sets Google as default TTS provider.

Defined in:

MSRS

Parameter:

#string PathToCredentials

Full path to the google credentials JSON file, e.g. "C:\Users\username\Downloads\service-account-file.json". Can also be the Google API key.

Return value:

self

[Deprecated] Use google text-to-speech set the API key (only for DCS-gRPC).

Defined in:

MSRS

Parameter:

#string APIKey

API Key, usually a string of length 40 with characters and numbers.

Return value:

self

Set label.

Defined in:

MSRS

Parameter:

#number Label

Default "ROBOT"

Return value:

self

Set modulations.

Defined in:

MSRS

Parameter:

#table Modulations

Modulations. Can also be given as a #number if only one modulation should be used.

Return value:

self

Set path to SRS install directory.

More precisely, path to where the DCS-SR-ExternalAudio.exe is located.

Defined in:

MSRS

Parameter:

#string Path

Path to the directory, where the sound file is located. Default is C:\\Program Files\\DCS-SimpleRadio-Standalone.

Return value:

self

Set port.

Defined in:

MSRS

Parameter:

#number Port

Port. Default 5002.

Return value:

self

Set provider used to generate text-to-speech.

These options are available:

  • MSRS.Provider.WINDOWS: Microsoft Windows (default)
  • MSRS.Provider.GOOGLE: Google Cloud
  • MSRS.Provider.AZURE: Microsoft Azure (only with DCS-gRPC backend)
  • MSRS.Provier.AMAZON: Amazone Web Service (only with DCS-gRPC backend)

Note that all providers except Microsoft Windows need as additonal information the credentials of your account.

Defined in:

MSRS

Parameter:

#string Provider

Return value:

self

Set provider options and credentials.

Defined in:

MSRS

Parameters:

#string Provider

Provider.

#string CredentialsFile

Full path to your credentials file. For Google this is the path to a JSON file.

#string AccessKey

Your API access key.

#string SecretKey

Your secret key.

#string Region

Region to use.

Return value:

Provider optionas table.

Set provider options and credentials for Amazon Web Service (AWS).

Only supported in combination with DCS-gRPC as backend.

Defined in:

MSRS

Parameters:

#string AccessKey

Your API access key.

#string SecretKey

Your secret key.

#string Region

Your AWS region.

Return value:

self

Set provider options and credentials for Microsoft Azure.

Only supported in combination with DCS-gRPC as backend.

Defined in:

MSRS

Parameters:

#string AccessKey

Your API access key.

#string Region

Your Azure region.

Return value:

self

Set provider options and credentials for Google Cloud.

Defined in:

MSRS

Parameters:

#string CredentialsFile

Full path to your credentials file. For Google this is the path to a JSON file. This is used if DCS-SR-ExternalAudio.exe is used as backend.

#string AccessKey

Your API access key. This is necessary if DCS-gRPC is used as backend.

Return value:

self

Use Amazon Web Service (AWS) to provide text-to-speech.

Only supported if used in combination with DCS-gRPC as backend.

Defined in:

MSRS

Return value:

self

Use Microsoft Azure to provide text-to-speech.

Only supported if used in combination with DCS-gRPC as backend.

Defined in:

MSRS

Return value:

self

Use Google to provide text-to-speech.

Defined in:

MSRS

Return value:

self

Use Microsoft to provide text-to-speech.

Defined in:

MSRS

Return value:

self

Set to use a specific voice.

Note that this will override any gender and culture settings as a voice already has a certain gender/culture.

Defined in:

MSRS

Parameter:

#string Voice

Voice.

Return value:

self

Set to use a specific voice if Amazon Web Service is use as provider (only DCS-gRPC backend).

Note that this will override any gender and culture settings.

Defined in:

MSRS

Parameter:

#string Voice

AWS Voice. Default "Brian".

Return value:

self

Set to use a specific voice if Microsoft Azure is use as provider (only DCS-gRPC backend).

Note that this will override any gender and culture settings.

Defined in:

MSRS

Parameter:

#string Voice

Azure Voice. Default "en-US-AriaNeural".

Return value:

self

Set to use a specific voice if Google is use as provider.

Note that this will override any gender and culture settings.

Defined in:

MSRS

Parameter:

#string Voice

Voice. Default MSRS.Voices.Google.Standard.en_GB_Standard_A.

Return value:

self

Set to use a specific voice for a given provider.

Note that this will override any gender and culture settings.

Defined in:

MSRS

Parameters:

#string Voice

Voice.

#string Provider

Provider. Default is as set by MSRS.SetProvider, which itself defaults to MSRS.Provider.WINDOWS if not set.

Return value:

self

Set to use a specific voice if Microsoft Windows' native TTS is use as provider.

Note that this will override any gender and culture settings.

Defined in:

MSRS

Parameter:

#string Voice

Voice. Default "Microsoft Hazel Desktop".

Return value:

self

Set SRS volume.

Defined in:

MSRS

Parameter:

#number Volume

Volume - 1.0 is max, 0.0 is silence

Return value:

self

Create MSRS.ProviderOptions.

Defined in:

MSRS

Parameters:

#string Provider

Provider.

#string CredentialsFile

Full path to your credentials file. For Google this is the path to a JSON file.

#string AccessKey

Your API access key.

#string SecretKey

Your secret key.

#string Region

Region to use.

Return value:

Provider optionas table.

Make DCS-gRPC API call to transmit text-to-speech over SRS.

Defined in:

MSRS

Parameters:

#string Text

Text of message to transmit (can also be SSML).

#table Frequencies

Radio frequencies to transmit on. Can also accept a number in MHz.

#string Gender

Gender.

#string Culture

Culture.

#string Voice

Voice.

#number Volume

Volume.

#string Label

Label.

Coordinate.

Return value:

self

Execute SRS command to play sound using the DCS-SR-ExternalAudio.exe.

Defined in:

MSRS

Parameter:

#string command

Command to executer

Return value:

#number:

Return value of os.execute() command.

Get SRS command to play sound using the DCS-SR-ExternalAudio.exe.

Defined in:

MSRS

Parameters:

#table freqs

Frequencies in MHz.

#table modus

Modulations.

#number coal

Coalition.

#string gender

Gender.

#string voice

Voice.

#string culture

Culture.

#number volume

Volume.

#number speed

Speed.

#number port

Port.

#string label

Label, defaults to "ROBOT" (displayed sender name in the radio overlay of SRS) - No spaces allowed!

Coordinate.

Return value:

#string:

Command.

Get lat, long and alt from coordinate.

Defined in:

MSRS

Parameter:

Coordinate. Can also be a DCS#Vec3.

Return values:

#number:

Latitude (or 0 if no input coordinate was given).

#number:

Longitude (or 0 if no input coordinate was given).

#number:

Altitude (or 0 if no input coordinate was given).

Function returns estimated speech time in seconds.

Assumptions for time calc: 100 Words per min, average of 5 letters for english word so

  • 5 chars * 100wpm = 500 characters per min = 8.3 chars per second

So length of msg / 8.3 = number of seconds needed to read it. rounded down to 8 chars per sec map function:

  • (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min

Defined in:

MSRS

Parameters:

#number length

can also be passed as #string

#number speed

Defaults to 1.0

#boolean isGoogle

We're using Google TTS

Function for UUID.

Defined in:

MSRS

Field(s)

#string MSRS.ClassName

Name of the class.

#string MSRS.ConfigFileName

Name of the standard config file.

#string MSRS.ConfigFilePath

Path to the standard config file.

#boolean MSRS.ConfigLoaded

If true if config file was loaded.

#string MSRS.Label

Label showing up on the SRS radio overlay. Default is "ROBOT". No spaces allowed.

#string MSRS.backend

Backend used as interface to SRS (MSRS.Backend.SRSEXE or MSRS.Backend.GRPC).

#number MSRS.coalition

Coalition of the transmission.

Core.Point#COORDINATE MSRS.coordinate

Coordinate from where the transmission is send.

#string MSRS.culture

Culture. Default "en-GB".

#table MSRS.frequencies

Frequencies used in the transmissions.

#string MSRS.gender

Gender. Default "female".

#string MSRS.lid

Class id string for output to DCS log file.

#table MSRS.modulations

Modulations used in the transmissions.

#string MSRS.name

Name. Default "MSRS".

#string MSRS.path

Path to the SRS exe.

#table MSRS.poptions

Provider options. Each element is a data structure of type MSRS.ProvierOptions.

#number MSRS.port

Port. Default 5002.

#string MSRS.provider

Provider of TTS (win, gcloud, azure, amazon).

#string MSRS.version

MSRS class version.

#string MSRS.voice

Specific voice. Only used if no explicit provider voice specified.

#number MSRS.volume

Volume between 0 (min) and 1 (max). Default 1.

Function(s)

Clear the state of an object.

Defined in:

Parameters:

Object

The object that holds the Value set by the Key.

StateName

The key that is should be cleared.

Creation of a Birth Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

#string IniUnitName

The initiating unit name.

place

subplace

Creation of a Crash Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

IniObjectCategory

Creation of a Dead Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

IniObjectCategory

Creation of a S_EVENT_PLAYER_ENTER_AIRCRAFT event.

Defined in:

Parameter:

Wrapper.Unit#UNIT PlayerUnit

The aircraft unit the player entered.

Creation of a Remove Unit Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

Creation of a Takeoff Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

Creation of a Crash Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

Log an exception which will be traced always.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Returns the event dispatcher

Defined in:

Return value:

Remove all subscribed events

Defined in:

Return value:

Trace a function call.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function call level 2.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function call level 3.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Get the ClassID of the class instance.

Defined in:

Return value:

#string:

The ClassID of the class instance.

Get the ClassName of the class instance.

Defined in:

Return value:

#string:

The ClassName of the class instance.

Get the ClassName + ClassID of the class instance.

The ClassName + ClassID is formatted as '%s#%09d'.

Defined in:

Return value:

#string:

The ClassName + ClassID of the class instance.

Get the Class Core.Event processing Priority.

The Event processing Priority is a number from 1 to 10, reflecting the order of the classes subscribed to the Event to be processed.

Defined in:

Return value:

#number:

The Core.Event processing Priority.

This is the worker method to retrieve the Parent class.

Note that the Parent class must be passed to call the parent class method.

self:GetParent(self):ParentMethod()

Defined in:

Parameters:

#BASE Child

This is the Child class from which the Parent class needs to be retrieved.

#BASE FromClass

(Optional) The class from which to get the parent.

Return value:

Get a Value given a Key from the Object.

Note that if the Object is destroyed, set to nil, or garbage collected, then the Values and Keys will also be gone.

Defined in:

Parameters:

Object

The object that holds the Value set by the Key.

Key

The key that is used to retrieve the value. Note that the key can be a #string, but it can also be any other type!

Return value:

The Value retrieved or nil if the Key was not found and thus the Value could not be retrieved.

Subscribe to a DCS Event.

Defined in:

Parameters:

Event ID.

#function EventFunction

(optional) The function to be called when the event occurs for the unit.

Return value:

Log an information which will be traced always.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

This is the worker method to inherit from a parent class.

Defined in:

Parameters:

Child

is the Child class that inherits.

#BASE Parent

is the Parent class that the Child inherits from.

Return value:

Child

This is the worker method to check if an object is an (sub)instance of a class.

Examples:

  • ZONE:New( 'some zone' ):IsInstanceOf( ZONE ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'ZONE' ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'zone' ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'BASE' ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'GROUP' ) will return false

Defined in:

Parameter:

ClassName

is the name of the class or the class itself to run the check against

Return value:

#boolean:

Enquires if tracing is on (for the class).

Defined in:

Return value:

#boolean:

BASE constructor.

This is an example how to use the BASE:New() constructor in a new class definition when inheriting from BASE.

function EVENT:New()
  local self = BASE:Inherit( self, BASE:New() ) -- #EVENT
  return self
end

Defined in:

Return value:

Occurs when an Event for an object is triggered.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that triggered the event.

Defined in:

Parameter:

The EventData structure.

BDA.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a ground unit captures either an airbase or a farp.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that captured the base place: The airbase that was captured, can be a FARP or Airbase. When calling place:getCoalition() the faction will already be the new owning faction.

Defined in:

Parameter:

The EventData structure.

Occurs when any object is spawned into the mission.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was spawned

Defined in:

Parameter:

The EventData structure.

Occurs when any aircraft crashes into the ground and is completely destroyed.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that has crashed

Defined in:

Parameter:

The EventData structure.

Occurs when an object is dead.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is dead.

Defined in:

Parameter:

The EventData structure.

Unknown precisely what creates this event, likely tied into newer damage model.

Will update this page when new information become available.

  • initiator: The unit that had the failure.

Defined in:

Parameter:

The EventData structure.

Discard chair after ejection.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a pilot ejects from an aircraft Have a look at the class Core.Event#EVENT as these are just the prototypes.

initiator : The unit that has ejected

Defined in:

Parameter:

The EventData structure.

Occurs when any aircraft shuts down its engines.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is stopping its engines.

Defined in:

Parameter:

The EventData structure.

Occurs when any aircraft starts its engines.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is starting its engines.

Defined in:

Parameter:

The EventData structure.

Occurs whenever an object is hit by a weapon.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit object the fired the weapon weapon: Weapon object that hit the target target: The Object that was hit.

Defined in:

Parameter:

The EventData structure.

Occurs when any system fails on a human controlled aircraft.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that had the failure

Defined in:

Parameter:

The EventData structure.

Occurs on the death of a unit.

Contains more and different information. Similar to unit_lost it will occur for aircraft before the aircraft crash event occurs. Have a look at the class Core.Event#EVENT as these are just the prototypes.

  • initiator: The unit that killed the target
  • target: Target Object
  • weapon: Weapon Object

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft lands at an airbase, farp or ship Have a look at the class Core.Event#EVENT as these are just the prototypes.

initiator : The unit that has landed place: Object that the unit landed on. Can be an Airbase Object, FARP, or Ships

Defined in:

Parameter:

The EventData structure.

Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up.

Event does not occur if the pilot lands in the water and sub combs to Davey Jones Locker. Have a look at the class Core.Event#EVENT as these are just the prototypes.

  • initiator: Static object representing the ejected pilot. Place : Aircraft that the pilot ejected from.
  • place: may not return as a valid object if the aircraft has crashed into the ground and no longer exists.
  • subplace: is always 0 for unknown reasons.

Defined in:

Parameter:

The EventData structure.

Landing quality mark.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a new mark was added.

Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mark text was changed.

Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mark was removed.

Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Weapon add.

Fires when entering a mission per pylon with the name of the weapon (double pylons not counted, infinite wep reload not counted. Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when the pilot of an aircraft is killed.

Can occur either if the player is alive and crashes or if a weapon kills the pilot without completely destroying the plane. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that the pilot has died in.

Defined in:

Parameter:

The EventData structure.

Occurs when a player enters a slot and takes control of an aircraft.

Have a look at the class Core.Event#EVENT as these are just the prototypes. NOTE: This is a workaround of a long standing DCS bug with the PLAYER_ENTER_UNIT event. initiator : The unit that is being taken control of.

Defined in:

Parameter:

The EventData structure.

Occurs when any player assumes direct control of a unit.

Note - not Mulitplayer safe. Use PlayerEnterAircraft. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is being taken control of.

Defined in:

Parameter:

The EventData structure.

Occurs when any player relieves control of a unit to the AI.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that the player left.

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft connects with a tanker and begins taking on fuel.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is receiving fuel.

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft is finished taking fuel.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was receiving fuel.

Defined in:

Parameter:

The EventData structure.

Occurs when any modification to the "Score" as seen on the debrief menu would occur.

There is no information on what values the score was changed to. Event is likely similar to player_comment in this regard. Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when any unit stops firing its weapon.

Event will always correspond with a shooting start event. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was doing the shooting.

Defined in:

Parameter:

The EventData structure.

Occurs when any unit begins firing a weapon that has a high rate of fire.

Most common with aircraft cannons (GAU-8), autocannons, and machine guns. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is doing the shooting. target: The unit that is being targeted.

Defined in:

Parameter:

The EventData structure.

Occurs whenever any unit in a mission fires a weapon.

But not any machine gun or autocannon based weapon, those are handled by EVENT.ShootingStart. Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft takes off from an airbase, farp, or ship.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that tookoff place: Object from where the AI took-off from. Can be an Airbase Object, FARP, or Ships

Defined in:

Parameter:

The EventData structure.

Trigger zone.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when the game thinks an object is destroyed.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

  • initiator: The unit that is was destroyed.

Defined in:

Parameter:

The EventData structure.

Schedule a new time event.

Note that the schedule will only take place if the scheduler is started. Even for a single schedule event, the scheduler needs to be started also.

Defined in:

Parameters:

#number Start

Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.

#function SchedulerFunction

The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.

#table ...

Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.

Return value:

#string:

The Schedule ID of the planned schedule.

Schedule a new time event.

Note that the schedule will only take place if the scheduler is started. Even for a single schedule event, the scheduler needs to be started also.

Defined in:

Parameters:

#number Start

Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.

#number Repeat

Specifies the interval in seconds when the scheduler will call the event function.

#number RandomizeFactor

Specifies a randomization factor between 0 and 1 to randomize the Repeat.

#number Stop

Specifies the amount of seconds when the scheduler will be stopped.

#function SchedulerFunction

The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.

#table ...

Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.

Return value:

#string:

The Schedule ID of the planned schedule.

Stops the Schedule.

Defined in:

Parameter:

#string SchedulerID

(Optional) Scheduler ID to be stopped. If nil, all pending schedules are stopped.

Set the Class Core.Event processing Priority.

The Event processing Priority is a number from 1 to 10, reflecting the order of the classes subscribed to the Event to be processed.

Defined in:

Parameter:

#number EventPriority

The Core.Event processing Priority.

Return value:

self

Set a state or property of the Object given a Key and a Value.

Note that if the Object is destroyed, set to nil, or garbage collected, then the Values and Keys will also be gone.

Defined in:

Parameters:

Object

The object that will hold the Value set by the Key.

Key

The key that is used as a reference of the value. Note that the key can be a #string, but it can also be any other type!

Value

The value to is stored in the object.

Return value:

The Value set.

Trace a function logic level 1.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function logic level 2.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function logic level 3.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace all methods in MOOSE

Defined in:

Parameter:

#boolean TraceAll

true = trace all methods in MOOSE.

Set tracing for a class

Defined in:

Parameter:

#string Class

Class name.

Set tracing for a specific method of class

Defined in:

Parameters:

#string Class

Class name.

#string Method

Method.

Set trace level

Defined in:

Parameter:

#number Level

Set trace off.

Defined in:

Usage:

-- Switch the tracing Off
BASE:TraceOff()

Set trace on.

Defined in:

Usage:

-- Switch the tracing On
BASE:TraceOn()

Set trace on or off Note that when trace is off, no BASE.Debug statement is performed, increasing performance! When Moose is loaded statically, (as one file), tracing is switched off by default.

So tracing must be switched on manually in your mission if you are using Moose statically. When moose is loading dynamically (for moose class development), tracing is switched on by default.

Defined in:

Parameter:

#boolean TraceOnOff

Switch the tracing on or off.

Usage:


  -- Switch the tracing On
  BASE:TraceOnOff( true )

  -- Switch the tracing Off
  BASE:TraceOnOff( false )

UnSubscribe to a DCS event.

Defined in:

Parameter:

Event ID.

Return value:

Trace a function call.

This function is private.

Defined in:

Parameters:

Arguments

A #table or any field.

DebugInfoCurrentParam

DebugInfoFromParam

(Internal) Serialize arguments

Defined in:

Parameter:

#table Arguments

Return value:

#string:

Text

Trace a function logic.

Defined in:

Parameters:

Arguments

A #table or any field.

DebugInfoCurrentParam

DebugInfoFromParam

The main event handling function...

This function captures all events generated for the class.

Defined in:

Parameter:

DCS#Event event

Backend options to communicate with SRS.

Field(s)

#string MSRS.Backend.GRPC

Use DCS-gRPC.

#string MSRS.Backend.SRSEXE

Use DCS-SR-ExternalAudio.exe.

Function(s)

Text-to-speech providers.

These are compatible with the DCS-gRPC conventions.

Field(s)

#string MSRS.Provider.AMAZON

Amazon Web Service (aws). Only possible with DCS-gRPC backend.

#string MSRS.Provider.AZURE

Microsoft Azure (azure). Only possible with DCS-gRPC backend.

#string MSRS.Provider.GOOGLE

Google (gcloud).

#string MSRS.Provider.WINDOWS

Microsoft windows (win).

Function(s)

Provider options.

Field(s)

#string MSRS.ProviderOptions.credentials

Google credentials JSON file (full path).

#string MSRS.ProviderOptions.defaultVoice

Default voice (not used).

#string MSRS.ProviderOptions.key

Access key (DCS-gRPC with Google, AWS, AZURE as provider).

#string MSRS.ProviderOptions.provider

Provider.

#string MSRS.ProviderOptions.region

Region.

#string MSRS.ProviderOptions.secret

Secret key (DCS-gRPC with AWS as provider)

#string MSRS.ProviderOptions.voice

Voice used.

Function(s)

Voices

Field(s)

Function(s)

Manages radio transmissions.

The purpose of the MSRSQUEUE class is to manage SRS text-to-speech (TTS) messages using the MSRS class. This can be used to submit multiple TTS messages and the class takes care that they are transmitted one after the other (and not overlapping).

Field(s)

#string MSRSQUEUE.ClassName

Name of the class "MSRSQUEUE".

#number MSRSQUEUE.Tlast

Time (abs) when the last transmission finished.

#string MSRSQUEUE.alias

Name of the radio queue.

#boolean MSRSQUEUE.checking

If true, the queue update function is scheduled to be called again.

#number MSRSQUEUE.dt

Time interval in seconds for checking the radio queue.

#string MSRSQUEUE.lid

ID for dcs.log.

#table MSRSQUEUE.queue

The queue of transmissions.

Function(s)

Add a transmission to the radio queue.

Defined in:

MSRSQUEUE

Parameter:

The transmission data table.

Return value:

self

Broadcast radio message.

Defined in:

MSRSQUEUE

Parameter:

The transmission.

Calculate total transmission duration of all transmission in the queue.

Defined in:

MSRSQUEUE

Return value:

#number:

Total transmission duration.

Clear the radio queue.

Defined in:

MSRSQUEUE

Return value:

self The MSRSQUEUE object.

Create a new MSRSQUEUE object for a given radio frequency/modulation.

Defined in:

MSRSQUEUE

Parameter:

#string alias

(Optional) Name of the radio queue.

Return value:

self The MSRSQUEUE object.

Create a new transmission and add it to the radio queue.

Defined in:

MSRSQUEUE

Parameters:

#string text

Text to play.

#number duration

Duration in seconds the file lasts. Default is determined by number of characters of the text message.

MOOSE SRS object.

#number tstart

Start time (abs) seconds. Default now.

#number interval

Interval in seconds after the last transmission finished.

#table subgroups

Groups that should receive the subtiltle.

#string subtitle

Subtitle displayed when the message is played.

#number subduration

Duration [sec] of the subtitle being displayed. Default 5 sec.

#number frequency

Radio frequency if other than MSRS default.

#number modulation

Radio modulation if other then MSRS default.

#string gender

Gender of the voice

#string culture

Culture of the voice

#string voice

Specific voice

#number volume

Volume setting

#string label

Label to be used

Coordinate to be used

Return value:

Radio transmission table.

Switch to only transmit if there are players on the server.

Defined in:

MSRSQUEUE

Parameter:

#boolean Switch

If true, only send SRS if there are alive Players.

Return value:

self

Check radio queue for transmissions to be broadcasted.

Defined in:

MSRSQUEUE

Parameter:

#number delay

Delay in seconds before checking.

Field(s)

#string MSRSQUEUE.ClassName

Name of the class "MSRSQUEUE".

#number MSRSQUEUE.Tlast

Time (abs) when the last transmission finished.

#string MSRSQUEUE.alias

Name of the radio queue.

#boolean MSRSQUEUE.checking

If true, the queue update function is scheduled to be called again.

#number MSRSQUEUE.dt

Time interval in seconds for checking the radio queue.

#string MSRSQUEUE.lid

ID for dcs.log.

#table MSRSQUEUE.queue

The queue of transmissions.

Function(s)

Clear the state of an object.

Defined in:

Parameters:

Object

The object that holds the Value set by the Key.

StateName

The key that is should be cleared.

Creation of a Birth Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

#string IniUnitName

The initiating unit name.

place

subplace

Creation of a Crash Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

IniObjectCategory

Creation of a Dead Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

IniObjectCategory

Creation of a S_EVENT_PLAYER_ENTER_AIRCRAFT event.

Defined in:

Parameter:

Wrapper.Unit#UNIT PlayerUnit

The aircraft unit the player entered.

Creation of a Remove Unit Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

Creation of a Takeoff Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

Creation of a Crash Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

Log an exception which will be traced always.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Returns the event dispatcher

Defined in:

Return value:

Remove all subscribed events

Defined in:

Return value:

Trace a function call.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function call level 2.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function call level 3.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Get the ClassID of the class instance.

Defined in:

Return value:

#string:

The ClassID of the class instance.

Get the ClassName of the class instance.

Defined in:

Return value:

#string:

The ClassName of the class instance.

Get the ClassName + ClassID of the class instance.

The ClassName + ClassID is formatted as '%s#%09d'.

Defined in:

Return value:

#string:

The ClassName + ClassID of the class instance.

Get the Class Core.Event processing Priority.

The Event processing Priority is a number from 1 to 10, reflecting the order of the classes subscribed to the Event to be processed.

Defined in:

Return value:

#number:

The Core.Event processing Priority.

This is the worker method to retrieve the Parent class.

Note that the Parent class must be passed to call the parent class method.

self:GetParent(self):ParentMethod()

Defined in:

Parameters:

#BASE Child

This is the Child class from which the Parent class needs to be retrieved.

#BASE FromClass

(Optional) The class from which to get the parent.

Return value:

Get a Value given a Key from the Object.

Note that if the Object is destroyed, set to nil, or garbage collected, then the Values and Keys will also be gone.

Defined in:

Parameters:

Object

The object that holds the Value set by the Key.

Key

The key that is used to retrieve the value. Note that the key can be a #string, but it can also be any other type!

Return value:

The Value retrieved or nil if the Key was not found and thus the Value could not be retrieved.

Subscribe to a DCS Event.

Defined in:

Parameters:

Event ID.

#function EventFunction

(optional) The function to be called when the event occurs for the unit.

Return value:

Log an information which will be traced always.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

This is the worker method to inherit from a parent class.

Defined in:

Parameters:

Child

is the Child class that inherits.

#BASE Parent

is the Parent class that the Child inherits from.

Return value:

Child

This is the worker method to check if an object is an (sub)instance of a class.

Examples:

  • ZONE:New( 'some zone' ):IsInstanceOf( ZONE ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'ZONE' ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'zone' ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'BASE' ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'GROUP' ) will return false

Defined in:

Parameter:

ClassName

is the name of the class or the class itself to run the check against

Return value:

#boolean:

Enquires if tracing is on (for the class).

Defined in:

Return value:

#boolean:

BASE constructor.

This is an example how to use the BASE:New() constructor in a new class definition when inheriting from BASE.

function EVENT:New()
  local self = BASE:Inherit( self, BASE:New() ) -- #EVENT
  return self
end

Defined in:

Return value:

Occurs when an Event for an object is triggered.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that triggered the event.

Defined in:

Parameter:

The EventData structure.

BDA.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a ground unit captures either an airbase or a farp.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that captured the base place: The airbase that was captured, can be a FARP or Airbase. When calling place:getCoalition() the faction will already be the new owning faction.

Defined in:

Parameter:

The EventData structure.

Occurs when any object is spawned into the mission.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was spawned

Defined in:

Parameter:

The EventData structure.

Occurs when any aircraft crashes into the ground and is completely destroyed.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that has crashed

Defined in:

Parameter:

The EventData structure.

Occurs when an object is dead.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is dead.

Defined in:

Parameter:

The EventData structure.

Unknown precisely what creates this event, likely tied into newer damage model.

Will update this page when new information become available.

  • initiator: The unit that had the failure.

Defined in:

Parameter:

The EventData structure.

Discard chair after ejection.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a pilot ejects from an aircraft Have a look at the class Core.Event#EVENT as these are just the prototypes.

initiator : The unit that has ejected

Defined in:

Parameter:

The EventData structure.

Occurs when any aircraft shuts down its engines.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is stopping its engines.

Defined in:

Parameter:

The EventData structure.

Occurs when any aircraft starts its engines.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is starting its engines.

Defined in:

Parameter:

The EventData structure.

Occurs whenever an object is hit by a weapon.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit object the fired the weapon weapon: Weapon object that hit the target target: The Object that was hit.

Defined in:

Parameter:

The EventData structure.

Occurs when any system fails on a human controlled aircraft.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that had the failure

Defined in:

Parameter:

The EventData structure.

Occurs on the death of a unit.

Contains more and different information. Similar to unit_lost it will occur for aircraft before the aircraft crash event occurs. Have a look at the class Core.Event#EVENT as these are just the prototypes.

  • initiator: The unit that killed the target
  • target: Target Object
  • weapon: Weapon Object

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft lands at an airbase, farp or ship Have a look at the class Core.Event#EVENT as these are just the prototypes.

initiator : The unit that has landed place: Object that the unit landed on. Can be an Airbase Object, FARP, or Ships

Defined in:

Parameter:

The EventData structure.

Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up.

Event does not occur if the pilot lands in the water and sub combs to Davey Jones Locker. Have a look at the class Core.Event#EVENT as these are just the prototypes.

  • initiator: Static object representing the ejected pilot. Place : Aircraft that the pilot ejected from.
  • place: may not return as a valid object if the aircraft has crashed into the ground and no longer exists.
  • subplace: is always 0 for unknown reasons.

Defined in:

Parameter:

The EventData structure.

Landing quality mark.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a new mark was added.

Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mark text was changed.

Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mark was removed.

Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Weapon add.

Fires when entering a mission per pylon with the name of the weapon (double pylons not counted, infinite wep reload not counted. Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when the pilot of an aircraft is killed.

Can occur either if the player is alive and crashes or if a weapon kills the pilot without completely destroying the plane. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that the pilot has died in.

Defined in:

Parameter:

The EventData structure.

Occurs when a player enters a slot and takes control of an aircraft.

Have a look at the class Core.Event#EVENT as these are just the prototypes. NOTE: This is a workaround of a long standing DCS bug with the PLAYER_ENTER_UNIT event. initiator : The unit that is being taken control of.

Defined in:

Parameter:

The EventData structure.

Occurs when any player assumes direct control of a unit.

Note - not Mulitplayer safe. Use PlayerEnterAircraft. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is being taken control of.

Defined in:

Parameter:

The EventData structure.

Occurs when any player relieves control of a unit to the AI.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that the player left.

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft connects with a tanker and begins taking on fuel.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is receiving fuel.

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft is finished taking fuel.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was receiving fuel.

Defined in:

Parameter:

The EventData structure.

Occurs when any modification to the "Score" as seen on the debrief menu would occur.

There is no information on what values the score was changed to. Event is likely similar to player_comment in this regard. Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when any unit stops firing its weapon.

Event will always correspond with a shooting start event. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was doing the shooting.

Defined in:

Parameter:

The EventData structure.

Occurs when any unit begins firing a weapon that has a high rate of fire.

Most common with aircraft cannons (GAU-8), autocannons, and machine guns. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is doing the shooting. target: The unit that is being targeted.

Defined in:

Parameter:

The EventData structure.

Occurs whenever any unit in a mission fires a weapon.

But not any machine gun or autocannon based weapon, those are handled by EVENT.ShootingStart. Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft takes off from an airbase, farp, or ship.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that tookoff place: Object from where the AI took-off from. Can be an Airbase Object, FARP, or Ships

Defined in:

Parameter:

The EventData structure.

Trigger zone.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when the game thinks an object is destroyed.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

  • initiator: The unit that is was destroyed.

Defined in:

Parameter:

The EventData structure.

Schedule a new time event.

Note that the schedule will only take place if the scheduler is started. Even for a single schedule event, the scheduler needs to be started also.

Defined in:

Parameters:

#number Start

Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.

#function SchedulerFunction

The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.

#table ...

Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.

Return value:

#string:

The Schedule ID of the planned schedule.

Schedule a new time event.

Note that the schedule will only take place if the scheduler is started. Even for a single schedule event, the scheduler needs to be started also.

Defined in:

Parameters:

#number Start

Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.

#number Repeat

Specifies the interval in seconds when the scheduler will call the event function.

#number RandomizeFactor

Specifies a randomization factor between 0 and 1 to randomize the Repeat.

#number Stop

Specifies the amount of seconds when the scheduler will be stopped.

#function SchedulerFunction

The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.

#table ...

Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.

Return value:

#string:

The Schedule ID of the planned schedule.

Stops the Schedule.

Defined in:

Parameter:

#string SchedulerID

(Optional) Scheduler ID to be stopped. If nil, all pending schedules are stopped.

Set the Class Core.Event processing Priority.

The Event processing Priority is a number from 1 to 10, reflecting the order of the classes subscribed to the Event to be processed.

Defined in:

Parameter:

#number EventPriority

The Core.Event processing Priority.

Return value:

self

Set a state or property of the Object given a Key and a Value.

Note that if the Object is destroyed, set to nil, or garbage collected, then the Values and Keys will also be gone.

Defined in:

Parameters:

Object

The object that will hold the Value set by the Key.

Key

The key that is used as a reference of the value. Note that the key can be a #string, but it can also be any other type!

Value

The value to is stored in the object.

Return value:

The Value set.

Trace a function logic level 1.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function logic level 2.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function logic level 3.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace all methods in MOOSE

Defined in:

Parameter:

#boolean TraceAll

true = trace all methods in MOOSE.

Set tracing for a class

Defined in:

Parameter:

#string Class

Class name.

Set tracing for a specific method of class

Defined in:

Parameters:

#string Class

Class name.

#string Method

Method.

Set trace level

Defined in:

Parameter:

#number Level

Set trace off.

Defined in:

Usage:

-- Switch the tracing Off
BASE:TraceOff()

Set trace on.

Defined in:

Usage:

-- Switch the tracing On
BASE:TraceOn()

Set trace on or off Note that when trace is off, no BASE.Debug statement is performed, increasing performance! When Moose is loaded statically, (as one file), tracing is switched off by default.

So tracing must be switched on manually in your mission if you are using Moose statically. When moose is loading dynamically (for moose class development), tracing is switched on by default.

Defined in:

Parameter:

#boolean TraceOnOff

Switch the tracing on or off.

Usage:


  -- Switch the tracing On
  BASE:TraceOnOff( true )

  -- Switch the tracing Off
  BASE:TraceOnOff( false )

UnSubscribe to a DCS event.

Defined in:

Parameter:

Event ID.

Return value:

Trace a function call.

This function is private.

Defined in:

Parameters:

Arguments

A #table or any field.

DebugInfoCurrentParam

DebugInfoFromParam

(Internal) Serialize arguments

Defined in:

Parameter:

#table Arguments

Return value:

#string:

Text

Trace a function logic.

Defined in:

Parameters:

Arguments

A #table or any field.

DebugInfoCurrentParam

DebugInfoFromParam

The main event handling function...

This function captures all events generated for the class.

Defined in:

Parameter:

DCS#Event event

Radio queue transmission data.

Field(s)

Core.Set#SET_CLIENT MSRSQUEUE.Transmission.PlayerSet

PlayerSet created when TransmitOnlyWithPlayers == true

#number MSRSQUEUE.Transmission.Tplay

Mission time (abs) in seconds when the transmission should be played.

#boolean MSRSQUEUE.Transmission.TransmitOnlyWithPlayers

If true, only transmit if there are alive Players.

#number MSRSQUEUE.Transmission.Tstarted

Mission time (abs) in seconds when the transmission started.

Core.Point#COORDINATE MSRSQUEUE.Transmission.coordinate

Coordinate for this transmission

#string MSRSQUEUE.Transmission.culture

Voice culture

#number MSRSQUEUE.Transmission.duration

Duration in seconds.

#string MSRSQUEUE.Transmission.gender

Voice gender

#number MSRSQUEUE.Transmission.interval

Interval in seconds before next transmission.

#boolean MSRSQUEUE.Transmission.isplaying

If true, transmission is currently playing.

#string MSRSQUEUE.Transmission.label

Label to be used

#number MSRSQUEUE.Transmission.modulation

Modulation.

#number MSRSQUEUE.Transmission.subduration

Duration of the subtitle being displayed.

#table MSRSQUEUE.Transmission.subgroups

Groups to send subtitle to.

#string MSRSQUEUE.Transmission.subtitle

Subtitle of the transmission.

#string MSRSQUEUE.Transmission.text

Text to be transmitted.

#string MSRSQUEUE.Transmission.voice

Voice if any

Function(s)