Debugging a script for SFD in Visual Studio
Posted: Mon Nov 13, 2017 6:44 pm
If you have Visual Studio installed you can debug scripts written in Superfighters Deluxe directly through the IDE with breakpoints.
This is done by pointing to the Visual Studio devenv.exe in you config.ini for SFD with DEVENV as key and full path to the devenv.exe as value. Example:
DEVENV=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe
Then you need to start and attach Visual Studio to the Superfighters Deluxe process. This will let SFD know that there's a debugger attached and ready to be used.
If DEVENV is setup, Visual Studio started and attached to SFD the map editor will generate a full .cs source file each time you test run a map. This file will be opened in Visual Studio. Once the file has been opened you can set breakpoints and inspect your private values as you test your map.
To set breakpoints in any early code (like OnStartup) you can insert System.Diagnostics.Debugger.Break();
A few limitations apply.
- You can not edit and continue execution.
- You will not be able to inspect any proxy objects (any classes from the ScriptAPI) you may hold as references. (Workaround involves first reading any values to private variables and then inspecting those.)
This will hopefully help some of you create even better scripts.
Also see how to visually debug your scripts viewtopic.php?f=22&t=3776 directly through the ScriptAPI.
Good luck!
This is done by pointing to the Visual Studio devenv.exe in you config.ini for SFD with DEVENV as key and full path to the devenv.exe as value. Example:
DEVENV=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe
Then you need to start and attach Visual Studio to the Superfighters Deluxe process. This will let SFD know that there's a debugger attached and ready to be used.
If DEVENV is setup, Visual Studio started and attached to SFD the map editor will generate a full .cs source file each time you test run a map. This file will be opened in Visual Studio. Once the file has been opened you can set breakpoints and inspect your private values as you test your map.
To set breakpoints in any early code (like OnStartup) you can insert System.Diagnostics.Debugger.Break();
A few limitations apply.
- You can not edit and continue execution.
- You will not be able to inspect any proxy objects (any classes from the ScriptAPI) you may hold as references. (Workaround involves first reading any values to private variables and then inspecting those.)
This will hopefully help some of you create even better scripts.
Also see how to visually debug your scripts viewtopic.php?f=22&t=3776 directly through the ScriptAPI.
Good luck!