Installation

To get started with Ravenscript you will need the following:

Ravenfield

Get a copy of Ravenfield from either Steam or the Humble Store. More details can be found on the Ravenfield website.

Ravenfield Tools Pack

The Ravenfield Tools Pack contains essential assets and scripts necessary to build and publish mods. Follow the instructions on the Ravenfield website.

Visual Studio Code

Visual Studio Code is a text editor from Microsoft.

There are a couple of reasons we recommend Visual Studio Code:

  • Built-in support in Unity

  • Debugger support for Lua

  • Syntax highlighting for Lua-files with .txt extension

It is possible to use Ravenscript with any text-editor. Vim, Sublime Text, Notepad++, whichever you like. But this documentation will assume that your are using Visual Studio Code.

Henceforth Visual Studio Code will be known as VSCode.

Unity ❤ Visual Studio Code

Unity will default to MonoEdit or a version of Visual Studio. But we can configure Unity to use VSCode instead:

  1. Open the Ravenfield Tools Pack project in Unity.

  2. Open Unity preferences (Edit > Preferences)

  3. Click External Tools

  4. Select Browse from the External Script Editor drop-down

_images/unity-external-tools-vs17.png
  1. Browse to %localappdata%/Programs/Microsoft VS Code/ and select Code.exe

  2. Visual Studio Code should now be selected as your External Script Editor

  3. Close the preferences

  4. Open a new VSCode window (without a workspace)

  5. Open the Ravenfield Tools Pack folder (File > Open Folder)

_images/vscode-open-folder.png
  1. Done

Extensions

VSCode is high customizable through extensions. There are extensions for Lua, C#, and debugging support.

  1. Open VSCode

  2. Open the extensions tab (View > Extensions)

_images/vscode-open-extensions.png
  1. Search for vscode-lua in the top-left search bar

  2. Select the first result

  3. Press the green Install button

_images/vscode-install-lua.png
  1. Repeat for C# (unless already installed)

  2. Repeat for EditorConfig for VS Code

  3. Done

Syntax highlighting

Note

Syntax highlighting should work out-of-the-box with the latest Ravenfield Tools Pack if you have followed the above instructions.

Ravenscript files use the .txt file extensions. They are bundled into Unity Asset Bundles as Text Assets hence the file extensions requirement.

VSCode should treat all .txt files within the Ravenfield Tools Pack folder as Lua code. If you followed the above steps it should already work as expected. However, if it does not, keep reading.

VSCode does not apply syntax highlighting to .txt files out of the box. We must convince VSCode to apply Lua syntax highlighting to all .txt files within the Ravenfield Tools Pack folder.

  1. Browse to the Ravenfield Tools Pack folder

  2. Open the .vscode directory (it may be hidden)

  3. Open the settings.json file

  4. Make sure it includes:

    {
        "files.associations": {
            "*.txt": "lua",
        }
    }