How to use Visual Studio Code to edit motion profiles
This short tutorial shows how to use Visual Studio Code to edit motion scripts associated with profiles in ForceSeatPM. Using Visual Studio Code enables code completion (IntelliSense), syntax highlighting and contextual help. It allows also to browse API classes and functions directly from the editor.
- Make sure that ForceSeatPM 2.109 or newer version is installed. Older versions will not work with Visual Studio Code.
- Make sure that Visual Studio Code is installed.
- Start the program, go to File, Preferences, Extensions and install C/C++ extension.
- Wait until the extension and all dependencies are installed and then close the program.
- Go to ForceSeatPM
- Clone the selected profile, e.g. SDK – Vehicle Telemetry:
- disable Shallow copy
- enable Activate new profile
- enable Open editor for new profile
- enable Clone scripts
- In Profile Editor go to Motion Scripts tab and find a script that matches your motion platform.
- Press Run button next to the script to verify that the script works correctly and there are no errors in the the output console.
- Click Code to open the script in Visual Studio Code
- At this point there are two scenarios:
- If you are editing the script when the game is running in the background and you plan switch (Alt+Tab) to the game to check your changes (e.g. changed filter parameters), you can close the Profile Editor. ForceSeatPM will detect any changes made to the script and reload it. If there is any syntax error in the script, details will be displayed in Action Center.
- If you are editing the script without the game running in the background or you want to check the script manually and see results in the output console, then don’t close the Profile Editor. You will be clicking Run button later.
- Code completition and content help can be used normally during script developement.
- All headers (with embedded comments/documentation) that define scripts API are located in: C:\Program Files (x86)\MotionSystems\ForceSeatPM\ScriptsAPI
You can browse them from Visual Studio Code.
- When you finish making changes to the script, save it and then go to Profile Editor to press Run (or switch to the game).
- If there is any error, it will be displayed in Action Center or in output console (if you press Run button).