// Use on ALL "single avatar multisit" prims (with a mixed setup)// When an avatar chooses a sync pose, the ones using a single pose will be forced to sync// On return from couple to single, other avatars will play last used single pose// Optionally, you can make the other avatars return to a specific single pose: see below...keygQueryID;
stringgName;
integergLine;
integerSINGLE_POSES;
stringsme ="stpsync";
stringsme2 ="stpsync2";
integerlastpose;
integerLAST_SINGLE_POSE;
default{
state_entry() {
gName = llGetInventoryName(INVENTORY_NOTECARD, 0);
if (gName != "") gQueryID = llGetNotecardLine(gName, gLine);
}
link_message(integersender_num, integernum, stringstr, keyid){
if (llAvatarOnSitTarget()!=NULL_KEY){
stringms=llList2String(llCSV2List(str),0);
if (ms == "start" || ms == "startf") {
if (num > SINGLE_POSES) llMessageLinked(LINK_ALL_OTHERS, num, sme, "");
else {
if (lastpose > SINGLE_POSES) llMessageLinked(LINK_ALL_OTHERS, num, sme2, "");
LAST_SINGLE_POSE = num - 1;
}
lastpose=num;
}
elseif (str==sme && lastpose <= SINGLE_POSES) {
lastpose=num;
llSleep(.6);
llMessageLinked(LINK_THIS, num - 1, "stRC", "");
}
elseif (str==sme2 && lastpose > SINGLE_POSES) { // return to single poselastpose=num;
llSleep(.6);
// sync to last used single pose:llMessageLinked(LINK_THIS, LAST_SINGLE_POSE , "stRC", "");
// Note: if you change the line above to//llMessageLinked(LINK_THIS, 0 , "stRC", "");// the other avatar(s) will return to their 1st pose on notecard...}
}
}
dataserver(keyquery_id, stringdata) {
if (query_id == gQueryID) {
if (data != EOF) {
data=llStringTrim(data, STRING_TRIM);
if (llGetSubString(data, 0, 0)=="-") {
SINGLE_POSES=-((integer)data);
if (SINGLE_POSES < 1 ) llOwnerSay("Singles Sync: Wrong single poses setup!");
elsellOwnerSay("Singles Sync: "+(string)SINGLE_POSES);
}
else {
++gLine;
gQueryID = llGetNotecardLine(gName, gLine);
}
}
else{
llOwnerSay("Singles Sync: Single poses setup not found!");
}
}
}
changed(integerchange) {
if(change & CHANGED_INVENTORY)llResetScript();
if(lastpose && change & CHANGED_LINK)if (llAvatarOnSitTarget()== NULL_KEY) lastpose=0;
}
}