Page 1 of 1

Debugging a script for SFD in Visual Studio

Posted: Mon Nov 13, 2017 6:44 pm
by Gurt
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!

Re: Debugging a script for SFD in Visual Studio

Posted: Tue Nov 14, 2017 5:21 pm
by Venom
will codeblocks work or IDE is required?

Re: Debugging a script for SFD in Visual Studio

Posted: Tue Nov 14, 2017 6:31 pm
by Gurt
Venom wrote:
Tue Nov 14, 2017 5:21 pm
will codeblocks work or IDE is required?
Code::Blocks? Don't think it supports C# unless it's some plugin or newer support. I haven't tried any other IDE other than Visual Studio so I don't know.

Re: Debugging a script for SFD in Visual Studio

Posted: Wed Nov 15, 2017 11:05 am
by Venom
Gurt wrote:
Tue Nov 14, 2017 6:31 pm
Venom wrote:
Tue Nov 14, 2017 5:21 pm
will codeblocks work or IDE is required?
Code::Blocks? Don't think it supports C# unless it's some plugin or newer support. I haven't tried any other IDE other than Visual Studio so I don't know.
ok...