How to enable the in-game console

Gedemon

Modder
Super Moderator
Joined
Oct 4, 2004
Messages
12,682
Location
France
Open the "AppOptions.txt" file in the "\AppData\Local\Firaxis Games\Sid Meier's Civilization VII" folder (on Windows)

find the line

Code:
;Enable Debug Panels. 1 : Enable, 0 : Disable, -1 : Default
;EnableDebugPanels -1

and set it to

Code:
EnableDebugPanels 1

(don't forget to remove the semi-colon at the beginning)

You'll be able to access it in game with the tilde key.

1738904351013.png
 
Last edited:
Does this expose a console so we can test to see if there were validation errors with mods? I apologize if this is a silly question - trying to figure out my diagnostic tools.
 
the logs are in the "\AppData\Local\Firaxis Games\Sid Meier's Civilization VII\Logs" folder.
 
the logs are in the "\AppData\Local\Firaxis Games\Sid Meier's Civilization VII\Logs" folder.
Ah, I was referring to stdout - seems like debug mode does have a stdout for UI scripts. This was also helpful though - found the logs where you described.
 
The civ6 tuner can be connected, and some of the civ7 panels can be used ("\Steam\steamapps\common\Sid Meier's Civilization VII\Base\Platforms\Windows\Config\TunerPanels" folder), but there is no output to its console (you can input commands like console.log("Hello World !"), with output in logs)

I'll try to do a small tutorial for the tuner, but not sure I'll have the time today.
 
Hey guys, thanks for the tips and tutorials! I'm building a mod as we speak because of you.

Have you found a way to use the console to reload the modding framework in such a way it will load newly added files to the <ImportFiles> element without having to restart the full game?
 
Open the "AppOptions.txt" file in the "\AppData\Local\Firaxis Games\Sid Meier's Civilization VII" folder (on Windows)

find the line

Code:
;Enable Debug Panels. 1 : Enable, 0 : Disable, -1 : Default
;EnableDebugPanels -1

and set it to

Code:
EnableDebugPanels 1

(don't forget to remove the semi-colon at the beginning)

You'll be able to access it in game with the tilde key.

View attachment 718395

You can also use the steam launch options to set the app options. So as example: "-EnableDebugPanels 1". This will prevent the overwriting issue too.
 
I tested script reloading by using the "reload" button in ui -> console panel without restarting game.
There is some log severity issue in console output, but it works with no problem.

I selected below file for editing
>> Base\modules\core\ui\utilities\utilities-tuner.js

1) add custom class and declare variable with this class in utilities-tuner.js

class CustomUtilities {

// one more movement to current selected unit
go(){
const id = UI.Player.getHeadSelectedUnit();
if ((id != null) && (id.owner != -1 && id.id != -1)) {
const unit = Units.get(id);
if (unit) {

let typeName = "";
const unitInfo = GameInfo.Units.lookup(unit.type);
if (unitInfo != null) {
typeName = unitInfo.UnitType.replace("UNIT_", "");
} else {
typeName = unit.type.toString();
}
console.warn(typeName);

Units.restoreMovement(unit.id);
}
}
}

// complete the buildqueue of current selected city
comp() {
const cityID = UI.Player.getHeadSelectedCity();
if (cityID) {
let city = Cities.get(cityID);
if (city != null) {

let cityName = city.name;
cityName = cityName.replace('LOC_CITY_NAME_', '');

let cityStatus = "City";
if ( city.isTown )
{
cityStatus = "Town";
}

console.warn(cityName + " - " + cityStatus);
city.BuildQueue.completeProduction();
}
}
}

}

var cu = new CustomUtilities();

2) just press reload button on debug -> ui -> console panel

3) select a unit in game screen and just enter the command to input box in console panel

cu.go()


[References]
Base\Platforms\Windows\Config\TunerPanels\cities.ltp
Base\Platforms\Windows\Config\TunerPanels\units.ltp
 
Last edited:
I have the debug panel enabled (it's not overwritten during game loading):

Képernyőkép 2025-02-20 114050.png


but still can't bring up the panel with the ~ (tilde) key in game. I have no problem writing it anywhere: ~~~~

Am I missing something, or it's some sort of keyboard language shenanigan perhaps?! Any tip I greatly appreciate, thank you!
 
I have the debug panel enabled (it's not overwritten during game loading):

View attachment 720916

but still can't bring up the panel with the ~ (tilde) key in game. I have no problem writing it anywhere: ~~~~

Am I missing something, or it's some sort of keyboard language shenanigan perhaps?! Any tip I greatly appreciate, thank you!
I had the same issue (French keyboard here) but if you have US keyboard also installed in Windows

1740310462815.png


then you can alt-shift to toggle to Qwerty then the ² key in the top left corner of your keyboard will do the job.

1740310417542.png


As bonus, you will be able to move the camera ingame using ZQSD :p
 
Last edited:
I think it depends also on your OS. I'm using mostly MacOS and have to press < to open the debug panel.
I had the same issue (French keyboard here) but if you have US keyboard also installed in Windows
...
Thank you to you both! I forgot to edit my post, that I actually found the key via brute-force, it was Ctrl + Alt + ö (for whatever reason when everywhere else it's the usual Ctrl + Alt + 1... :crazyeye: ). But I do appreciate you for trying to help, thank you! :)
 
Is there a way to see the ‘stack trace’ in the console. I’ve been using console.error to see what values are but I can’t figure out what is calling the method.

I'm looking at AnchorText and can see the message be passed in but I don't know how to find out where it's comming from. I've tried searching for the name 'AnchorText' in the files but the only reference is not doing the call.

FYI it's for an ability like Napoleon which rewards happieness after kills. The pop up always says influence even though I specify in the modifier string happieness and the reward is happieness.
 
Back
Top Bottom