Skip to content

Creating a Script

Matryoshika edited this page May 27, 2018 · 3 revisions

The file

There are 3 requirements for Scripter to be able to see script-files:

  1. They have to be located in /config/Scripter, or a subdirectory therein
  2. They have to contain the word scripter in their file-name
  3. They have to have the extension .js

File-names need to contain scripter as this allows one to create other JS scripts in the same folder, that will not be read by Scripter. This allows one to have a central file that houses commonly used functions across several scripts etc.


Inside the file

The very first line has to be a comment. This comment is read by Scripter as it maps what scripts to call during a specific event.
If one uses the comment //PlayerInteractEvent.RightClickBlock on the first line, then Scripter will execute this script when this event is called.
For a full list of events one can use, please read [events].

There is one further limitation on scripts. Scripter will only call one function from each script-file, and this function has to be named onEvent and it has to have a single parameter, for example: var onEvent = function(event){}
This function can be seen as a miniature main method, for this script. You can call other functions from this, and they will be executed during the specified event.

Clone this wiki locally