Center to Capital and cycle through cities keybindings

Center to Capital and cycle through cities keybindings 0.0.4

Civ7 Center Capital Mod
---------------------------------------

Features
- Center to Capital with 'Home' key
- Cycle Cities with 'PageUp' and 'PageDown'
- (Keys are customizable)

---

Version History
0.0.4 (Latest)
- Configurable city cycling order: 1. Grouped, 2. Alphabetical, 3. Geographical 4. Game default
- Improved city cycling logic — city list now refreshes only when cycling for better performance.
- Added ENABLE_CONSOLE_ERRORS flag for easily toggling debug messages (set true for development, false for release).
- Added timestamp logic to refresh the city table only if the previous refresh was over 20 seconds ago.
- Fixed issue where pressing 'Home' on a focused Capital wouldn't open the city details panel.
- Improved internal logging system for better debugging during development.

0.0.3
- Removed dependency on lib-register-keybinding
- Keybindings are now managed in input-action-default-gestures.xml (no longer configurable in game settings).
- Added user-configurable camera movement (zoom vs. instant).
- Ensured mod loads last to prevent conflicts.
- Capital details panel now opens on second press of the 'Home' key if already centered on the Capital.

0.0.2
- Hotkeys now assignable in game settings menu, not just main menu. (This version causes compatibility issues.)

0.0.1
- Initial release.
---

Tested on Civilization 7 version 1.1.0

---

What Does This Mod Do?
This mod adds three custom hotkeys to make city management easier in Civilization VII:
- Home → Center Camera on Capital. Second press → Open Capital city details panel
- PageUp → Cycle Forward Through Cities
- PageDown → Cycle Backward Through Cities

---

Installation
1. Copy the "Civ7_CenterCapitalMod" folder into your Sid Meier’s Civilization VII Mods directory.

Common Path:
C:\Users\<YourUserName>\AppData\Local\Firaxis Games\Sid Meier's Civilization VII\Mods

2. Launch the game and enable the mod under "Additional Content" (or your mod manager of choice).

---

Customizing Keybindings
Keybindings are now configured in the mod's XML file:

1. Open: Civ7_CenterCapitalMod\data\input-action-default-gestures.xml
2. Locate these lines:
GestureData="KEY_HOME"
GestureData="KEY_PAGEUP"
GestureData="KEY_PAGEDOWN"

3. Edit the GestureData value. Examples:
- Single key: KEY_G
- Ctrl + key: KEY_CONTROL+KEY_H
- Alt + key: KEY_ALT+KEY_H
- Ctrl + Alt + key: KEY_CONTROL+KEY_ALT+KEY_H
- Shift + key: KEY_SHIFT+KEY_N

4. Save the file and restart the game.

---

New Features

Configurable City Cycling Modes (New!)
The mod now offers 4 distinct city cycling modes for improved navigation:

1. Grouped Order
- Player’s cities sorted by city ID in alphabetical order, starting with the capital.
2. Alphabetical Order
- All cities are sorted alphabetically. The capital is forced to be at index 0.
3. Geographical Order (Recommended)
- Cities are sorted by proximity to the capital, with an advanced look-ahead pathfinding system for optimal path creation.
- Use this setting for a natural city navigation path.
- Capital is forced to be at index 0.
4. Game Default Order
- Uses the game’s native order — no sorting applied.

To configure the cycling mode:
1. Open: Civ7_CenterCapitalMod\UI\focus-capital.js
2. Locate this setting at the top of the file:
const CYCLING_MODE = 3;

3. Change the number to the desired mode:

| Mode | Description |
|------|--------------------------------|
| 1 | Grouped Order |
| 2 | Alphabetical Order |
| 3 | Geographical Order (Recommended) |
| 4 | Game Default Order |

4. Save the file and restart the game.

---

### Timestamp Logic for Efficient Refreshing (New!)
To improve performance, the mod now refreshes the city table only if the last refresh was over 20 seconds ago.
- Located in focus-capital.js
const REFRESH_INTERVAL = 20000; // Time in milliseconds (20 seconds)
---

Troubleshooting
- Ensure this mod does not conflict with other mods using the same key actions.
- Confirm that the mod folder is in the correct location and that the mod is enabled.
- The camera actions are only active in the "World" context (the main map view). They won’t work in menus or special screens.
- If changes don’t take effect, try disabling other mods to check for conflicts.

---

Enjoy the Mod!
Feel free to adapt this mod for your own needs! If you’d like to improve or expand features, contributions are welcome.

---

Common Key Identifiers

Alphanumeric Keys
KEY_0 to KEY_9
KEY_A to KEY_Z

Function Keys
KEY_F1 to KEY_F12

Arrow Keys
KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT

Editing/Navigation Keys
KEY_BACKSPACE, KEY_DELETE, KEY_INSERT
KEY_HOME, KEY_END
KEY_PAGEUP, KEY_PAGEDOWN

Control Keys
KEY_SHIFT, KEY_ALT, KEY_CONTROL (or KEY_CTRL)

More key identifiers can be found in the game installation directory:
/core/config/Input.xml

Note: Caps Lock, Windows key, or other special keys may not always be recognized. Check for collisions or test them directly.

---

Thanks for testing and suggestions:
Finwickle
beezany
Author
Burntz
Downloads
861
Views
3,593
First release
Last update

Ratings

5.00 star(s) 4 ratings

More resources from Burntz

Latest updates

  1. 0.0.4 - New City Cycling modes + other improvements

    0.0.4 - Configurable city cycling order: 1. Grouped, 2. Alphabetical, 3. Geographical 4. Game...
  2. 0.0.3 Compability fix + new features

    Removed dependency on lib-register-keybinding. input-action-default-gestures.xml now holds the...
  3. 0.0.2 Hotkeys now assignable in game settings menu

    Hotkeys now assignable also in game settings menu, not just main menu. (Thanks maddachshund)...

Latest reviews

Very nice quality of life mod.
how can I asign my mousebutton 4/5?
Very nice quality of life mod. It's so helpful to jump back to the capital on a key press. With todays update it works perfectly and has some nice extra features. Well done!
Its working perfect! But had to do a small workaround, see my comment.
I had some trouble getting the mod to work but figured out a fix eventually. If it's not working and not showing up you might need to hit RESET TO DEFAULTS inside of the options > Keyboard + Mouse [Configure] screen for your customized keybindings to show up. This is after you install **lib-register-keybinding** mod and change the GestureData attributes to whatever your want your keybindings to be inside of the \data\input-action-default-gestures.xml file (idk why OP chose H and N because those are defaulted to something else already). Anyways thanks for making this, now I got my Endless Legend TAB key that cycles through my settlements! AWESOMENESS!
Burntz
Burntz
Thanks for the info. I'll change the defaults to some unused keys for next update. Also the info about needing the resetting to defaults is good one and i'll add that to the readme. 👍
Back
Top Bottom