EliteG19s Lua Scripting

version 3.7

The EliteG19s companion app can now be scripted with Lua scripts. You will need to enable this manually in the options.

Scripts are stored in %AppData%\EliteG19s\Scripts.

Journal events trigger the app to search for an appropriate .lua file to execute. If the file is found, it is executed.

Apart from journal events, there is an additional event that is triggered when the status "goes live". This means that the app has processed all old journal events and is now waiting for new live information from the game. When this happens the script GoLive.lua is run.

A second event that is regularly triggered is when the status is updated. This triggers the script StatusUpdated.lua.

All Journal events follow the pattern Journal-EventName.lua. So for instance Journal-LoadGame.lua, Journal-FSDJump.lua or Journal-Music.lua. See the Journal Manual for details on the available events.

For journal events a global variable eventArgs is populated with the event's attributes. These event args are as specified in the EliteJournalReader project on Github.

For example, here is a script for Journal-LoadGame.lua:

g19s:Log("Game loaded for cmdr " .. (eventArgs.Commander or "<unknown>"))

and here for Journal-EngineerProgress.lua:

local eng = eventArgs.Engineers[4];
g19s:Log("Your rank with " .. eng.Engineer .. " is " .. eng.Rank)

To interface with the G19s app, a global interface object g19s is available. This interface provides basically the same functionality as the VoiceAttack interface and has the following available commands:

CommandExampleDescription
Logg19s:Log("hello")Log an informational message to the log file (only when verbose logging is enabled)
LogErrorg19s:LogError("error")Log an error message to the log file
ShowMessageg19s:ShowMessage("hello")Display a message on the G19s screen
Speakg19s:Speak("hello", true)Use text-to-speech to speak a line, with optional second argument true/false to indicate if the script has to wait for the speech to finish
ChangeVolumeg19s:ChangeVolume(-5)Change the volume in the app
VolumeUpg19s:VolumeUp()Increase the volume in the app
VolumeDowng19s:VolumeDown()Decrease the volume in the app
Muteg19s:Mute()Mute the volume in the app
SwitchScreeng19s:SwitchScreen("AudioVisualization")Switch the G19s screen to a different view. Valid screen names are: Menu, About, AudioVisualization, Options, Radio, Spotify, Status, Orrery, News, WhatsNew, Youtube, Twitch, Camera, GPS
ListenToRadiostationg19s:ListenToRadiostation("Lave Radio")Listen to the named radio station (as defined in options.json)
ListenToSpotifyPlaylistg19s:ListenToSpotifyPlaylist("Elite Dangerous OST")Listen to the named spotify playlist (as defined in options.json)
ListenToMusicFolderg19s:ListenToMusicFolder("C:\\Music")Listen to compatible audio files in the specified folder
StreamMusicUrlg19s:StreamMusicUrl("http://music.org/stream.mp3")Stream music from the provided url
ListenToPlaylistg19s:ListenToPlaylist("C:\\Music\\Playlist.m3u")Listen to a .m3u playlist as specified
WatchYoutubePresetg19s:WatchYoutubePreset("Isinona")Watch a Youtube video as named (defined in options.json)
StopMusicg19s:StopMusic()Stop any music that is being played
GoToNextTrackg19s:GoToNextTrack()Go to the next audio track / video
GoToPreviousTrackg19s:GoToPreviousTrack()Go to the previous audio track / video
ShuffleMusicg19s:ShuffleMusic()Shuffle music / spotify
PauseMusicg19s:PauseMusic()Pause any playing music
PlayFileg19s:PlayFile(path, false)Play a specific music/sound file
MusicSkipBackg19s:MusicSkipBack()Skip back 30 seconds in the audio (if supported)
MusicSkipForwardg19s:MusicSkipForward()Skip forward 30 seconds in the audio (if supported)
ShowAudioVisualizationg19s:ShowAudioVisualization("cassette")Show the named audio visualization. Valid names are: cassette, orrery, equalizer, full screen cover art, full screen equalizer, starfield, waveform, spectrogram
ListenToSpaceTrafficControlg19s:ListenToSpaceTrafficControl(true)Enable or disable space traffic control
ChangeSpaceTrafficVolumeg19s:ChangeSpaceTrafficVolume(-5)Change the volume of space traffic control by the given delta (min 0, max 100)
SpaceTrafficVolumeUpg19s:SpaceTrafficVolumeUp()Increase the volume of space traffic control
SpaceTrafficVolumeDowng19s:SpaceTrafficVolumeDown()Decrease the volume of space traffic control
ChangeNPCVolumeg19s:ChangeNPCVolume(-5)Change the volume for NPC text-to-speech by the given delta (min 0, max 100)
NPCVolumeUpg19s:NPCVolumeUp()Increase the volume for NPC text-to-speech
NPCVolumeDowng19s:NPCVolumeDown()Decrease the volume for NPC text-to-speech
ButtonUpg19s:ButtonUp()Simulate pressing the Logitech button "Up"
ButtonDowng19s:ButtonDown()Simulate pressing the Logitech button "Down"
ButtonLeftg19s:ButtonLeft()Simulate pressing the Logitech button "Left"
ButtonRightg19s:ButtonRight()Simulate pressing the Logitech button "Right"
ButtonMenug19s:ButtonMenu()Simulate pressing the Logitech button "Menu"
ButtonOKg19s:ButtonOK()Simulate pressing the Logitech button "OK"
ButtonCancelg19s:ButtonCancel()Simulate pressing the Logitech button "Cancel"
Buttong19s:Button("Left")Simulate pressing the Logitech button with the given name
SelectInteractiveOptiong19s:SelectInteractiveOption("Approved")When an interactive message is displayed, this will select the given option
GetWhatsPlayingg19s:GetWhatsPlaying()Returns information on the currently playing audio. See below for details.
GetStatusg19s:GetStatus()Returns information on the current game status. See below for details.
OrreryZoomIng19s:OrreryZoomIn()Zooms in on the orrery view
OrreryZoomOutg19s:OrreryZoomOut()Zooms out in the orrery view
OrreryFasterg19s:OrreryFaster()Speed up time in the orrery view
OrrerySlowerg19s:OrrerySlower()Slow down time in the orrery view
OrreryResetViewg19s:OrreryResetView()Reset orrery view to defaults

