Enforcer Script - Enforcer Events

Standard Events


Here is a list of the current "standard" events that The Enforcer understands.


EventDescription
LogonA user establishes a session with a Hub
LoginA user wears their Mesmerizer, or logs in to SL while wearing their Mesmerizer
LogoffA user's session with their hub times out
AddressA connected hub allocates a new HTTP address
LocationA user moves within SL
UpdatePeriodic "keepalive" event
MenuUser makes selection from a menu
Custom EventUser's Mesmerizer invokes the signal command



These events use the following notecards, and define the following variables:
EventNotecard(s)Variables
LogonLogon:<name>name
LoginLogin:<name>name
LogoffLogoff:<name>name
AddressAddress:<hubname>hubName, hubAddress
LocationLocation:<name>:<sim>name, location, sim, x, y, x
UpdateUpdate:<name>:<sim>name, location, sim, x, y, x
MenuMenu:<name>name, data
Custom EventEvent-name:<name>name, data

The notecard names in the above table have a fixed part that corresponds to the name of the event (e.g. Location), and one or two qualifiers, separated from one another and from the event name by colons.   Qualifiers are indicated in the table by being enclosed in angle-brackets, but that's just to make them stand out in the table - the angle brackets should not be used in the actual notecard names.  These qualifiers limit the applicability of the notecard so that it is only invoked for the event when it occurs for the specified person or other qualifier.  For instance, a notecard named "Login:Nue Broome" would be invoked each time I logged in, but not if someone else were to log in.  To create a notecard that would fire for anyone logging in, use "*" in place of the name, i.e. a notecard called "Login:*".  Only the most specific notecard will be invoked for an event, so if The Enforcer contained both of the above notecards, Login:Nue Broome would be used whenever I log in, and Login:* would be used for everyone else.  The name of the user is considered more "specific" than the sim they're in, so if a Location event were fired for me in the "Sleepy Hill" sim, and The Enforcer contained the following Location notecards:  Location:*.*Location:Nue Broome:* and Location:*.Sleepy Hill, then the notecard that would be invoked would be Location:Nue Broome:*.

Currently, the matching of notecard names is done in a case-sensitive manner, so a notecard called Login:nue Broome would not work.   I may lift that restriction in the future, so you should avoid using notecards whose names differ only in the case of some of their letters.  There is a new Validate option in The Enforcer's menu, which goes through all the notecards and verifies that the user-names provided are canonical Legacy Names with correct case (e.g."Nue Broome" or "Fenella27 Resident"), and suggests corrections for any that are not.

Custom Events

In addition to the standard events listed above, a Mesmerizer can use the signal command to create custom events within The Enforcer it's connected to.  

signal takes two parameters - the name of the event to generate, and a "data" parameter.  Within The Enforcer, the event name, along with the Mesmerizer wearer's name will be used to select a notecard, just as with the standard events above.  Note that currently, the sim-name is not automatically sent the The Enforcer as part of the custom event, so it cannot be used to select a response notecard.

Among other things, custom events allow for any standard Mesmerizer event to be turned into an Enforcer event.  For example, let's say you want to run an Enforcer program whenever a user teleports.  While the Mesmerizer supports the on-teleport event, this event is purely local - it's not signaled back to The Enforcer.  But you can create an event-handler within the Mesmerizer that will signal it, for example by using the following Mesmerizer trigger:

on-teleport = internal signal "Teleport" "$location"

When the Mesmerizer wearer teleports, this local trigger will fire, and it will signal a "Teleport" event to The Enforcer.  Within the notecard that The Enforcer selects to respond to this Teleport event, the data variable will be set to the current location of the wearer.


No comments:

Post a Comment