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

From Second Life Wiki
Jump to navigation Jump to search
 
(6 intermediate revisions by the same user not shown)
Line 6: Line 6:
version: 001
version: 001


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


* A unique command !x-cancel
* A unique command !x-cancel
Line 19: Line 19:
   
   
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 !!
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 (June 2011)
// 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>
==Caveat and remarks==
*!x-cancel and !x-delay
The implementation of !x-cancel requires to know the owner of a controller, so the use of llGetOwnerKey(). The latter instruction is sim-local. So it is important to store this information with all pending timers, if the session should start when the avatar is not anymore in the sim in which the !x-delay was received.
*!x-cancel and !x-takeover by email
With a !x-takeover by email, it is impossible to get the UUID key of the owner of the new controller taking over the session. So the owner will be always the owner of the first controller.

Latest revision as of 04:32, 28 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 (June 2011) // 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>

Caveat and remarks

  • !x-cancel and !x-delay

The implementation of !x-cancel requires to know the owner of a controller, so the use of llGetOwnerKey(). The latter instruction is sim-local. So it is important to store this information with all pending timers, if the session should start when the avatar is not anymore in the sim in which the !x-delay was received.

  • !x-cancel and !x-takeover by email

With a !x-takeover by email, it is impossible to get the UUID key of the owner of the new controller taking over the session. So the owner will be always the owner of the first controller.