-
Notifications
You must be signed in to change notification settings - Fork 0
API System Overview
Category: System & Debugging Commands: Logger (5 commands) + Testing (11 commands) API Version: 1.3.11.2 Status: STABLE
System commands provide essential debugging, logging, and testing capabilities for the Bannerlord GameMaster mod. These commands enable you to monitor command execution through comprehensive logging, validate command reliability through automated testing, and troubleshoot issues during development and gameplay.
The system command set is divided into two major subsystems: the Command Logger for tracking and auditing command execution, and the Automated Testing Framework for validating command functionality. Together, these tools ensure reliable operation, facilitate debugging, and maintain command quality across game updates and modifications.
All system commands work in campaign mode and are designed for developers, testers, and power users who need visibility into command operations. They do not modify gameplay directly but provide critical infrastructure for command management and validation.
| Command | Description | Category | Status |
|---|---|---|---|
| gm.log.enable | Enable command logging | Logger Control | STABLE |
| gm.log.disable | Disable command logging | Logger Control | STABLE |
| gm.log.status | Show logging status | Logger Info | STABLE |
| gm.log.clear | Clear log file contents | Logger Management | STABLE |
| gm.log.help | Display logger help | Logger Info | STABLE |
| Command | Description | Category | Status |
|---|---|---|---|
| gm.test.register_standard | Register standard tests | Registration | STABLE |
| gm.test.register_integration | Register integration tests | Registration | STABLE |
| gm.test.register_all | Register all tests | Registration | STABLE |
| gm.test.register_all_run | Register and run all tests | Quick Test | STABLE |
| gm.test.run_all | Execute all registered tests | Execution | STABLE |
| gm.test.run_category | Run tests in category | Execution | STABLE |
| gm.test.run_single | Run specific test | Execution | STABLE |
| gm.test.list | List registered tests | Management | STABLE |
| gm.test.last_results | Show last test results | Management | STABLE |
| gm.test.clear | Clear registered tests | Management | STABLE |
| gm.test.help | Display testing help | Management | STABLE |
Commands for managing the command logging system.
gm.log.enable - Activates command logging and initializes the log file. All subsequent GameMaster commands are recorded with timestamps, parameters, and results. Supports custom file paths or uses default location in Documents folder.
gm.log.disable - Deactivates command logging. Previously logged commands remain in the file, but new commands are not recorded. Does not delete existing log file.
Commands for viewing logger status and managing log files.
gm.log.status - Displays current logging status, file location, file size, and entry count statistics. Quick overview without opening the log file.
gm.log.clear - Clears all content from the log file while keeping the file and logging system intact. Writes new session header after clearing. Permanent deletion of history.
gm.log.help - Displays comprehensive help information about logging commands with usage examples and integration notes.
Commands for registering test suites into the testing framework.
gm.test.register_standard - Registers the standard test suite containing basic validation tests for core command functionality. Tests parameter validation, error handling, and basic execution.
gm.test.register_integration - Registers integration test suite that validates game state changes. Tests verify commands actually modify the game state as expected (modifies game, use on test saves).
gm.test.register_all - Registers all available test suites (standard + integration). Clears previously registered tests before registration.
gm.test.register_all_run - Convenience command that registers all tests and immediately runs them. Fastest way to validate the entire command system.
Commands for running registered tests and generating reports.
gm.test.run_all - Executes all currently registered tests and generates comprehensive report with pass/fail statistics, success rate, and detailed results for each test.
gm.test.run_category - Executes all tests in a specific category (e.g., HeroQuery, ClanManagement). Useful for focused testing of specific command groups.
gm.test.run_single - Executes a single specific test by its unique test ID. Ideal for debugging failed tests or re-running specific scenarios.
Commands for managing registered tests and viewing results.
gm.test.list - Lists all registered tests organized by category. Optionally filter by specific category. Shows test IDs, descriptions, commands being tested, and expected outcomes.
gm.test.last_results - Displays results from the most recent test run. Supports both summary (quick stats) and verbose (detailed report) output modes.
gm.test.clear - Clears all registered tests from the test runner. Use to reset before registering a new test suite.
gm.test.help - Displays comprehensive help information about testing commands with usage examples and workflows.
File Path (Optional)
- Custom log file location
- Default:
Documents\Mount and Blade II Bannerlord\Configs\GameMaster\command_log.txt - Supports full file paths
Verbosity
- All commands provide detailed output
- Status command shows file statistics
Category Name
- Category identifier (e.g., "HeroQuery", "ClanManagement")
- Case-sensitive
- Use list command to see available categories
Test ID
- Unique test identifier (e.g., "test_hero_query_001")
- Case-sensitive
- Use list command to see available test IDs
Verbose Mode
- Boolean or keyword "verbose"
- Controls detail level of results display
- Summary vs. detailed output
Enable logging for debugging session:
gm.log.enable
gm.hero.set_gold player 10000
gm.clan.add_hero empire wanderer_1
gm.log.status
gm.log.disable
Result: All commands logged to file, status checked, logging disabled after session.
Use custom log path for specific save game:
gm.log.enable C:\MyLogs\SaveGame1\commands.txt
Result: Commands logged to custom location for organized tracking.
Validate entire command system rapidly:
gm.test.register_all_run
Result: All tests registered and executed, comprehensive report generated.
Test specific command group after modifications:
gm.test.register_all
gm.test.list HeroQuery
gm.test.run_category HeroQuery
gm.test.last_results verbose
Result: Only hero query tests executed, detailed results reviewed.
Investigate and re-run specific failing test:
gm.test.run_all
gm.test.run_single test_hero_query_001
Result: All tests run to identify failures, specific test re-executed for debugging.
Always enable logging when troubleshooting issues or during important operations:
gm.log.enable
The log provides valuable diagnostic information for resolving problems.
Use custom log paths to organize logs by save game or purpose:
gm.log.enable C:\MyLogs\Campaign1\session1.txt
Keeps command history organized and associated with specific gameplay sessions.
Check log file size periodically and clear when needed:
gm.log.status
gm.log.clear
Prevents log files from growing excessively large.
Run comprehensive tests after game updates or mod changes:
gm.test.register_all_run
Ensures all commands still function correctly after updates.
Integration tests modify game state, so run on dedicated test saves:
gm.test.register_integration
gm.test.run_all
Protects main save games from test-induced modifications.
Integration tests MODIFY game state:
- Heroes have attributes changed
- Clans have properties modified
- Kingdoms may be affected
- Always run on test saves or backup main saves first
Enabling logging with a custom path overwrites existing files without warning. Backup important log files before reusing paths.
The gm.log.clear command permanently deletes all log history. Consider backing up log files before clearing if history is important.
Command logging has minimal performance impact:
- Asynchronous file writes
- Only active when enabled
- Automatic error handling
- Negligible impact on command execution speed
Tests are organized by categories:
- HeroQuery - Hero search tests
- ClanManagement - Clan operation tests
- KingdomManagement - Kingdom operation tests
- ItemManagement - Item operation tests
- Categories help focus testing on specific systems
Log files use structured, human-readable format:
- Session headers with timestamps
- Command entries with timestamps
- Execution results
- Separator lines for readability
Format is designed for manual review and analysis.
Test results persist until next test run:
- Last results always available via
last_resultscommand - Results cleared when new tests execute
- Verbose mode provides complete detail
All system commands support the other command groups:
- Hero Management Commands
- Clan Management Commands
- Kingdom Management Commands
- Troop Management Commands
- Item Management Commands
- Query Commands
- Quick Start Guide - Getting started with GameMaster
- Best Practices - Recommended usage patterns
- Troubleshooting - Use logging for troubleshooting
When investigating issues:
1. gm.log.enable
2. (execute problematic commands)
3. gm.log.status
4. (review log file in Documents folder)
5. gm.log.disable
For important save games:
1. gm.log.enable C:\MySaves\campaign1_commands.txt
2. (gameplay session with commands)
3. (log maintained permanently)
After game updates or mod changes:
1. gm.test.register_all_run
2. (review results)
3. (re-run failed tests individually if needed)
For mod developers:
1. gm.test.clear
2. gm.test.register_all
3. gm.test.list
4. gm.test.run_category YourCategory
5. gm.test.last_results verbose
Last Updated: 2025-12-16 API Version: 1.3.11.2
🏠 Home | Quick Reference | Syntax Guide
Hero Commands
- gm.hero.abort_pregnancy
- gm.hero.add_gold
- gm.hero.add_hero_to_party
- gm.hero.create_companions
- gm.hero.create_lord
- gm.hero.create_party
- gm.hero.divorce
- gm.hero.edit_appearance
- gm.hero.edit_party
- gm.hero.equip_hero
- gm.hero.export_character
- gm.hero.generate_lords
- gm.hero.give_birth
- gm.hero.heal
- gm.hero.import_character
- gm.hero.impregnate
- gm.hero.imprison
- gm.hero.kill
- gm.hero.list_appearances
- gm.hero.list_characters
- gm.hero.list_developments
- gm.hero.list_traits
- gm.hero.load_appearance
- gm.hero.load_character
- gm.hero.load_development
- gm.hero.load_traits
- gm.hero.marry
- gm.hero.open_inventory
- gm.hero.release
- gm.hero.remove_clan
- gm.hero.rename
- gm.hero.save_appearance
- gm.hero.save_development
- gm.hero.save_traits
- gm.hero.set_age
- gm.hero.set_clan
- gm.hero.set_culture
- gm.hero.set_gold
- gm.hero.set_relation
- gm.hero.start_convrsation
Clan Commands
- gm.clan.add_gold
- gm.clan.add_gold_leader
- gm.clan.add_hero
- gm.clan.add_renown
- gm.clan.create_clan
- gm.clan.create_minor_clan
- gm.clan.destroy
- gm.clan.edit_banner
- gm.clan.equip_heroes
- gm.clan.generate_clans
- gm.clan.give_gold
- gm.clan.rename
- gm.clan.set_culture
- gm.clan.set_gold
- gm.clan.set_leader
- gm.clan.set_renown
- gm.clan.set_tier
- gm.clan.sync_kingdom_colors
Kingdom Commands
- gm.kingdom.add_clan
- gm.kingdom.call_ally_to_war
- gm.kingdom.create_kingdom
- gm.kingdom.declare_alliance
- gm.kingdom.declare_war
- gm.kingdom.destroy
- gm.kingdom.edit_banner
- gm.kingdom.equip_heroes
- gm.kingdom.generate_kingdoms
- gm.kingdom.get_tribute_info
- gm.kingdom.make_peace
- gm.kingdom.pay_tribute
- gm.kingdom.remove_clan
- gm.kingdom.rename
- gm.kingdom.set_ruler
- gm.kingdom.sync_vassal_banners
- gm.kingdom.trade_agreement
Settlement Commands
- gm.settlement.add_militia
- gm.settlement.fill_garrison
- gm.settlement.give_food
- gm.settlement.give_gold
- gm.settlement.rename
- gm.settlement.reset_names
- gm.settlement.set_culture
- gm.settlement.set_hearths
- gm.settlement.set_loyalty
- gm.settlement.set_prosperity
- gm.settlement.set_security
- gm.settlement.set_village_bound_settlement
- gm.settlement.set_village_trade_bound_settlement
- gm.settlement.spawn_wanderer
- gm.settlement.upgrade_buildings
Item Commands
- gm.item.add
- gm.item.equip
- gm.item.equip_slot
- gm.item.list_equipped
- gm.item.list_inventory
- gm.item.load_equipment
- gm.item.load_equipment_both
- gm.item.load_equipment_civilian
- gm.item.remove
- gm.item.remove_all
- gm.item.remove_equipped
- gm.item.remove_equipped_modifier
- gm.item.save_equipment
- gm.item.save_equipment_both
- gm.item.save_equipment_civilian
- gm.item.set_equipped_modifier
- gm.item.set_inventory_modifier
- gm.item.transfer
- gm.item.unequip
- gm.item.unequip_all
- gm.item.unequip_slot
Query Commands
- gm.query.character_objects
- gm.query.character_objects_any
- gm.query.character_objects_info
- gm.query.clan
- gm.query.clan_any
- gm.query.clan_info
- gm.query.culture
- gm.query.culture_info
- gm.query.hero
- gm.query.hero_any
- gm.query.hero_info
- gm.query.item
- gm.query.item_any
- gm.query.item_info
- gm.query.kingdom
- gm.query.kingdom_any
- gm.query.kingdom_info
- gm.query.modifier_info
- gm.query.modifiers
- gm.query.settlement
- gm.query.settlement_any
- gm.query.settlement_info
- gm.query.troop
- gm.query.troop_any
- gm.query.troop_info