Skip to content
Made in Poland
Global Shipping
Tutorials & Guides

Motion Scripts in VS Code

Edit motion scripts in Visual Studio Code with IntelliSense and syntax highlighting.

1 Introduction

This tutorial shows how to use Visual Studio Code to edit motion scripts associated with profiles in platform manager. 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.

Motion script open in Visual Studio Code with code completion and syntax highlighting

2 Prerequisites

1. Make sure that Visual Studio Code is installed.

2. Start the Visual Studio Code, go to File, Preferences, Extensions.

Visual Studio Code Extensions view with the QML extension ready to install

3. Search for C/C++ extension. Click install and wait until the extension and all dependencies are installed.

Visual Studio Code Extensions view with the C/C++ extension ready to install

4. Close the program.

Information
You can use other coding software, according to your preferences. We recommend using Visual Studio Code or Notepad++. The rest of this tutorial still applies, regardless of the software used.

3 Steps to open the script

Warning

Keep in mind that ONLY a cloned (not a built-in profile) and a full copy (non-shallow) profile's script can be edited.

Creating a full copy of a profile means, that it will not be updated in the future with software updates. In order to, for example, implement support for new devices, user will have to update his profiles by creating a full copy of new built-in profile and transfer his changes manually.

ForceSeatPM notice that customized profiles must be re-cloned after a built-in profile update

1. Go to ForceSeatPM and open the profile that you want to modify. Click Clone.

ForceSeatPM profile with the Clone button used before editing its motion script

2. In the cloning window:

  • Type in a new profile name
  • disable Shallow copy
  • enable Activate new profile
  • enable Open editor for new profile
ForceSeatPM clone dialog with Shallow copy off and Activate new profile and Open editor enabled
Information
To reach the Profile editor go to profile window and click Edit.
ForceSeatPM profile window with the Edit button that opens the Profile Editor

3. In Profile Editor go to Motion Scripts tab and find a script that matches your motion platform.

ForceSeatPM Profile Editor, Motion Scripts tab, with the script matching the motion platform
Information
If you are unsure which script to use - hover you mouse over Status icon at the bottom left corner of main app window.
ForceSeatPM status icon tooltip identifying which motion script applies

4. Press Run button next to the script to verify that the script works correctly and there are no errors in the the output console.

ForceSeatPM Profile Editor Run button with a clean output console
Information
An invalid script will display errors in red:
ForceSeatPM Profile Editor output console showing script errors in red

5. Click Code to open the script in Visual Studio Code

ForceSeatPM Profile Editor Code button that opens the script in Visual Studio Code

4 Coding the script

At this point there are two scenarios:

  1. If you are editing the script with the game running in the background and you plan to switch (Alt+Tab) between the VSC and game windows (e.g. changed filter parameters), you can close the Profile Editor. Platform manager will detect any changes made to the script and reload it automatically. If there are any syntax errors in the script, details will be displayed in Action Center.
  2. 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 do not close the Profile Editor. You will be checking that by clicking Run button later.

Code completion and content help can be used normally during script development

Motion script edited in Visual Studio Code with code completion and contextual help

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 are finished making changes to the script, save them and go to Profile Editor to press Run (or launch the game). If there are any errors, they will be displayed in Action Center or in the Script console (Run button).

ForceSeatPM Profile Editor output console showing script errors in red