Or, you know, ask the guy who wrote it.
Which would be me.
Here's my quick-and-dirty guide to the betty script.
Part 1: Components.
The betty script has three components, all of which must be present in order for the script to work. The script itself (obviously), the sound files, and the entries in sounds.tbl.
Part 2: Customization
Here, I will highlight the areas of the script where you will need or want to make alterations.
betty.queueprocessdelay = 2 --Minimum delay for queue processing
betty.comms = 500 --see sounds.tbl
betty.engine = 501
betty.nav = 502
betty.sensors = 503
betty.weapons = 504
betty.hull = 505
betty.eject = 506
betty.primary = {}
betty.primary[1] = 507
betty.primary[2] = 508
betty.primary[3] = 509
betty.secondary = {}
betty.secondary[1] = 510
betty.secondary[2] = 511
betty.secondary[3] = 512
betty.secondary[4] = 513
betty.secondaryempty = {}
betty.secondaryempty[1] = 514
betty.secondaryempty[2] = 515
betty.secondaryempty[3] = 516
betty.secondaryempty[4] = 517
betty.primaryempty = {}
betty.primaryempty[1] = 518
betty.primaryempty[2] = 519
betty.primaryempty[3] = 520
betty.subspace = 521
This is where you need to put your sounds.tbl indices, if you use your own. Note that the "subspace" warning does not work at this time. "betty.queueprocessdelay" is measured in seconds, and denotes the minimum time between two betty messages.
if not betty.subsystems.comms then
if betty.plrship["communications"]:isValid() then
betty.subsystems.comms = betty.plrship["communications"]
end
end
if not betty.subsystems.engine then
if betty.plrship["engine"]:isValid() then
betty.subsystems.engine = betty.plrship["engine"]
betty.enginenum = 0
end
if betty.plrship["engines"]:isValid() then
betty.subsystems.engine = betty.plrship["engines"]
betty.enginenum = 0
end
end
if not betty.subsystems.engine01 then
if betty.plrship["engine01"]:isValid() then
betty.subsystems.engine01 = betty.plrship["engine01"]
betty.enginenum = 1
end
end
if not betty.subsystems.engine02 then
if betty.plrship["engine02"]:isValid() then
betty.subsystems.engine02 = betty.plrship["engine02"]
betty.enginenum = 2
end
end
if not betty.subsystems.engine03 then
if betty.plrship["engine03"]:isValid() then
betty.subsystems.engine03 = betty.plrship["engine03"]
betty.enginenum = 3
end
end
if not betty.subsystems.engine04 then
if betty.plrship["engine04"]:isValid() then
betty.subsystems.engine04 = betty.plrship["engine04"]
betty.enginenum = 4
end
end
if not betty.subsystems.engine01 then
if betty.plrship["engine01a"]:isValid() then
betty.subsystems.engine01 = betty.plrship["engine01a"]
betty.enginenum = 1
end
end
if not betty.subsystems.engine02 then
if betty.plrship["engine02a"]:isValid() then
betty.subsystems.engine02 = betty.plrship["engine02a"]
betty.enginenum = 2
end
end
if not betty.subsystems.engine03 then
if betty.plrship["engine03a"]:isValid() then
betty.subsystems.engine03 = betty.plrship["engine03a"]
betty.enginenum = 3
end
end
if not betty.subsystems.engine04 then
if betty.plrship["engine04a"]:isValid() then
betty.subsystems.engine04 = betty.plrship["engine04a"]
betty.enginenum = 4
end
end
if not betty.subsystems.nav then
if betty.plrship["navigation"]:isValid() then
betty.subsystems.nav = betty.plrship["navigation"]
end
end
if not betty.subsystems.sensors then
if betty.plrship["sensors"]:isValid() then
betty.subsystems.sensors = betty.plrship["sensors"]
end
end
if not betty.subsystems.weapons then
if betty.plrship["weapons"]:isValid() then
betty.subsystems.weapons = betty.plrship["weapons"]
end
end
This is where the script gets pointers to the player's subsystems. You may need to add to or alter this section to adjust the script for your mods' models.
This next section handles the various triggers. Alter the conditions to adjust when a warning will occur; but take note how the trigger reset works. The script is set up to play a warning if a given subsystem falls below 1% health. Once that happens, a boolean variable by the name of betty.status.<bla>warned is set to true, in order to stop the script from throwing warnings every frame. Given that subsystems can be repaired and ammo restocked, the script is set up to reset that trigger if the subsys health is above 10 %. Ammo warnings are conceptually the same.
function processTriggers()
if betty.subsystems.comms then
if betty.subsystems.comms.HitpointsLeft/betty.subsystems.comms.HitpointsMax < 0.01 and not betty.status.commwarned then
queueWarning(betty.comms)
betty.status.commwarned = true
elseif betty.subsystems.comms.HitpointsLeft/betty.subsystems.comms.HitpointsMax > 0.1 then
betty.status.commwarned = false
end
end
getenginehealth()
if betty.enginehealth < 0.01 and not betty.status.enginewarned then
queueWarning(betty.engine)
betty.status.enginewarned = true
elseif betty.enginehealth > 0.1 then
betty.status.enginewarned = false
end
if betty.subsystems.nav then
if betty.subsystems.nav.HitpointsLeft/betty.subsystems.nav.HitpointsMax < 0.01 and not betty.status.navwarned then
queueWarning(betty.nav)
betty.status.navwarned = true
elseif betty.subsystems.nav.HitpointsLeft/betty.subsystems.nav.HitpointsMax > 0.1 then
betty.status.navwarned = false
end
end
if betty.subsystems.sensors then
if betty.subsystems.sensors.HitpointsLeft/betty.subsystems.sensors.HitpointsMax < 0.01 and not betty.status.sensorswarned then
queueWarning(betty.sensors)
betty.status.sensorswarned = true
elseif betty.subsystems.sensors.HitpointsLeft/betty.subsystems.sensors.HitpointsMax > 0.1 then
betty.status.sensorswarned = false
end
end
if betty.subsystems.weapons then
if betty.subsystems.weapons.HitpointsLeft/betty.subsystems.weapons.HitpointsMax < 0.01 and not betty.status.weaponswarned then
queueWarning(betty.weapons)
betty.status.weaponswarned = true
elseif betty.subsystems.weapons.HitpointsLeft/betty.subsystems.weapons.HitpointsMax > 0.1 then
betty.status.weaponswarned = false
end
end
if betty.plrship.HitpointsLeft/betty.plrship.HitpointsMax < 0.41 and not betty.status.hullwarned then
queueWarning(betty.hull)
betty.status.hullwarned = true
elseif betty.plrship.HitpointsLeft/betty.plrship.HitpointsMax > 0.41 then
betty.status.hullwarned = false
end
if betty.plrship.HitpointsLeft/betty.plrship.HitpointsMax < 0.1 and not betty.status.ejectwarned then
queueWarning(betty.eject)
betty.status.ejectwarned = true
elseif betty.plrship.HitpointsLeft/betty.plrship.HitpointsMax > 0.1 then
betty.status.ejectwarned = false
end
As MetalDestroyer pointed out, this is where you need to put your own weapon names for ballistic primaries.
for i = 1, 3, 1 do
if betty.plrship.PrimaryBanks[i]:isValid() then
if betty.plrship.PrimaryBanks[i].WeaponClass.Name == "Gattler" or betty.plrship.PrimaryBanks[i].WeaponClass.Name == "Archer" or betty.plrship.PrimaryBanks[i].WeaponClass.Name == "UX Accelerator" or betty.plrship.PrimaryBanks[i].WeaponClass.Name == "Redeemer" or betty.plrship.PrimaryBanks[i].WeaponClass.Name == "Vajra" then
if betty.plrship.PrimaryBanks[i].AmmoLeft/betty.plrship.PrimaryBanks[i].AmmoMax < 0.26 and not betty.status.primarywarned[i] then
queueWarning(betty.primary[i])
betty.status.primarywarned[i] = true
elseif betty.plrship.PrimaryBanks[i].AmmoLeft/betty.plrship.PrimaryBanks[i].AmmoMax > 0.27 then
betty.status.primarywarned[i] = false
end
if betty.plrship.PrimaryBanks[i].AmmoLeft == 0 and not betty.status.primaryemptywarned[i] then
queueWarning(betty.primaryempty[i])
betty.status.primaryemptywarned[i] = true
elseif betty.plrship.PrimaryBanks[i].AmmoLeft > 0 then
betty.status.primaryemptywarned[i] = false
end
end
end
end
for i = 1, 4, 1 do
if betty.plrship.SecondaryBanks[i]:isValid() then
if betty.plrship.SecondaryBanks[i].AmmoLeft/betty.plrship.SecondaryBanks[i].AmmoMax < 0.26 and not betty.status.secondarywarned[i] then
queueWarning(betty.secondary[i])
betty.status.secondarywarned[i] = true
elseif betty.plrship.SecondaryBanks[i].AmmoLeft/betty.plrship.SecondaryBanks[i].AmmoMax > 0.27 then
betty.status.secondarywarned[i] = false
end
if betty.plrship.SecondaryBanks[i].AmmoLeft == 0 and not betty.status.secondaryemptywarned[i] then
queueWarning(betty.secondaryempty[i])
betty.status.secondaryemptywarned[i] = true
elseif betty.plrship.SecondaryBanks[i].AmmoLeft > 0 then
betty.status.secondaryemptywarned[i] = false
end
end
end
end
Finally, we come to the on-frame business.
if not BettyOverride then
ttime = mn.getMissionTime()
if ttime ~= 0 then
if not bettyinited then
initbetty()
else
if betty.plrship.Class.Species.Name == "UEF" then
processTriggers()
printQueue()
processQueue()
else
betty = nil
bettyinited = false
BettyOverride = true
end
end
end
end
As was pointed out, the "if betty.plrship.Class.Species.Name == "UEF" then " conditional is what you need to alter/remove in order to use this on non-UEF ships.