Some UI elements in base game have tooltips like this:
If i unbind the control from the settings, it is displayed like this:
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:
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
Read if controls have keys bound to them in locale or in general
- protocol_1903
- Filter Inserter

- Posts: 531
- Joined: Fri Sep 09, 2022 4:33 pm
- Contact:
Re: Read if controls have keys bound to them in locale or in general
+1
pY and pYblock developer, wielder of fluid networks and subtick events in arbitrary ways. I make mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903
Buy me a coffee
https://mods.factorio.com/user/protocol_1903
Buy me a coffee
Re: Read if controls have keys bound to them in locale or in general
This looks even worse in 2.1
Re: Read if controls have keys bound to them in locale or in general
+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
in control.lua
(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.)
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
Code: Select all
tooltip = {"?", {"toggle-tooltip-with-control"}, {"toggle-tooltip"}}
