Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.

New to the forum? Say hello in this topic! Also make sure to read the rules.

Debugging a script for SFD in Visual Studio

Share questions, scripts and tutorials related to the ScriptAPI in SFD.
Forum rules
By using the forum you agree to the following rules.
Post Reply
User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1884
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 34

Debugging a script for SFD in Visual Studio

Post by Gurt » 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!
Last edited by Gurt on Sat Mar 31, 2018 5:14 pm, edited 1 time in total.
4 x
Gurt

User avatar
Venom
Superfighter
Superfighter
Posts: 68
Joined: Sun Apr 09, 2017 3:49 pm
Title: Faaking Jhesus
SFD Alias: jajajaja sadasdjasiojd
Started SFD: When it was fun
Gender:

Post by Venom » Tue Nov 14, 2017 5:21 pm

will codeblocks work or IDE is required?
0 x
YOU FAAKING BITH NIGR BE CAREFUL WHAT YOU DO YOU ARE FAAKING YOUR FAAKING LIFE

IF YOU FAAKING FAAKING WITH TIME I WILL FAAKING COME AND KILL YOU BITH YOU DED :evil:

User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1884
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 34

Post by Gurt » 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.
0 x
Gurt

User avatar
Venom
Superfighter
Superfighter
Posts: 68
Joined: Sun Apr 09, 2017 3:49 pm
Title: Faaking Jhesus
SFD Alias: jajajaja sadasdjasiojd
Started SFD: When it was fun
Gender:

Post by Venom » Wed Nov 15, 2017 11:05 am

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...
0 x
YOU FAAKING BITH NIGR BE CAREFUL WHAT YOU DO YOU ARE FAAKING YOUR FAAKING LIFE

IF YOU FAAKING FAAKING WITH TIME I WILL FAAKING COME AND KILL YOU BITH YOU DED :evil:

Post Reply