I know you don't want to read this, but you should. There's a lot to know about Reflex scripts that you probably will miss if you don't. Probably the answers to several "WTF?" questions you'll have are right here.
Since before Sansar went into public beta, Reflex scripts have been enabling experience creators to add interactivity to their scenes. Instead of providing complete solutions to very specific problems in single scripts, Reflex takes a building-block approach to creating behaviors, mainly by splitting functions up into separate sense and response scripts — what we call "sensors" and "actuators". One sensor can detect a person walking past a piece of ground and another can detect them pressing the "6" key on their keyboard. One actuator can open a door while another plays a sound.
What glues these separate sensors and actuators together is "bang" messages. Think of a gun going off to signal the start of a race. A trigger volume script has a Name setting. You might call it "DoorOpener". The script will send out "DoorOpener:On" bangs when people enter the volume and "DoorOpener:Off" bangs when they leave. So then your hinged door script has an OpenNamesCsv setting, into which you'll put "DoorOpener:On". And it has a CloseNamesCsv setting, into which you'll put "DoorOpener:Off".
Any number of actuators can listen for the same bang messages. You might, for example, have a light that swings into place using a sliding door script from the same on/off bangs.
Although it's not strictly enforced, you should uniquely name every Reflex script. The Name setting is always the first one you'll see. This allows you to do live programming and even create scripts that dynamically alter the settings (e.g., the volume of an audio emitter) in real time. And when an error occurs, the message will include the Reflex name, making it easier to find and fix the problem.
Please do install and take advantage of the Reflex console, a special script that is like a shepherd of all the other scripts. Plus, it offers a few cool features, like the ability to invite someone in the scene to teleport to your location. It will automatically show you badly configured Reflex scripts and enable you to live-program the settings of every one of them so you can find just the right values without having to frequently edit and rebuild your scene.
It's very important to note that Reflex 3 scripts are not designed to be compatible with older Reflex 2 and 1 scripts. They will simply ignore one another and happily live side by side. But please replace older Reflex scripts with the latest ones available.
This is a quirky concept to wrap your head around, in part because it has several meanings.
Your best starting point is to ask yourself: do I want to treat people as a whole or as individuals? Consider a door opener, for example, with a trigger volume sensor near it. Would you want the door to close as soon as one person leaves the volume? You definitely would not, because there may be someone else near the door. What you really want is for the door to stay open so long as at least one person is in the trigger volume. So in that case, you want to treat people as a group and thus to set PerPerson to Off.
Now let's say you have another trigger volume associated with an audio emitter that plays a sound whenever someone comes near. In that case, you probably do want to set PerPerson to On, because every person should trigger the sound, not just the first to arrive. Or maybe you really do want only the first to arrive to trigger it. Or perhaps only the last person to leave.
In the case of the chat emitter, PerPerson is used to decide whether the chat will go to everyone in range of the object or just to the one person who triggered it. It's a bit of a stretch of the per-person concept.
A key notion is the idea that sensors collect the identity of people who interact with them and pass those agent IDs along in their bang messages, which gets consumed by actuators like the teleporter.
Many logic scripts (still under development) can take advantage of the agent IDs in bangs to individualize responses.
Many scripts feature a RelativePosition on/off setting. They allow you to
express their Center, NearPosition, and other positional settings in terms
either absolute to the scene's own coordinate system or relative to the first
rigid body in an object. Not only to its position, but also relative to its
current orientation. If, for example, you set NearPosition for a
proximity sensor on a moving sled to
Note that it is no longer necessary for the object to be marked in settings as dynamic (Is Dynamic = On). But it is necessary for it to have a collision volume. This can save you from having to enter absolute positions even for static object by having the script figure out the position for you at startup.
One implication is that you can put teleporters, audio emitters, proximity detectors, key-press detectors, and many other kinds of sensors and actuators aboard moving vehicles, rotating objects, and other moving frames of reference.
Logic scripts get sandwiched in between sensors and actuators and allow you to craft more sophisticated behaviors without writing custom scripts. For example, the one-shot script can keep track of every person (and object) in your scene and only allow some event like chatting some instructions at them to occur once during their session. Or perhaps just throttle that chat so they don't see it more than once every five minutes. Per-person scripts look at and generate bang messages that contain a person's (or object's) ID in the scene.
This per-person behavior means logic scripts can be used to add some fairly sophisticated game-play features to your experiences.
Reflex is an open standard, in the sense that we encourage you to create your own Reflex-compatible scripts. You can create sensors, actuators, logic scripts, and so on. And, more importantly, you can write custom control scripts for your specific scenes that receive and send bang messages, allowing you to create hybrid technologies.
Please see the Integration section for details.