first commit

This commit is contained in:
codeviolet 2017-07-31 17:43:31 +10:00
parent e7d01132b3
commit 34f30ac80a
48 changed files with 13160 additions and 534 deletions

View file

@ -0,0 +1,236 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright (c) the AVsitter Contributors (http://avsitter.github.io)
* AVsitter™ is a trademark. For trademark use policy see:
* https://avsitter.github.io/TRADEMARK.mediawiki
*
* Please consider supporting continued development of AVsitter and
* receive automatic updates and other benefits! All details and user
* instructions can be found at http://avsitter.github.io
*/
string version = "2.2";
string notecard_name = "AVpos";
string main_script = "[AV]sitA";
key notecard_key;
key notecard_query;
integer notecard_line;
integer notecard_section;
integer SCRIPT_CHANNEL;
string myPose;
key mySitter;
list camera_triggers;
list camera_settings;
integer lastByButton = -1;
string lastPose;
integer get_number_of_scripts()
{
integer i = 1;
while (llGetInventoryType(main_script + " " + (string)i) == INVENTORY_SCRIPT)
{
i++;
}
return i;
}
integer verbose = 0;
Out(integer level, string out)
{
if (verbose >= level)
{
llOwnerSay(llGetScriptName() + "[" + version + "] " + out);
}
}
Readout_Say(string say, string SCRIPT_CHANNEL)
{
llSleep(0.2);
llMessageLinked(LINK_THIS, 90022, say, SCRIPT_CHANNEL);
}
set_camera(integer byButton)
{
if (mySitter)
{
if (llGetPermissions() & PERMISSION_CONTROL_CAMERA)
{
if (llGetPermissionsKey() == mySitter)
{
integer index = llListFindList(camera_triggers, [myPose]);
if (!~index)
{
if (~lastByButton)
{
index = lastByButton;
}
else
{
index = llListFindList(camera_triggers, ["DEFAULT"]);
}
}
if (~index)
{
if (byButton)
{
lastByButton = index;
}
list settings = llParseStringKeepNulls(llList2String(camera_settings, index), ["|"], []);
vector pos = (vector)llList2String(settings, 0) * llGetRot() + llGetPos();
vector focus = (vector)llList2String(settings, 1) * llGetRot() + llGetPos();
llSetCameraParams([CAMERA_ACTIVE, 1, CAMERA_FOCUS, focus, CAMERA_FOCUS_LOCKED, TRUE, CAMERA_POSITION, pos, CAMERA_POSITION_LOCKED, TRUE, CAMERA_FOCUS_OFFSET, <0,0,0>]);
}
else
{
llSetCameraParams([CAMERA_ACTIVE, 0]);
}
return;
}
}
llRequestPermissions(mySitter, PERMISSION_CONTROL_CAMERA);
}
}
default
{
run_time_permissions(integer perm)
{
if (perm & PERMISSION_CONTROL_CAMERA)
{
set_camera(FALSE);
}
}
state_entry()
{
SCRIPT_CHANNEL = (integer)llGetSubString(llGetScriptName(), llSubStringIndex(llGetScriptName(), " "), -1);
notecard_key = llGetInventoryKey(notecard_name);
if (llGetInventoryType(notecard_name) == INVENTORY_NOTECARD)
{
Out(0, "Loading...");
notecard_query = llGetNotecardLine(notecard_name, 0);
}
}
link_message(integer sender, integer num, string msg, key id)
{
if (sender == llGetLinkNumber())
{
if (num == 90230 | num == 90231)
{
list data = llParseStringKeepNulls(id, ["|"], []);
key this_controller = (key)llList2String(data, 0);
key this_sitter = (key)llList2String(data, -1);
if (this_sitter == mySitter)
{
myPose = msg;
if (myPose == "RESET")
{
lastByButton = -1;
myPose = lastPose;
}
set_camera(TRUE);
if (num == 90230)
{
llMessageLinked(LINK_THIS, 90005, "", this_controller);
}
}
}
else if (num == 90045)
{
list data = llParseStringKeepNulls(msg, ["|"], []);
integer sitter = (integer)llList2String(data, 0);
if (sitter == SCRIPT_CHANNEL)
{
mySitter = id;
myPose = llList2String(data, 1);
lastPose = myPose;
set_camera(FALSE);
}
}
else if (num == 90065)
{
if (id == mySitter)
{
lastByButton = -1;
mySitter = NULL_KEY;
}
else
{
llSleep(0.1);
set_camera(FALSE);
}
}
else if (num == 90174 && (integer)msg == SCRIPT_CHANNEL)
{
integer i = llGetListLength(camera_triggers);
integer index;
while (~(index = llListFindList(camera_triggers, [myPose])))
{
camera_triggers = llDeleteSubList(camera_triggers, index, index);
camera_settings = llDeleteSubList(camera_settings, index, index);
}
if (id != "none")
{
camera_triggers += myPose;
camera_settings += (string)id;
llSay(0, "CAMERA saved to '" + myPose + "' for SITTER " + (string)SCRIPT_CHANNEL + ".");
llSay(0, "CAMERA " + myPose + "|" + (string)id);
}
else
{
llSay(0, "CAMERA cleared from '" + myPose + "' for SITTER " + (string)SCRIPT_CHANNEL + ".");
}
set_camera(FALSE);
}
else if (num == 90020 && ((string)id == llGetScriptName() || (string)id + " " + msg == llGetScriptName()))
{
if ((integer)msg == SCRIPT_CHANNEL)
{
integer i;
for (i = 0; i < llGetListLength(camera_triggers); i++)
{
Readout_Say("CAMERA " + llList2String(camera_triggers, i) + "|" + llList2String(camera_settings, i), msg);
}
llMessageLinked(LINK_THIS, 90021, msg, (string)id);
}
}
}
}
changed(integer change)
{
if (change & CHANGED_INVENTORY)
{
if (llGetInventoryKey(notecard_name) != notecard_key)
{
llResetScript();
}
}
}
dataserver(key query_id, string data)
{
if (query_id == notecard_query)
{
if (data == EOF)
{
Out(0, (string)llGetListLength(camera_triggers) + " Cameras Ready, Mem=" + (string)llGetFreeMemory());
}
else
{
data = llGetSubString(data, llSubStringIndex(data, "◆") + 1, -1);
data = llStringTrim(data, STRING_TRIM);
string command = llGetSubString(data, 0, llSubStringIndex(data, " ") - 1);
list parts = llParseStringKeepNulls(llGetSubString(data, llSubStringIndex(data, " ") + 1, -1), [" | ", " |", "| ", "|"], []);
string part0 = llStringTrim(llList2String(parts, 0), STRING_TRIM);
if (command == "SITTER")
{
notecard_section = (integer)part0;
}
else if (notecard_section == SCRIPT_CHANNEL && command == "CAMERA")
{
string part1 = llStringTrim(llDumpList2String(llList2List(parts, 1, -1), "|"), STRING_TRIM);
list sequence = llParseString2List(part1, ["|"], []);
camera_triggers += part0;
camera_settings += part1;
}
notecard_query = llGetNotecardLine(notecard_name, notecard_line += 1);
}
}
}
}

View file

@ -1,3 +1,17 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright (c) the AVsitter Contributors (http://avsitter.github.io)
* AVsitter™ is a trademark. For trademark use policy see:
* https://avsitter.github.io/TRADEMARK.mediawiki
*
* Please consider supporting continued development of AVsitter and
* receive automatic updates and other benefits! All details and user
* instructions can be found at http://avsitter.github.io
*/
// 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"

View file

@ -1,12 +1,21 @@
// LSL-AVSITTER-LockGuard-PLUGIN
// Copyright (c) 2016
// Permission given to modify and adapt this script
//
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright (c) the AVsitter Contributors (http://avsitter.github.io)
* AVsitter™ is a trademark. For trademark use policy see:
* https://avsitter.github.io/TRADEMARK.mediawiki
*
* Please consider supporting continued development of AVsitter and
* receive automatic updates and other benefits! All details and user
* instructions can be found at http://avsitter.github.io
*/
// 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.

View file

@ -0,0 +1,188 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright (c) the AVsitter Contributors (http://avsitter.github.io)
* AVsitter™ is a trademark. For trademark use policy see:
* https://avsitter.github.io/TRADEMARK.mediawiki
*
* Please consider supporting continued development of AVsitter and
* receive automatic updates and other benefits! All details and user
* instructions can be found at http://avsitter.github.io
*/
string product = "AVsitter™ Xcite!";
string version = "1.02";
string notecard_name = "[AV]Xcite_settings";
key notecard_key;
key notecard_query;
integer notecard_line;
integer verbose = 0;
list POSE_AND_SITTER;
list XCITE_COMMANDS;
list XCITE_TILT;
integer TIMER_DEFAULT = 30;
string CURRENT_POSE;
list TIMERS;
list SITTERS;
integer DEBUG;
Out(integer level, string out)
{
if (verbose >= level)
{
llOwnerSay(llGetScriptName() + "[" + version + "]:" + out);
}
}
key key_request;
string parse_text(string say)
{
integer i;
for (i = 0; i < llGetListLength(SITTERS); i++)
{
string sitter_name = llList2String(llParseString2List(llKey2Name(llList2String(SITTERS, i)), [" "], []), 0);
if (sitter_name == "")
{
sitter_name = "(nobody)";
}
say = strReplace(say, "/" + (string)i, sitter_name);
}
return say;
}
string strReplace(string str, string search, string replace)
{
return llDumpList2String(llParseStringKeepNulls(str, [search], []), replace);
}
default
{
state_entry()
{
notecard_key = llGetInventoryKey(notecard_name);
Out(0, "Loading...");
notecard_query = llGetNotecardLine(notecard_name, 0);
}
changed(integer change)
{
if (change & CHANGED_INVENTORY)
{
if (llGetInventoryKey(notecard_name) != notecard_key)
{
llResetScript();
}
}
if (change & CHANGED_LINK)
{
if (llGetAgentSize(llGetLinkKey(llGetNumberOfPrims())) == ZERO_VECTOR)
{
TIMERS = [];
}
}
}
link_message(integer sender, integer num, string msg, key id)
{
if (sender == llGetLinkNumber())
{
if (num == 90045)
{
string name = llKey2Name(id);
if (name != "")
{
integer i = llGetListLength(TIMERS);
while (i > 0)
{
i--;
if (!llSubStringIndex(llList2String(TIMERS, i), name + "|"))
{
TIMERS = llDeleteSubList(TIMERS, i, i);
}
}
llSetTimerEvent(TIMER_DEFAULT);
list data = llParseStringKeepNulls(msg, ["|"], []);
integer script_channel = (integer)llList2String(data, 0);
CURRENT_POSE = llList2String(data, 1);
SITTERS = llParseStringKeepNulls(llList2String(data, 4), ["@"], []);
integer index = llListFindList(POSE_AND_SITTER, [CURRENT_POSE + "|" + (string)script_channel]);
if (!~index)
{
index = llListFindList(POSE_AND_SITTER, [CURRENT_POSE + "|*"]);
if (!~index)
{
index = llListFindList(POSE_AND_SITTER, ["*|*"]);
if (!~index)
{
return;
}
}
}
if (llList2Integer(XCITE_TILT, index) != 0)
{
if (DEBUG)
{
Out(0, "Setting " + name + "'s tilt to " + (string)llList2Integer(XCITE_TILT, index));
}
llMessageLinked(LINK_SET, 20020, name + "|" + (string)llList2Integer(XCITE_TILT, index), "");
}
else
{
if (DEBUG)
{
Out(0, "Restoring " + name + "'s tilt.");
}
llMessageLinked(LINK_SET, 20014, name, "");
}
data = llParseStringKeepNulls(llList2String(XCITE_COMMANDS, index), ["|"], []);
TIMERS += [name + "|" + llList2String(data, 0) + "|" + llList2String(data, 1) + "||" + llList2String(data, 3)];
string commands = parse_text(llList2String(XCITE_COMMANDS, index));
llMessageLinked(LINK_SET, 20001, name + "|" + commands, NULL_KEY);
if (DEBUG)
{
Out(0, "Sending xcite commands: " + name + "|" + commands);
}
}
}
}
}
timer()
{
integer i;
for (; i < llGetListLength(TIMERS); i++)
{
llMessageLinked(LINK_SET, 20001, llList2String(TIMERS, i), NULL_KEY);
if (DEBUG)
{
Out(0, "Sending xcite commands: " + llList2String(TIMERS, i));
}
}
}
dataserver(key query_id, string data)
{
if (query_id == notecard_query)
{
if (data == EOF || llStringTrim(llToLower(data), STRING_TRIM) == "end")
{
Out(0, (string)llGetListLength(POSE_AND_SITTER) + " items Ready, Mem=" + (string)llGetFreeMemory());
}
else
{
data = llStringTrim(data, STRING_TRIM);
string command = llGetSubString(data, 0, llSubStringIndex(data, " ") - 1);
list parts = llParseStringKeepNulls(llGetSubString(data, llSubStringIndex(data, " ") + 1, -1), [" | ", " |", "| ", "|"], []);
if (command == "TIMER")
{
TIMER_DEFAULT = (integer)llList2String(parts, 0);
}
else if (command == "DEBUG")
{
DEBUG = (integer)llList2String(parts, 0);
}
else if (command == "XCITE")
{
POSE_AND_SITTER += [llStringTrim(llList2String(parts, 0), STRING_TRIM) + "|" + llList2String(parts, 1)];
XCITE_COMMANDS += [llList2String(parts, 2) + "|" + llList2String(parts, 3) + "|" + llList2String(parts, 4) + "|" + llList2String(parts, 5)];
XCITE_TILT += (integer)llList2String(parts, 6);
}
notecard_query = llGetNotecardLine(notecard_name, ++notecard_line);
}
}
}
}

View file

@ -0,0 +1,72 @@
#############################################################
Example Xcite! notecard for use with AVsitter™ Xcite! plugin.
#############################################################
//
// Your object MUST contain your Xcite! partner script (provided by Xcite!) and/or your Sensations partner script (provided by Sensations).
//
// Please refer to your Xcite! and/or Sensations partner information for details.
//
// This notecard must be called "[AV]Xcite_settings"
//
// Format of each line is as follows:
//
// XCITE pose_name|sitter_number|arousal|arousal_max|text|kink|tilt
//
// For pose_name you can use * to apply to all poses, otherwise use the menu name of one pose.
//
// For sitter_number you can use * to apply to all sitters otherwise it should be 0,1, etc
//
// arousal and arousal_max are described in your Xcite! and Sensations partner information.
//
// For text you may include any text messages that you want to be said out when this arousal occurs.
// If you want the message to take the form of an emote simply start the text message with '/me'.
// You may also use any of the following special codes for appropriate pronouns in the text:
//
// %o - Replaced by the owner's first name
// %f - Replaced by the owner's full name
// %p - Replaced by the possessive pronoun according to sex (his, her)
// %r - Replaced by the objective pronoun (him, her)
// %s - Replaced by the subjective pronoun (he, she)
// %w - Replaced by the possessive form appropriate to the target rather than the owner
//
// Refer to your Xcite! partner information for full details on text.
//
// You can also refer to the sitters by first name with /0 /1 etc.
//
// Adding text is optional and isn't required for the arousal to occur.
//
// Note each notecard line can only be 255 characters maximum.
//
// You may also include a custom timer as follows:
// TIMER 30
//
// Arousal will be re-applied at this interval (default is 30 seconds)
//
// If you wish to debug Xcite commands sent, include:
// DEBUG 1
//
// Switching off Xcite! or Sensations features should be done via your Xcite or Sensations product's menu.
//
#############################################################
Example data follows....
#############################################################
DEBUG 0
TIMER 30
// Typical settings for poses
XCITE Couples1|0|15|95|/0 takes /1 by the hand...|kink|0
XCITE Couples1|1|5|95|example text for male...|kink|50
XCITE Couples_Climax|*|10|100||kink|50
// Pose with slowly diminishing arousal
XCITE Waiting|*|-15|95
// Pose that sets arousal to 0
XCITE Rest|*|0|0
// Default arousal for all poses
XCITE *|*|5|90
// Default arousal for sitter1's poses
XCITE *|1|5|90

View file

@ -0,0 +1,432 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright (c) the AVsitter Contributors (http://avsitter.github.io)
* AVsitter™ is a trademark. For trademark use policy see:
* https://avsitter.github.io/TRADEMARK.mediawiki
*
* Please consider supporting continued development of AVsitter and
* receive automatic updates and other benefits! All details and user
* instructions can be found at http://avsitter.github.io
*/
string product;
string version = "2.2";
integer RELAY_CHANNEL = -1812221819;
integer RELAY_GETSTATUS_CHANNEL;
integer GETSTATUShandle;
integer menu_channel;
integer menu_handle;
key CONTROLLER = "";
string controllerName;
key SLAVE;
string menu;
integer menuPage;
list folderPath;
list folderOptions;
list folderNamesFullLength;
list CLOTHING_LAYERS = ["gloves", "jacket", "pants", "shirt", "shoes", "skirt", "socks", "underpants", "undershirt", "", "", "", "", "alpha", "tattoo"];
list ATTACHMENT_POINTS = ["", "chest", "skull", "left shoulder", "right shoulder", "left hand", "right hand", "left foot", "right foot", "spine", "pelvis", "mouth", "chin", "left ear", "right ear", "left eyeball", "right eyeball", "nose", "r upper arm", "r forearm", "l upper arm", "l forearm", "right hip", "r upper leg", "r lower leg", "left hip", "l upper leg", "l lower leg", "stomach", "left pec", "right pec", "", "", "", "", "", "", "", "", "neck", "root"];
list RLV_RESTRICTIONS = ["Chat", "sendchat", "sending chat", "IM", "sendim", "sending IM", "Touch", "touchall", "touching", "Names", "shownames", "seeing names", "Rez/Edit", "edit,rez", "editing and rezzing objects", "Inventory", "showinv", "accessing their inventory", "Map", "showworldmap,showminimap", "seeing their map", "Location", "showloc", "seeing their location"];
string iconActive = "✘ ";
string iconInactive = "✔ ";
string iconEmpty = "○";
string iconHalf = "◑";
string iconFull = "●";
string iconAdd = "[]";
string iconSubtract = "[]";
string pagedMenuText;
list pagedMenuButtons;
integer verbose = 0;
Out(integer level, string out)
{
if (verbose >= level)
{
llOwnerSay(llGetScriptName() + "[" + version + "]:" + out);
}
}
string strReplace(string str, string search, string replace)
{
return llDumpList2String(llParseStringKeepNulls(str, [search], []), replace);
}
list order_buttons(list buttons)
{
return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4) + llList2List(buttons, -9, -7) + llList2List(buttons, -12, -10);
}
relay(key av, string msg)
{
msg = "RLV," + (string)av + "," + msg;
Out(1, "Sending RLV Command: " + msg);
llSay(RELAY_CHANNEL, msg);
}
remove_menu(string worn, list slots)
{
list menu_items;
Out(1, "remove menu:" + worn + ":" + llDumpList2String(slots, ","));
integer i;
for (i = 0; i < llGetListLength(slots); i++)
{
if (llList2String(slots, i) != "" && llGetSubString(worn, i, i) == "1")
{
menu_items += llList2String(slots, i);
}
}
Out(1, "remove menu2:" + llDumpList2String(menu_items, ","));
string text = "'s RLV setup may prevent some items from being removed.\n\nSelect an item to remove:";
if (!llGetListLength(menu_items))
{
text = " is not wearing any items to " + llToLower(menu) + ".";
}
new_paged_menu(menu + " menu for " + llKey2Name(SLAVE) + "\n\nThe captive" + text, menu_items);
}
new_paged_menu(string text, list menu_items)
{
pagedMenuText = text;
pagedMenuButtons = menu_items;
menuPage = 0;
paged_menu();
}
paged_menu()
{
list MypagedMenuButtons = pagedMenuButtons;
if (llGetListLength(pagedMenuButtons) > 11)
{
integer numberPages = llGetListLength(pagedMenuButtons) / 9;
if (llGetListLength(pagedMenuButtons) % 9)
{
numberPages++;
}
if (menuPage >= numberPages)
{
menuPage = 0;
}
else if (menuPage < 0)
{
menuPage = numberPages - 1;
}
MypagedMenuButtons = llList2List(pagedMenuButtons, menuPage * 9, menuPage * 9 + 8);
while (llGetListLength(MypagedMenuButtons) < 9)
{
MypagedMenuButtons += " ";
}
MypagedMenuButtons += ["[<<]", "[>>]"];
}
Out(1, "paged menu:" + llDumpList2String(MypagedMenuButtons, ","));
dialog(pagedMenuText, ["[BACK]"] + MypagedMenuButtons);
}
dialog(string text, list buttons)
{
while (llGetListLength(buttons) % 3)
buttons += " ";
llDialog(CONTROLLER, "AVsitter™ RLV " + product + " " + version + "\n\n" + text, order_buttons(buttons), menu_channel);
}
remove_script(string reason)
{
string message = "\n" + llGetScriptName() + " ==Script Removed==\n\n" + reason;
llDialog(llGetOwner(), message, ["OK"], -3675);
llInstantMessage(llGetOwner(), message);
llRemoveInventory(llGetScriptName());
}
main_menu()
{
menu = "";
dialog("Un/Dress menu for " + llKey2Name(SLAVE), ["[BACK]", "Browse #RLV", "Fast Strip", "Undress", "Detach"]);
}
default
{
state_entry()
{
if (llSubStringIndex(llGetScriptName(), " ") != -1)
{
remove_script("Use only one copy of this script!");
}
else
{
state running;
}
}
}
state running
{
state_entry()
{
}
link_message(integer sender, integer num, string msg, key id)
{
if (num == 90208 || num == 90209)
{
list data = llParseStringKeepNulls(id, ["|"], []);
SLAVE = (key)llList2String(data, 0);
CONTROLLER = (key)llList2String(data, 1);
product = llList2String(data, 2);
llListenRemove(menu_handle);
llListenRemove(GETSTATUShandle);
menu_handle = llListen(menu_channel = ((integer)llFrand(2147483646) + 1) * -1, "", CONTROLLER, "");
GETSTATUShandle = llListen(RELAY_GETSTATUS_CHANNEL = (integer)llFrand(999999999), "", "", "");
if (num == 90208)
{
main_menu();
}
else
{
menu = "Restrict";
relay(SLAVE, "@getstatus=" + (string)RELAY_GETSTATUS_CHANNEL);
}
}
else if (num == 90065)
{
if (id == SLAVE)
{
llListenRemove(menu_handle);
llListenRemove(GETSTATUShandle);
SLAVE = "";
}
}
}
listen(integer channel, string name, key id, string msg)
{
Out(1, "Listen Received: " + msg);
string command;
if (channel == menu_channel)
{
if (msg == "[>>]" || msg == "[<<]")
{
if (msg == "[<<]")
{
menuPage--;
}
else
{
menuPage++;
}
paged_menu();
}
else if (menu == "Browse #RLV")
{
integer index = llListFindList(folderOptions, [msg]);
if (~index)
{
msg = llList2String(folderNamesFullLength, index);
folderPath += msg;
relay(SLAVE, "@getinvworn:" + llDumpList2String(folderPath, "/") + "=" + (string)RELAY_GETSTATUS_CHANNEL);
}
else if (msg == "[BACK]")
{
if (!llGetListLength(folderPath))
{
main_menu();
}
else
{
folderPath = llDeleteSubList(folderPath, -1, -1);
relay(SLAVE, "@getinvworn:" + llDumpList2String(folderPath, "/") + "=" + (string)RELAY_GETSTATUS_CHANNEL);
}
}
else if (msg == iconAdd || msg == iconSubtract)
{
command = "attach";
if (msg == iconSubtract)
{
command = "detach";
}
relay(SLAVE, "@" + command + ":" + llDumpList2String(folderPath, "/") + "=force");
llSleep(4);
relay(SLAVE, "@getinvworn:" + llDumpList2String(folderPath, "/") + "=" + (string)RELAY_GETSTATUS_CHANNEL);
}
}
else if (msg == "[BACK]")
{
if (menu == "Restrict" || menu == "")
{
llMessageLinked(LINK_THIS, 90100, "0|Control...|" + (string)SLAVE, CONTROLLER);
}
else
{
main_menu();
}
}
else if (menu == "Detach" || menu == "Undress")
{
integer index = llListFindList(CLOTHING_LAYERS, [msg]);
command = "outfit";
if (!~index)
{
index = llListFindList(ATTACHMENT_POINTS, [msg]);
command = "attach";
}
if (~index)
{
relay(SLAVE, "@rem" + command + ":" + msg + "=force");
llSleep(2);
relay(SLAVE, "@get" + command + "=" + (string)RELAY_GETSTATUS_CHANNEL);
}
}
else if (msg == "Detach" || msg == "Undress" || msg == "Browse #RLV")
{
menu = msg;
folderPath = [];
command = "getoutfit";
if (msg == "Detach")
command = "getattach";
if (msg == "Browse #RLV")
command = "getinvworn";
relay(SLAVE, "@" + command + "=" + (string)RELAY_GETSTATUS_CHANNEL);
}
else if (msg == "Fast Strip")
{
menu = "fs";
dialog("Are you really sure? This will try to remove almost everything the avatar is wearing.", ["[BACK]", "YES!"]);
}
else if (msg == "YES!")
{
integer i;
for (i = 0; i < llGetListLength(CLOTHING_LAYERS); i++)
{
if (llList2String(CLOTHING_LAYERS, i))
{
relay(SLAVE, "@remoutfit:" + llList2String(CLOTHING_LAYERS, i) + "=force");
}
}
for (i = 0; i < llGetListLength(ATTACHMENT_POINTS); i++)
{
if (llList2String(ATTACHMENT_POINTS, i))
{
if (i != 2)
{
relay(SLAVE, "@remattach:" + llList2String(ATTACHMENT_POINTS, i) + "=force");
}
}
}
main_menu();
}
else
{
integer index = llListFindList(llList2ListStrided(RLV_RESTRICTIONS, 0, -1, 3), [llList2String(llParseString2List(msg, [" "], []), 1)]);
if (~index)
{
list subRestrictions = llParseString2List(llList2String(RLV_RESTRICTIONS, index * 3 + 1), [","], []);
string param = "n";
string chatText = strReplace(llKey2Name(SLAVE), " Resident", "") + " is ";
if (~llSubStringIndex(msg, iconActive))
{
param = "y";
chatText += "no longer ";
}
integer i;
while (i < llGetListLength(subRestrictions))
{
relay(SLAVE, "@" + llList2String(subRestrictions, i) + "=" + param);
i++;
}
llSay(0, chatText + "restricted from " + llList2String(RLV_RESTRICTIONS, index * 3 + 2) + ".");
relay(SLAVE, "@getstatus=" + (string)RELAY_GETSTATUS_CHANNEL);
}
}
}
else if (channel == RELAY_GETSTATUS_CHANNEL)
{
if (menu == "Browse #RLV")
{
folderOptions = [];
folderNamesFullLength = [];
list BUTTONS;
list results = llParseStringKeepNulls(msg, [","], []);
string folderInfo;
string subInfo;
integer i;
for (i = 0; i < llGetListLength(results); i++)
{
list item = llParseStringKeepNulls(llList2String(results, i), ["|"], []);
string folder = llList2String(item, 0);
integer worn = llList2Integer(item, 1);
integer wornThis = worn / 10;
integer wornSub = worn % 10;
string icon = "no items";
if (i)
{
if (wornThis || wornSub)
{
icon = iconEmpty;
if (wornThis > 1 || wornSub > 1)
{
icon = iconHalf;
}
if (wornThis == 3 && wornSub == 0 || (wornThis == 0 && wornSub == 3) || (wornThis == 3 && wornSub == 3))
{
icon = iconFull;
}
folderOptions += icon + " " + llGetSubString(folder, 0, 12);
folderNamesFullLength += folder;
subInfo = "\nSubfolders:\n" + iconEmpty + " = none worn\n" + iconHalf + " = some worn\n" + iconFull + " = all worn";
}
}
else
{
if (wornThis)
{
icon = "none worn";
if (wornThis == 2)
{
icon = "some worn";
}
if (wornThis == 3)
{
icon = "all worn";
}
BUTTONS += [iconAdd, iconSubtract];
folderInfo = "\n" + iconAdd + " = wear\n" + iconSubtract + " = remove\n";
}
msg = "Folder: /" + llDumpList2String(folderPath, "/") + "\n[" + icon + "]\n" + folderInfo;
}
}
if ((!llGetListLength(folderOptions)) && (!llGetListLength(BUTTONS)))
{
msg = "#RLV folder empty";
}
new_paged_menu(msg + subInfo, BUTTONS + folderOptions);
}
else if (menu == "Detach")
{
remove_menu(msg, ATTACHMENT_POINTS);
}
else if (menu == "Undress")
{
remove_menu(msg, CLOTHING_LAYERS);
}
else if (menu == "Restrict")
{
list currentRestrictions = llParseString2List(msg, ["/"], []);
list menu_items = ["[BACK]"];
integer i;
while (i < llGetListLength(RLV_RESTRICTIONS))
{
list subRestrictions = llParseString2List(llList2String(RLV_RESTRICTIONS, i + 1), [","], []);
integer inActive;
integer j;
while (j < llGetListLength(subRestrictions))
{
if (!~llListFindList(currentRestrictions, [llList2String(subRestrictions, j)]))
{
inActive = TRUE;
}
j++;
}
string symbol = iconInactive;
if (!inActive)
{
symbol = iconActive;
}
string btntext = symbol + llList2String(RLV_RESTRICTIONS, i);
while (llStringLength(btntext) < 20)
btntext += " ";
btntext += ".";
menu_items += btntext;
i += 3;
}
dialog("RLV for " + llKey2Name(SLAVE) + "\n\n" + iconInactive + "= Allowed\n" + iconActive + "= Restricted", menu_items);
}
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,195 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright (c) the AVsitter Contributors (http://avsitter.github.io)
* AVsitter™ is a trademark. For trademark use policy see:
* https://avsitter.github.io/TRADEMARK.mediawiki
*
* Please consider supporting continued development of AVsitter and
* receive automatic updates and other benefits! All details and user
* instructions can be found at http://avsitter.github.io
*/
string product = "AVsitter™ Menu Control";
string version = "2.2";
string security_script = "[AV]root-security";
string RLV_script = "[AV]root-RLV";
list DESIGNATIONS_NOW;
key CONTROLLER = NULL_KEY;
integer KEY_TAKEN;
string CONTROLLER_NAME;
list SITTERS_MENUKEYS;
list SITTERS_SHORTNAMES;
integer menu_channel;
integer menu_handle;
key key_request;
integer verbose = 1;
Out(integer level, string out)
{
if (verbose >= level)
{
llOwnerSay(llGetScriptName() + "[" + version + "]:" + out);
}
}
list order_buttons(list buttons)
{
return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4) + llList2List(buttons, -9, -7) + llList2List(buttons, -12, -10);
}
string strReplace(string str, string search, string replace)
{
return llDumpList2String(llParseStringKeepNulls(str, [search], []), replace);
}
controller_menu(key id)
{
CONTROLLER = id;
CONTROLLER_NAME = llKey2Name(id);
list SITTERS;
integer count = llGetNumberOfPrims();
while (llGetAgentSize(llGetLinkKey(count)) != ZERO_VECTOR)
{
SITTERS += llGetLinkKey(count);
count--;
}
if ((~llListFindList(SITTERS, [id])) && check_for_RLV())
{
llMessageLinked(LINK_SET, 90005, "", id);
}
else
{
if (llGetListLength(SITTERS) == 1 && ((!check_for_RLV()) || (!~llListFindList(DESIGNATIONS_NOW, ["S"])) || llGetListLength(DESIGNATIONS_NOW) == 1))
{
if (check_for_RLV())
{
llMessageLinked(LINK_THIS, 90100, "x|Control...|" + llList2String(SITTERS, 0), id);
}
else
{
llMessageLinked(LINK_SET, 90005, "", llDumpList2String([id, llList2Key(SITTERS, 0)], "|"));
}
}
else
{
list menu_items;
SITTERS_MENUKEYS = [];
integer i;
for (i = 0; i < llGetListLength(SITTERS); i++)
{
if (llList2Key(SITTERS, i) != NULL_KEY)
{
menu_items += llGetSubString(strReplace(llKey2Name(llList2Key(SITTERS, i)), " Resident", ""), 0, 11);
SITTERS_MENUKEYS += llList2Key(SITTERS, i);
}
}
SITTERS_SHORTNAMES = menu_items;
string text = "Which avatar?";
if (check_for_RLV())
{
if (!llGetListLength(menu_items))
{
llMessageLinked(LINK_THIS, 90211, "", id);
return;
}
if ((~llListFindList(DESIGNATIONS_NOW, ["S"])) && llGetListLength(SITTERS) < llGetListLength(DESIGNATIONS_NOW))
{
text += "\n\nCapture = trap a new avatar.";
menu_items += "Capture...";
}
}
if (llGetListLength(menu_items))
{
dialog(text, order_buttons(menu_items), id);
}
}
}
}
dialog(string text, list menu_items, key id)
{
llListenRemove(menu_handle);
menu_handle = llListen(menu_channel = ((integer)llFrand(2147483646) + 1) * -1, "", id, "");
llDialog(id, product + " " + version + "\n\n" + text + "\n", order_buttons(menu_items), menu_channel);
llSetTimerEvent(120);
}
integer check_for_RLV()
{
if (llGetInventoryType(RLV_script) == INVENTORY_SCRIPT)
{
return TRUE;
}
return FALSE;
}
default
{
state_entry()
{
llSetTimerEvent(0);
}
on_rez(integer x)
{
llResetScript();
}
timer()
{
llListenRemove(menu_handle);
}
link_message(integer sender, integer num, string msg, key id)
{
if (num == 90007)
{
if (id == CONTROLLER || CONTROLLER == NULL_KEY)
{
controller_menu(id);
}
else
{
string text = "Take control of the menu?";
if (llGetAgentSize(CONTROLLER) != ZERO_VECTOR)
{
text += "\n\nCurrently controlled by: " + CONTROLLER_NAME;
}
dialog(text, ["Take Control", "[CANCEL]"], id);
}
}
else if (num == 90206)
{
DESIGNATIONS_NOW = llParseStringKeepNulls(msg, ["|"], []);
}
}
listen(integer channel, string name, key id, string message)
{
llListenRemove(menu_handle);
integer index = llListFindList(SITTERS_SHORTNAMES, [message]);
if (~index)
{
if (check_for_RLV())
{
llMessageLinked(LINK_THIS, 90100, "x|Control...|" + llList2String(SITTERS_MENUKEYS, index), CONTROLLER);
}
else
{
llMessageLinked(LINK_SET, 90005, "", llDumpList2String([CONTROLLER, llList2Key(SITTERS_MENUKEYS, index)], "|"));
}
}
else if (message == "Capture...")
{
llMessageLinked(LINK_THIS, 90211, "", id);
}
else if (message == "Take Control")
{
llMessageLinked(LINK_SET, 90033, "", "");
if (id != CONTROLLER)
{
llRegionSayTo(CONTROLLER, 0, llKey2Name(id) + " has taken control of the menu.");
}
controller_menu(id);
}
}
changed(integer change)
{
if (llGetAgentSize(llGetLinkKey(llGetNumberOfPrims())) == ZERO_VECTOR)
{
CONTROLLER = NULL_KEY;
}
}
}

View file

@ -0,0 +1,384 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright (c) the AVsitter Contributors (http://avsitter.github.io)
* AVsitter™ is a trademark. For trademark use policy see:
* https://avsitter.github.io/TRADEMARK.mediawiki
*
* Please consider supporting continued development of AVsitter and
* receive automatic updates and other benefits! All details and user
* instructions can be found at http://avsitter.github.io
*/
integer is_running = TRUE;
list facial_anim_list = ["express_afraid_emote", "express_anger_emote", "express_laugh_emote", "express_bored_emote", "express_cry_emote", "express_embarrassed_emote", "express_sad_emote", "express_toothsmile", "express_smile", "express_surprise_emote", "express_worry_emote", "express_repulsed_emote", "express_shrug_emote", "express_wink_emote", "express_disdain", "express_frown", "express_kiss", "express_open_mouth", "express_tongue_out"];
integer IsInteger(string data)
{
return llParseString2List((string)llParseString2List(data, ["8", "9"], []), ["0", "1", "2", "3", "4", "5", "6", "7"], []) == [] && data != "";
}
string version = "2.1";
string notecard_name = "AVpos";
string main_script = "[AV]sitA";
key key_request;
key notecard_key;
key notecard_query;
integer notecard_line;
integer notecard_section;
integer listen_handle;
list anim_triggers;
list anim_animsequences;
list running_uuid;
list running_sequence_indexes;
list running_pointers;
list SITTERS;
list SITTER_POSES;
integer get_number_of_scripts()
{
integer i = 1;
while (llGetInventoryType(main_script + " " + (string)i) == INVENTORY_SCRIPT)
{
i++;
}
return i;
}
integer verbose = 0;
Out(integer level, string out)
{
if (verbose >= level)
{
llOwnerSay(llGetScriptName() + "[" + version + "] " + out);
}
}
Readout_Say(string say, string SCRIPT_CHANNEL)
{
llSleep(0.2);
llMessageLinked(LINK_THIS, 90022, say, SCRIPT_CHANNEL);
}
string Key2Number(key objKey)
{
return llGetSubString((string)llAbs((integer)("0x" + llGetSubString((string)objKey, -8, -1)) & 1073741823 ^ -1073741825), 6, -1);
}
init_sitters()
{
SITTERS = [];
SITTER_POSES = [];
integer i;
for (i = 0; i < get_number_of_scripts(); i++)
{
SITTERS += NULL_KEY;
SITTER_POSES += "";
}
}
string element(string text, integer x)
{
return llList2String(llParseStringKeepNulls(text, ["|"], []), x);
}
start_sequence(integer sequence_index, key av)
{
integer wasRunning = llListFindList(running_sequence_indexes, [sequence_index]);
if (~wasRunning)
{
if (llList2Key(running_uuid, wasRunning) == av)
{
running_uuid = llListReplaceList(running_uuid, [], wasRunning, wasRunning);
running_sequence_indexes = llListReplaceList(running_sequence_indexes, [], wasRunning, wasRunning);
running_pointers = llListReplaceList(running_pointers, [], wasRunning, wasRunning);
}
}
running_uuid += av;
running_sequence_indexes += sequence_index;
running_pointers += 0;
llSetTimerEvent(0.01);
}
sequence()
{
list anims;
list uuids;
integer i;
while (i < llGetListLength(running_pointers))
{
integer sequence_pointer = llList2Integer(running_pointers, i);
integer sequence_index = llList2Integer(running_sequence_indexes, i);
list sequence = llParseStringKeepNulls(llList2String(anim_animsequences, sequence_index), ["|"], []);
list sequence_anims = llList2ListStrided(sequence, 0, -1, 2);
list sequence_durations = llList2ListStrided(llDeleteSubList(sequence, 0, 0), 0, -1, 2);
integer sequence_length;
integer j;
while (j <= llGetListLength(sequence_durations))
{
integer lastDuration = (integer)llList2String(sequence_durations, j - 1);
integer repeats = FALSE;
if (lastDuration < 0)
{
repeats = TRUE;
lastDuration = llAbs(lastDuration);
}
string anim;
if (sequence_pointer == sequence_length)
{
anim = llStringTrim(llList2String(sequence_anims, j), STRING_TRIM);
}
else if (repeats && sequence_pointer > sequence_length - lastDuration && sequence_pointer < sequence_length - 1)
{
anim = llStringTrim(llList2String(sequence_anims, j - 1), STRING_TRIM);
}
if (anim)
{
if (IsInteger(anim))
{
anim = llList2String(facial_anim_list, (integer)anim);
}
anims += anim;
uuids += llList2Key(running_uuid, i);
}
if (llList2String(sequence_durations, j) == "-")
{
sequence_pointer++;
jump go;
}
integer duration = llAbs((integer)llList2String(sequence_durations, j));
sequence_length += duration;
j++;
}
sequence_pointer++;
if (sequence_pointer == sequence_length)
{
sequence_pointer = 0;
}
@go;
running_pointers = llListReplaceList(running_pointers, [sequence_pointer], i, i);
i++;
}
for (i = 0; i < llGetListLength(anims); i++)
{
if (llList2String(anims, i) != "none")
{
if (is_running)
{
llMessageLinked(LINK_THIS, 90001, llList2String(anims, i), llList2Key(uuids, i));
}
}
}
}
remove_sequences(key id)
{
integer index;
while (~llListFindList(running_uuid, [id]))
{
index = llListFindList(running_uuid, [id]);
running_uuid = llDeleteSubList(running_uuid, index, index);
list sequence = llParseStringKeepNulls(llList2String(anim_animsequences, llList2Integer(running_sequence_indexes, index)), ["|"], []);
running_sequence_indexes = llDeleteSubList(running_sequence_indexes, index, index);
running_pointers = llDeleteSubList(running_pointers, index, index);
while (sequence)
{
if ((!IsInteger(llList2String(sequence, 0))) && llList2String(sequence, 0) != "none")
{
llMessageLinked(LINK_THIS, 90002, llList2String(sequence, 0), id);
}
sequence = llDeleteSubList(sequence, 0, 1);
}
}
if (llGetListLength(running_uuid) == 0)
{
llSetTimerEvent(0);
}
}
default
{
state_entry()
{
init_sitters();
notecard_key = llGetInventoryKey(notecard_name);
if (llGetInventoryType(notecard_name) == INVENTORY_NOTECARD)
{
Out(0, "Loading...");
notecard_query = llGetNotecardLine(notecard_name, 0);
}
}
timer()
{
sequence();
llSetTimerEvent(1);
}
on_rez(integer start)
{
is_running = TRUE;
}
link_message(integer sender, integer num, string msg, key id)
{
if (num == 90100)
{
list data = llParseString2List(msg, ["|"], []);
if (llList2String(data, 1) == "[FACES]")
{
llMessageLinked(sender, 90101, llDumpList2String([llList2String(data, 0), "[ADJUST]", id], "|"), llList2String(data, 2));
if (id == llGetOwner())
{
is_running = (!is_running);
if (sender == llGetLinkNumber())
{
llRegionSayTo(id, 0, "Facial Expressions " + llList2String(["OFF", "ON"], is_running));
}
}
else
{
llRegionSayTo(id, 0, "Sorry, only the owner can change this.");
}
}
}
else if (sender == llGetLinkNumber())
{
if (num == 90045)
{
list data = llParseStringKeepNulls(msg, ["|"], []);
integer sitter = (integer)llList2String(data, 0);
if (id == llList2Key(SITTERS, sitter))
{
string given_posename = llList2String(data, 1);
SITTER_POSES = llListReplaceList(SITTER_POSES, [given_posename], sitter, sitter);
given_posename = (string)sitter + "|" + given_posename;
remove_sequences(id);
integer i;
while (i < llGetListLength(anim_triggers))
{
if (llList2String(anim_triggers, i) == given_posename)
{
integer reference = llListFindList(anim_triggers, [(string)sitter + "|" + llList2String(anim_animsequences, i)]);
if (!~reference)
{
reference = i;
}
start_sequence(reference, id);
}
i++;
}
}
}
else if (num == 90065)
{
remove_sequences(id);
integer index = llListFindList(SITTERS, [id]);
if (index != -1)
{
SITTERS = llListReplaceList(SITTERS, [NULL_KEY], index, index);
}
}
else if (num == 90030)
{
SITTERS = llListReplaceList(SITTERS, [NULL_KEY], (integer)msg, (integer)msg);
SITTERS = llListReplaceList(SITTERS, [NULL_KEY], (integer)((string)id), (integer)((string)id));
}
else if (num == 90070)
{
SITTERS = llListReplaceList(SITTERS, [id], (integer)msg, (integer)msg);
}
else if (num == 90172)
{
is_running = TRUE;
integer sitter = (integer)msg;
remove_sequences(llList2Key(SITTERS, sitter));
integer i = llGetListLength(anim_triggers);
while (i > 0)
{
i--;
if (llList2String(anim_triggers, i) == msg + "|" + llList2String(SITTER_POSES, sitter))
{
anim_triggers = llDeleteSubList(anim_triggers, i, i);
anim_animsequences = llDeleteSubList(anim_animsequences, i, i);
}
}
if (id != "none")
{
anim_triggers += [msg + "|" + llList2String(SITTER_POSES, sitter)];
anim_animsequences += (string)id + "|1";
start_sequence(llGetListLength(anim_animsequences) - 1, llList2Key(SITTERS, sitter));
llSay(0, "FACE added: '" + (string)id + "' to '" + llList2String(SITTER_POSES, sitter) + "' for SITTER " + (string)sitter + ".");
}
}
else if (num == 90020 && (string)id == llGetScriptName())
{
integer i;
for (i = 0; i < llGetListLength(anim_triggers); i++)
{
if (!llSubStringIndex(llList2String(anim_triggers, i), msg + "|"))
{
list trigger = llParseString2List(llList2String(anim_triggers, i), ["|"], []);
list sequence = llParseString2List(llList2String(anim_animsequences, i), ["|"], []);
integer x;
for (x = 0; x < llGetListLength(sequence); x += 2)
{
if (IsInteger(llList2String(sequence, x)))
{
sequence = llListReplaceList(sequence, [llList2String(facial_anim_list, (integer)llList2String(sequence, x))], x, x);
}
}
Readout_Say("ANIM " + llList2String(trigger, 1) + "|" + llDumpList2String(sequence, "|"), msg);
}
}
llMessageLinked(LINK_THIS, 90021, msg, llGetScriptName());
}
}
}
changed(integer change)
{
if (change & CHANGED_INVENTORY)
{
if (llGetInventoryKey(notecard_name) != notecard_key)
{
llResetScript();
}
else if (get_number_of_scripts() != llGetListLength(SITTERS))
{
init_sitters();
}
}
else if (change & CHANGED_LINK)
{
if (llGetAgentSize(llGetLinkKey(llGetNumberOfPrims())) == ZERO_VECTOR)
{
}
}
}
dataserver(key query_id, string data)
{
if (query_id == notecard_query)
{
if (data == EOF)
{
Out(0, (string)llGetListLength(anim_triggers) + " Expressions Ready, Mem=" + (string)llGetFreeMemory());
}
else
{
data = llGetSubString(data, llSubStringIndex(data, "◆") + 1, -1);
data = llStringTrim(data, STRING_TRIM);
string command = llGetSubString(data, 0, llSubStringIndex(data, " ") - 1);
list parts = llParseStringKeepNulls(llGetSubString(data, llSubStringIndex(data, " ") + 1, -1), [" | ", " |", "| ", "|"], []);
string part0 = llStringTrim(llList2String(parts, 0), STRING_TRIM);
if (command == "SITTER")
{
notecard_section = (integer)part0;
}
else if (command == "ANIM")
{
string part1 = llStringTrim(llDumpList2String(llList2List(parts, 1, -1), "|"), STRING_TRIM);
list sequence = llParseString2List(part1, ["|"], []);
integer x;
for (x = 0; x < llGetListLength(sequence); x += 2)
{
integer index = llListFindList(facial_anim_list, [llList2String(sequence, x)]);
if (~index)
{
sequence = llListReplaceList(sequence, [index], x, x);
}
}
anim_triggers += [(string)notecard_section + "|" + part0];
anim_animsequences += llDumpList2String(sequence, "|");
}
notecard_query = llGetNotecardLine(notecard_name, notecard_line += 1);
}
}
}
}

View file

@ -0,0 +1,608 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright (c) the AVsitter Contributors (http://avsitter.github.io)
* AVsitter™ is a trademark. For trademark use policy see:
* https://avsitter.github.io/TRADEMARK.mediawiki
*
* Please consider supporting continued development of AVsitter and
* receive automatic updates and other benefits! All details and user
* instructions can be found at http://avsitter.github.io
*/
string product = "AVmenu™";
string version = "2.2";
integer verbose = 0;
string prop_script = "[AV]prop";
string notecard_name = "AVpos";
string main_script = "[AV]sitA";
string custom_text;
list MENUCONTROL_TYPES = ["ALL", "OWNER ONLY", "GROUP ONLY"];
integer MENUCONTROL_INDEX;
integer owner_only;
integer last_menu_unixtime;
string last_menu_avatar;
integer menu_channel;
key notecard_key;
key notecard_query;
list MENU_LIST;
list DATA_LIST;
integer MTYPE;
integer notecard_line;
integer current_menu = -1;
integer menu_page;
integer choosing;
string choice;
integer listen_handle;
integer number_per_page = 9;
integer menu_pages;
string last_text;
integer pass_security(key id)
{
integer access_allowed = FALSE;
string SECURITY_TYPE = llList2String(MENUCONTROL_TYPES, MENUCONTROL_INDEX);
if (SECURITY_TYPE == "ALL")
{
access_allowed = TRUE;
}
else if (SECURITY_TYPE == "GROUP ONLY" && llSameGroup(id) == TRUE)
{
access_allowed = TRUE;
}
else if (id == llGetOwner())
{
access_allowed = TRUE;
}
return access_allowed;
}
check_avsit()
{
if (llGetInventoryType(main_script) == INVENTORY_SCRIPT)
{
remove_script("This script can not be used with the sit script in the same prim. Removing script!");
}
}
list order_buttons(list buttons)
{
return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4) + llList2List(buttons, -9, -7) + llList2List(buttons, -12, -10);
}
Out(integer level, string out)
{
if (verbose >= level)
{
llOwnerSay(llGetScriptName() + "[" + version + "] " + out);
}
}
Readout_Say(string say)
{
llSleep(0.2);
string objectname = llGetObjectName();
llSetObjectName("");
llRegionSayTo(llGetOwner(), 0, "◆" + say);
llSetObjectName(objectname);
}
dialog(key av, string menu_text, list menu_items)
{
llDialog(av, product + " " + version + "\n\n" + menu_text, order_buttons(menu_items), menu_channel);
last_menu_unixtime = llGetUnixTime();
llSetTimerEvent(120);
}
integer avprop_is_copy_transfer(integer owner_mask)
{
integer perms = llGetInventoryPermMask(prop_script, owner_mask);
if (perms & PERM_COPY && perms & PERM_TRANSFER)
{
return 1;
}
return 0;
}
integer prim_is_mod()
{
integer perms = llGetObjectPermMask(MASK_OWNER);
if (perms & PERM_MODIFY)
{
return 1;
}
return 0;
}
menu_check(string name, key id)
{
if (pass_security(id) == TRUE)
{
if (name == last_menu_avatar || llGetUnixTime() - last_menu_unixtime > 5)
{
last_menu_unixtime = llGetUnixTime();
last_menu_avatar = name;
menu_page = 0;
current_menu = -1;
prop_menu(FALSE, id);
}
else
{
llDialog(id, product + " " + version + "\n\n" + llList2String(llParseString2List(last_menu_avatar, [" "], []), 0) + " is already using the menu.\nPlease wait a moment.", [], -585868);
}
}
else
{
llDialog(id, product + " " + version + "\n\n" + "Sorry, the owner has set this menu to: " + llList2String(MENUCONTROL_TYPES, MENUCONTROL_INDEX), [], -585868);
}
}
options_menu()
{
string text;
list menu_items = ["[BACK]"];
text = "Prop options:\n";
if (avprop_is_copy_transfer(MASK_OWNER) && prim_is_mod())
{
menu_items += ["[NEW]", "[DUMP]"];
text += "\n[NEW] = Add a new prop.";
text += "\n[DUMP] = Read settings to chat.";
}
menu_items += ["[SAVE]", "[CLEAR]", "[SECURITY]", "[RESET]"];
text += "\n[SAVE] = Save prop positions.";
text += "\n[CLEAR] = Clear props.";
text += "\n[SECURITY] = Menu security.";
text += "\n[RESET] = Reload notecard.";
dialog(llGetOwner(), text, menu_items);
}
choice_menu(list options, string menu_text)
{
last_text = menu_text;
choosing = TRUE;
menu_text = "\n(Page " + (string)(menu_page + 1) + "/" + (string)menu_pages + ")\n" + menu_text + "\n\n";
list menu_items;
integer i;
if (llGetListLength(options) == 0)
{
menu_text = "\nNo items of required type in the prim inventory.";
menu_items = ["[BACK]"];
}
else
{
integer cutoff = 65;
integer all_options_length = llStringLength(llDumpList2String(options, ""));
integer total_need_to_cut = 412 - all_options_length;
if (total_need_to_cut < 0)
{
cutoff = 43;
}
for (i = 0; i < llGetListLength(options); i++)
{
menu_items += (string)(i + 1);
string item = llList2String(options, i);
if (llStringLength(item) > cutoff)
{
item = llGetSubString(item, 0, cutoff) + "..";
}
menu_text += (string)(i + 1) + "." + item + "\n";
}
while (llGetListLength(menu_items) < number_per_page)
{
menu_items += " ";
}
menu_items += ["[BACK]", "[<<]", "[>>]"];
}
dialog(llGetOwner(), menu_text, menu_items);
}
list get_choices(integer page)
{
menu_page = page;
list options;
integer i;
integer start = number_per_page * menu_page;
integer end = start + number_per_page;
integer type = INVENTORY_OBJECT;
i = start;
while (llGetListLength(options) + start < end && i < llGetInventoryNumber(type))
{
options += llGetInventoryName(type, i);
i++;
}
i = llGetInventoryNumber(type);
menu_pages = llCeil((float)i / number_per_page);
return options;
}
remove_script(string reason)
{
string message = "\n" + llGetScriptName() + " ==Script Removed==\n\n" + reason;
llDialog(llGetOwner(), message, ["OK"], -3675);
llInstantMessage(llGetOwner(), message);
llRemoveInventory(llGetScriptName());
}
integer prop_menu(integer return_pages, key av)
{
choosing = FALSE;
choice = "";
integer total_items;
integer i = current_menu + 1;
while (i < llGetListLength(MENU_LIST) && llSubStringIndex(llList2String(MENU_LIST, i), "M:") != 0)
{
total_items++;
i++;
}
list menu_items2;
if (current_menu != -1)
{
menu_items2 = ["[BACK]"] + menu_items2;
}
list menu_items1;
if (llGetInventoryType(prop_script) == INVENTORY_SCRIPT)
{
menu_items2 += ["[OWNER]"];
}
if (total_items + llGetListLength(menu_items2) > 12)
{
menu_items2 += ["[<<]", "[>>]"];
}
integer items_per_page = 12 - llGetListLength(menu_items2);
integer page_start = current_menu + 1 + menu_page * items_per_page;
for (i = page_start; i < page_start + items_per_page; i++)
{
if (i < llGetListLength(MENU_LIST))
{
if (llSubStringIndex(llList2String(MENU_LIST, i), "M:") != -1)
{
jump end;
}
if (llListFindList(["T:", "S:", "B:"], [llGetSubString(llList2String(MENU_LIST, i), 0, 1)]) == -1)
{
menu_items1 += llList2String(MENU_LIST, i);
}
else
{
menu_items1 += llGetSubString(llList2String(llParseString2List(llList2String(MENU_LIST, i), ["|"], []), 0), 2, -1);
}
}
}
@end;
if (return_pages)
{
integer pages = llCeil(total_items) / (12 - llGetListLength(menu_items2));
if (total_items % (12 - llGetListLength(menu_items2)) == 0)
{
pages--;
}
return pages;
}
if (llList2String(menu_items2, 0) == "[BACK]")
{
menu_items1 = ["[BACK]"] + menu_items1;
menu_items2 = llDeleteSubList(menu_items2, 0, 0);
}
menu_channel = ((integer)llFrand(2147483646) + 1) * -1;
llListenRemove(listen_handle);
listen_handle = llListen(menu_channel, "", av, "");
dialog(av, custom_text, menu_items1 + menu_items2);
return 0;
}
string strReplace(string str, string search, string replace)
{
return llDumpList2String(llParseStringKeepNulls((str = "") + str, [search], []), replace);
}
naming()
{
llTextBox(llGetOwner(), "\nPlease type a button name for your prop\nProp: " + choice, menu_channel);
}
default
{
state_entry()
{
if (llSubStringIndex(llGetScriptName(), " ") != -1)
{
remove_script("Use only one copy of this script!");
}
check_avsit();
notecard_key = llGetInventoryKey(notecard_name);
Out(0, "Loading...");
notecard_query = llGetNotecardLine(notecard_name, notecard_line);
}
timer()
{
llListenRemove(listen_handle);
}
listen(integer listen_channel, string name, key id, string msg)
{
if (choice)
{
if (msg == "")
{
naming();
}
else
{
integer perms = llGetInventoryPermMask(choice, MASK_NEXT);
if (!(perms & PERM_COPY))
{
llSay(0, "Could not add prop '" + choice + "'. Props and their content must be COPY-OK for NEXT owner.");
}
else
{
llMessageLinked(LINK_THIS, 90173, msg, choice);
MENU_LIST = ["B:" + msg] + MENU_LIST;
DATA_LIST = [90200] + DATA_LIST;
}
choice = "";
options_menu();
}
return;
}
if (choosing && llListFindList(["1", "2", "3", "4", "5", "6", "7", "8", "9"], [msg]) != -1)
{
choosing = FALSE;
choice = llList2String(get_choices(menu_page), (integer)msg - 1);
naming();
return;
}
if (msg == "[SECURITY]")
{
if (id == llGetOwner())
{
dialog(llGetOwner(), "Who is allowed to control this menu?", MENUCONTROL_TYPES);
}
else
{
llRegionSayTo(id, 0, "Sorry, only the owner can use this.");
}
return;
}
integer mindex_test = llListFindList(MENU_LIST, ["M:" + msg]);
if (mindex_test != -1)
{
menu_page = 0;
current_menu = mindex_test;
}
mindex_test = llListFindList(MENU_LIST, ["B:" + msg]);
if (mindex_test != -1)
{
list button_data = llParseStringKeepNulls(llList2String(DATA_LIST, mindex_test), ["<22>"], []);
if (llList2String(button_data, 1))
{
msg = llList2String(button_data, 1);
}
if (llList2String(button_data, 2))
{
id = llList2String(button_data, 2);
}
llMessageLinked(LINK_SET, (integer)llList2String(button_data, 0), msg, id);
return;
}
else if (msg == "[>>]" || msg == "[<<]")
{
if (choosing)
{
if (msg == "[>>]")
{
menu_page++;
if (menu_page >= menu_pages)
{
menu_page = 0;
}
}
else if (msg == "[<<]")
{
menu_page--;
if (menu_page < 0)
{
menu_page = menu_pages - 1;
}
}
choice_menu(get_choices(menu_page), last_text);
}
else
{
if (msg == "[<<]")
{
menu_page--;
if (menu_page < 0)
{
menu_page = prop_menu(TRUE, NULL_KEY);
}
}
else
{
menu_page++;
if (menu_page > prop_menu(TRUE, NULL_KEY))
{
menu_page = 0;
}
}
prop_menu(FALSE, id);
}
return;
}
else if (msg == "[BACK]")
{
menu_page = 0;
current_menu = -1;
}
else if (msg == "[NEW]")
{
llMessageLinked(LINK_THIS, 90200, "", "");
choice_menu(get_choices(0), "Please choose your prop:\n\n(Props must include the [AV]object script!)");
return;
}
else if (msg == "[DUMP]")
{
Readout_Say("");
Readout_Say("--✄--COPY BELOW INTO \"AVpos\" NOTECARD--✄--");
Readout_Say("");
if (custom_text)
{
Readout_Say("TEXT " + strReplace(custom_text, "\n", "\\n"));
}
integer i;
for (i = 0; i < llGetListLength(MENU_LIST); i++)
{
list change_me = llParseString2List(llList2String(MENU_LIST, i), [":"], []);
if (llGetListLength(change_me) == 2)
{
if (llList2String(change_me, 0) == "M")
{
Readout_Say("MENU " + llGetSubString(llList2String(change_me, 1), 0, -2));
}
else if (llList2String(change_me, 0) == "T")
{
Readout_Say("TOMENU " + llGetSubString(llList2String(change_me, 1), 0, -2));
}
else if (llList2String(change_me, 0) == "B")
{
list l = [llList2String(change_me, 1), strReplace(strReplace(llList2String(DATA_LIST, i), "90200", ""), "<22>", "|")];
if (llList2String(l, 1) == "")
{
l = llList2List(l, 0, 0);
}
string end = llDumpList2String(l, "|");
Readout_Say("BUTTON " + end);
}
}
}
llMessageLinked(LINK_THIS, 90020, "0", prop_script);
return;
}
else if (msg == "[SAVE]" && id == llGetOwner())
{
llMessageLinked(LINK_SET, 90101, "0|" + msg, "");
options_menu();
return;
}
else if (msg == "[CLEAR]")
{
Out(0, "Props have been cleared!");
llMessageLinked(LINK_THIS, 90200, "", "");
}
else if (msg == "[RESET]")
{
llMessageLinked(LINK_THIS, 90200, "", "");
llSleep(1);
llResetOtherScript(prop_script);
llResetScript();
return;
}
else if (msg == "[BACK]")
{
}
else if (msg == "[OWNER]")
{
if (id == llGetOwner())
{
options_menu();
return;
}
else
{
llRegionSayTo(id, 0, "Sorry, only the owner can use this.");
}
}
else if (id == llGetOwner() && llListFindList(MENUCONTROL_TYPES, [msg]) != -1)
{
MENUCONTROL_INDEX = llListFindList(MENUCONTROL_TYPES, [msg]);
Out(0, "Menu access set to: " + llList2String(MENUCONTROL_TYPES, MENUCONTROL_INDEX));
if (llGetInventoryType(prop_script) == INVENTORY_SCRIPT)
{
options_menu();
return;
}
else
{
}
}
prop_menu(FALSE, id);
}
touch_start(integer touched)
{
if (MTYPE < 3)
{
menu_check(llDetectedName(0), llDetectedKey(0));
}
}
changed(integer change)
{
if (change & CHANGED_INVENTORY)
{
if (llGetInventoryKey(notecard_name) != notecard_key)
{
llResetScript();
}
check_avsit();
}
}
link_message(integer sender, integer num, string msg, key id)
{
if (sender == llGetLinkNumber())
{
if (num == 90005)
{
menu_check(llKey2Name(id), id);
}
else if (num == 90022)
{
Readout_Say(msg);
}
else if (num == 90021)
{
Readout_Say("");
Readout_Say("--✄--COPY ABOVE INTO \"AVpos\" NOTECARD--✄--");
Readout_Say("");
}
}
}
dataserver(key query_id, string data)
{
if (query_id == notecard_query)
{
if (data == EOF)
{
Out(0, (string)llGetListLength(MENU_LIST) + " menu items Ready, Memory: " + (string)llGetFreeMemory());
llPassTouches(FALSE);
if (MTYPE == 3)
{
llPassTouches(TRUE);
}
}
else
{
data = llGetSubString(data, llSubStringIndex(data, "◆") + 1, -1);
data = llStringTrim(data, STRING_TRIM);
string command = llGetSubString(data, 0, llSubStringIndex(data, " ") - 1);
list parts = llParseStringKeepNulls(llGetSubString(data, llSubStringIndex(data, " ") + 1, -1), [" | ", " |", "| ", "|"], []);
string part0 = llStringTrim(llList2String(parts, 0), STRING_TRIM);
string part1 = llList2String(parts, 1);
if (llGetListLength(parts) > 1)
{
part1 = llStringTrim(llDumpList2String(llList2List(parts, 1, -1), "<22>"), STRING_TRIM);
}
if (command == "TEXT")
{
custom_text = llDumpList2String(llParseStringKeepNulls(part0, ["\\n"], []), "\n");
}
part0 = llGetSubString(part0, 0, 22);
if (command == "MENU")
{
MENU_LIST += ["M:" + part0 + "*"];
DATA_LIST += "";
}
else if (command == "TOMENU")
{
MENU_LIST += ["T:" + part0 + "*"];
DATA_LIST += "";
}
else if (command == "BUTTON")
{
MENU_LIST += ["B:" + part0];
if (part1 == "")
{
part1 = "90200";
}
DATA_LIST += part1;
}
else if (command == "MTYPE")
{
MTYPE = (integer)part0;
}
notecard_query = llGetNotecardLine(notecard_name, ++notecard_line);
}
}
}
}

View file

@ -0,0 +1,241 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright (c) the AVsitter Contributors (http://avsitter.github.io)
* AVsitter™ is a trademark. For trademark use policy see:
* https://avsitter.github.io/TRADEMARK.mediawiki
*
* Please consider supporting continued development of AVsitter and
* receive automatic updates and other benefits! All details and user
* instructions can be found at http://avsitter.github.io
*/
/*
* The release version of the [AV]object Script has the original AVsitter experience
* enabled. Scripts with this experience may not be shared in full perms form.
* Please support further development of AVsitter by not sharing it!
* If you acquired this script from someone else, please support the
* developers by purchasing AVsitter (see https://avsitter.github.io)
* and also obtain the benefit of automatic updates.
*/
string version = "2.020";
integer comm_channel;
integer local_attach_channel = -2907539;
integer listen_handle;
integer prop_type;
integer prop_id;
integer prop_point;
integer experience_denied_reason;
key originalowner;
key give_prop_warning_request;
unsit_all()
{
integer i = llGetNumberOfPrims();
while (llGetAgentSize(llGetLinkKey(i)))
{
llUnSit(llGetLinkKey(i));
i--;
}
}
integer verbose = 5;
Out(integer level, string out)
{
if (verbose >= level)
{
llOwnerSay(llGetScriptName() + "[" + version + "] " + out);
}
}
default
{
state_entry()
{
}
on_rez(integer start)
{
if (start)
{
state prop;
}
}
}
state prop
{
state_entry()
{
if (llGetLinkNumber() < 2)
{
if (llGetStartParameter() <= -10000000)
{
string start_param = (string)llGetStartParameter();
prop_type = (integer)llGetSubString(start_param, -1, -1);
prop_point = (integer)llGetSubString(start_param, -3, -2);
prop_id = (integer)llGetSubString(start_param, -5, -4);
comm_channel = (integer)llGetSubString(start_param, 0, -6);
listen_handle = llListen(comm_channel, "", "", "");
llSay(comm_channel, "REZ|" + (string)prop_id);
}
else
{
}
}
if (prop_type != 2 && prop_type != 1)
{
if (llGetInventoryType("[AV]sitA") == INVENTORY_NONE)
{
llSetClickAction(-1);
}
}
else
{
llSetClickAction(CLICK_ACTION_TOUCH);
}
}
attach(key id)
{
if (comm_channel)
{
if (llGetAttached())
{
llListen(local_attach_channel, "", "", "");
llSay(comm_channel, "ATTACHED|" + (string)prop_id);
llSay(local_attach_channel, "LOCAT|" + (string)llGetAttached());
if (experience_denied_reason == 17)
{
if (llGetOwner() == originalowner)
{
list details = llGetExperienceDetails("");
if (llList2String(details, 3) == "17")
{
llSay(comm_channel, "NAG|" + llList2String(details, 0));
}
}
}
}
else
{
llSay(comm_channel, "DETACHED|" + (string)prop_id);
}
}
}
touch_start(integer touched)
{
if ((!llGetAttached()) && (prop_type == 2 || prop_type == 1))
{
llRequestExperiencePermissions(llDetectedKey(0), "");
}
}
run_time_permissions(integer permissions)
{
if (permissions & PERMISSION_ATTACH)
{
if (llGetAttached())
{
llDetachFromAvatar();
}
else
{
llAttachToAvatarTemp(prop_point);
}
}
else
{
llSay(comm_channel, "DEREZ|" + (string)prop_id);
llDie();
}
}
experience_permissions(key target_id)
{
if (llGetAttached())
{
llDetachFromAvatar();
}
else
{
llAttachToAvatarTemp(prop_point);
}
}
experience_permissions_denied(key agent_id, integer reason)
{
originalowner = llGetOwner();
experience_denied_reason = reason;
llRequestPermissions(agent_id, PERMISSION_ATTACH);
}
on_rez(integer start)
{
if (!llGetAttached())
{
state restart_prop;
}
}
listen(integer channel, string name, key id, string message)
{
list data = llParseString2List(message, ["|"], []);
string command = llList2String(data, 0);
if (llList2String(data, 0) == "LOCAT" && llGetOwnerKey(id) == llGetOwner() && llList2String(data, 1) == (string)llGetAttached())
{
llRequestPermissions(llGetOwner(), PERMISSION_ATTACH);
}
else if (command == "ATTACHTO" && prop_type == 1 && (key)llList2String(data, 2) == llGetKey())
{
if (llGetAgentSize((key)llList2String(data, 1)) == ZERO_VECTOR)
{
llSay(comm_channel, "DEREZ|" + (string)prop_id);
llDie();
}
else
{
llRequestExperiencePermissions((key)llList2String(data, 1), "");
}
}
else if (llGetSubString(command, 0, 3) == "REM_")
{
integer remove;
if (command == "REM_ALL")
{
remove = TRUE;
}
else if (command == "REM_INDEX" || (command == "REM_WORLD" && (!llGetAttached())))
{
if (~llListFindList(data, [(string)prop_id]))
{
remove = TRUE;
}
}
else if (llGetAttached() && command == "REM_WORN" && (key)llList2String(data, 1) == llGetOwner())
{
remove = TRUE;
}
if (remove)
{
if (llGetAttached())
{
llRequestPermissions(llGetOwner(), PERMISSION_ATTACH);
}
else
{
if (llGetAgentSize(llGetLinkKey(llGetNumberOfPrims())))
{
unsit_all();
llSleep(1);
}
llSay(comm_channel, "DEREZ|" + (string)prop_id);
llDie();
}
}
}
else if (message == "PROPSEARCH" && (!llGetAttached()))
{
llSay(comm_channel, "SAVEPROP|" + (string)prop_id);
}
}
}
state restart_prop
{
state_entry()
{
state prop;
}
}

View file

@ -0,0 +1,578 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright (c) the AVsitter Contributors (http://avsitter.github.io)
* AVsitter™ is a trademark. For trademark use policy see:
* https://avsitter.github.io/TRADEMARK.mediawiki
*
* Please consider supporting continued development of AVsitter and
* receive automatic updates and other benefits! All details and user
* instructions can be found at http://avsitter.github.io
*/
string version = "2.2";
string notecard_name = "AVpos";
string main_script = "[AV]sitA";
key key_request;
integer comm_channel;
integer WARN = 1;
key notecard_key;
key notecard_query;
integer notecard_line;
integer notecard_section;
integer listen_handle;
list prop_triggers;
list prop_types;
list prop_objects;
list prop_positions;
list prop_rotations;
list prop_groups;
list prop_points;
list sequential_prop_groups;
integer HAVENTNAGGED = TRUE;
list SITTERS;
list SITTER_POSES;
list ATTACH_POINTS = [ATTACH_CHEST, "chest", ATTACH_HEAD, "head", ATTACH_LSHOULDER, "left shoulder", ATTACH_RSHOULDER, "right shoulder", ATTACH_LHAND, "left hand", ATTACH_RHAND, "right hand", ATTACH_LFOOT, "left foot", ATTACH_RFOOT, "right foot", ATTACH_BACK, "back", ATTACH_PELVIS, "pelvis", ATTACH_MOUTH, "mouth", ATTACH_CHIN, "chin", ATTACH_LEAR, "left ear", ATTACH_REAR, "right ear", ATTACH_LEYE, "left eye", ATTACH_REYE, "right eye", ATTACH_NOSE, "nose", ATTACH_RUARM, "right upper arm", ATTACH_RLARM, "right lower arm", ATTACH_LUARM, "left upper arm", ATTACH_LLARM, "left lower arm", ATTACH_RHIP, "right hip", ATTACH_RULEG, "right upper leg", ATTACH_RLLEG, "right lower leg", ATTACH_LHIP, "left hip", ATTACH_LULEG, "left upper leg", ATTACH_LLLEG, "left lower leg", ATTACH_BELLY, "stomach", ATTACH_LEFT_PEC, "left pectoral", ATTACH_RIGHT_PEC, "right pectoral", ATTACH_HUD_CENTER_2, "HUD center 2", ATTACH_HUD_TOP_RIGHT, "HUD top right", ATTACH_HUD_TOP_CENTER, "HUD top", ATTACH_HUD_TOP_LEFT, "HUD top left", ATTACH_HUD_CENTER_1, "HUD center", ATTACH_HUD_BOTTOM_LEFT, "HUD bottom left", ATTACH_HUD_BOTTOM, "HUD bottom", ATTACH_HUD_BOTTOM_RIGHT, "HUD bottom right", 39, "neck", 40, "avatar center"];
integer verbose = 5;
Out(integer level, string out)
{
if (verbose >= level)
{
llOwnerSay(llGetScriptName() + "[" + version + "] " + out);
}
}
integer IsInteger(string data)
{
return llParseString2List((string)llParseString2List(data, ["8", "9"], []), ["0", "1", "2", "3", "4", "5", "6", "7"], []) == [] && data != "";
}
integer get_number_of_scripts()
{
integer i = 1;
while (llGetInventoryType(main_script + " " + (string)i) == INVENTORY_SCRIPT)
{
i++;
}
return i;
}
integer get_point(string text)
{
integer i;
for (i = 1; i < llGetListLength(ATTACH_POINTS); i = i + 2)
{
if (~llSubStringIndex(llToUpper(text), llToUpper(llList2String(ATTACH_POINTS, i))))
{
return llList2Integer(ATTACH_POINTS, i - 1);
}
}
return 0;
}
rez_prop(integer index)
{
integer type = llList2Integer(prop_types, index);
string object = llList2String(prop_objects, index);
if (object != "")
{
vector pos = llList2Vector(prop_positions, index) * llGetRot() + llGetPos();
rotation rot = llEuler2Rot(llList2Vector(prop_rotations, index) * DEG_TO_RAD) * llGetRot();
integer pt = get_point(llList2String(prop_points, index));
string point = (string)pt;
if (llStringLength(point) == 1)
{
point = "0" + point;
}
string prop_id = (string)index;
if (llStringLength(prop_id) == 1)
{
prop_id = "0" + prop_id;
}
integer int = (integer)((string)comm_channel + prop_id + point + (string)type);
if (llGetInventoryType(object) != INVENTORY_OBJECT)
{
llSay(0, "Could not find prop '" + object + "'.");
return;
}
integer perms = llGetInventoryPermMask(object, MASK_NEXT);
string next = " for NEXT owner";
if (WARN == 2)
{
next = "";
perms = llGetInventoryPermMask(object, MASK_OWNER);
}
if (type == 0 || type == 3)
{
if (!(perms & PERM_COPY))
{
llSay(0, "Can't rez '" + object + "'. Props and their content must be COPY-OK" + next);
return;
}
}
else if (type > 0)
{
if ((!(perms & PERM_COPY)) || (!(perms & PERM_TRANSFER)))
{
llSay(0, "Can't rez '" + object + "'. Attachment props and their content must be COPY-TRANSFER" + next);
return;
}
}
llRezAtRoot(object, pos, ZERO_VECTOR, rot, int);
}
}
send_command(string command)
{
llRegionSay(comm_channel, command);
llSay(comm_channel, command);
}
remove_all_props()
{
send_command("REM_ALL");
}
rez_props_by_trigger(string pose_name)
{
integer i;
for (; i < llGetListLength(prop_triggers); i++)
{
if (llList2String(prop_triggers, i) == pose_name)
{
rez_prop(i);
}
}
}
list get_props_by_pose(string pose_name)
{
list props_to_do;
integer i;
for (; i < llGetListLength(prop_triggers); i++)
{
if (llList2String(prop_triggers, i) == pose_name)
{
props_to_do += i;
}
}
return props_to_do;
}
remove_props_by_sitter(string sitter, integer remove_type3)
{
list text;
integer i;
for (; i < llGetListLength(prop_triggers); i++)
{
if (llSubStringIndex(llList2String(prop_triggers, i), sitter + "|") == 0)
{
if (llList2Integer(prop_types, i) != 3 || remove_type3)
{
text += [i];
}
}
}
string command = "REM_INDEX";
if (llGetInventoryType(main_script) != INVENTORY_SCRIPT)
{
command = "REM_WORLD";
}
if (text)
{
send_command(llDumpList2String([command] + text, "|"));
}
}
remove_worn(key av)
{
send_command(llDumpList2String(["REM_WORN", av], "|"));
}
remove_sitter_props_by_pose(string sitter_pose, integer remove_type3)
{
list text;
integer i;
for (; i < llGetListLength(prop_triggers); i++)
{
if (llList2String(prop_triggers, i) == sitter_pose)
{
if (llList2Integer(prop_types, i) != 3 || remove_type3)
{
text += [i];
}
}
}
if (text)
{
send_command(llDumpList2String(["REM_INDEX"] + text, "|"));
}
}
remove_sitter_props_by_pose_group(string msg)
{
list props = get_props_by_pose(msg);
list groups;
integer i;
for (; i < llGetListLength(props); i++)
{
string prop_group = llList2String(prop_groups, llList2Integer(props, i));
if (!~llListFindList(groups, [prop_group]))
{
groups += prop_group;
remove_props_by_group(llListFindList(sequential_prop_groups, [prop_group]));
}
}
}
remove_props_by_group(integer gp)
{
list text;
string group = llList2String(sequential_prop_groups, gp);
integer i;
for (; i < llGetListLength(prop_groups); i++)
{
if (llList2String(prop_groups, i) == group)
{
text += [i];
}
}
string command = "REM_INDEX";
if (llGetInventoryType(main_script) != INVENTORY_SCRIPT)
{
command = "REM_WORLD";
}
if (text)
{
send_command(llDumpList2String([command] + text, "|"));
}
}
Readout_Say(string say)
{
llSleep(0.2);
llMessageLinked(LINK_THIS, 90022, say, "");
}
init_sitters()
{
SITTERS = [];
SITTER_POSES = [];
integer i;
for (i = 0; i < get_number_of_scripts(); i++)
{
SITTERS += NULL_KEY;
SITTER_POSES += "";
}
}
init_channel()
{
llListenRemove(listen_handle);
comm_channel = ((integer)llFrand(8999) + 1000) * -1;
listen_handle = llListen(comm_channel, "", "", "");
}
string element(string text, integer x)
{
return llList2String(llParseStringKeepNulls(text, ["|"], []), x);
}
default
{
state_entry()
{
Out(0, "Mem=" + (string)(65536 - llGetUsedMemory()));
init_sitters();
init_channel();
notecard_key = llGetInventoryKey(notecard_name);
if (llGetInventoryType(notecard_name) == INVENTORY_NOTECARD)
{
Out(0, "Loading...");
notecard_query = llGetNotecardLine(notecard_name, 0);
}
}
on_rez(integer start)
{
init_channel();
}
link_message(integer sender, integer num, string msg, key id)
{
if (sender == llGetLinkNumber())
{
if (num == 90045)
{
list data = llParseStringKeepNulls(msg, ["|"], []);
integer sitter = (integer)llList2String(data, 0);
if (id == llList2Key(SITTERS, sitter))
{
remove_sitter_props_by_pose(llList2String(SITTER_POSES, sitter), FALSE);
string given_posename = llList2String(data, 1);
given_posename = (string)sitter + "|" + given_posename;
SITTER_POSES = llListReplaceList(SITTER_POSES, [given_posename], sitter, sitter);
remove_sitter_props_by_pose_group(given_posename);
rez_props_by_trigger(given_posename);
}
}
else if (num == 90200 || num == 90220)
{
list ids = llParseStringKeepNulls(id, ["|"], []);
key sitting_av_or_sitter = (key)llList2String(ids, -1);
if (llGetInventoryType(main_script) != INVENTORY_SCRIPT)
{
SITTERS = [sitting_av_or_sitter];
}
integer i;
if (!llSubStringIndex(msg, "remprop_"))
{
for (; i < llGetListLength(SITTERS); i++)
{
if (llList2Key(SITTERS, i) == sitting_av_or_sitter || id == "" || (string)sitting_av_or_sitter == (string)i)
{
remove_sitter_props_by_pose((string)i + "|" + llGetSubString(msg, 8, -1), TRUE);
}
}
}
else
{
integer flag;
for (; i < llGetListLength(SITTERS); i++)
{
if (~llListFindList(prop_triggers, [(string)i + "|" + msg]))
{
flag = TRUE;
}
}
for (i = 0; i < llGetListLength(SITTERS); i++)
{
if (llList2Key(SITTERS, i) == sitting_av_or_sitter || id == "" || (string)sitting_av_or_sitter == (string)i)
{
integer index = llListFindList(prop_triggers, [(string)i + "|" + msg]);
if (!~index)
{
if (llGetInventoryType(main_script) != INVENTORY_SCRIPT)
{
remove_all_props();
}
else if (!flag)
{
remove_props_by_sitter((string)i, TRUE);
}
}
else
{
remove_sitter_props_by_pose_group((string)i + "|" + msg);
rez_props_by_trigger((string)i + "|" + msg);
}
}
}
}
if (sitting_av_or_sitter)
{
if (num == 90200)
{
llMessageLinked(LINK_THIS, 90005, "", id);
}
}
}
if (num == 90101)
{
list data = llParseString2List(msg, ["|"], []);
if (llList2String(data, 1) == "[SAVE]")
{
llRegionSay(comm_channel, "PROPSEARCH");
}
}
else if (num == 90065)
{
remove_props_by_sitter(msg, FALSE);
remove_worn(id);
integer index = llListFindList(SITTERS, [id]);
if (~index)
{
SITTERS = llListReplaceList(SITTERS, [NULL_KEY], index, index);
}
}
else if (num == 90030)
{
remove_props_by_sitter(msg, FALSE);
remove_props_by_sitter((string)id, FALSE);
SITTERS = llListReplaceList(SITTERS, [NULL_KEY], (integer)msg, (integer)msg);
SITTERS = llListReplaceList(SITTERS, [NULL_KEY], (integer)((string)id), (integer)((string)id));
}
else if (num == 90070)
{
SITTERS = llListReplaceList(SITTERS, [id], (integer)msg, (integer)msg);
}
else if (num == 90171 || num == 90173)
{
integer sitter;
if (num == 90171)
{
sitter = (integer)msg;
prop_triggers += [llList2String(SITTER_POSES, sitter)];
}
else
{
sitter = 0;
SITTER_POSES = ["0|" + msg];
prop_triggers += "0|" + msg;
}
prop_types += 0;
prop_objects += (string)id;
string prop_group = (string)sitter + "|G1";
prop_groups += prop_group;
if (llListFindList(sequential_prop_groups, [prop_group]) == -1)
{
sequential_prop_groups += prop_group;
}
prop_positions += <0,0,1>;
prop_rotations += <0,0,0>;
prop_points += "";
rez_prop(llGetListLength(prop_triggers) - 1);
string text = "PROP added: '" + (string)id + "' to '" + element(llList2String(SITTER_POSES, sitter), 1) + "'";
if (llGetListLength(SITTERS) > 1)
{
text += " for SITTER " + (string)sitter;
}
llSay(0, text);
llSay(0, "Position your prop and click [SAVE].");
}
else if (num == 90020 && (string)id == llGetScriptName())
{
integer i;
for (; i < llGetListLength(prop_triggers); i++)
{
if (llSubStringIndex(llList2String(prop_triggers, i), msg + "|") == 0)
{
string type = (string)llList2Integer(prop_types, i);
if (type == "0")
{
type = "";
}
Readout_Say("PROP" + type + " " + llDumpList2String([element(llList2String(prop_triggers, i), 1), llList2String(prop_objects, i), element(llList2String(prop_groups, i), 1), llList2String(prop_positions, i), llList2String(prop_rotations, i), llList2String(prop_points, i)], "|"));
}
}
llMessageLinked(LINK_THIS, 90021, msg, llGetScriptName());
}
}
}
changed(integer change)
{
if (change & CHANGED_INVENTORY)
{
if (llGetInventoryKey(notecard_name) != notecard_key)
{
remove_all_props();
llResetScript();
}
else if (get_number_of_scripts() != llGetListLength(SITTERS))
{
init_sitters();
}
}
else if (change & CHANGED_LINK)
{
if (llGetAgentSize(llGetLinkKey(llGetNumberOfPrims())) == ZERO_VECTOR)
{
HAVENTNAGGED = TRUE;
if (llGetInventoryType(main_script) == INVENTORY_SCRIPT)
{
remove_all_props();
}
}
}
}
listen(integer channel, string name, key id, string message)
{
list data = llParseStringKeepNulls(message, ["|"], []);
if (llList2String(data, 0) == "SAVEPROP")
{
integer index = (integer)llList2String(data, 1);
if (index >= 0 && index < llGetListLength(prop_triggers))
{
if (llList2Vector(llGetObjectDetails(id, [OBJECT_POS]), 0) != ZERO_VECTOR)
{
list details = [OBJECT_POS, OBJECT_ROT];
rotation f = llList2Rot(details = llGetObjectDetails(llGetKey(), details) + llGetObjectDetails(id, details), 1);
vector target_rot = llRot2Euler(llList2Rot(details, 3) / f) * RAD_TO_DEG;
vector target_pos = (llList2Vector(details, 2) - llList2Vector(details, 0)) / f;
prop_positions = llListReplaceList(prop_positions, [target_pos], index, index);
prop_rotations = llListReplaceList(prop_rotations, [target_rot], index, index);
string type = llList2String(prop_types, index);
if (type == "0")
{
type = "";
}
string text = "PROP Saved to memory, SITTER " + element(llList2String(prop_triggers, index), 0) + ": PROP" + type + " " + element(llList2String(prop_triggers, index), 1) + "|" + name + "|" + element(llList2String(prop_groups, index), 1) + "|" + (string)target_pos + "|" + (string)target_rot + "|" + llList2String(prop_points, index);
llSay(0, text);
}
}
else
{
Out(0, "Error, cannot find prop: " + name);
}
}
else if (llList2String(data, 0) == "ATTACHED" || llList2String(data, 0) == "DETACHED" || llList2String(data, 0) == "REZ" || llList2String(data, 0) == "DEREZ")
{
integer prop_index = (integer)llList2String(data, 1);
integer sitter = (integer)llList2String(llParseStringKeepNulls(llList2String(prop_triggers, prop_index), ["|"], []), 0);
key sitter_key = llList2Key(SITTERS, sitter);
if (sitter_key != NULL_KEY && llList2String(data, 0) == "REZ" && llList2Integer(prop_types, prop_index) == 1)
{
llSay(comm_channel, "ATTACHTO|" + (string)sitter_key + "|" + (string)id);
}
llMessageLinked(LINK_SET, 90500, llDumpList2String([llList2String(data, 0), llList2String(prop_triggers, prop_index), llList2String(prop_objects, prop_index), llList2String(llParseStringKeepNulls(llList2String(prop_groups, prop_index), ["|"], []), 1), id], "|"), sitter_key);
}
else if (llList2String(data, 0) == "NAG" && HAVENTNAGGED && (!llGetAttached()))
{
llRegionSayTo(llGetOwner(), 0, "To enable auto-attachments, please enable the experience '" + llList2String(data, 1) + "' by Code Violet in 'About Land'.");
HAVENTNAGGED = FALSE;
}
}
dataserver(key query_id, string data)
{
if (query_id == notecard_query)
{
if (data == EOF)
{
Out(0, (string)llGetListLength(prop_triggers) + " Props Ready, Mem=" + (string)llGetFreeMemory());
}
else
{
data = llGetSubString(data, llSubStringIndex(data, "◆") + 1, -1);
data = llStringTrim(data, STRING_TRIM);
string command = llGetSubString(data, 0, llSubStringIndex(data, " ") - 1);
list parts = llParseStringKeepNulls(llGetSubString(data, llSubStringIndex(data, " ") + 1, -1), [" | ", " |", "| ", "|"], []);
if (command == "SITTER")
{
notecard_section = (integer)llList2String(parts, 0);
}
else if (llGetSubString(command, 0, 3) == "PROP")
{
if (llGetListLength(prop_triggers) == 100)
{
Out(0, "Max props is 100, could not add prop!"); // the real limit is less than this due to memory running out first :)
}
else
{
integer prop_type;
if (command == "PROP1")
{
prop_type = 1;
}
else if (command == "PROP2")
{
prop_type = 2;
}
else if (command == "PROP3")
{
prop_type = 3;
}
prop_triggers += [(string)notecard_section + "|" + llList2String(parts, 0)];
prop_types += prop_type;
prop_objects += llList2String(parts, 1);
string prop_group = (string)notecard_section + "|" + llList2String(parts, 2);
prop_groups += prop_group;
if (llListFindList(sequential_prop_groups, [prop_group]) == -1)
{
sequential_prop_groups += prop_group;
}
prop_positions += (vector)llList2String(parts, 3);
prop_rotations += (vector)llList2String(parts, 4);
prop_points += llList2String(parts, 5);
}
}
else if (command == "WARN")
{
WARN = (integer)llList2String(parts, 0);
}
notecard_query = llGetNotecardLine(notecard_name, notecard_line += 1);
}
}
}
}

View file

@ -1,25 +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)
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,230 +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"
// - 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

@ -0,0 +1,427 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright (c) the AVsitter Contributors (http://avsitter.github.io)
* AVsitter™ is a trademark. For trademark use policy see:
* https://avsitter.github.io/TRADEMARK.mediawiki
*
* Please consider supporting continued development of AVsitter and
* receive automatic updates and other benefits! All details and user
* instructions can be found at http://avsitter.github.io
*/
string product = "AVsitter™ sequence";
string version = "2.2";
string main_script = "[AV]sitA";
list SITTERS;
integer DEBUG;
string notecard_name = "[AV]sequence_settings";
integer notecard_line;
key notecard_query;
key notecard_key;
list SEQUENCE_DATA_NAMES;
list SEQUENCE_DATA_ACTIONS;
list SEQUENCE_DATA_DATAS;
string CURRENT_SEQUENCE_NAME;
list CURRENT_SEQUENCE_ACTIONS;
list CURRENT_SEQUENCE_DATAS;
integer SEQUENCE_LINKNUMBER = 90210;
integer SEQUENCE_POINTER = -1;
integer sequence_running;
key CONTROLLER;
key CONTROLLED;
integer menu_channel;
integer menu_handle;
integer playsounds = TRUE;
integer no_waits_yet;
integer verbose = 1;
Out(integer level, string out)
{
if (verbose >= level)
{
llOwnerSay(llGetScriptName() + "[" + version + "] " + out);
}
}
string strReplace(string str, string search, string replace)
{
return llDumpList2String(llParseStringKeepNulls(str, [search], []), replace);
}
DEBUGSay(integer level, string out)
{
if (DEBUG >= level)
{
llWhisper(0, out);
}
}
run_sequence()
{
while (SEQUENCE_POINTER >= 0)
{
string command = llList2String(CURRENT_SEQUENCE_ACTIONS, SEQUENCE_POINTER);
string data = llList2String(CURRENT_SEQUENCE_DATAS, SEQUENCE_POINTER);
list data_list = llParseStringKeepNulls(data, ["|"], []);
if (command == "PLAY")
{
DEBUGSay(2, "Playing pose " + data);
llMessageLinked(LINK_THIS, 90003, data, "");
llSleep(0.5);
}
else if (command == "SAY")
{
llSay(0, parse_text(data));
}
else if (command == "WHISPER")
{
llWhisper(0, parse_text(data));
}
else if (command == "SOUND")
{
if (playsounds)
{
string sound = llList2String(data_list, 0);
float volume = (float)llList2String(data_list, 1);
llPlaySound(sound, volume);
DEBUGSay(2, "Playing sound " + sound + " at volume " + (string)volume);
}
}
else if (command == "LOOP")
{
no_waits_yet = FALSE;
if (SEQUENCE_POINTER == llGetListLength(CURRENT_SEQUENCE_ACTIONS) - 1)
{
SEQUENCE_POINTER = -1;
DEBUGSay(2, "Looping back to start of sequence");
if (sequence_running)
{
llSetTimerEvent(0.1);
}
return;
}
}
else if (command == "WAIT")
{
if (sequence_running)
{
float time = (float)data;
DEBUGSay(2, "Waiting for " + (string)time + " seconds");
llSetTimerEvent(time);
if (time >= 2)
{
integer found;
integer next_POINTER = SEQUENCE_POINTER;
while (next_POINTER++ < llGetListLength(CURRENT_SEQUENCE_ACTIONS) && found == FALSE)
{
string next_command = llList2String(CURRENT_SEQUENCE_ACTIONS, SEQUENCE_POINTER + 1);
if (next_command == "WAIT" || next_command == "SOUND")
{
found = TRUE;
if (next_command == "SOUND")
{
list next_data_list = llParseStringKeepNulls(llList2String(CURRENT_SEQUENCE_DATAS, next_POINTER), ["|"], []);
string sound = llList2String(next_data_list, 0);
DEBUGSay(2, "Preloading sound " + sound);
llPreloadSound(sound);
}
}
}
}
no_waits_yet = FALSE;
}
return;
}
if (++SEQUENCE_POINTER >= llGetListLength(CURRENT_SEQUENCE_ACTIONS))
{
integer index = llListFindList(CURRENT_SEQUENCE_ACTIONS, ["LOOP"]);
if (index != -1)
{
SEQUENCE_POINTER = index;
DEBUGSay(2, "Looping back to line " + (string)SEQUENCE_POINTER + " of sequence");
if (sequence_running)
{
llSetTimerEvent(0.1);
}
return;
}
else
{
stop_sequence(FALSE);
return;
}
}
}
}
integer get_number_of_scripts()
{
integer i;
while (llGetInventoryType(main_script + " " + (string)(++i)) == INVENTORY_SCRIPT)
;
return i;
}
string parse_text(string say)
{
integer i;
for (i = 0; i < llGetListLength(SITTERS); i++)
{
string sitter_name = llList2String(llParseString2List(llKey2Name(llList2String(SITTERS, i)), [" "], []), 0);
if (sitter_name == "")
{
sitter_name = "nobody";
}
say = strReplace(say, "/" + (string)i, sitter_name);
}
return say;
}
start_sequence(integer index)
{
no_waits_yet = (sequence_running = TRUE);
SEQUENCE_POINTER = 0;
CURRENT_SEQUENCE_NAME = llList2String(SEQUENCE_DATA_NAMES, index);
CURRENT_SEQUENCE_ACTIONS = llParseStringKeepNulls(llList2String(SEQUENCE_DATA_ACTIONS, index), ["◆"], []);
CURRENT_SEQUENCE_DATAS = llParseStringKeepNulls(llList2String(SEQUENCE_DATA_DATAS, index), ["◆"], []);
DEBUGSay(1, "Sequence '" + CURRENT_SEQUENCE_NAME + "' Started!");
}
stop_sequence(integer stopSound)
{
if (sequence_running)
{
DEBUGSay(1, "Sequence '" + CURRENT_SEQUENCE_NAME + "' Ended!");
}
sequence_running = FALSE;
SEQUENCE_POINTER = -1;
llSetTimerEvent(0);
if (stopSound && (~llListFindList(CURRENT_SEQUENCE_ACTIONS, ["SOUND"])))
{
llStopSound();
}
}
sequence_control()
{
llListenRemove(menu_handle);
menu_channel = ((integer)llFrand(2147483646) + 1) * -1;
string pauseplay = "▶";
if (sequence_running)
{
pauseplay = "▮▮";
}
list menu_items = ["◀◀", pauseplay, "▶▶"];
menu_handle = llListen(menu_channel, "", CONTROLLER, "");
llDialog(CONTROLLER, product + " " + version + "\n\n[" + CURRENT_SEQUENCE_NAME + "]\n◀◀ = previous anim in sequence.\n▮▮ = pause sequence.\n▶▶ = skip to next anim in sequence.", order_buttons(["[BACK]"] + menu_items), menu_channel);
}
list order_buttons(list buttons)
{
return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4) + llList2List(buttons, -9, -7) + llList2List(buttons, -12, -10);
}
commit_sequence_data()
{
SEQUENCE_DATA_NAMES += CURRENT_SEQUENCE_NAME;
SEQUENCE_DATA_ACTIONS += llDumpList2String(CURRENT_SEQUENCE_ACTIONS, "◆");
SEQUENCE_DATA_DATAS += llDumpList2String(CURRENT_SEQUENCE_DATAS, "◆");
}
default
{
state_entry()
{
notecard_key = llGetInventoryKey(notecard_name);
if (llGetInventoryType(notecard_name) == INVENTORY_NOTECARD)
{
Out(0, "Loading...");
notecard_query = llGetNotecardLine(notecard_name, notecard_line);
}
}
changed(integer change)
{
if (change & CHANGED_INVENTORY)
{
if (llGetInventoryKey(notecard_name) != notecard_key)
{
llResetScript();
}
}
}
dataserver(key query_id, string data)
{
if (query_id == notecard_query)
{
if (data == EOF)
{
commit_sequence_data();
state running;
}
else
{
list datalist = llParseString2List(data, [" "], []);
string command = llList2String(datalist, 0);
data = llStringTrim(llDumpList2String(llList2List(datalist, 1, -1), " "), STRING_TRIM);
list commands = ["PLAY", "WAIT", "SAY", "WHISPER", "SOUND", "LOOP"];
if (command == "DEBUG")
{
DEBUG = (integer)data;
}
else if (command == "SEQUENCE")
{
if (CURRENT_SEQUENCE_NAME)
{
commit_sequence_data();
}
CURRENT_SEQUENCE_NAME = data;
CURRENT_SEQUENCE_ACTIONS = [];
CURRENT_SEQUENCE_DATAS = [];
}
else if (llListFindList(commands, [command]) != -1)
{
CURRENT_SEQUENCE_ACTIONS += command;
CURRENT_SEQUENCE_DATAS += data;
}
notecard_query = llGetNotecardLine(notecard_name, ++notecard_line);
}
}
}
}
state running
{
state_entry()
{
Out(0, (string)llGetListLength(SEQUENCE_DATA_NAMES) + " Sequences Ready, Mem=" + (string)(65536 - llGetUsedMemory()));
integer i;
for (i = 0; i < get_number_of_scripts(); i++)
{
SITTERS += NULL_KEY;
}
}
link_message(integer sender, integer num, string msg, key id)
{
if (sender == llGetLinkNumber())
{
if (num == 90065)
{
integer index = llListFindList(SITTERS, [id]);
if (index != -1)
{
SITTERS = llListReplaceList(SITTERS, [NULL_KEY], index, index);
}
stop_sequence(TRUE);
}
else if (num == 90030)
{
SITTERS = llListReplaceList(SITTERS, [NULL_KEY], (integer)msg, (integer)msg);
SITTERS = llListReplaceList(SITTERS, [NULL_KEY], (integer)((string)id), (integer)((string)id));
stop_sequence(TRUE);
}
else if (num == 90070)
{
SITTERS = llListReplaceList(SITTERS, [id], (integer)msg, (integer)msg);
}
else if (num == 90000)
{
stop_sequence(TRUE);
integer index = llListFindList(SEQUENCE_DATA_NAMES, [msg]);
if (index != -1)
{
start_sequence(index);
run_sequence();
}
}
else if (num == 90205)
{
llMessageLinked(LINK_SET, 90005, "", id);
playsounds = (!playsounds);
if (playsounds)
{
llSay(0, "Sounds ON");
}
else
{
llSay(0, "Sounds OFF");
llStopSound();
}
}
else if (num == SEQUENCE_LINKNUMBER)
{
stop_sequence(TRUE);
list data = llParseStringKeepNulls(id, ["|"], []);
CONTROLLER = (key)llList2String(data, 0);
CONTROLLED = (key)llList2String(data, -1);
integer index = llListFindList(SEQUENCE_DATA_NAMES, [msg]);
if (index != -1)
{
start_sequence(index);
if ((~llListFindList(CURRENT_SEQUENCE_ACTIONS, ["WAIT"])) && (~llListFindList(CURRENT_SEQUENCE_ACTIONS, ["PLAY"])))
{
sequence_control();
}
else
{
llMessageLinked(LINK_SET, 90005, "", id);
}
run_sequence();
}
}
}
}
listen(integer listen_channel, string name, key id, string msg)
{
if (msg == "▮▮")
{
sequence_running = FALSE;
llSetTimerEvent(0);
DEBUGSay(1, "Sequence '" + CURRENT_SEQUENCE_NAME + "' Paused!");
}
else if (msg == "▶")
{
sequence_running = TRUE;
SEQUENCE_POINTER++;
DEBUGSay(1, "Sequence '" + CURRENT_SEQUENCE_NAME + "' Resumed!");
run_sequence();
}
else if (msg == "▶▶")
{
SEQUENCE_POINTER++;
run_sequence();
}
else if (msg == "◀◀")
{
integer count_waits;
while (SEQUENCE_POINTER > -1 && count_waits < 2)
{
SEQUENCE_POINTER--;
if (llList2String(CURRENT_SEQUENCE_ACTIONS, SEQUENCE_POINTER) == "WAIT")
{
count_waits++;
}
}
SEQUENCE_POINTER++;
run_sequence();
}
else if (msg == "[BACK]")
{
llMessageLinked(LINK_SET, 90005, "", (string)id + "|" + (string)CONTROLLED);
return;
}
sequence_control();
}
timer()
{
llSetTimerEvent(0);
SEQUENCE_POINTER++;
run_sequence();
}
on_rez(integer start)
{
playsounds = TRUE;
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
}
if (change & CHANGED_INVENTORY)
{
if (llGetInventoryKey(notecard_name) != notecard_key || get_number_of_scripts() != llGetListLength(SITTERS))
{
llResetScript();
}
}
}
}