Difference between revisions of "LSL Protocol/Restrained Love Open Relay Group/cancel"

From Second Life Wiki
Jump to navigation Jump to search
Line 29: Line 29:
// and type in the box the username of the avatar to release.
// and type in the box the username of the avatar to release.
// If the avatar's relay supports !x-cancel, all sessions controlled
// If the avatar's relay supports !x-cancel, all sessions controlled
// by one of your device will be cancelled.  
// by one of your devices will be cancelled.  


string avatar;
string avatar;

Revision as of 05:18, 19 June 2011

cancel

STATUS: draft

version: 001

Implemented in Dahlia's multirelay 1.2.22 and anythingRLV3.7beta

  • A unique command !x-cancel

Description of !x-cancel

Syntax

The relay must always answer !x-cancel,ok if it is supported. There are no exceptions !!

Semantics

The effect of this command is to release the relay from all sessions controlled by objects owned by the same owner as the owner of the script which sends the !x-cancel. There are no exceptions to this behaviour !!

A script for releasing an avatar

<lsl> // Author Dahlia Orfan // Put this script in a prim (rezzed or worn); touch this prim // and type in the box the username of the avatar to release. // If the avatar's relay supports !x-cancel, all sessions controlled // by one of your devices will be cancelled.

string avatar; integer listener;

default
{
    touch_end(integer num)
    {
        if (llDetectedKey(0) != llGetOwner())
            return;
        integer channel = -1000000 - (integer)llFrand(1000000);
        llListenRemove(listener);
        listener = llListen(channel,"",llGetOwner(),"");
        llTextBox(llGetOwner(),
                  "\n\nEnter the username of the avatar to release from your own devices (case sensitive)"
                  ,channel);
        llSetTimerEvent(60.0);
    }
    listen(integer channel,string name,key id,string message)
    {
        llListenRemove(listener);
        llSetTimerEvent(0.0);
        integer n = llGetListLength(llParseString2List(message,[" "],[]));
        if (n == 1)
            message += " Resident";
        avatar = message;
        llSensor(avatar,NULL_KEY,AGENT,95.0,PI);
    }
    sensor(integer num)
    {
        integer RELAY_CHANNEL = -1812221819;
        llRegionSayTo(llDetectedKey(0),RELAY_CHANNEL,"cancel," 
                      + (string)llDetectedKey(0) + ",!x-cancel");
        llDialog(llGetOwner(),"\n\n" 
                 + llDetectedName(0) 
                 + " is released if the relay supports !x-cancel.",[],-100);
        llResetScript();
    }
    no_sensor()
    {
        llDialog(llGetOwner(),
                 "\n\n" 
                 + avatar 
                 + " not found. You must enter the exact username.",[],-100);
        llResetScript();
    }
    timer()
    {
        llResetScript();
    }
}

</lsl>