Forums » Community Projects

Dynamic Hud Colours

Mar 23, 2013 TheRedSpy link
A plugin to dynamically change the colour of HUD elements based on conditions, events or custom preferences

This is a plugin in draft form that dynamically changes the colour of your HUD.

There is a palette system. Ive started programming modes in. There are these modes currently:

/hud R G B [new]
Will generate a palette based on the colour RGB value you feed into it, 3 numbers between 0-255.

/hud ship [new]
Will set your hud to the colour of your ship. Light coloured ships work better with this mode.

/hud health [new]
Will set your hud to a light green and gets progressively yellower and then redder as you lose health. Makes the whole HUD function like a health indicator.

/hud random [new]
Will set your hud to a random colour palette every time you undock.

/hud fresh [new]
Will set your hud to a random colour palette and saves it permanently.

/hud factionspace [new]
Will set your hud based on the alignment of the sector you are in.

Adding "new" to the end of the command will replace the recticles with the new high-contrast ones

Here's an example photo

Here's one with the new high contrast recticle option
Mar 24, 2013 Lord~spidey link
Apr 06, 2013 Phaserlight link
Pretty cool, but I think this plugin introduces a bug where any HUD messages linger after they are supposed to fade (in health mode, not sure about general):
Apr 07, 2013 TheRedSpy link
I see what you mean. I haven't experienced that on any of the computers i've seen it used on, but it might be due to you getting hit on the jumpout.

There are a few lines of codes that mess with the visibility of HUD elements because for some reason when you change the colour of the text bar it also makes it visible.

Thanks for demoing it though, i'll make a note to have a look
Apr 09, 2013 TheRedSpy link
Added new high-contrast, higher resolution custom recticles. Add the word 'new' to either custom or health mode to load them, they will load automatically after that.

There's probably an issue with removing them in the current version, but it's a draft it'll get ironed out eventually
Apr 16, 2013 TheRedSpy link
Renamed plugin to FlamboyanceHUD

Completely reorganised the file and gave it all sorts of markup and headings

Added random mode and factionspace mode, needs tweaking to get proper contrast though, some of the colours are god awful contrast to the systems you're in.
Apr 27, 2013 TheRedSpy link
Fixed bug where the HUD.notify_text would remain persistent if you changed the HUD colour while it was visible. Now just makes it invisible until next time it happens.
Apr 29, 2013 Pizzasgood link
Has an error about Voce being undefined at the point where you check if it's nil.

Not sure off the top of my head what the best practice for checking if other plugins are loaded is, but in LegionHail I check for KombatTunes by first doing this up near the top of LegionHail's main.lua:

declare('KombatTunes', KombatTunes or {})

That way it is defined, even if it's defined as being empty (and thus false). So then later in the code, well after plugin loading has finished, it checks whether KombatTunes is true.

Maybe there is a better way though.

EDIT: A mode based on standing with the local faction might be cool.
Apr 29, 2013 meridian link
Doesn't work, Pizza. declare('KombatTunes', KombatTunes or {}) gives an undeclared variable KombatTunes lua error if the plugin is not installed.

And removing a plugin from the plugins folder while the client is active and reloading the interface to test is cheating. You have to do a complete client restart to properly test after removing a plugin.

Instead use pcall to suppress the error:
local is_kombattunes_installed = pcall(function() return KombatTunes end)
Apr 30, 2013 Pizzasgood link
Actually it works fine. I just tested to make sure. Moved KombatTunes out of plugins and restarted the entire game, no errors.
Apr 30, 2013 TheRedSpy link
"EDIT: A mode based on standing with the local faction might be cool."

I'll add it to the list!

I'm fixing the addon modules now, I need to apply the same for targetless as well so I can get a proper method for plugin addons.

Everytime a plugin changes the interface you gotta write a fricken addon to make it use the colours.
Apr 30, 2013 TheRedSpy link
Adopted meridian's method for detecting whether or not plugins are loaded and applied it to the addons for Voce and targetless

Added fresh mode, it's the same as random mode except it doesnt change when you undock and it sets your HUD colour to the random palette permanently.


If you guys wanna help me I could use hand identifying the IUP properties for these elements, ones just in the HUD table somewhere the other is in targetless:

They have eluded me thus far.
Apr 30, 2013 meridian link
Huh, interesting. I installed LegionHail and the declare method does seem to work. Apparently it doesn't give an error if the code is included in the main.lua code that gets executed when the plugin is loaded, but it will give an error if used inside a function called from processing a user command or triggered by an event.

So that does further complicate things. If my cool plugin named LoadsAfterLegionHail needs to check if KombatTunes is installed, it would also have to make sure that KombatTunes isn't just an empty table created by LegionHail. If using the pcall code, it would have to do the following:
local is_kombattunes_present_and_not_empty = pcall(function() return KombatTunes and next(KombatTunes) end)

But if you are lazy, it could be shorted to just the following since it is embedded in pcall():
local is_kombattunes_present_and_not_empty = pcall(function() return next(KombatTunes) end)

I don't have time to look up the HUD elements now, maybe later.
May 01, 2013 meridian link
The best I can determine is that the scrollbar from the chatframe is located at HUD:chatframe[1][1][1][1], which is also the multiline containing the text of the chatlog. HUD:chatframe[1][1][1][1].visible = "NO" hides it, at least.
May 25, 2013 TheRedSpy link
[Update] 0.9.6
Fixed bug reported by Azurea as demanded by Rin. /hud health mode should no longer clear your chat bar on damage. Temporary hack in place to solve the login problem which I think will disappear when I fix my events
May 25, 2013 Pizzasgood link
Cool, thanks!
May 29, 2013 Samwise9 link
Tried installing it and this happened.
May 30, 2013 TheRedSpy link
Samwise replace your main.lua with this:

And it will work.
May 31, 2013 Samwise9 link
That fixed it. Thanks.
Jun 05, 2013 Samwise9 link
Slight bug report:

If it's set to Health, logging in while launched has the HUD colored a dark red regardless of armor level. Typing "/hud health" again fixes it.