Get started with scripting¶
The standard client uses lots of default scripts to create the end user experience. But you're capable of running your own scripts on the client, entities and server.
Tivoli uses QtScriptEngine to provide a scripting environment.
Unfortunately our JS engine is deprecated and is due for a redesign.
When interfacing with the API, you're likely to use these namespaces:
|Entities|| Lets you manipulate entities around you if you have the required permission. This means you can add, remove and edit entities. Everyone has access to the properties of an entity which can be used to find entities in range, direction, collision or rays. |
Beware that everyone can use
|AvatarList AvatarManager MyAvatar||Lets you get information on an Avatar or manipulate your own client-only MyAvatar. The information will always be of the client running the script. AvatarList and AvatarManager are basically the same but for different contexts.|
|Script|| Lets you connect callbacks from your client to the script, such as functionality that depend on time |
Connect paths relatively from the script location
Include other scripts
Or cleanup when the script is turned off
There are many other namespaces available in our API. Feel free to explore them!
Types of scripts¶
|Interface script||Interface scripts run on the interface client. You can perform single tasks or create apps, menus, overlays, tweaks or extensions.|
|Assignment client script||Assignment client scripts run on the world server. They can interact with entities or avatars and continue running as long as the world is running.|
|Avatar script||Avatar script run on the avatar and can give it unique effects.|
|Client entity script||Client entity scripts are scripts attached to entities that run locally. You can control what happens when a user interacts with an entity.|
|Server entity script||Server entity scripts are scripts attached to entities that run on the server. These scripts control entities and their behavior is seen and heard by everyone in the world|
Each server owner has the ability to set create/edit permissions. If the script you want to run adds or edits entities and you don't have the permission to do so, you wont see anything created or changed. However the script will still continue running.
Running scripts window¶
The running scripts window can be used to load, run and stop scripts from a URL or from disk.
To open the running scripts window, go to Edit > Running Scripts or press CTRL + J on your keyboard.
The scripting console lets you test and run short script snippets quickly to see how they work.
To open the console go to Developer > Scripting > Console. If the Developer menu is not visible, enable Settings > Developer Menu. You can also press CTRL + ALT + J.
Script log (Debug window)¶
The script log shows the output of your running scripts. This is used for debugging and when something is not working as intended. It can point you to the line of code where an error happened.
To open the script log, go to Developer > Scripting > Script Log (HMD Friendly). If the Developer menu is not visible, enable Settings > Developer Menu.