ares-scripties/hardware/debug.lsl

96 lines
2.1 KiB
Plaintext

//--------------------------------------------------------------------------
// BEGIN config
#define USE_LIGHTS
#define USE_PUBLIC
#define USE_ACS
// END config
//--------------------------------------------------------------------------
// BEGIN macros
#define listen_on(_h, _ch) llListenRemove(_h); _h = llListen(_ch, "", NULL_KEY, "")
// END macros
//--------------------------------------------------------------------------
// BEGIN includes
#include <utils.lsl>
#include <objects.lsl>
// END includes
//--------------------------------------------------------------------------
// BEGIN globals
#ifdef USE_LIGHTS
integer L_LIGHTS = 0;
integer C_LIGHTS = 0;
#endif
#ifdef USE_PUBLIC
integer L_PUBLIC = 0;
integer C_PUBLIC = -9999999;
#endif
#ifdef USE_ACS
integer L_ACS = 0;
integer C_ACS = 360;
#endif
key avatar = NULL_KEY;
// END globals
//--------------------------------------------------------------------------
// BEGIN functions
init() {
avatar = llGetOwner();
#ifdef USE_LIGHTS
C_LIGHTS = 105 - (integer)("0x" + substr(avatar, 29, 35));
listen_on(L_LIGHTS, C_LIGHTS);
#endif
#ifdef USE_PUBLIC
listen_on(L_PUBLIC, C_PUBLIC);
#endif
#ifdef USE_ACS
listen_on(L_ACS, C_ACS);
#endif
} // init()
// END functions
//--------------------------------------------------------------------------
// BEGIN main
default {
state_entry() {
init();
} // state_entry()
on_rez(integer n) {
init();
} // on_rez(...)
listen(integer cc, string src, key id, string msg) {
#ifdef USE_LIGHTS
if (cc == C_LIGHTS) {
if (substr(msg, 0, 5) != "power ") {
echo("recv (light bus) from " + src + " (" + (string)id + "): " + msg);
}
} // if (cc == C_LIGHTS)
#endif
#ifdef USE_PUBLIC
if (cc == C_PUBLIC) {
echo ("recv (public bus) from " + src + " (" + (string)id + "):" + msg);
}
#endif
#ifdef USE_ACS
if (cc == C_ACS) {
echo("recv (ACS) from " + src + " (" + (string)id + "): " + msg);
}
#endif
} // listen(...)
} // state default
// END main
//--------------------------------------------------------------------------