GTA3script for Visual Studio Code
This is an extension for VSCode which adds support for GTA3script:
- Syntax highlighting.
- Documentation for commands and its arguments.
Installing & Configuring
First, you will need to install Visual Studio Code. Then, in the command pallete (
Install Extension and choose
Then, you need to configure the extension with the path to a compiler and path to the game executable (optional). Go to
File > Preferences > User Settings and paste the following within the curly brackets:
And replace the settings apropriately. The final result should look like this.
.sc script file using Visual Studio Code and start coding! When in doubt of what to type, try pressing
ctrl-space for auto-completion.
f6 or execute
GTA3script: Build to compile this script.
f7 or execute
GTA3script: Build and Run to compile and run the game in case of success.
ctrl-f7 or execute
GTA3script: Run to run the game.
If, instead of opening a
.sc file, you open a workspace (
File > Open Folder), all the
*.sc files in the root of the workspace folder are going to be compiled instead of the one currently open in the editor.
Additionally, do notice the status bars at the lower right corner while a
.sc file is open:
- Click on the game status (
GTASA in the image above) to select the target game to compile and run.
- Click on the type flag (
CS in the image above) to select compilation options, including whether to compile a custom script, custom mission or a multifile script.
GTA3script: Select Game and
GTA3script: Build Flags are the analogues of this status bar.
Selecting a game is always set as a user setting (i.e. not a workspace setting). Build flags, however, are set as workspace settings if there's a workspace open, otherwise as a user setting.
Although, most of the settings can be set within commands embeded in VSCode by this extension, advanced users may desire to have more control over their settings. The following Visual Studio Code settings are available. These can be set in user preferences (
ctrl+,) or workspace settings (
"gtasa": ["--guesser", "--cs"]
"gta3script.docprovider": ["GTAModding", "GTAG Opcode Database"],
Do note tweaking the
gta3script.buildflags is currently prone to break the
GTA3script: Build Flags command. For instance, this command uses
-fno-entity-tracking as a base, if you set
-fentity-tracking on your settings, the command won't recognize that. There is no problem, however, in setting other arbitrary flags (like
Building and Debugging the Extension
VSCode provides a easy and well documented extension API. You can set up a development environment for debugging the extension during extension development.
First make sure you do not have the extension installed in
~/.vscode/extensions. Then clone the repo somewhere else on your machine, run
npm install and open a development instance of Code.
rm -rf ~/.vscode/extensions/thelink2012.gta3script
git clone https://github.com/thelink2012/vscode-gta3script
You can now go to the Debug viewlet and select Launch Extension then hit run (F5). You can now hit breakpoints and step through the extension.