Skip to content
JasXSL edited this page Nov 29, 2017 · 2 revisions

The XOBJ listener is the standard way to accept method calls from outside a linkset, using llListen. Most often added to a project #ROOT script.

Install

In state entry add initiateListen(); to set up the default XOBJ listener.

Anywhere directly under a state (usually default{}), add #include "xobj_core/_LISTEN.lsl" to add the listen event. You can now use runMethod( key target, string moduleName, integer method, list arguments, string callback ) with target being the linkset or user it is attached to.

Configure

Add these configuration definitions #define <name> <val> above your preprocessor includes if you want to use any:

Definition Type Example Explanation
REQUIRE_INIT N/A #define REQUIRE_INIT Requires a global integer named integer BFL;, and a definition BFL_INIT. Checks if(BFL&BFL_INIT) before allowing any messages. This can be used if your script need to run asynchronous tasks before allowing any external messages.
ALLOW_USER_DEBUG int limit #define ALLOW_USER_DEBUG 1 Allows you to use the chat command line. A value of 2 allows ANYONE to use the command line on you (DANGEROUS). Any other value limits it to owner.
ALLOW_USER_DEBUG_KEY key id #define ALLOW_USER_DEBUG_KEY "cf2625ff-b1e9-4478-8e6b-b954abde056b" Use in conjunction with #define ALLOW_USER_DEBUG 2 to limit the console to a specific avatar by UUID. Can be useful when making bots.
LISTEN_LIMIT_FREETEXT code #define LISTEN_LIMIT_FREETEXT <code> Injects code into the top of the listen event. This is one you might use a lot, for an instance if you want to add custom code to limit who gets to send messages to you. You can use return; in your code to prevent the default XOBJ listener behavior.
Clone this wiki locally