Scripting in the Substrata metaverse is currently done with the Winter programming language.
Winter is a high-performance functional programming language, made by us at Glare Technologies. We use it in our other software Indigo Renderer and Chaotica.
See the Github Winter page for the language reference documentation.
Scripts in Substrata are executed in the Substrata client program (e.g. they are executed 'client-side'). Winter programs are restricted in what they can do, so are safe to execute client-side. (Although we can't rule out all bugs in the Winter execution environment)
To make a script for an object, you edit code in the 'Script' text edit box in the object editor in the Substrata client, after selecting an object. You can only edit scripts on objects that you own (e.g. that you created).
To script the behaviour of an object, you can define either of two functions:
def evalRotation(float time, WinterEnv env) vec3
time is the current global time in the Substrata metaverse.
This function returns a 3-vector, where the direction of the vector defines the axis of rotation, and the length of the vector defines the counter-clockwise rotation around the axis, in radians.
For example, the rotating wind turbine blades use the following script:
def evalRotation(float time, WinterEnv env) vec3 : vec3(-0.6, 0.0, 0.0) * time
This rotates the blades clockwise (due to the minus sign) around the x axis at a constant rate.
def evalTranslation(float time, WinterEnv env) vec3
This function returns a 3-vector, which defines a spatial translation from the usual position of an object (as placed by a user or entered in the object editor). The translation can be a function of time to allow object movement.
For example, this script makes an object move back and forth along the x axis:
def evalTranslation(float time, WinterEnv env) vec3 : vec3(sin(time * 1.51) * 0.1, 0, 0)
We plan to allow users to run their own server as well, to control their parcels, which will allow arbitrarily complicated code to affect their Substrata parcels.