So, I've hacked together a small collection of key assignments for UI functions that I find essential for playing Civ6 without going blind, mad or otherwise becoming really irritated
. Far from LUA competent, I'd like to open the subject for discussion and try to establish some sort of "best practice" approach to further key input modding. These key functions are working for me without issue, but could bear some scrutiny. My main concern is efficiency and not honking up UI performance.
The first two add a means to toggle normally static UI map elements in order to produce a "clean map" view. Personally, I find this essential when hunting for resource instances or getting a general overview of territory. The others already exist as controls in MinimapPanel, but currently lack a key assignment. Perhaps Firaxis will add these... it seems strange that they're absent.
I think 'heal' and possibly some other unit commands are missing assignments as well. I'll look to those after the map keys.
All additions are made to DefaultMessageHandler in Ingame.lua. From experience with civ5, placing these here is the only(?) way to have the keys active during the entire turn cycle. Unit icons and city banners work exactly as in civ5... I only switched to uiKey from wParam, following current convention. For resources and yields, I lifted the functions directly from MinimapPanel. Perhaps there's a better way, but I haven't found it. Execution is fast with the exception of the yield display... that noticeably lags, just as it does when performed from the panel. I would expect Firaxis to replace that at some point.
Here are the changes to DefaultMessageHandler... added key section is marked. Full InGame.lua is attached below...
Any feedback would be appreciated. I may release a properly formatted mod (as a forum resource) in the near future, once we see what Firaxis does with updates. I'd also like to reach a consensus on essential hotkeys, as most additions will modify the same file(s).
Installation:Back up your copy of ..\Sid Meier's Civilization VI\Base\Assets\UI\InGame.lua and replace it with this. If you want to change key assignments, you can easily do so "on the fly" by live editing the document.
Repackaged as a regular mod. Drop the folder from the archive into the /mod directory and enable from the Additional Content menu.
Notes: I like to use a 3rd party mouse button manager to bind essential keys. Firaxis' hotkey binder will only work with keys that they've hooked up and doesn't provide certain advanced functionality. I recommend X-Mouse Button Control available here. It's clean (aka free of "offers" and spyware) and has some neat features like button cording. With the cording feature, you can do things like <left button><right button><hold> = rotate camera. This sort of thing really makes my day
.

The first two add a means to toggle normally static UI map elements in order to produce a "clean map" view. Personally, I find this essential when hunting for resource instances or getting a general overview of territory. The others already exist as controls in MinimapPanel, but currently lack a key assignment. Perhaps Firaxis will add these... it seems strange that they're absent.
- toggle unit icons U
- toggle city banners X
- toggle resource icons R
- toggle yield icons Y
I think 'heal' and possibly some other unit commands are missing assignments as well. I'll look to those after the map keys.
All additions are made to DefaultMessageHandler in Ingame.lua. From experience with civ5, placing these here is the only(?) way to have the keys active during the entire turn cycle. Unit icons and city banners work exactly as in civ5... I only switched to uiKey from wParam, following current convention. For resources and yields, I lifted the functions directly from MinimapPanel. Perhaps there's a better way, but I haven't found it. Execution is fast with the exception of the yield display... that noticeably lags, just as it does when performed from the panel. I would expect Firaxis to replace that at some point.
Here are the changes to DefaultMessageHandler... added key section is marked. Full InGame.lua is attached below...
Code:
DefaultMessageHandler[KeyEvents.KeyUp] =
function( pInputStruct:table )
local uiKey = pInputStruct:GetKey();
if( uiKey == Keys.VK_ESCAPE ) then
if( Controls.TopOptionsMenu:IsHidden() ) then
OpenInGameOptionsMenu();
return true;
end
return false; -- Already open, let it handle it.
elseif( uiKey == Keys.B and pInputStruct:IsShiftDown() and pInputStruct:IsAltDown() and (not UI.IsFinalRelease()) ) then
-- DEBUG: Force unhiding
local msg:string = "***PLAYER Force Bulk unhiding SHIFT+ALT+B ***";
UI.DataError(msg);
m_bulkHideTracker = 1;
BulkHide(false, msg);
elseif( uiKey == Keys.J and pInputStruct:IsShiftDown() and pInputStruct:IsAltDown() and (not UI.IsFinalRelease()) ) then
if m_bulkHideTracker < 1 then
BulkHide(true, "Forced" );
else
BulkHide(false, "Forced" );
end
-- ................ Added Keys ................................ -clp
elseif ( uiKey == Keys.U ) then
Controls.UnitFlagManager:SetHide( not Controls.UnitFlagManager:IsHidden() );
return true;
elseif ( uiKey == Keys.X ) then
Controls.CityBannerManager:SetHide( not Controls.CityBannerManager:IsHidden() );
return true;
elseif ( uiKey == Keys.R ) then
UserConfiguration.ShowMapResources( not UserConfiguration.ShowMapResources() );
return true;
elseif ( uiKey == Keys.Y ) then
local showMapYield:boolean = not UserConfiguration.ShowMapYield();
UserConfiguration.ShowMapYield( showMapYield );
if showMapYield then
LuaEvents.MinimapPanel_ShowYieldIcons();
else
LuaEvents.MinimapPanel_HideYieldIcons();
end
return true;
end
--.............................................................. end clp
return false;
end
Any feedback would be appreciated. I may release a properly formatted mod (as a forum resource) in the near future, once we see what Firaxis does with updates. I'd also like to reach a consensus on essential hotkeys, as most additions will modify the same file(s).
Installation:
Repackaged as a regular mod. Drop the folder from the archive into the /mod directory and enable from the Additional Content menu.
Notes: I like to use a 3rd party mouse button manager to bind essential keys. Firaxis' hotkey binder will only work with keys that they've hooked up and doesn't provide certain advanced functionality. I recommend X-Mouse Button Control available here. It's clean (aka free of "offers" and spyware) and has some neat features like button cording. With the cording feature, you can do things like <left button><right button><hold> = rotate camera. This sort of thing really makes my day
