EliteG19s Lua Scripting

version 3.5

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:

Command Example Description
Log g19s:Log("hello") Log an informational message to the log file (only when verbose logging is enabled)
LogError g19s:LogError("error") Log an error message to the log file
ShowMessage g19s:ShowMessage("hello") Display a message on the G19s screen
ChangeVolume g19s:ChangeVolume(-5) Change the volume in the app
VolumeUp g19s:VolumeUp() Increase the volume in the app
VolumeDown g19s:VolumeDown() Decrease the volume in the app
Mute g19s:Mute() Mute the volume in the app
SwitchScreen g19s: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
ListenToRadiostation g19s:ListenToRadiostation("Lave Radio") Listen to the named radio station (as defined in options.json)
ListenToSpotifyPlaylist g19s:ListenToSpotifyPlaylist("Elite Dangerous OST") Listen to the named spotify playlist (as defined in options.json)
ListenToMusicFolder g19s:ListenToMusicFolder("C:\\Music") Listen to compatible audio files in the specified folder
StreamMusicUrl g19s:StreamMusicUrl("http://music.org/stream.mp3") Stream music from the provided url
ListenToPlaylist g19s:ListenToPlaylist("C:\\Music\\Playlist.m3u") Listen to a .m3u playlist as specified
WatchYoutubePreset g19s:WatchYoutubePreset("Isinona") Watch a Youtube video as named (defined in options.json)
StopMusic g19s:StopMusic() Stop any music that is being played
GoToNextTrack g19s:GoToNextTrack() Go to the next audio track / video
GoToPreviousTrack g19s:GoToPreviousTrack() Go to the previous audio track / video
ShuffleMusic g19s:ShuffleMusic() Shuffle music / spotify
PauseMusic g19s:PauseMusic() Pause any playing music
MusicSkipBack g19s:MusicSkipBack() Skip back 30 seconds in the audio (if supported)
MusicSkipForward g19s:MusicSkipForward() Skip forward 30 seconds in the audio (if supported)
ShowAudioVisualization g19s:ShowAudioVisualization("cassette") Show the named audio visualization. Valid names are: cassette, orrery, equalizer, full screen cover art, full screen equalizer, starfield, waveform, spectrogram
ListenToSpaceTrafficControl g19s:ListenToSpaceTrafficControl(true) Enable or disable space traffic control
ChangeSpaceTrafficVolume g19s:ChangeSpaceTrafficVolume(-5) Change the volume of space traffic control by the given delta (min 0, max 100)
SpaceTrafficVolumeUp g19s:SpaceTrafficVolumeUp() Increase the volume of space traffic control
SpaceTrafficVolumeDown g19s:SpaceTrafficVolumeDown() Decrease the volume of space traffic control
ChangeNPCVolume g19s:ChangeNPCVolume(-5) Change the volume for NPC text-to-speech by the given delta (min 0, max 100)
NPCVolumeUp g19s:NPCVolumeUp() Increase the volume for NPC text-to-speech
NPCVolumeDown g19s:NPCVolumeDown() Decrease the volume for NPC text-to-speech
ButtonUp g19s:ButtonUp() Simulate pressing the Logitech button "Up"
ButtonDown g19s:ButtonDown() Simulate pressing the Logitech button "Down"
ButtonLeft g19s:ButtonLeft() Simulate pressing the Logitech button "Left"
ButtonRight g19s:ButtonRight() Simulate pressing the Logitech button "Right"
ButtonMenu g19s:ButtonMenu() Simulate pressing the Logitech button "Menu"
ButtonOK g19s:ButtonOK() Simulate pressing the Logitech button "OK"
ButtonCancel g19s:ButtonCancel() Simulate pressing the Logitech button "Cancel"
Button g19s:Button("Left") Simulate pressing the Logitech button with the given name
SelectInteractiveOption g19s:SelectInteractiveOption("Approved") When an interactive message is displayed, this will select the given option
GetWhatsPlaying g19s:GetWhatsPlaying() Returns information on the currently playing audio. See below for details.
GetStatus g19s:GetStatus() Returns information on the current game status. See below for details.
OrreryZoomIn g19s:OrreryZoomIn() Zooms in on the orrery view
OrreryZoomOut g19s:OrreryZoomOut() Zooms out in the orrery view
OrreryFaster g19s:OrreryFaster() Speed up time in the orrery view
OrrerySlower g19s:OrrerySlower() Slow down time in the orrery view
OrreryResetView g19s:OrreryResetView() Reset orrery view to defaults

GetWhatsPlaying()

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

Property Description
Station The name of the radio station
Artist Name of performing artist
Album Name of album
Title Name of current track
CoverArt Array of bytes for the cover art image

GetStatus()

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

Property Description
CommanderName Name of current CMDR
Credits Number of credits owned
CombatRank Current combat rank
TradeRank Current trade rank
ExplorationRank Current exploration rank
CQCRank Current CQC rank
FederationRank Current rank with the Federation
EmpireRank Current rank with the Empire
GameMode Current game mode (Open, Solo or Private)
IsGameInBeta Running a beta version of the game
Ship Current ship type
ShipName Current ship name
ShipId Current ship identification code
CurrentSystem Name of current star system
ClosestStation Name of near station (if any)
ClosestBody Name of near body (if any)
CurrentLongitude Current longitude of position (if known)
CurrentLatitude Current latitude of position (if known)
CurrentAltitude Current altitude of position (if known)
CurrentHeading Current heading (if known)
AssignedLandingPad Current assigned landing pad
IsCockpitBreached true if cockpit is breached
IsInCrew true if currently in a multicrew
IsInWitchspace true if currently in witchspace (FSD jumping)
Firegroup Currently selected fire group
GuiFocus Current GUI focus
PipsSystem Number of pips in SYS
PipsEngine Number of pips in ENG
PipsWeapons Number of pips in WEP
IsDocked true if currently docked
IsLanded true if currently landed
IsLandingGearDown true if landing gear is in down position
IsShieldsUp true if shields are up
IsInSuperCruise true if currently in SC
IsFlightAssistOff true if FA is off
IsHardpointsDeployed true if hardpoints are deployed
IsInWing true if currently in a wing
IsLightsOn true if lights are on
IsCargoScoopDeployed true if cargo scoop is deployed
IsSilentRunning true if silent running is enabled
IsScoopingFuel true if currently scooping fuel
IsSrvHandbrake true if SRV has handbrake set
IsSrvTurret true if currently in the SRV's turret mode
IsSrvUnderShip true if SRV is currently beneath the ship
IsSrvDriveAssist true if SRV's drive assist is enabled
IsFsdMassLocked true if FSD is mass locked
IsFsdCharging true if FSD is charging
IsFsdCooldown true if FSD is cooling down
IsLowFuel true if low on fuel (less than 25%)
IsOverheating true if the ship is overheating
HasLatLong true if latitude and longitude are updating
IsInDanger true if currently in danger
IsBeingInterdicted true if currently being interdicted
IsInMainShip true if currently in main ship
IsInFighter true if currently in a fighter
IsInSrv true if currently in an SRV