Skip to main content

Introduction

Getting started

  1. Visit our Developer panel and create a new product for your script. Provide the necessary details and save it.

  2. Clone your Gitea repository using the Git Credentials from your account settings.

  3. Initialize the Project:

    • After cloning the repository, navigate to the local directory where you cloned it.
    • Open your preferred command-line interface (CLI) or terminal and navigate to the project directory.
    • Run the command npm install to initialize the project and install the required dependencies. This will set up the necessary environment for your script.
  4. Enable Your Script:

    • To enable your script, it must be added to your Profile on the Client Page.
    • Select Add Script and chose your newly created script from the list. This step will enable your script and make it accessible in the game.
  5. Push Changes:

    • Once you have made modifications or added new features to your script, it's time to push the changes.
    • Commit your changes locally using Git and push them to the remote repository on Gitea.
    • All changes you push to the scripts are applied in real-time to the game.

Congratulations! You have successfully created your first script for Scripter's Rift. Remember to test your script thoroughly and make any necessary adjustments before pushing changes to ensure it functions as intended.

Many samples and most of the core framework source-code can also be found on our Gitea instance.

Documentation style

  • T? will be used to indicate the value is optional.
  • T1|T2 will be used to indicate the value type is variant.
  • {T1,T2} will be used to indicate multiple returns.

Lua style guide

  • Globals should be in PascalCase.
Me.SetViewAngles(Me.ViewAngles)
  • Local variables, functions, and member properties should be in camelCase.
local nextIter = 0
local function next()
local result = nextIter
nextIter = result + 1
return result
end
  • Constants and enumerations should be in CONST_CASE.
if entity.team == Team.ALLY then
...
end
  • Abbrevations of long words and acronyms are exempt from these requirements where necessary.
local function makeHSV(h, s, v)
return Color.HSV(h, s, v)
end
  • Semicolon should be omitted.

Performance tips

  • Use local x instead of x and local function x instead of function x as much as possible.
  • You should always filter out as much as possible in the entity query as opposed to doing it in your loop.
  • Draw in 3D space where possible instead of projecting the vector onto screen.

IDE Integration

TypeScript

You can generate a repo to create the boilerplate required to start your project with compiler fully configured and complete type-hints.

SR Lua

We have easy to integrate auto-completion support for most commonly used IDEs, if you do not see yours here feel free to shoot us a message!

Visual Studio Code

  1. Download the SR Lua extension.
  2. Go to %USERPROFILE%\.vscode\extensions and unpack the contents into a folder called srlua.
  3. Start VSCode and ensure you can see the extension in the extensions list as below.
  4. Hit CTRL+SHIFT+P to get the bar and choose Change Language Mode, pick SR Lua from the list if not done.
  5. Enjoy!

Atom

  1. File > Settings > Open Config Folder.
  2. Clone language-lua from here to .atom/packages.
  3. Download the snippets file.
  4. Replace the contents of .atom/packages/language-lua/snippets/language-lua.cson with the file you downloaded.
  5. Enjoy!