This one accepts messages on local chat based on a touch trigger. It also requires the n2k script in the same primitive.

failednoob_online_detector.lsl
///////////////////////////////////////////////////////////////////////////
//  Copyright (C) Wizardry and Steamworks 2011 - License: GNU GPLv3      //
//  Please see: http://www.gnu.org/licenses/gpl.html for legal details,  //
//  rights of fair usage, the disclaimer and warranty conditions.        //
///////////////////////////////////////////////////////////////////////////
 
key _kReq = NULL_KEY;
string _kName = "";
key _kKey = NULL_KEY;
 
default
{
    state_entry() {
        llSetText(_kName = "Touch me to look for an agent's status.", <1,1,1>, 1);
    }
    touch_start(integer num) {
        llListen(0, "", llDetectedKey(0), "");
        llSetText("Type the name of the agent in local chat.", <1,1,1>, 1);
    }
    listen(integer channel, string name, key id, string message) {
        llSetText("Checking...", <1,1,1>, 1);
        _kName = message;
        llMessageLinked(LINK_THIS, 0, _kName, "");
        llSetTimerEvent(10);
    }
    timer() {
        llSetTimerEvent(0);
        if(_kReq == NULL_KEY) {
            _kReq = "a";
            llSetText("Agent could not be found.", <1,1,1>, 1);
            llSetTimerEvent(5);
            return;
        }
        llResetScript();
    }
    link_message(integer sender, integer num, string str, key id) {
        if(str == "KN2K") if(id) {
            _kKey = (key)id;
            state check;
            return;
        }
    }
    changed(integer change) {
        if(change & CHANGED_INVENTORY) llResetScript();
    }
 
}
 
state check 
{
    state_entry() {
        _kReq = llRequestAgentData(_kKey, DATA_ONLINE);
        llSetTimerEvent(10);
    }
    timer() {
        llSetTimerEvent(0);
        llSetText("Agent could not be found.", <1,1,1>, 1);
        llResetScript();
    }
    dataserver(key id, string data) {
        if(id != _kReq) return;
        if(data == "1") {
            llSetText(_kName + " is online.", <0,1,0>, 1);
            return;
        }
        llSetText(_kName + " is offline.", <1,0,0>, 1);
    }
    touch_start(integer num) {
        state default;
    }
 
}

secondlife/online_detector/local_chat.txt ยท Last modified: 2022/11/24 07:46 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.