Assignment Client Scripts
Assignment Client (AC) scripts (also known as "persistent scripts") run persistently in a domain and aren't affected by other scripts. These scripts run on an assignment client separate from the Interface, so the script will continue to run until you either remove the script from the domain or you shut down the domain entirely.
With AC scripts, you can do things like coordinate actions between entities and avatars, and add virtual pets to greet visitors to your domain.
Add an AC Script
Once you've written and hosted your script, you need to add it to a domain, either your own or one where you have permissions to run an AC script.
Open your 'Domain Administration Panel'. If you are on a local domain server, open it by clicking on the Overte icon in the taskbar notifications and 'click Settings'.
From the menu, go to Content > Scripts.
In the Persistent Scripts section, click + and paste the URL to your script under 'Script URL'.
At the top of the page, click 'Save and Restart'. Now, every time you enter that domain, the AC script will be running.
Example of an AC Script
The following script counts the number of entities found in a domain using Overte's EntityViewer.
"use strict"
const SEARCH_CENTER = {x: 0, y: -10, z: 0};
const SEARCH_RADIUS = 100;
let isInitialized = false;
const timeout = 1000;
const update = function(deltaTime) {
if (!isInitialized) {
if (Entities.serversExist() && Entities.canRez()) {
EntityViewer.setPosition(SEARCH_CENTER);
EntityViewer.setCenterRadius(SEARCH_RADIUS);
EntityViewer.queryOctree();
Script.setTimeout(function(){
var foundEntities = Entities.findEntities(SEARCH_CENTER, SEARCH_RADIUS).length;
print("AC Script found: " + foundEntities + " entities within " + SEARCH_RADIUS + "m of " + JSON.stringify(SEARCH_CENTER));
}, timeout);
isInitialized = true;
Script.update.disconnect(update);
}
}
};
Script.update.connect(update);
See Also