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:
SCRIPTED_AGENT_KEY
in a 64m
range every second.SCRIPTED_AGENT_KEY
is detected, then the script sends an authentication token to the bot and instructs it to sit down.sitting
state where permissions are requested and the bot accepts the request to be animated./////////////////////////////////////////////////////////////////////////// // 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; } } }