Update repo (#1)

* Update README.md

* Update and rename [AV]LockGuard-object.lslp to [AV]LockGuard-object.lsl

* Update [AV]LockGuard-object.lsl

* Update [AV]LockGuard-object.lsl

* Update [AV]LockGuard-object.lsl

* Update and rename [AV]LockGuard.lslp to [AV]LockGuard.lsl

* Update and rename shared props via BUTTON.lslp to shared props via BUTTON.lsl

* Update and rename shared props via POSE.lslp to shared props via POSE.lsl
This commit is contained in:
Builder's Brewery 2016-06-06 03:25:56 +02:00 committed by codeviolet
parent ff60b814dc
commit 5c4f5b3418
9 changed files with 497 additions and 395 deletions

View file

@ -0,0 +1,40 @@
// Placed in prop objects, this script sends the uuid of any Lockguard rings to the script in furniture.
// Ring prims in the prop should be named with "ring" in their prim name. e.g. "ring1", "ring2"
integer COMM_CHANNEL = -57841689;
integer comm_handle;
list findPrimsWithSubstring(string name)
{
list found;
integer index = llGetLinkNumber() != 0;
integer number = llGetNumberOfPrims() + index;
for (; index <= number; index++)
{
if (~llSubStringIndex(llToLower(llGetLinkName(index)), name))
{
found += [llGetLinkName(index), llGetLinkKey(index)];
}
}
return found;
}
default
{
on_rez(integer start)
{
if (!llGetStartParameter()) return;
comm_handle = llListen(COMM_CHANNEL, "", NULL_KEY, "INFORM");
}
listen(integer listen_channel, string name, key id, string msg)
{
list ring_prims = findPrimsWithSubstring("ring");
llSay(COMM_CHANNEL, llDumpList2String(["ATTACHPOINTS"] + ring_prims, "|"));
llListenRemove(comm_handle);
}
}

View file

@ -1,28 +0,0 @@
// Placed in prop objects, this script sends the uuid of any Lockguard rings to the script in furniture.
// Ring prims in the prop should be named with "ring" in their prim name. e.g. "ring1", "ring2"
integer COMM_CHANNEL = -57841689;
integer comm_handle;
default{
on_rez(integer start){
if(llGetStartParameter()){
comm_handle = llListen(COMM_CHANNEL,"","","INFORM");
}
}
listen(integer listen_channel, string name, key id, string msg){
list ring_prims;
integer i;
for(i=0;i<=llGetNumberOfPrims();i++){
if (llSubStringIndex(llToLower(llGetLinkName(i)),"ring")!=-1){
ring_prims += [llGetLinkName(i),llGetLinkKey(i)];
}
}
llSay(COMM_CHANNEL,llDumpList2String(["ATTACHPOINTS"]+ring_prims,"|"));
llListenRemove(comm_handle);
}
}

View file

@ -0,0 +1,197 @@
// LSL-AVSITTER-LockGuard-PLUGIN
// Copyright (c) 2016
// Permission given to modify and adapt this script
//
// For use attaching particle chains to LockGuard V2 compatible cuffs such as Open Collar
// This script should be placed inside the prim that contains your poses and props.
// Inspiration and function (not code) from the Bright CISS system by Shan Bright & Innula Zenovka.
// SITTER:
// The AVsitter SITTER # the cuff settings are for.
integer SITTER = 0;
// USES_PROPS:
// - TRUE for ring prims within props
// - FALSE for ring prims linked to furniture
// - If you're using props, you must include the "[AV]LockGuard-object" script in your props
// and ring prim names must contain the substring "ring". Each pose can only have 1 prop
// for all the rings (e.g. the ring prop for each pose should be 1 linked object, not
// separate props of individual rings).
// NOTE:
// - Most builds should use USES_PROPS = FALSE;
// - USES_PROPS should only be used for specific cases. e.g. if the prop completely changes the
// surrounding scene which the chains attach to. If you want the LockGuard rings rezzed all the
// time then they should be permanently linked to the furniture and not approached with props.
integer USES_PROPS = FALSE;
// POSES list
// - specifies which cuffs to chain to which prims for each POSE or SYNC (these correspond to
// menu names of your poses, not animation file names!).
// e.g: "Pose2", "leftwrist, ring1, rightwrist, ring2"
// - When the POSE "Pose2" is played, this will chain the "leftwrist" cuff to the prim hook named
// "ring1" and the "rightwrist" cuff to the prim hook named "ring2". The hook prims in the
// furniture should be named (e.g. "ring1" and "ring2").
// - See http://www.lslwiki.net/lslwiki/wakka.php?wakka=exchangeLockGuardItem
// for a list of LockGuard V2 Standard ID Tags and more information. The LockGuard package
// (with full instructions for the protocol) can be obtained in-world from Lillani Lowell's
// inworld location.
list POSES = [
"Pose1", "leftwrist,ring1,rightwrist,ring2,leftankle,ring3,rightankle,ring4",
"Pose2", "leftwrist,ring1,rightwrist,ring2",
"Pose3", "leftwrist,ring5,rightwrist,ring6,leftankle,ring7,rightankle,ring8",
"Pose4", "leftwrist,ring5,rightwrist,ring6"
];
// CHAIN_PARAMETERS:
// - For information on parameters see http://www.lslwiki.net/lslwiki/wakka.php?wakka=exchangeLockGuard
// - Specifies any special LockGuard commands. If you do not specify any then the particle will
// use the cuff default. Common used parameters are "gravity g", "life secs",
// "color red green blue", "size x y", "texture uuid".
// e.g. "color 1 0 0 texture 6808199d-e4c8-22f9-cf8a-2d9992ab630d" will bind with red ropes.
string CHAIN_PARAMETERS = "size 0.12 0.12 life 1 gravity 0.3 texture d7277e78-06f4-58ae-9f7c-7499e50de18a";
// "size 0.12 0.12 life 1 gravity 0.3 texture 245ea72d-bc79-fee3-a802-8e73c0f09473"
// "size 0.12 0.12 life 1.2 gravity 0 texture d7277e78-06f4-58ae-9f7c-7499e50de18a"
integer LOCKGUARD_CHANNEL = -9119;
integer COMM_CHANNEL = -57841689;
integer comm_handle;
key avatar;
list links;
list ring_prims;
goChain(list new_links)
{
integer index;
// unlink unused links
for (; index < llGetListLength(links); index += 2)
{
integer found = llListFindList(new_links, [llList2String(links, index)]);
if (~found)
{
llWhisper(LOCKGUARD_CHANNEL, "lockguard " + (string)avatar + " " + llList2String(links, index) + " unlink");
}
}
index = 0;
// link new links
for (; index < llGetListLength(new_links); index += 2)
{
integer found = llListFindList(ring_prims, [llList2String(new_links, index + 1)]);
if (~found)
{
llWhisper(LOCKGUARD_CHANNEL, "lockguard " + (string)avatar + " " + llList2String(new_links, index) + " link " + llList2String(ring_prims, found + 1) + " " + CHAIN_PARAMETERS);
}
}
links = new_links;
}
list findPrimsWithSubstring(string name)
{
list found;
integer index = llGetLinkNumber() != 0;
integer number = llGetNumberOfPrims() + index;
for (; index <= number; index++)
{
if (~llSubStringIndex(llToLower(llGetLinkName(index)), name))
{
found += [llGetLinkName(index), llGetLinkKey(index)];
}
}
return found;
}
default
{
link_message(integer sender, integer num, string msg, key id)
{
if (sender != llGetLinkNumber()) return;
if (num == 90500 && USES_PROPS)
{
list data = llParseStringKeepNulls(msg, ["|"], []);
integer SITTER_NUMBER = (integer)llList2String(data, 1);
if (SITTER_NUMBER == SITTER)
{
avatar = id;
string EVENT = llList2String(data, 0);
// string PROP_NAME = llList2String(data, 2);
string PROP_OBJECT = llList2String(data, 3);
// string PROP_GROUP = llList2String(data, 4);
string PROP_UUID = llList2String(data,5);
// llOwnerSay(llList2CSV([EVENT, SITTER_NUMBER, PROP_NAME, PROP_OBJECT, PROP_GROUP, PROP_UUID, AVATAR_UUID]));
if (EVENT == "REZ")
{
llListenRemove(comm_handle);
comm_handle = llListen(COMM_CHANNEL, PROP_OBJECT, PROP_UUID, "");
llRegionSayTo((key)PROP_UUID, COMM_CHANNEL, "INFORM");
}
}
}
else if (num == 90065)
{//stands up
if (id == avatar)
{
goChain([]);
avatar = NULL_KEY;
}
}
else if (num == 90045)
{//animation played
list data = llParseString2List(msg, ["|"], []);
string SITTER_NUMBER = llList2String(data, 0);
if ((integer)SITTER_NUMBER == SITTER)
{
if (id != avatar)
{
goChain([]);
}
avatar = id;
string POSE_NAME = llList2String(data, 1);
list new_links;
integer pose_index = llListFindList(POSES, [POSE_NAME]);
if (~pose_index)
{
new_links = llCSV2List(llList2String(POSES, pose_index + 1));
}
if (USES_PROPS)
{
goChain(new_links);
}
else
{
ring_prims = findPrimsWithSubstring("ring");
}
goChain(new_links);
}
else if (id == avatar)
{
goChain([]);
avatar = NULL_KEY;
}
}
}
listen(integer listen_channel, string name, key id, string msg)
{
list data = llParseString2List(msg, ["|"], []);
if (llList2String(data, 0) != "ATTACHPOINTS") return;
ring_prims = llDeleteSubList(data, 0, 0);
goChain(links);
}
}

View file

@ -1,154 +0,0 @@
/*
LSL-AVSITTER-LockGuard-PLUGIN
Copyright (c) 2015
Permission given to modify and adapt this script
For use attaching particle chains to LockGuard V2 compatible cuffs such as Open Collar
This script should be placed inside the prim that contains your poses and props.
Inspiration and function (not code) from the Bright CISS system by Shan Bright & Innula Zenovka.
*/
// SITTER: The AVsitter SITTER # the cuff settings are for.
integer SITTER = 0;
// USES_PROPS: Set to FALSE if your ring prims are linked to your furniture. Set TRUE if your prim rings are in props. If you're using props, you must include the "[AV]LockGuard-object" script in your props and ring prims must have the word "ring" in their name. Each pose can only have 1 prop for all the rings (e.g. the ring prop for each pose should be 1 linked object, not separate props of individual rings).
// NOTE: USES_PROPS should only be used for specific cases. e.g. if the prop completely changes the surrounding scene which the chains attach to. If you want the LockGuard rings rezzed all the time then they should be permanently linked to the furniture and not approached with props. Most builds should use USES_PROPS = FALSE;
integer USES_PROPS = FALSE;
/*
In the POSES list below, specify which cuffs to chain to which prims for each POSE or SYNC (these correspond to menu names of your poses, not animation file names!).
e.g: "Pose2", "leftwrist,ring1,rightwrist,ring2"
When the POSE "Pose2" is played, this will chain the "leftwrist" cuff to the prim hook named "ring1" and the "rightwrist" cuff to the prim hook named "ring2". The hook prims in the furniture should be named (e.g. "ring1" and "ring2").
See http://www.lslwiki.net/lslwiki/wakka.php?wakka=exchangeLockGuardItem for a list of LockGuard V2 Standard ID Tags and more information.
The LockGuard package (with full instructions for the protocol) can be obtained in-world from Lillani Lowell's inworld location.
*/
list POSES = [
"Pose1", "leftwrist,ring1,rightwrist,ring2,leftankle,ring3,rightankle,ring4",
"Pose2", "leftwrist,ring1,rightwrist,ring2",
"Pose3", "leftwrist,ring5,rightwrist,ring6,leftankle,ring7,rightankle,ring8",
"Pose4", "leftwrist,ring5,rightwrist,ring6"
];
// CHAIN_PARAMETERS: Specify any special LockGuard commands. If you do not specify any then the particle will use the cuff default. Common used parameters are "gravity g", "life secs", "color red green blue", "size x y", "texture uuid". e.g. "color 1 0 0 texture 6808199d-e4c8-22f9-cf8a-2d9992ab630d" will bind with red ropes. For information on parameters see http://www.lslwiki.net/lslwiki/wakka.php?wakka=exchangeLockGuard
string CHAIN_PARAMETERS = "size 0.12 0.12 life 1 gravity 0.3 texture d7277e78-06f4-58ae-9f7c-7499e50de18a";
//string CHAIN_PARAMETERS = "size 0.12 0.12 life 1 gravity 0.3 texture 245ea72d-bc79-fee3-a802-8e73c0f09473";
//string CHAIN_PARAMETERS = "size 0.12 0.12 life 1.2 gravity 0 texture d7277e78-06f4-58ae-9f7c-7499e50de18a";
/*
CHANGES:
3.03a ~ altered to still uses pose name (rather than prop name) when USES_PROPS = TRUE
*/
/******************************************************************
* DON'T EDIT BELOW THIS UNLESS YOU KNOW WHAT YOU'RE DOING!
******************************************************************/
integer LOCKGUARD_CHANNEL = -9119;
integer COMM_CHANNEL = -57841689;
integer comm_handle;
key avatar;
list links;
list ring_prims;
//string PROP_NAME;
string POSE_NAME;
go_chain(list new_links){
integer link_index;
// unlink unused links
for(link_index=0;link_index<llGetListLength(links);link_index+=2){
if(llListFindList(new_links,[llList2String(links,link_index)])==-1){
llWhisper(LOCKGUARD_CHANNEL,"lockguard "+(string)avatar+" "+llList2String(links,link_index)+" unlink");
}
}
// link new links
for(link_index=0;link_index<llGetListLength(new_links);link_index+=2){
integer index = llListFindList(ring_prims,[llList2String(new_links,link_index+1)]);
if(index!=-1){
llWhisper(LOCKGUARD_CHANNEL,"lockguard "+(string)avatar+" "+llList2String(new_links,link_index)+" link "+llList2String(ring_prims,index+1)+" "+CHAIN_PARAMETERS);
}
}
links = new_links;
}
default{
link_message(integer sender, integer num, string msg, key id){
if(sender==llGetLinkNumber()){
if(num==90500 && USES_PROPS){
list data = llParseStringKeepNulls(msg,["|"],[]);
integer SITTER_NUMBER = (integer)llList2String(data,1);
if(SITTER_NUMBER==SITTER){
avatar = id;
string EVENT = llList2String(data,0);
//PROP_NAME = llList2String(data,2);
string PROP_OBJECT = llList2String(data,3);
//string PROP_GROUP = llList2String(data,4);
string PROP_UUID = llList2String(data,5);
//llOwnerSay(llDumpList2String([EVENT, SITTER_NUMBER, PROP_NAME, PROP_OBJECT, PROP_GROUP, PROP_UUID, AVATAR_UUID],","));
if(EVENT=="REZ"){
llListenRemove(comm_handle);
comm_handle = llListen(COMM_CHANNEL,PROP_OBJECT,PROP_UUID,"");
llRegionSayTo((key)PROP_UUID,COMM_CHANNEL,"INFORM");
}
}
}
else if(num==90065){//stands up
if(id==avatar){
go_chain([]);
avatar = NULL_KEY;
}
}
else if(num==90045){//animation played
list data = llParseString2List(msg,["|"],[]);
string SITTER_NUMBER = llList2String(data,0);
if((integer)SITTER_NUMBER==SITTER){
if(id!=avatar){
go_chain([]);
}
avatar = id;
POSE_NAME = llList2String(data,1);
list new_links;
integer pose_index = llListFindList(POSES,[POSE_NAME]);
if(pose_index!=-1){
new_links = llCSV2List(llList2String(POSES,pose_index+1));
}
if(USES_PROPS){
go_chain(new_links);
}
else{
ring_prims = [];
integer i;
for(i=0;i<=llGetNumberOfPrims();i++){
if (llSubStringIndex(llToLower(llGetLinkName(i)),"ring")!=-1){
ring_prims += [llGetLinkName(i),llGetLinkKey(i)];
}
}
}
go_chain(new_links);
}
else if(id==avatar){
go_chain([]);
avatar = NULL_KEY;
}
}
}
}
listen(integer listen_channel, string name, key id, string msg){
list data = llParseString2List(msg,["|"],[]);
if(llList2String(data,0)=="ATTACHPOINTS"){
ring_prims = llDeleteSubList(data,0,0);
go_chain(links);
}
}
}

View file

@ -0,0 +1,25 @@
// Shared props with BUTTON (alpha) v0.01a
//
// Allows props to be rezzed by button. They won't derez when sitters "swap" or
// if only one avatar stands up. Requires [AV]prop script from AVsitter2
// box 2.1-09.01 or later. Shared props should use PROP3 in the AVpos notecard
// (a special prop type specifically for shared props).
//
// example use:
//
// BUTTON myprop|555 <--- rez the prop
// BUTTON [CLEAR]|555 <--- clear all props
// BUTTON remprop_myprop|555 <--- derez the prop
// PROP3 myprop|object|0|<0,0,0><0,0,0> <--- define the prop (in any SITTER)
default
{
link_message(integer sender, integer num, string msg, key id)
{
if (num != 555) return
llMessageLinked(LINK_THIS, 90220, "remprop_" + msg, NULL_KEY); // remove the prop
llMessageLinked(LINK_THIS, 90220, msg, NULL_KEY); // rez the prop
llMessageLinked(LINK_THIS, 90005, "", id); // give back the menu
}
}

View file

@ -1,29 +0,0 @@
/******************************************************************
* Shared props with BUTTON (alpha) v0.01a
* Allows props to be rezzed by button. They won't derez when sitters "swap" or if only one avatar stands up.
* Requires [AV]prop script from AVsitter2 box 2.1-09.01 or later.
* Shared props should use PROP3 in the AVpos notecard (a special prop type specifically for shared props).
*
* example use:
BUTTON myprop|555 <--- rez the prop
BUTTON [CLEAR]|555 <--- clear all props
BUTTON remprop_myprop|555 <--- derez the prop
PROP3 myprop|object|0|<0,0,0><0,0,0> <--- define the prop (in any SITTER)
******************************************************************/
/******************************************************************
* DON'T EDIT BELOW THIS UNLESS YOU KNOW WHAT YOU'RE DOING!
******************************************************************/
default{
link_message(integer sender, integer num, string msg, key id){
if(num==555){
llMessageLinked(LINK_THIS,90220,"remprop_"+msg,""); //remove the prop
llMessageLinked(LINK_THIS,90220,msg,""); //rez the prop
llMessageLinked(LINK_THIS,90005,"",id); //give back the menu
}
}
}

View file

@ -0,0 +1,230 @@
// Shared prop script (alpha) v0.04a
//
// - Allows props to be "shared" i.e. props will rez while any one of a number
// of POSE/SYNC are playing for any avatar.
// - Also replaces the need for the "Rez Same Prop for Several Poses" script.
// - Requires [AV]prop script from AVsitter2 box 2.1-09 or later.
// - Shared props should use PROP3 in the AVpos notecard (a special prop type
// specifically for shared props).
// - Shared props can be set up in SITTER 0 section of the AVpos notecard in a
// regular setup prim, or in a dedicated rezzer prim.
// - Props for a specific sitter can use PROP, PROP1 or PROP2.
// - All props referenced by this script should be named different from pose
// names (unlike basic props, which do have names that match poses).
//
// - SITTER_SITTER_PROPS_N_POSES is your list of SITTER#, PROP names, and
// POSE/SYNC names the props are for.
// e.g: 0, "weights", "stand1,stand2"
// - SITTER with -1 indicates the prop is for all sitters (i.e. shared prop,
// that should use PROP3 in the AVpos notecard).
// e.g: -1,"prop1", "sit1,sit2,sit3"
//
// - "*" for POSE name indicates the prop should rez for all poses.
list SITTER_PROPS_N_POSES = [
-1, "prop1", "sit1,sit2,sit3",
-1, "prop2", "sit4,sync2",
-1, "prop3", "sync1,sync2",
0, "hat", "*",
0, "weights", "weights1,weights2",
1, "weights", "weights1,weights2"
];
list SITTER_PRIMS; // which prims have AVsitter setups
list SITTER_POSES_BY_PRIM; // which poses are playing for each sitter in each prim
list SITTERS_BY_PRIM; // which sitters are occupied in each setup prim
list REZZED; // which props are rezzed, for which avatars
integer ANY_SITTERS; // if avatars are sitting
rez_derez()
{
integer i;
for (; i < llGetListLength(SITTER_PROPS_N_POSES); i += 3)
{
integer wasRezzed = llList2Integer(REZZED, i);
integer forSitter = llList2Integer(SITTER_PROPS_N_POSES, i);
list poses = llParseString2List(llList2String(SITTER_PROPS_N_POSES, i + 2), [","], []);
integer j;
for (; j < llGetListLength(poses); j++)
{
integer k;
for (; k < llGetListLength(SITTER_PRIMS); k++)
{
list SITTER_POSES_IN_PRIM = llParseStringKeepNulls(llList2String(SITTER_POSES_BY_PRIM, k), ["|"], []);
integer found = llListFindList(SITTER_POSES_IN_PRIM, [llList2String(poses, j)]);
if (~found || llList2String(poses, j) == "*")
{
list SITTERS_IN_PRIM = llParseStringKeepNulls(llList2String(SITTERS_BY_PRIM, k), ["|"], []);
integer l = found;
for (; l < llGetListLength(SITTERS_IN_PRIM); l++)
{
if (forSitter == -1 || forSitter == l)
{
if ((llList2String(SITTER_POSES_IN_PRIM, l) == llList2String(poses, j) || llList2String(poses, j) == "*") && llList2String(SITTERS_IN_PRIM, l) != "")
{
if (!llList2Integer(REZZED, i))
{
string uuid;
if (forSitter == l)
{
uuid = llList2String(SITTERS_IN_PRIM,l);
}
// llOwnerSay("===REZ====" + llList2String(SITTER_PROPS_N_POSES, i + 1) + "for uuid:" + uuid);
// rez our prop
llMessageLinked(LINK_THIS, 90220, llList2String(SITTER_PROPS_N_POSES, i + 1), uuid);
REZZED = llListReplaceList(REZZED, [TRUE, uuid], i, i + 1);
}
jump done;
}
}
}
}
}
}
if (wasRezzed)
{
string uuid;
if (~llList2Integer(SITTER_PROPS_N_POSES, i))
{
uuid = llList2String(SITTER_PROPS_N_POSES, i);
}
// llOwnerSay("===DEREZ====" + llList2String(SITTER_PROPS_N_POSES, i + 1) + "for uuid:" + uuid);
// remove our prop
llMessageLinked(LINK_THIS, 90220, "remprop_" + llList2String(SITTER_PROPS_N_POSES, i + 1), uuid);
REZZED = llListReplaceList(REZZED, [FALSE], i, i);
}
@done;
}
}
list fill_array(integer x)
{
list array;
integer i;
for (; i < x; i++)
{
array += "";
}
return array;
}
default
{
state_entry()
{
REZZED = fill_array(llGetListLength(SITTER_PROPS_N_POSES));
}
link_message(integer sender, integer num, string msg, key id)
{
// if props were cleared with a BUTTON
if (msg == "[CLEAR]")
{
REZZED = fill_array(llGetListLength(SITTER_PROPS_N_POSES));
}
// pose played
else if (num == 90045)
{
list data = llParseStringKeepNulls(msg, ["|"], []);
integer SITTER_NUMBER = (integer)llList2String(data, 0);
string POSE_NAME = llList2String(data, 1);
list SITTERS_IN_PRIM = llParseStringKeepNulls(llList2String(data, 4), ["@"], []);
list LAST_SITTERS_IN_PRIM;
list SITTER_POSES_IN_PRIM;
integer index = llListFindList(SITTER_PRIMS, [sender]);
if (~index)
{
SITTER_POSES_IN_PRIM = llParseStringKeepNulls(llList2String(SITTER_POSES_BY_PRIM, index), ["|"], []);
SITTER_PRIMS = llDeleteSubList(SITTER_PRIMS, index, index);
SITTER_POSES_BY_PRIM = llDeleteSubList(SITTER_POSES_BY_PRIM, index, index);
LAST_SITTERS_IN_PRIM = llParseStringKeepNulls(llList2String(SITTERS_BY_PRIM, index), ["|"], []);
SITTERS_BY_PRIM = llDeleteSubList(SITTERS_BY_PRIM, index, index);
// if the sitters have swapped, consider any props for the changed sitters derezzed
integer i;
for (; i < llGetListLength(LAST_SITTERS_IN_PRIM); i++)
{
if (llList2String(SITTERS_IN_PRIM, i) != llList2String(LAST_SITTERS_IN_PRIM, i))
{
integer j;
for (; j < llGetListLength(SITTER_PROPS_N_POSES); j += 3)
{
if (llList2Integer(SITTER_PROPS_N_POSES, j) == i)
{
REZZED = llListReplaceList(REZZED, [FALSE, ""], j, j + 1);
// llOwnerSay("rezzed:" + llList2CSV(REZZED));
}
}
}
}
}
else
{
SITTER_POSES_IN_PRIM = fill_array(llGetListLength(SITTERS_IN_PRIM));
}
SITTER_POSES_IN_PRIM = llListReplaceList(SITTER_POSES_IN_PRIM, [POSE_NAME], SITTER_NUMBER, SITTER_NUMBER);
SITTER_PRIMS += sender;
SITTER_POSES_BY_PRIM += llDumpList2String(SITTER_POSES_IN_PRIM, "|");
SITTERS_BY_PRIM += llDumpList2String(SITTERS_IN_PRIM, "|");
rez_derez();
}
// sitter stands
else if (num == 90065)
{
integer index = llListFindList(SITTER_PRIMS, [sender]);
if (~index)
{
list SITTER_POSES_IN_PRIM = llParseStringKeepNulls(llList2String(SITTER_POSES_BY_PRIM, index), ["|"], []);
SITTER_POSES_IN_PRIM = llListReplaceList(SITTER_POSES_IN_PRIM, [""], (integer)msg, (integer)msg);
SITTER_POSES_BY_PRIM = llListReplaceList(SITTER_POSES_BY_PRIM, [llDumpList2String(SITTER_POSES_IN_PRIM, "|")], index, index);
list SITTERS_IN_PRIM = llParseStringKeepNulls(llList2String(SITTERS_BY_PRIM, index), ["|"], []);
SITTERS_IN_PRIM = llListReplaceList(SITTERS_IN_PRIM, [""], (integer)msg, (integer)msg);
SITTERS_BY_PRIM = llListReplaceList(SITTERS_BY_PRIM, [llDumpList2String(SITTERS_IN_PRIM, "|")], index, index);
rez_derez();
}
}
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
integer IS_SITTER;
// someone is sitting
if (llGetAgentSize(llGetLinkKey(llGetNumberOfPrims())))
{
IS_SITTER = TRUE;
}
else
{
SITTER_PRIMS = [];
SITTER_POSES_BY_PRIM = [];
SITTERS_BY_PRIM = [];
}
if (IS_SITTER != ANY_SITTERS)
{
ANY_SITTERS = IS_SITTER;
rez_derez();
}
}
}
}

