Shortnote

The following script is the LSL counterpart to the Claviger bot that commands a scripted agent (bot) to sit down on the primitive that the current script is in.

The script contains the SCRIPTED_AGENT_KEY parameter that has to be changed to the UUID of the bot.

Certain segments of the script are marked with:

////////////// CUT //////////////

indicating that that part of code may be left out in case a different script in the same primitive takes care of animating the bot.

The script below performs the following operations:

  1. The script scans for the bot with UUID SCRIPTED_AGENT_KEY in a 64m range every second.
  2. If the scripted agent with UUID SCRIPTED_AGENT_KEY is detected, then the script sends an authentication token to the bot and instructs it to sit down.
  3. Once the bot receives the authentication token (and if the authentication token matches the password in its configuration file) and the UUID of the prim to sit down, it sits on the primitive.
  4. The script commutes to the sitting state where permissions are requested and the bot accepts the request to be animated.

Code

claviger_poseball.lsl
///////////////////////////////////////////////////////////////////////////
//  Copyright (C) Wizardry and Steamworks 2012 - 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 SCRIPTED_AGENT_KEY = "a639881b-1b3a-49d9-a677-f1a48a565680";
 
default
{
    state_entry() {
        ////////////// CUT //////////////
        llSitTarget(<0,0,1>, ZERO_ROTATION);
        ////////////// CUT //////////////
        llSensorRepeat("", SCRIPTED_AGENT_KEY, AGENT, 64, TWO_PI, 1);
    }
    sensor(integer num) {
        llInstantMessage(SCRIPTED_AGENT_KEY, "auth 53x11");
        llSleep(1.1-llGetRegionTimeDilation());
        llInstantMessage(SCRIPTED_AGENT_KEY, "s " + (string)llGetKey());
    }
    changed(integer change) {
        if(change & CHANGED_LINK) {
            key av = llAvatarOnSitTarget();
            if(av != SCRIPTED_AGENT_KEY) {
                llUnSit(av);
                return;
            }
            state sitting;
        }
    }
}
 
state sitting {
    ////////////// CUT //////////////
    state_entry() {
        llRequestPermissions(SCRIPTED_AGENT_KEY, PERMISSION_TRIGGER_ANIMATION);
    }
    run_time_permissions(integer perm) {
        if(perm & PERMISSION_TRIGGER_ANIMATION) {
            llStartAnimation("Breakdance");
        }
    }
    ////////////// CUT //////////////
    changed(integer change) {
        if(change & CHANGED_LINK) {
            if(llAvatarOnSitTarget() == SCRIPTED_AGENT_KEY) return;
            state sitting;
        }
    }
}

secondlife/scripted_agents/claviger/poseball.txt ยท Last modified: 2017/02/22 18:30 (external edit)

Access website using Tor


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