GetWhatsPlaying()

The g19s:GetWhatsPlaying() function returns an object with details on the currently playing audio:

PropertyDescription
StationThe name of the radio station
ArtistName of performing artist
AlbumName of album
TitleName of current track
CoverArtArray of bytes for the cover art image

GetStatus()

The g19s:GetStatus() function returns an object with details on the current game status:

PropertyDescription
CommanderNameName of current CMDR
CreditsNumber of credits owned
CombatRankCurrent combat rank
TradeRankCurrent trade rank
ExplorationRankCurrent exploration rank
CQCRankCurrent CQC rank
FederationRankCurrent rank with the Federation
EmpireRankCurrent rank with the Empire
GameModeCurrent game mode (Open, Solo or Private)
IsGameInBetaRunning a beta version of the game
ShipCurrent ship type
ShipNameCurrent ship name
ShipIdCurrent ship identification code
CurrentSystemName of current star system
ClosestStationName of near station (if any)
ClosestBodyName of near body (if any)
CurrentLongitudeCurrent longitude of position (if known)
CurrentLatitudeCurrent latitude of position (if known)
CurrentAltitudeCurrent altitude of position (if known)
CurrentHeadingCurrent heading (if known)
AssignedLandingPadCurrent assigned landing pad
IsCockpitBreachedtrue if cockpit is breached
IsInCrewtrue if currently in a multicrew
IsInWitchspacetrue if currently in witchspace (FSD jumping)
FiregroupCurrently selected fire group
GuiFocusCurrent GUI focus
PipsSystemNumber of pips in SYS
PipsEngineNumber of pips in ENG
PipsWeaponsNumber of pips in WEP
IsDockedtrue if currently docked
IsLandedtrue if currently landed
IsLandingGearDowntrue if landing gear is in down position
IsShieldsUptrue if shields are up
IsInSuperCruisetrue if currently in SC
IsFlightAssistOfftrue if FA is off
IsHardpointsDeployedtrue if hardpoints are deployed
IsInWingtrue if currently in a wing
IsLightsOntrue if lights are on
IsCargoScoopDeployedtrue if cargo scoop is deployed
IsSilentRunningtrue if silent running is enabled
IsScoopingFueltrue if currently scooping fuel
IsSrvHandbraketrue if SRV has handbrake set
IsSrvTurrettrue if currently in the SRV's turret mode
IsSrvUnderShiptrue if SRV is currently beneath the ship
IsSrvDriveAssisttrue if SRV's drive assist is enabled
IsFsdMassLockedtrue if FSD is mass locked
IsFsdChargingtrue if FSD is charging
IsFsdCooldowntrue if FSD is cooling down
IsLowFueltrue if low on fuel (less than 25%)
IsOverheatingtrue if the ship is overheating
HasLatLongtrue if latitude and longitude are updating
IsInDangertrue if currently in danger
IsBeingInterdictedtrue if currently being interdicted
IsInMainShiptrue if currently in main ship
IsInFightertrue if currently in a fighter
IsInSrvtrue if currently in an SRV