-
Notifications
You must be signed in to change notification settings - Fork 4
Core Macros
JasXSL edited this page Nov 29, 2017
·
8 revisions
These are macros, functions & config definitions that are used within XOBJ itself. They are different to libjas and libJasPre in that they're directly related to XOBJ, whereas the libraries are more generic features.
Define at the top of your _core.lsl file
Definition | Arg | Description |
---|---|---|
SCRIPT_IS_ROOT | N/A | Should only be defined at the top of your #ROOT script |
USE_EVENTS | N/A | Enables the event listener in the script. |
OVERRIDE_TOKEN | N/A | Overrides the default listener token generator. See Securing XOBJ for more info |
SCRIPT_ALIASES | (list)aliases | Allows your script to be accesses through other names. In GoT this can be used for "ms MonsterScript" to accept interact calls meant for "got Localconf" |
DEBUG | DEBUG_ALL DEBUG_USER DEBUG_RARE DEBUG_UNCOMMON DEBUG_COMMON |
Sets the debugging level in a script or project. See Debugging for more info |
PC_SALT | integer salt | Salt for player channel. See Securing XOBJ |
TOKEN_SALT | string salt | Salt for com-tokens. See Securing XOBJ |
DISREGARD_TOKEN | N/A | Don't use security tokens. See Securing XOBJ |
ALLOW_USER_DEBUG | 1 = Owner only 2 = ALL |
Sets up a debug listener allowing the owner (or anyone if defined as 2) to run methods on the linkset using the chat command "debug (str)module, (int)method, (var)arg1, (var)arg2..." |
ALLOW_USER_DEBUG_KEY | (key)uuid | Use with #define ALLOW_USER_DEBUG 2 to set a UUID that can use the debug command |
USE_DB2 | N/A | Use legacy DB2 instead of DB3, recommended only for legacy purposes. |
Function | LSL | Description |
---|---|---|
runMethod(string uuidOrLink, string className, integer method, list data, string callback) | X | Standard function of calling a method on a module. Either internal or external |
runOmniMethod(string className, integer method, list data, string callback) | X | Same as above but sent as a regionsay |
runLimitMethod(string tokenSender, string className, integer method, list data, string callback, float range) | X | Uses llSay()/llWhisper etc, whichever is the minimum to cover range. Memory intensive, not recommended. Use a range argument in the method instead and check on the recipient if it was valid. |
raiseEvent(evt, data) | Raises an event | |
resetAllOthers() | Resets all XOBJ scripts except the one that called it | |
resetAll() | Resets all modules in the linkset, even the one that called it |
Event | Value | Data | Description |
---|---|---|---|
evt$SCRIPT_INIT | -1 | void | Can be raised whenever a module is intialized |
evt$SCRIPT_TOUCH_START | -2 | (int)prim, (key)id | Can be raised by #ROOT on touch_start |
evt$SCRIPT_TOUCH_END | -3 | (int)prim, (key)id | Can be raised by #ROOT on touch_end |
evt$SCRIPT_BUTTON_PRESS | -4 | (int)level&edge | Can be raised by #ROOT on a keyboard button pressed |
evt$SCRIPT_BUTTON_RELEASE | -5 | (int)~level&edge | Can be raised by #ROOT on a keyboard button released |
evt$SCRIPT_BUTTON_DOUBLE_PRESS | -6 | (int)level&edge | Can be raised by #ROOT on a keyboard button double tapped |
evt$SCRIPT_BUTTON_HELD_SEC | -7 | (int)level, (float)sec | Can be raised by #ROOT after a button has been held for sec seconds |
Const | Value | Description |
---|---|---|
CALLBACK_NONE NORET TNN |
JSON_INVAILD | Used in runMethod to specify that you don't want a callback |
These are standard events, they all use a negative integer for their value. Always use a positive integer when defining module events.
Event | Value | Data | Description |
---|---|---|---|
evt$SCRIPT_INIT | -1 | void | Can be raised whenever a module is intialized |
evt$SCRIPT_TOUCH_START | -2 | (int)prim, (key)id | Can be raised by #ROOT on touch_start |
evt$SCRIPT_TOUCH_END | -3 | (int)prim, (key)id | Can be raised by #ROOT on touch_end |
evt$SCRIPT_BUTTON_PRESS | -4 | (int)level&edge | Can be raised by #ROOT on a keyboard button pressed |
evt$SCRIPT_BUTTON_RELEASE | -5 | (int)~level&edge | Can be raised by #ROOT on a keyboard button released |
evt$SCRIPT_BUTTON_DOUBLE_PRESS | -6 | (int)level&edge | Can be raised by #ROOT on a keyboard button double tapped |
evt$SCRIPT_BUTTON_HELD_SEC | -7 | (int)level, (float)sec | Can be raised by #ROOT after a button has been held for sec seconds |
Communication in XOBJ is done through linkmessages (even when received from an external source). XOBJ uses a negative integer in the link_message integer entry to determine the base action. As such you cannot use a negative int for llMessageLinked if you need to use llMessageLinked in your project. Here is a list of the current types used.
Action | NR | Deprecated | Description |
---|---|---|---|
RUN_METHOD | -1 | Runs a method | |
METHOD_CALLBACK | -2 | Sends a callback | |
EVT_RAISED | -3 | Sends an event | |
RESET_ALL | -4 | Resets all XOBJ scripts | |
DB2_ADD | -5 | X | Legacy |
DB2_UPDATE | -6 | X | Legacy |
DB2_DELETE | -7 | X | Legacy |
DB2_REFRESHME | -8 | X | Legacy |
DB3_ADD | -5 | Replaces DB2_ADD. Adds a table to DB3 and sends stdMethod$setShared as a callback on success to the script that requested it |