Simple Script User Guide

Simple Scripts user guide

Simple Scripts overview

Simple Scripts are a set of plug-and-play scripts that come with Sansar. They are designed to be easily configured without modifying their code, and they work with each other to create interesting and useful effects when triggered.

Triggers and responders

There are two essential types of Simple Scripts: triggers and responders.

Triggers send one or more named messages to all other Simple Scripts when a particular action, such as a touch or a chat command, happens. The property names for triggers end with ->. For example, if we were to put SimpleInteraction on an object and set the value for On 1st Click -> to "clicked", then any time that object is clicked it will send the named message "clicked" to all other simple scripts.

Responders listen for one or more named messages from all other Simple Scripts and perform an action when the message is received. The property names for responders start with ->. For example, if we were to put a SimpleLight on an object and set teh value for "-> Mode A" to "clicked", then the light will switch to the color and intensity of Mode A whenever a Simple Script sends the message "clicked". By putting both of these example objects into the same scene, we can then change the light of the responder object to Mode A by clicking the object with the trigger.

Any responder or trigger field can take a list of comma-separated named messages, to either respond to multiple different named messages or to send multiple different named messages.

Where to get Simple Scripts

Simple Scripts are in your Sansar inventory by default, in the Purchased category.

If you need to re-upload any Simple Scripts, or if you are interested in their code, you can find them in your Sansar installation folder, under /Client/ScriptApi/Examples/SimpleScripts.

At this time, there are 14 Simple Scripts. For details on the parameters for each, take a look at Example Scripts

Have more questions? Ask in our Discord!

Last updated