View file

@ -1,179 +0,0 @@
/******************************************************************
* Shared prop script (alpha) v0.04a
* Allows props to be "shared" i.e. props will rez while any one of a number of POSE/SYNC are playing for any avatar.
* Also replaces the need for the "Rez Same Prop for Several Poses" script.
* Requires [AV]prop script from AVsitter2 box 2.1-09 or later.
* Shared props should use PROP3 in the AVpos notecard (a special prop type specifically for shared props).
* Shared props can be set up in SITTER 0 section of the AVpos notecard in a regular setup prim, or in a dedicated rezzer prim.
* Props for a specific sitter can use PROP, PROP1 or PROP2.
* All props referenced by this script should be named different from pose names (unlike basic props, which do have names that match poses).
******************************************************************/
/******************************************************************
SITTER_SITTER_PROPS_N_POSES is your list of SITTER#, PROP names, and POSE/SYNC names the props are for.
e.g: 0,"weights", "stand1,stand2"
-1 for SITTER indicates the prop is for all sitters (i.e. shared prop, that should use PROP3 in the AVpos notecard).
e.g: -1,"prop1", "sit1,sit2,sit3"
"*" for POSE name indicates the prop should rez for all poses.
******************************************************************/
list SITTER_PROPS_N_POSES = [
-1,"prop1", "sit1,sit2,sit3",
-1,"prop2", "sit4,sync2",
-1,"prop3", "sync1,sync2",
0,"hat", "*",
0,"weights", "weights1,weights2",
1,"weights", "weights1,weights2"
];
/******************************************************************
* DON'T EDIT BELOW THIS UNLESS YOU KNOW WHAT YOU'RE DOING!
******************************************************************/
list SITTER_PRIMS; // which prims have AVsitter setups
list SITTER_POSES_BY_PRIM; // which poses are playing for each sitter in each prim
list SITTERS_BY_PRIM; // which sitters are occupied in each setup prim
list REZZED; // which props are rezzed, for which avatars
integer ANY_SITTERS; // if avatars are sitting
rez_derez(){
integer i;
for (i=0;i<llGetListLength(SITTER_PROPS_N_POSES);i+=3){
integer wasRezzed=llList2Integer(REZZED,i);
integer forSitter = llList2Integer(SITTER_PROPS_N_POSES,i);
list poses = llParseString2List(llList2String(SITTER_PROPS_N_POSES,i+2),[","],[]);
integer j;
for (j=0;j<llGetListLength(poses);j++){
integer k;
for (k=0;k<llGetListLength(SITTER_PRIMS);k++){
list SITTER_POSES_IN_PRIM=llParseStringKeepNulls(llList2String(SITTER_POSES_BY_PRIM,k),["|"],[]);
integer index = llListFindList(SITTER_POSES_IN_PRIM,[llList2String(poses,j)]);
if(~index || llList2String(poses,j)=="*"){
list SITTERS_IN_PRIM=llParseStringKeepNulls(llList2String(SITTERS_BY_PRIM,k),["|"],[]);
integer l;
for (l=index;l<llGetListLength(SITTERS_IN_PRIM);l++){
if(forSitter==-1 || forSitter==l){
if((llList2String(SITTER_POSES_IN_PRIM,l)==llList2String(poses,j) || llList2String(poses,j)=="*") && llList2String(SITTERS_IN_PRIM,l)!=""){
if(!llList2Integer(REZZED,i)){
string uuid;
if(forSitter==l){
uuid = llList2String(SITTERS_IN_PRIM,l);
}
//llOwnerSay("===REZ===="+llList2String(SITTER_PROPS_N_POSES,i+1)+"for uuid:"+uuid);
llMessageLinked(LINK_THIS,90220,llList2String(SITTER_PROPS_N_POSES,i+1),uuid); // rez our prop.
REZZED=llListReplaceList(REZZED,[TRUE,uuid],i,i+1);
}
jump done;
}
}
}
}
}
}
if(wasRezzed){
string uuid;
if(~llList2Integer(SITTER_PROPS_N_POSES,i)){
uuid=llList2String(SITTER_PROPS_N_POSES,i);
}
//llOwnerSay("===DEREZ===="+llList2String(SITTER_PROPS_N_POSES,i+1)+"for uuid:"+uuid);
llMessageLinked(LINK_THIS,90220,"remprop_"+llList2String(SITTER_PROPS_N_POSES,i+1),uuid); // remove our prop.
REZZED=llListReplaceList(REZZED,[FALSE],i,i);
}
@done;
}
}
list fill_array(integer x){
list array;
integer i;
for (i=0;i<x;i++){
array+="";
}
return array;
}
default{
state_entry(){
REZZED=fill_array(llGetListLength(SITTER_PROPS_N_POSES));
}
link_message(integer sender, integer num, string msg, key id){
if(msg=="[CLEAR]"){ // if props were cleared with a BUTTON
REZZED=fill_array(llGetListLength(SITTER_PROPS_N_POSES));
}
else if(num==90045){ // pose played
list data = llParseStringKeepNulls(msg,["|"],[]);
integer SITTER_NUMBER = (integer)llList2String(data,0);
string POSE_NAME = llList2String(data,1);
list SITTERS_IN_PRIM = llParseStringKeepNulls(llList2String(data,4),["@"],[]);
list LAST_SITTERS_IN_PRIM;
list SITTER_POSES_IN_PRIM;
integer index = llListFindList(SITTER_PRIMS,[sender]);
if(~index){
SITTER_POSES_IN_PRIM=llParseStringKeepNulls(llList2String(SITTER_POSES_BY_PRIM,index),["|"],[]);
SITTER_PRIMS=llDeleteSubList(SITTER_PRIMS,index,index);
SITTER_POSES_BY_PRIM=llDeleteSubList(SITTER_POSES_BY_PRIM,index,index);
LAST_SITTERS_IN_PRIM=llParseStringKeepNulls(llList2String(SITTERS_BY_PRIM,index),["|"],[]);
SITTERS_BY_PRIM=llDeleteSubList(SITTERS_BY_PRIM,index,index);
// if the sitters have swapped, consider any props for the changed sitters derezzed
integer i;
for (i=0;i<llGetListLength(LAST_SITTERS_IN_PRIM);i++){
if(llList2String(SITTERS_IN_PRIM,i)!=llList2String(LAST_SITTERS_IN_PRIM,i)){
integer j;
for (j=0;j<llGetListLength(SITTER_PROPS_N_POSES);j+=3){
if (llList2Integer(SITTER_PROPS_N_POSES,j)==i){
REZZED=llListReplaceList(REZZED,[FALSE,""],j,j+1);
//llOwnerSay("rezzed:"+llDumpList2String(REZZED,","));
}
}
}
}
}
else{
SITTER_POSES_IN_PRIM=fill_array(llGetListLength(SITTERS_IN_PRIM));
}
SITTER_POSES_IN_PRIM=llListReplaceList(SITTER_POSES_IN_PRIM,[POSE_NAME],SITTER_NUMBER,SITTER_NUMBER);
SITTER_PRIMS+=sender;
SITTER_POSES_BY_PRIM+=llDumpList2String(SITTER_POSES_IN_PRIM,"|");
SITTERS_BY_PRIM+=llDumpList2String(SITTERS_IN_PRIM,"|");
rez_derez();
}
else if(num==90065){ // sitter stands
integer index = llListFindList(SITTER_PRIMS,[sender]);
if(~index){
list SITTER_POSES_IN_PRIM=llParseStringKeepNulls(llList2String(SITTER_POSES_BY_PRIM,index),["|"],[]);
SITTER_POSES_IN_PRIM=llListReplaceList(SITTER_POSES_IN_PRIM,[""],(integer)msg,(integer)msg);
SITTER_POSES_BY_PRIM=llListReplaceList(SITTER_POSES_BY_PRIM,[llDumpList2String(SITTER_POSES_IN_PRIM,"|")],index,index);
list SITTERS_IN_PRIM=llParseStringKeepNulls(llList2String(SITTERS_BY_PRIM,index),["|"],[]);
SITTERS_IN_PRIM = llListReplaceList(SITTERS_IN_PRIM,[""],(integer)msg,(integer)msg);
SITTERS_BY_PRIM = llListReplaceList(SITTERS_BY_PRIM,[llDumpList2String(SITTERS_IN_PRIM,"|")],index,index);
rez_derez();
}
}
}
changed(integer change){
if(change & CHANGED_LINK){
integer IS_SITTER;
if(llGetAgentSize(llGetLinkKey(llGetNumberOfPrims()))){ // someone is sitting
IS_SITTER=TRUE;
}
else{
SITTER_PRIMS=[];
SITTER_POSES_BY_PRIM=[];
SITTERS_BY_PRIM=[];
}
if(IS_SITTER!=ANY_SITTERS){
ANY_SITTERS=IS_SITTER;
rez_derez();
}
}
}
}

View file

@ -1,9 +1,9 @@
# AVsitter
# [AVsitter™](https://avsitter.com)
Respository for some opensource components of AVsitter - furniture pose system for Second Life™
Respository for some of the open-source components of [AVsitter™](https://avsitter.com) - a furniture pose system for [Second Life™](https://www.secondlife.com)
* More information at http://avsitter.com
* Uses the LSL scripting language.
* Very few things published here now - it's a test to see if GitHub can be helpful.
* [AVsitter™](https://avsitter.com) uses the [Linden Scripting Language (LSL)](https://wiki.secondlife.com/wiki/LSL_Portal).
---
[Second Life™](https://www.secondlife.com) is a trademark of Linden Research, Inc. [AVsitter™](https://avsitter.com) is not affiliated with or sponsored by Linden Research.