Page 1 of 1

Read if controls have keys bound to them in locale or in general

Posted: Thu Mar 05, 2026 4:00 pm
by Osmo
Some UI elements in base game have tooltips like this:
изображение.png
изображение.png (39.92 KiB) Viewed 620 times
If i unbind the control from the settings, it is displayed like this:
изображение.png
изображение.png (36.55 KiB) Viewed 620 times
I have a similar UI, but as far as i know, there is no way to read the state of keybinds, so the only option is to always show them via rich text, which looks like this:
изображение.png
изображение.png (14.68 KiB) Viewed 620 times
This adds unnecessary clutter on every button. In a tooltip, its kind of not too ugly, but that's already a compromise, ideally it'd be displayed alongside the button text, but that'd look bad if most of them are not set.

While there are some usecases to just being able to read currently bound keys, if this worked similar to locale pluralization (which only works on numbers currently) that'd also be enough for my usecase

Re: Read if controls have keys bound to them in locale or in general

Posted: Thu Mar 05, 2026 5:42 pm
by protocol_1903
+1

Re: Read if controls have keys bound to them in locale or in general

Posted: Tue Jun 23, 2026 5:00 pm
by Osmo
This looks even worse in 2.1
изображение.png
изображение.png (53.48 KiB) Viewed 245 times

Re: Read if controls have keys bound to them in locale or in general

Posted: Fri Jul 31, 2026 11:11 pm
by Shemp
+1, although I imagine being able to read controls directly in Lua would lead to de-syncs, so if you wanted to go down that path it would be a request_translation type of situation.

I wonder how you would implement this. It is useful to show "Not set" in some contexts.

Perhaps a __CONTROL_SET__name__ LocalisedString parameter, which acts similarly to CONTROL, but fails to resolve if the named CustomInput isn't assigned. So you could write:

in locale.cfg

Code: Select all

toggle-tooltip-with-control=Toggle entity (__CONTROL_SET__toggle-entity__)
toggle-tooltip=Toggle entity
in control.lua

Code: Select all

tooltip = {"?", {"toggle-tooltip-with-control"}, {"toggle-tooltip"}}
(There is also the issue of controls in mod tooltips not changing when the player changes the binding, but I assume that's a deliberate compromise.)