This set of pages describes use and programming of The Enforcer. This document describes Version 1.1 of The Enforcer.
Overview of The Enforcer
The Enforcer manages one or more CHAOS Communications Hubs within a region. For those managed Hubs, it can monitor the users currently logged in, and can bridge messages from one Hub to another, but it's main purpose is to respond to events signaled by the Hubs.
Events can be generated by a Hub itself (for example, the Hub obtains a new URL after a sim restart), but most events are caused by the activity of a Mesmerizer that's connected to the Hub. Once The Enforcer is associated with a Hub, it will be sent every event that the Hub generates or receives, and can be programmed to respond to those events to enforce such things as curfews, sim bans, automatic application or removal of RLV constraints, running trances, automatic teleporting or force-sitting - since it can send Mesmerizer commands to the user that generated the event, it can be programmed to do anything that their Mesmerizer can do.
There are several advantages to using The Enforcer to perform complex programming, as opposed to programming the Mesmerizer via triggers. While the Mesmerizer's triggers do offer a lot of functionality, they are stored in script memory, which is a finite and limited resource, and the response time of the Mesmerizer decreases with the number of triggers that are set. The Enforcer's programs, by contrast, are stored in notecards, which can be effectively unlimited in number. Also, the conditional capabilities of Mesmerizer triggers are somewhat limited, compared to the capabilities of The Enforcer scripting language. Finally, The Enforcer allows for centralized programming that can be shared between multiple subs, and can be developed, tested and deployed while the sub is not online.
Setting up The Enforcer
Before it will do anything, The Enforcer has to be connected to at least one CHAOS Communications Hub. If you run multiple Hubs, you should give each Hub a unique name - this will make things much less confusing. To connect to a Hub, click on The Enforcer to get its menu, and choose "Connect...". The Enforcer will look within the sim for CHAOS Communications Hubs and offer a list from which you can pick one to connect to. Choosing "Connections" from the menu will show the Hubs that are currently connected.
At this stage, The Enforcer will begin to receive events from the Hub(s) that you've connected it to. However, it has not been told what to do with these events, so it will just ignore them. Before discussing how to respond to events, we'll take a look at a couple of other menu choices.
The "Status" button lets you see the memory usage of the most important scripts within The Enforcer, as well as some statistics about the events that are currently being processed. Using the "Stats On" or "Stats Off" button will allow you to choose whether to display the most important statistics above The Enforcer as hovertext.
"Cur Users" and "All Users" show the logged in users, and the complete set of users on all connected Hubs.
The remaining buttons will be discussed in the sections describing the functions they control.
Responding to events
When it receives an event from a Hub, The Enforcer will look in its inventory for a notecard that will tell it how to respond. Each event has a name that specifies what kind of event it is. For example, the "Login" event is generated by a sub's Mesmerizer when they put on the Mesmerizer or log in to SL. Events also have "qualifiers" - typically the first qualifier is the legacy name of the user whose Mesmerizer generated the event, although for events generate by a Hub, the first qualifier is the name of the Hub (which is why it's important to give distinct names to your Hubs if you have more than one). Not all events have a second qualifier, but for those that do it's typically the name of the sim in which the user was when they generated the event.
When The Enforcer receives an event of type "Event1", with qualifiers "Q1" and "Q2", it will look in its inventory, for the following notecards:
- Event1:Q1:Q2
- Event1:Q1:*
- Event1:*:Q2
- Event1:*:*
- Event1
The first matching notecard it finds will be used to create a response to the event, by executing the script contained within the notecard.
As a more concrete example, consider the "Location" event, which is generated when a Mesmerizer enters a sim. The qualifiers for the Location event are the user's legacy name, and the sim they're in. So if Jane Doe is wearing a Mesmerizer that's connected to a Hub that's being monitored by The Enforcer, and Jane teleports into the "Sleepy Hill" sim, her Mesmerizer will generate a Location event, which will cause The Enforcer to look for one of the following notecards:
- Location:Jane Doe:Sleepy Hill
- Location:Jane Doe:*
- Location:*:Sleepy Hill
- Location:*:*
- Location
Enforcer Script
Types of instruction
- Lines beginning with a # character are considered comments, and ignored
- Lines beginning with a ^ character are considered to be Mesmerizer commands, and are sent to the Mesmerizer that generated the event.
- Lines beginning with @ or & are "Calls", that will invoke a second notecard, pausing the current notecard until the second one has completed execution. The difference between @ and & relates to namespaces and variables, which are discussed below.
- Lines beginning with a ! character are Enforcer Script lines, and the possible commands are detailed below.
- All other lines are considered to be "Debugging info", and will be sent to the owner of The Enforcer. This allows you to create a script that would send commands to a Mesmerizer, but initially omit the leading ^ from those lines. When the notecard is executed, you will be able to see the lines that would have been sent to the event generator's Mesmerizer. Once you're happy with them, you can just add back the ^ character to "activate" the Mesmerizer commands.
No comments:
Post a Comment