Guidebook Debugging
Debug any mod in any language: logs, consoles, reload, and the per-language error paths. Framework internals: Core Overview; symptom tables: FAQ Troubleshooting.
The three observation points (all languages)
Section titled “The three observation points (all languages)”| Point | How | Shows |
|---|---|---|
Loader log (Latest.log, game root) |
Mod registriert: … [ID: …], [DynamicPatcher], [gregCore][HwId], HWID SYSTEM ACTIVE |
Boot, registration, patches, ID healing, all Logger + Lua log_* output |
Backquote console (`) |
help, clear, mods, menus, keys, version |
Registry, Hub menus, keybinds, framework version — no file reading |
| F1 Hub | Open/Close buttons, Settings jump | Whether your menu wiring (RegisterOpener/Closer, BindToggle/Report) is truthful |
- REPL (F12): run
greg.*calls live before putting them inmain.lua; discover hooks viagreg.hooks.groups()/.list(). - Hot-reload: a
FileSystemWatcher(LuaHotReload) watches*.luaunder your mod dir — just save the file.on_shutdown()runs, the script reloads,on_reload()runs. No restart needed. - Errors:
SafeCallcatches runtime errors per mod ([LuaMod:<id>] Runtime error: …in the log) andLuaErrorOverlay.ReportError(modId, message, stackTrace?)surfaces them in-game instead of killing other mods. - Budget:
LuaProfilerenforces ~2 ms/frame — emptyon_update, poll withgreg.every, never log per frame.
- No hot-reload: rebuild → overwrite
<game>/Mods/YourMod.dll→ restart (see Guidebook CSharp 06 Deploy Debug). Logger.Info / Warning / Error(with exception) is your printf;GregDoctorcovers boot-level causes;DisposeSubscriptions()+OnUnloadhygiene prevents ghost callbacks after reload.- After a game update: vanilla-first test, re-copy interop assemblies, regenerate
GameApi+ hooks,validate_contracts.py, full test run.
- Errors surface as
[gregCore][JS] <modId>/<file>: …in the loader log — check there first (mod-tagged, per file). - No restart needed: edit + save, return to the main menu, watch for
Reloaded. Mid-game edits stay queued. Raw.tswarns and skips — compile withtscfirst.
The debugging loop
Section titled “The debugging loop”- Reproduce once, note versions (game, framework via
`→version, loader, mod list viamods). - Read the log excerpt top-down: registration → patcher → your lines → first error.
- Shrink: REPL (Lua) or minimal subscription until the failure reappears.
- Fix, reload (Lua HotLoad, JS main-menu HotLoad, C# restart), re-run your chapter checkpoint.
- Still stuck → FAQ Troubleshooting → mod tracker (single-mod bug) or gregCore tracker (Hub/HUD/saves) with versions + log excerpt.