Step-by-step debugging is advanced technique of programming for finding and resolving proble
- Find root game directory at your system. Usualy it is something like this:
C:\Steam\steamapps\common\Life is Feudal Forest Village\
- Create debug.cmd in this directory with following content:
"ForestVillage.exe" -debug -console
- Find script.pak in the same directory. Extract it by QuickBMS.
- Download and install [ZeroBrane IDE]. Run it.
- Select Project -> ProjectDirectory -> Choose and select root game directory.
- Select Project -> LuaInterpretor -> Moai
- Select Edit -> Preference -> Settings: System. Add this lines at the end of file and save it:
debugger.runonstart = true debugger.redirect = 'c' path.moai = "debug.cmd"
- Restart ZeroBrane IDE.
- If setup done correctly you can press "start debugging" button (green triangle) and game will start.
- When the game window pops up start a new game.
- Browse project window (Project View -> Project/FileTree) and open some scripts. Click next to any line number to toggle breakpoint at this line (red circle). When script execution reaches this line the game will stop.
- Use stack window (Project View -> Stack) to examine stack and local variables at this point.
- Use Project -> Step Into, Step Over, Step Out buttons to step-by-step execution.
- Use this command in scripts to print any information into View -> Output window:
- To print information about the running game you can just put available global variables in print statements. If you put the following code in one of your Mod-Lua files it will print all elements of the fv.core Table to the Zerobrane console:
for key,val in pairs ( fv.core ) do print( key,val ) end
- Find more info about ZeroBrane IDE on [official site].