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

61
.gitignore vendored Normal file
View file

@ -0,0 +1,61 @@
UPDATES.md
TODO.md
NOTES.md
MARKETPLACE.md
optimized
# Compressed/optimized LSL scripts
*.lslz
.project
.buildpath
.settings
.externalToolBuilders
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
# =========================
# Operating System Files
# =========================
# OSX
# =========================
.DS_Store
.AppleDouble
.LSOverride
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

502
AVsitter1/AVadjuster.lsl Normal file
View file

@ -0,0 +1,502 @@
/*
* 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
*/
float version = 1.1;
string helper_name = "AVhelper";
string notecard_name = "AVpos";
key notecard_key;
integer active_link;
integer active_sitter;
string pose_name;
integer total_scripts;
list HELPER_KEY_LIST;
list HELPER_AV_LIST;
list INVOLVED;
list HELPER_POS_ROT;
list HELPERS_REZZED;
integer menu_page;
string adding;
string last_text;
integer choosing;
integer choice_page;
integer choice_pages;
integer number_per_page = 9;
string chosen_animation;
string chosen_animation2;
integer dont_move;
integer comm_channel;
string strReplace(string str, string search, string replace)
{
return llDumpList2String(llParseStringKeepNulls((str = "") + str, [search], []), replace);
}
Owner_Say(string say)
{
llOwnerSay(llGetScriptName() + ": " + say);
}
list order_buttons(list buttons)
{
return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4) + llList2List(buttons, -9, -7) + llList2List(buttons, -12, -10);
}
clean_avhelper()
{
integer i;
for (i = 0; i < llGetInventoryNumber(INVENTORY_OBJECT); i++)
{
if (llGetSubString(llGetInventoryName(INVENTORY_OBJECT, i), 0, llStringLength(helper_name) - 1) == helper_name)
{
llOwnerSay("Cleaning \"" + llGetInventoryName(INVENTORY_OBJECT, i) + "\" from prim " + (string)llGetLinkNumber());
llRemoveInventory(llGetInventoryName(INVENTORY_OBJECT, i));
i--;
}
}
}
calc_sit_target(integer script, key av, key target)
{
if (llList2Vector(llGetObjectDetails(target, [OBJECT_POS]), 0) != ZERO_VECTOR)
{
list details = [OBJECT_POS, OBJECT_ROT];
rotation f = llList2Rot(details = llGetObjectDetails(llGetLinkKey(active_link), details) + llGetObjectDetails(target, details), 1);
rotation target_rot = llList2Rot(details, 3) / f;
vector target_pos = (llList2Vector(details, 2) - llList2Vector(details, 0)) / f;
string posrot = (string)target_pos + "|" + (string)(llRot2Euler(target_rot) * RAD_TO_DEG);
llMessageLinked(active_link, 90090, (string)script, posrot);
HELPER_POS_ROT = llListReplaceList(HELPER_POS_ROT, [posrot], script, script);
llRegionSay(comm_channel, "POS|" + (string)script + "|" + convert_to_world_positions(script));
}
}
string convert_to_world_positions(integer num)
{
list details = llGetObjectDetails(llGetLinkKey(active_link), [OBJECT_POS, OBJECT_ROT]);
list HELPER_POSITION = llParseStringKeepNulls(llList2String(HELPER_POS_ROT, num), ["|"], []);
rotation target_rot = llEuler2Rot((vector)llList2String(HELPER_POSITION, 1) * DEG_TO_RAD) * llList2Rot(details, 1);
vector target_pos = (vector)llList2String(HELPER_POSITION, 0) * llList2Rot(details, 1) + llList2Vector(details, 0);
return (string)target_pos + "|" + (string)target_rot;
}
new_menu()
{
menu_page = 0;
list menu_items = ["[BACK]", "~", "~", "[POSE]", "[SYNC]", "[SUBMENU]"];
string menu_text = "\nWhat would you like to create?:";
llDialog(llGetOwner(), menu_text, order_buttons(menu_items), comm_channel);
}
choice_menu(list options, string menu_text)
{
last_text = menu_text;
choosing = TRUE;
menu_text = "\n" + menu_text + "\n\n";
list menu_items;
integer i;
if (llGetListLength(options) == 0)
{
menu_text = "\nNo animations in the prim inventory.";
menu_items = ["[BACK]"];
}
else
{
for (i = 0; i < llGetListLength(options); i++)
{
menu_items += (string)(i + 1);
menu_text += (string)(i + 1) + "." + llList2String(options, i) + "\n";
}
while (llGetListLength(menu_items) < number_per_page)
{
menu_items += "~";
}
menu_items += ["[BACK]", "[PAGE-]", "[PAGE+]"];
}
llDialog(llGetOwner(), menu_text, order_buttons(menu_items), comm_channel);
}
list get_contents(integer type, integer newpage)
{
choice_page = newpage;
list contents;
integer i;
integer start = number_per_page * choice_page;
integer end = start + number_per_page;
for (i = start; i < end; i++)
{
if (i < llGetInventoryNumber(type))
{
if (type != INVENTORY_OBJECT || type == INVENTORY_OBJECT && llGetInventoryName(type, i) != "AVhelper")
{
contents += llGetInventoryName(type, i);
}
}
}
i = llGetInventoryNumber(type);
if (type == INVENTORY_OBJECT)
{
i--;
}
choice_pages = i / number_per_page;
return contents;
}
default
{
state_entry()
{
notecard_key = llGetInventoryKey(notecard_name);
comm_channel = ((integer)llFrand(999999) + 1) * 1000 * -1;
llMessageLinked(LINK_SET, comm_channel, "Adjuster-Check", NULL_KEY);
llListen(comm_channel, "", "", "");
llListen(5, "", llGetOwner(), "cleanup");
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
if (llGetInventoryType(helper_name) == INVENTORY_OBJECT)
{
llMessageLinked(LINK_SET, 90085, "", NULL_KEY);
}
}
else if (change & CHANGED_INVENTORY)
{
if (llGetInventoryKey(notecard_name) != notecard_key)
{
llRegionSay(comm_channel, "DONEA");
notecard_key = llGetInventoryKey(notecard_name);
}
}
}
link_message(integer sender, integer num, string msg, key id)
{
if (num == 90030)
{
HELPER_AV_LIST = llListReplaceList(HELPER_AV_LIST, [NULL_KEY], (integer)msg, (integer)msg);
HELPER_AV_LIST = llListReplaceList(HELPER_AV_LIST, [NULL_KEY], (integer)((string)id), (integer)((string)id));
integer i = llList2Integer(HELPERS_REZZED, (integer)msg);
HELPERS_REZZED = llListReplaceList(HELPERS_REZZED, [llList2Integer(HELPERS_REZZED, (integer)((string)id))], (integer)msg, (integer)msg);
HELPERS_REZZED = llListReplaceList(HELPERS_REZZED, [i], (integer)((string)id), (integer)((string)id));
llRegionSay(comm_channel, "SWAP|" + (string)((integer)msg) + "|" + (string)((integer)((string)id)));
}
else if (num == 90010)
{
integer i;
for (i = 0; i < llGetListLength(HELPER_AV_LIST); i++)
{
if (llList2Integer(HELPERS_REZZED, i) == TRUE)
{
if (llList2Key(HELPER_AV_LIST, i) != NULL_KEY)
{
calc_sit_target(i, llList2Key(HELPER_AV_LIST, i), llList2Key(HELPER_AV_LIST, i));
}
else
{
calc_sit_target(i, llList2Key(HELPER_AV_LIST, i), llList2Key(HELPER_KEY_LIST, i));
}
}
}
string type = "POSE '" + pose_name;
if (llSubStringIndex(pose_name, "S:") == 0)
{
type = "SYNC '" + llGetSubString(pose_name, 2, -1);
}
llSay(0, type + "' saved to memory.");
}
else if (num == 90060)
{
llRegionSay(comm_channel, "DONEA");
}
else if (num == 90040)
{
active_link = sender;
if (llGetNumberOfPrims() == 1)
{
active_link = 0;
}
list data = llParseString2List(msg, ["|"], []);
HELPER_POS_ROT = [];
INVOLVED = [];
total_scripts = llList2Integer(data, 1);
integer i;
for (i = 0; i < total_scripts; i++)
{
HELPER_POS_ROT += "~";
INVOLVED += FALSE;
}
active_sitter = llList2Integer(data, 0);
llMessageLinked(active_link, 90110, (string)active_sitter, "");
}
else if (num == 90100)
{
llRegionSay(comm_channel, "DONEA");
integer i = llGetNumberOfPrims();
while (llGetAgentSize(llGetLinkKey(i)) != ZERO_VECTOR)
{
llUnSit(llGetLinkKey(i));
i--;
}
active_link = sender;
if (llGetNumberOfPrims() == 1)
{
active_link = 0;
}
list data = llParseString2List(msg, ["|"], []);
HELPER_KEY_LIST = [];
HELPER_AV_LIST = [];
INVOLVED = [];
HELPER_POS_ROT = [];
HELPERS_REZZED = [];
total_scripts = llList2Integer(data, 1);
for (i = 0; i < total_scripts; i++)
{
HELPER_KEY_LIST += NULL_KEY;
HELPER_AV_LIST += NULL_KEY;
INVOLVED += FALSE;
HELPER_POS_ROT += "~";
HELPERS_REZZED += FALSE;
}
active_sitter = llList2Integer(data, 0);
llMessageLinked(active_link, 90110, (string)active_sitter, "");
}
else if (num == 90070 && sender == active_link)
{
HELPER_AV_LIST = llListReplaceList(HELPER_AV_LIST, [id], (integer)msg, (integer)msg);
}
else if (num == 90130)
{
list data = llParseString2List(msg, [">"], []);
integer sending_script = (integer)((string)id);
HELPER_POS_ROT = llListReplaceList(HELPER_POS_ROT, [llList2String(data, 0) + ">" + "|" + llList2String(data, 1) + ">"], sending_script, sending_script);
INVOLVED = llListReplaceList(INVOLVED, [llList2Integer(data, 2)], sending_script, sending_script);
if (llListFindList(HELPER_POS_ROT, ["~"]) == -1)
{
integer i;
for (i = 0; i < llGetListLength(HELPERS_REZZED); i++)
{
if (llList2Integer(INVOLVED, i) != FALSE)
{
if (llList2Integer(HELPERS_REZZED, i) == FALSE)
{
llRezObject(helper_name, llGetPos(), ZERO_VECTOR, llGetRot(), comm_channel + i * -1);
HELPERS_REZZED = llListReplaceList(HELPERS_REZZED, [TRUE], i, i);
}
else
{
if (!dont_move)
{
llRegionSay(comm_channel, "POS|" + (string)i + "|" + convert_to_world_positions(i));
}
}
}
else if (llList2Integer(HELPERS_REZZED, i) == TRUE)
{
if (llList2Key(HELPER_AV_LIST, i) != NULL_KEY)
{
HELPER_AV_LIST = llListReplaceList(HELPER_AV_LIST, [NULL_KEY], i, i);
llMessageLinked(LINK_THIS, 90075, (string)i, NULL_KEY);
}
HELPERS_REZZED = llListReplaceList(HELPERS_REZZED, [FALSE], i, i);
llRegionSay(comm_channel, "DONE|" + (string)i);
}
}
dont_move = FALSE;
}
}
if (num == 90160)
{
if (id == llGetOwner())
{
active_sitter = (integer)msg;
if (sender == llGetLinkNumber())
{
adding = "";
new_menu();
}
else
{
llInstantMessage(id, "Sorry, the [NEW] menu is only available if your AVadjuster and AVhelper are in the same prim as your AVsit.");
}
}
else
{
llInstantMessage(id, "Sorry, the [NEW] menu is for owner only.");
}
}
else if (msg == "Adjuster-Check" && num != comm_channel)
{
clean_avhelper();
llOwnerSay("Deleting \"" + llGetScriptName() + "\" from prim " + (string)llGetLinkNumber());
llOwnerSay("Please place only one Adjuster in your linkset!");
llRemoveInventory(llGetScriptName());
}
else if (num == 90045)
{
list data = llParseStringKeepNulls(msg, ["|"], []);
pose_name = llList2String(data, 0);
}
}
listen(integer chan, string name, key id, string message)
{
if (chan == 5)
{
llRegionSay(comm_channel, "DONEA");
clean_avhelper();
llOwnerSay("Cleaning \"" + llGetScriptName() + "\" from prim " + (string)llGetLinkNumber());
llRemoveInventory(llGetScriptName());
}
else if (id == llGetOwner())
{
if (message == "[PAGE+]")
{
choice_page++;
if (choice_page > choice_pages)
{
choice_page = 0;
}
choice_menu(get_contents(INVENTORY_ANIMATION, choice_page), last_text);
}
else if (message == "[PAGE-]")
{
choice_page--;
if (choice_page < 0)
{
choice_page = choice_pages;
}
choice_menu(get_contents(INVENTORY_ANIMATION, choice_page), last_text);
}
else if (message == "[BACK]")
{
llMessageLinked(LINK_SET, 90005, "", id);
}
else if (message == "[POSE]")
{
adding = message;
choice_menu(get_contents(INVENTORY_ANIMATION, 0), "Please choose your animation:");
}
else if (message == "[SYNC]")
{
if (total_scripts < 2)
{
Owner_Say("To create a SYNC via menu requires 2 AVsit scripts in the prim!");
new_menu();
}
else
{
adding = message;
choice_menu(get_contents(INVENTORY_ANIMATION, 0), "Please choose your first animation:");
}
}
else if (message == "[SUBMENU]")
{
adding = message;
llTextBox(llGetOwner(), "\n\nPlease type a name for your submenu:", comm_channel);
}
else if (llListFindList(["1", "2", "3", "4", "5", "6", "7", "8", "9"], [message]) != -1 && (adding == "[POSE]" || adding == "[SYNC]" || adding == "[SYNC]2"))
{
string anim = llList2String(get_contents(INVENTORY_ANIMATION, choice_page), (integer)message - 1);
if (adding == "[POSE]")
{
adding = "[POSE]2";
chosen_animation = anim;
llTextBox(llGetOwner(), "\n\nPlease type a menu name for pose\n\nAnimation: " + chosen_animation, comm_channel);
}
else if (adding == "[SYNC]2")
{
adding = "[SYNC]3";
chosen_animation2 = anim;
llTextBox(llGetOwner(), "\n\nPlease type a menu name for sync\n\nAnimation1: " + chosen_animation + "\nAnimation2: " + chosen_animation2, comm_channel);
}
else if (adding == "[SYNC]")
{
adding = "[SYNC]2";
chosen_animation = anim;
choice_menu(get_contents(INVENTORY_ANIMATION, 0), "Please choose your second animation:");
}
}
else
{
message = strReplace(message, "\n", "");
message = strReplace(message, "|", "");
message = llGetSubString(message, 0, 22);
if (message == "")
{
llMessageLinked(LINK_SET, 90005, "", id);
}
else if (adding == "[SUBMENU]")
{
llMessageLinked(active_link, 90170, (string)active_sitter, "T:" + message + "*|");
llMessageLinked(active_link, 90170, (string)active_sitter, "M:" + message + "*|");
Owner_Say("Created submenu '" + message + "' in SITTER " + (string)active_sitter);
llMessageLinked(LINK_SET, 90005, "", id);
}
else if (adding == "[POSE]2")
{
llMessageLinked(active_link, 90170, (string)active_sitter, message + "|" + chosen_animation);
llMessageLinked(active_link, 90110, (string)active_sitter, "");
llSay(0, "Added POSE '" + message + "' using anim '" + chosen_animation + "' in SITTER " + (string)active_sitter);
dont_move = TRUE;
}
else if (adding == "[SYNC]3")
{
message = "S:" + message;
llMessageLinked(active_link, 90170, (string)0, message + "|" + chosen_animation);
llMessageLinked(active_link, 90170, (string)1, message + "|" + chosen_animation2);
llMessageLinked(active_link, 90110, (string)active_sitter, "");
llSay(0, "Added SYNC '" + llGetSubString(message, 2, -1) + "' using anms '" + chosen_animation + "' and '" + chosen_animation2 + "'");
dont_move = TRUE;
}
if (adding == "[POSE]2" || adding == "[SYNC]3")
{
llMessageLinked(LINK_SET, 90005, "", id);
HELPER_POS_ROT = [];
INVOLVED = [];
integer i;
for (i = 0; i < total_scripts; i++)
{
HELPER_POS_ROT += "~";
INVOLVED += FALSE;
}
}
}
}
else if (llGetOwnerKey(id) == llGetOwner())
{
list data = llParseString2List(message, ["|"], []);
integer num = llList2Integer(data, 1);
if (llList2String(data, 0) == "REG")
{
HELPER_KEY_LIST = llListReplaceList(HELPER_KEY_LIST, [id], num, num);
llRegionSay(comm_channel, "POS|" + (string)num + "|" + convert_to_world_positions(num));
}
else if (llList2String(data, 0) == "ANIMA")
{
integer i;
for (i = 0; i < llGetListLength(HELPER_AV_LIST); i++)
{
if (llList2Key(HELPER_AV_LIST, i) == llList2Key(data, 2))
{
HELPER_AV_LIST = llListReplaceList(HELPER_AV_LIST, [NULL_KEY], i, i);
llMessageLinked(LINK_SET, 90075, (string)i, NULL_KEY);
}
}
llMessageLinked(active_link, 90050, (string)llList2Key(data, 1), llList2Key(data, 2));
}
else if (llList2String(data, 0) == "GETUP")
{
HELPER_AV_LIST = llListReplaceList(HELPER_AV_LIST, [NULL_KEY], num, num);
llMessageLinked(LINK_SET, 90075, (string)num, NULL_KEY);
}
else if (llList2String(data, 0) == "MENU")
{
llMessageLinked(LINK_SET, 90005, "3", llList2Key(data, 2));
}
}
}
on_rez(integer x)
{
llResetScript();
}
}

967
AVsitter1/AVplus.lsl Normal file
View file

@ -0,0 +1,967 @@
/*
* 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_and_version = "AVsitter™ AVplus 1.4";
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 != "";
}
list SITTERS;
integer sticky_rez;
integer expressions_toggle_off;
vector camera_position;
vector camera_focus;
integer script_channel;
key playing_sound_for;
key playing_prop_for;
string anim_name;
string pose_name;
string raw_pose_name;
integer page;
integer pages;
integer loop;
float volume = 1;
string sound;
string notecard_name = "AVpos";
string script_basename = "AVplus";
string mainscript_basename = "AVsit";
list prop_triggers;
list props;
list sound_triggers;
list sounds;
list item_triggers;
list items;
list anim_triggers;
list anims;
integer comm_channel;
integer menu_channel;
integer comm_listen_handle;
integer menu_listen_handle;
string menu_type;
key notecard_key;
key notecard_query;
integer notecard_line;
list running_sequences_keys;
list running_sequences_trigger_index;
list running_sequences_pointers;
Owner_Say(string say)
{
llOwnerSay(llGetScriptName() + ":" + say);
}
Readout_Say(string say)
{
llOwnerSay("◆" + say);
}
list order_buttons(list buttons)
{
return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4) + llList2List(buttons, -9, -7) + llList2List(buttons, -12, -10);
}
check_sitters()
{
integer i;
for (i = 0; i < llGetListLength(SITTERS); i++)
{
if (llList2Key(SITTERS, i) != NULL_KEY)
{
jump skip;
}
}
remove_props();
running_sequences_keys = [];
running_sequences_trigger_index = [];
running_sequences_pointers = [];
pose_name = "";
@skip;
}
integer get_number_of_scripts(string basename)
{
integer i = 1;
while (llGetInventoryType(basename + " " + (string)i) == INVENTORY_SCRIPT)
{
i++;
}
return i;
}
remove_props()
{
llRegionSay(comm_channel, "REMPROPS");
}
rez_prop(integer index)
{
list data = llParseStringKeepNulls(llList2String(props, index), ["|"], []);
string object = llList2String(data, 0);
vector pos = (vector)llList2String(data, 1);
rotation rot = llEuler2Rot((vector)llList2String(data, 2));
rot = llEuler2Rot((vector)llList2String(data, 2) * DEG_TO_RAD) * llGetRot();
pos = (vector)llList2String(data, 1) * llGetRot() + llGetPos();
llRezAtRoot(object, pos, ZERO_VECTOR, rot, comm_channel);
}
play_sound(integer index)
{
list data = llParseStringKeepNulls(llList2String(sounds, index), ["|"], []);
string sound = llList2String(data, 0);
integer loop = (integer)llList2String(data, 1);
float volume = (float)llList2String(data, 2);
if (loop)
{
llLoopSound(sound, volume);
}
else
{
llPlaySound(sound, volume);
}
}
give_item(integer index, string anim_name, key id)
{
list data = llParseStringKeepNulls(llList2String(items, index), ["|"], []);
string item = llList2String(data, 0);
string anim = llList2String(data, 1);
if (anim == "" || anim == anim_name)
{
llSleep(1);
llGiveInventory(id, item);
}
}
start_sequence(integer index, string anim_name, key id)
{
list data = llParseStringKeepNulls(llList2String(anims, index), ["|"], []);
string anim = llList2String(data, 1);
if (anim == "" || anim == anim_name)
{
integer index2 = llListFindList(running_sequences_trigger_index, [index]);
if (index2 != -1)
{
if (llList2Key(running_sequences_keys, index2) == id)
{
running_sequences_keys = llListReplaceList(running_sequences_keys, [], index2, index2);
running_sequences_trigger_index = llListReplaceList(running_sequences_trigger_index, [], index2, index2);
running_sequences_pointers = llListReplaceList(running_sequences_pointers, [], index2, index2);
}
}
running_sequences_keys += id;
running_sequences_trigger_index += index;
running_sequences_pointers += 0;
}
if (llGetListLength(running_sequences_keys) > 0)
{
llSetTimerEvent(0.01);
}
}
sequence()
{
list seq_anims;
list seq_ids;
integer i;
while (i < llGetListLength(running_sequences_pointers))
{
integer anim_index = llList2Integer(running_sequences_trigger_index, i);
integer sequence_pointer = llList2Integer(running_sequences_pointers, i);
list data = llParseStringKeepNulls(llList2String(anims, anim_index), ["|"], []);
list sequence = llParseStringKeepNulls(llList2String(data, 0), [":"], []);
list sequence_animations = llList2ListStrided(sequence, 0, -1, 2);
list sequence_times = llList2ListStrided(llDeleteSubList(sequence, 0, 0), 0, -1, 2);
integer sequence_length;
integer j;
while (j <= llGetListLength(sequence_times))
{
if (sequence_length == sequence_pointer)
{
string anim = llList2String(sequence_animations, j);
if (IsInteger(anim))
{
anim = llList2String(facial_anim_list, (integer)anim);
}
seq_anims += anim;
seq_ids += llList2Key(running_sequences_keys, i);
}
if (llList2String(sequence_times, j) == "-")
{
sequence_pointer++;
jump go;
}
sequence_length += (integer)llList2String(sequence_times, j);
j++;
}
sequence_pointer++;
if (sequence_pointer == sequence_length)
{
sequence_pointer = 0;
}
@go;
running_sequences_pointers = llListReplaceList(running_sequences_pointers, [sequence_pointer], i, i);
i++;
}
if (!expressions_toggle_off)
{
for (i = 0; i < llGetListLength(seq_anims); i++)
{
llMessageLinked(LINK_SET, 90001, llList2String(seq_anims, i), llList2Key(seq_ids, i));
}
}
}
remove_sequences(key id)
{
integer index;
while (llListFindList(running_sequences_keys, [id]) != -1)
{
index = llListFindList(running_sequences_keys, [id]);
running_sequences_keys = llDeleteSubList(running_sequences_keys, index, index);
running_sequences_trigger_index = llDeleteSubList(running_sequences_trigger_index, index, index);
running_sequences_pointers = llDeleteSubList(running_sequences_pointers, index, index);
}
if (llGetListLength(running_sequences_keys) == 0)
{
llSetTimerEvent(0);
}
}
main_menu()
{
page = 0;
string text = "N/A";
if (camera_position != ZERO_VECTOR)
{
text = "YES";
}
string menu_text = "\n" + product_and_version + "\nEXTRAS for Pose:" + pose_name + "\n\nCamera:" + text + "\nProp:";
integer i;
text = "N/A";
for (i = 0; i < llGetListLength(prop_triggers); i++)
{
if (llList2String(prop_triggers, i) == pose_name)
{
text = llList2String(llParseStringKeepNulls(llList2String(props, i), ["|"], []), 0);
}
}
menu_text += text + "\nSound:";
text = "N/A";
for (i = 0; i < llGetListLength(sound_triggers); i++)
{
if (llList2String(sound_triggers, i) == pose_name)
{
text = llList2String(llParseStringKeepNulls(llList2String(sounds, i), ["|"], []), 0);
}
}
menu_text += text + "\nItem:";
text = "N/A";
for (i = 0; i < llGetListLength(item_triggers); i++)
{
if (llList2String(item_triggers, i) == pose_name)
{
text = llList2String(llParseStringKeepNulls(llList2String(items, i), ["|"], []), 0);
}
}
menu_text += text + "\nFace:";
text = "N/A";
for (i = 0; i < llGetListLength(anim_triggers); i++)
{
if (llList2String(anim_triggers, i) == pose_name)
{
text = llList2String(llParseStringKeepNulls(llList2String(anims, i), ["|", ":"], []), 0);
}
}
menu_text += text + "\n";
list menu_items = ["[TOP]", "[CAMERA]", "[PROPS]", "[SOUNDS]", "[ITEMS]", "[FACES]"];
llDialog(llGetOwner(), menu_text, order_buttons(menu_items), menu_channel);
}
choice_menu(list options)
{
string menu_text = "\nPlease choose your item:\n\n";
list menu_items;
integer i;
if (llGetListLength(options) == 0)
{
menu_text = "\nNo items of that type in the prim inventory.";
menu_items = ["[BACK]"];
}
else
{
for (i = 0; i < llGetListLength(options); i++)
{
menu_items += (string)(i + 1);
menu_text += (string)(i + 1) + "." + llList2String(options, i) + "\n";
}
while (llGetListLength(menu_items) < 8)
{
menu_items += "~";
}
menu_items += ["[CLEAR]", "[BACK]", "[PAGE-]", "[PAGE+]"];
}
llDialog(llGetOwner(), menu_text, order_buttons(menu_items), menu_channel);
}
list facial_anims(integer newpage)
{
page = newpage;
pages = llGetListLength(facial_anim_list) / 8;
integer start = 8 * page;
return llList2List(facial_anim_list, start, start + 8 - 1);
}
list get_contents(integer type, integer newpage)
{
page = newpage;
list contents;
integer i;
integer start = 8 * page;
integer end = start + 8;
for (i = start; i < end; i++)
{
if (i < llGetInventoryNumber(type))
{
if (type != INVENTORY_OBJECT || type == INVENTORY_OBJECT && llGetInventoryName(type, i) != "AVhelper")
{
contents += llGetInventoryName(type, i);
}
}
}
i = llGetInventoryNumber(type);
if (type == INVENTORY_OBJECT)
{
i--;
}
pages = i / 8;
return contents;
}
menu_determine(string mtype)
{
if (mtype == "[PROPS]")
{
choice_menu(get_contents(INVENTORY_OBJECT, page));
}
else if (mtype == "[SOUNDS]")
{
choice_menu(get_contents(INVENTORY_SOUND, page));
}
else if (mtype == "[FACES]")
{
choice_menu(facial_anims(page));
}
else if (mtype == "[ITEMS]")
{
choice_menu(get_contents(INVENTORY_OBJECT, page));
}
else if (mtype == "[CAMERA]")
{
if (llGetPermissionsKey() == llGetOwner() && llGetPermissions() & PERMISSION_TRACK_CAMERA)
{
camera_menu();
}
else
{
llRequestPermissions(llGetOwner(), PERMISSION_TRACK_CAMERA);
}
}
menu_type = mtype;
}
camera_menu()
{
list menu_items = ["[BACK]", "[SET]", "[RELEASE]"];
llDialog(llGetOwner(), "\nChoose a camera angle and click [SET], or use [RELEASE] to clear it.", order_buttons(menu_items), menu_channel);
}
sound_menu()
{
llPlaySound("ed124764-705d-d497-167a-182cd9fa2e6c", 0);
if (loop)
{
llLoopSound(sound, volume);
}
else
{
llPlaySound(sound, volume);
}
playing_sound_for = llGetOwner();
list menu_items = ["[SOUNDS]", "~"];
if (loop)
{
menu_items += ["[NO LOOP]"];
}
else
{
menu_items += ["[LOOP]"];
}
menu_items += ["[VOLUME-]", "[VOLUME+]", "[OK]"];
llDialog(llGetOwner(), "\nConfigure your sound:\n\nSound:" + sound + "\nVolume:" + (string)((integer)(volume / 1 * 100)) + "%", order_buttons(menu_items), menu_channel);
}
default
{
timer()
{
sequence();
llSetTimerEvent(1);
}
state_entry()
{
script_channel = (integer)llGetSubString(llGetScriptName(), llSubStringIndex(llGetScriptName(), " "), -1);
if (script_channel != 0)
{
state nothing;
}
integer i;
for (i = 0; i < get_number_of_scripts(mainscript_basename); i++)
{
SITTERS += NULL_KEY;
}
llPlaySound("ed124764-705d-d497-167a-182cd9fa2e6c", 0);
comm_channel = ((integer)llFrand(2147483646) + 1) * -1;
menu_channel = ((integer)llFrand(2147483646) + 1) * -1;
comm_listen_handle = llListen(comm_channel, "", "", "SAVEPROP");
menu_listen_handle = llListen(menu_channel, "", llGetOwner(), "");
llListenControl(comm_listen_handle, FALSE);
llListenControl(menu_listen_handle, FALSE);
notecard_key = llGetInventoryKey(notecard_name);
if (llGetInventoryType(notecard_name) == INVENTORY_NOTECARD)
{
Owner_Say("Reading " + notecard_name);
notecard_query = llGetNotecardLine(notecard_name, 0);
}
}
on_rez(integer start)
{
comm_channel = ((integer)llFrand(2147483646) + 1) * -1;
menu_channel = ((integer)llFrand(2147483646) + 1) * -1;
}
listen(integer channel, string name, key id, string message)
{
if (channel == menu_channel)
{
if (id == llGetOwner())
{
if (message == "[TOP]")
{
llMessageLinked(LINK_SET, 90005, "", id);
}
else if (message == "[CLEAR]")
{
if (menu_type == "[PROPS]")
{
integer i;
for (i = 0; i < llGetListLength(prop_triggers); i++)
{
if (llList2String(prop_triggers, i) == pose_name)
{
prop_triggers = llDeleteSubList(prop_triggers, i, i);
props = llDeleteSubList(props, i, i);
}
}
}
else if (menu_type == "[SOUNDS]")
{
integer i;
for (i = 0; i < llGetListLength(sound_triggers); i++)
{
if (llList2String(sound_triggers, i) == pose_name)
{
sound_triggers = llDeleteSubList(sound_triggers, i, i);
sounds = llDeleteSubList(sounds, i, i);
llPlaySound("ed124764-705d-d497-167a-182cd9fa2e6c", 0);
}
}
}
else if (menu_type == "[ITEMS]")
{
integer i;
for (i = 0; i < llGetListLength(item_triggers); i++)
{
if (llList2String(item_triggers, i) == pose_name)
{
item_triggers = llDeleteSubList(item_triggers, i, i);
items = llDeleteSubList(items, i, i);
}
}
}
else if (menu_type == "[FACES]")
{
integer i;
for (i = 0; i < llGetListLength(anim_triggers); i++)
{
if (llList2String(anim_triggers, i) == pose_name)
{
anim_triggers = llDeleteSubList(anim_triggers, i, i);
anims = llDeleteSubList(anims, i, i);
remove_sequences(llGetOwner());
}
}
}
main_menu();
}
else if (message == "[BACK]")
{
main_menu();
}
else if (message == "[PAGE+]" || message == "[PAGE-]")
{
if (message == "[PAGE-]")
{
page--;
if (page < 0)
{
page = pages;
}
}
else
{
page++;
if (page > pages)
{
page = 0;
}
}
menu_determine(menu_type);
}
else if (message == "[SET]")
{
if (llGetPermissions() & PERMISSION_TRACK_CAMERA)
{
llPlaySound("3d09f582-3851-c0e0-f5ba-277ac5c73fb4", 1.);
list details = [OBJECT_POS, OBJECT_ROT];
rotation f = llList2Rot(details = llGetObjectDetails(llGetKey(), details) + llGetCameraPos() + llGetCameraRot(), 1);
rotation camera_rotation = llList2Rot(details, 3) / f;
camera_position = (llList2Vector(details, 2) - llList2Vector(details, 0)) / f;
camera_focus = camera_position + 1 * llRot2Fwd(camera_rotation);
main_menu();
}
}
else if (message == "[RELEASE]")
{
camera_position = ZERO_VECTOR;
main_menu();
}
else if (message == "[VOLUME+]" || message == "[VOLUME-]")
{
if (message == "[VOLUME-]")
{
volume -= 0.2;
}
else
{
volume += 0.2;
}
if (volume < 0)
{
volume = 0;
}
else if (volume > 1)
{
volume = 1;
}
sound_menu();
}
else if (message == "[OK]")
{
integer i;
for (i = 0; i < llGetListLength(sound_triggers); i++)
{
if (llList2String(sound_triggers, i) == pose_name)
{
sound_triggers = llDeleteSubList(sound_triggers, i, i);
sounds = llDeleteSubList(sounds, i, i);
}
}
sound_triggers += pose_name;
sounds += sound + "|" + (string)loop + "|1";
main_menu();
}
else if (message == "[LOOP]" || message == "[NO LOOP]")
{
loop = 0;
if (message == "[LOOP]")
{
loop = 1;
}
sound_menu();
}
else if (llListFindList(["1", "2", "3", "4", "5", "6", "7", "8", "9"], [message]) != -1)
{
if (menu_type == "[PROPS]")
{
remove_props();
string object = llList2String(get_contents(INVENTORY_OBJECT, page), (integer)message - 1);
llRezObject(object, llGetPos() + <0,0,2>, ZERO_VECTOR, llGetRootRotation(), comm_channel);
playing_prop_for = id;
llSay(0, "Please position your prop and click [SAVE] when done.");
llMessageLinked(LINK_SET, 90005, "", id);
}
else if (menu_type == "[SOUNDS]")
{
sound = llList2String(get_contents(INVENTORY_SOUND, page), (integer)message - 1);
sound_menu();
}
else if (menu_type == "[FACES]")
{
integer i;
for (i = 0; i < llGetListLength(anim_triggers); i++)
{
if (llList2String(anim_triggers, i) == pose_name)
{
anim_triggers = llDeleteSubList(anim_triggers, i, i);
anims = llDeleteSubList(anims, i, i);
}
}
string anim = llList2String(facial_anims(page), (integer)message - 1);
anim_triggers += pose_name;
anims += anim + ":1|";
integer index = llListFindList(anim_triggers, [pose_name]);
if (index != -1)
{
start_sequence(index, anim_name, llGetOwner());
}
main_menu();
}
else if (menu_type == "[ITEMS]")
{
integer i;
for (i = 0; i < llGetListLength(item_triggers); i++)
{
if (llList2String(item_triggers, i) == pose_name)
{
item_triggers = llDeleteSubList(item_triggers, i, i);
items = llDeleteSubList(items, i, i);
}
}
string item = llList2String(get_contents(INVENTORY_OBJECT, page), (integer)message - 1);
item_triggers += pose_name;
items += item + "|";
main_menu();
}
}
else
{
menu_determine(message);
}
}
}
else if (channel == comm_channel)
{
if (llGetOwnerKey(id) == llGetOwner())
{
if (message == "SAVEPROP")
{
if (llList2Vector(llGetObjectDetails(id, [OBJECT_POS]), 0) != ZERO_VECTOR)
{
integer i;
for (i = 0; i < llGetListLength(prop_triggers); i++)
{
if (llList2String(prop_triggers, i) == pose_name)
{
prop_triggers = llDeleteSubList(prop_triggers, i, i);
props = llDeleteSubList(props, i, i);
}
}
list details = [OBJECT_POS, OBJECT_ROT];
rotation f = llList2Rot(details = llGetObjectDetails(llGetKey(), details) + llGetObjectDetails(id, details), 1);
rotation target_rot = llList2Rot(details, 3) / f;
vector target_pos = (llList2Vector(details, 2) - llList2Vector(details, 0)) / f;
prop_triggers += pose_name;
props += name + "|" + (string)target_pos + "|" + (string)(llRot2Euler(target_rot) * RAD_TO_DEG);
llSay(0, "PROP for pose '" + pose_name + "' saved to memory.");
}
}
}
}
}
link_message(integer sender, integer num, string msg, key id)
{
if (num == 90075)
{
llPlaySound("ed124764-705d-d497-167a-182cd9fa2e6c", 0);
playing_sound_for = NULL_KEY;
SITTERS = llListReplaceList(SITTERS, [NULL_KEY], (integer)msg, (integer)msg);
check_sitters();
}
else if (sender == llGetLinkNumber())
{
if (num == 1125)
{
expressions_toggle_off = (!expressions_toggle_off);
string expressions_text = "ON";
if (expressions_toggle_off)
{
expressions_text = "OFF";
}
llInstantMessage(id, "Facial Expressions " + expressions_text);
}
else if (num == 90045)
{
list data = llParseStringKeepNulls(msg, ["|"], []);
anim_name = llList2String(data, 1);
string given_posename = llList2String(data, 0);
if (llSubStringIndex(given_posename, "S:") == 0)
{
given_posename = llGetSubString(given_posename, 2, -1);
}
if (given_posename != pose_name || llSubStringIndex(llList2String(data, 0), "S:") == -1)
{
integer old_is_sync;
if (llSubStringIndex(raw_pose_name, "S:") == 0)
{
old_is_sync = TRUE;
}
raw_pose_name = llList2String(data, 0);
pose_name = given_posename;
integer index = llListFindList(prop_triggers, [pose_name]);
llPlaySound("ed124764-705d-d497-167a-182cd9fa2e6c", 0);
if ((!sticky_rez) && (id == playing_prop_for || old_is_sync || llSubStringIndex(raw_pose_name, "S:") == 0) || index != -1)
{
sticky_rez = FALSE;
remove_props();
}
if (index != -1)
{
playing_prop_for = id;
rez_prop(index);
}
index = llListFindList(sound_triggers, [pose_name]);
if (index != -1)
{
playing_sound_for = id;
play_sound(index);
}
}
remove_sequences(id);
integer i;
while (i < llGetListLength(anim_triggers))
{
if (llList2String(anim_triggers, i) == pose_name)
{
start_sequence(i, anim_name, id);
}
i++;
}
i = 0;
while (i < llGetListLength(item_triggers))
{
if (llList2String(item_triggers, i) == pose_name)
{
give_item(i, anim_name, id);
}
i++;
}
}
else if (num == 90010)
{
llListenControl(comm_listen_handle, TRUE);
llRegionSay(comm_channel, "PROPSEARCH");
}
else if (num == 90060)
{
llListenControl(comm_listen_handle, FALSE);
llListenControl(menu_listen_handle, FALSE);
integer index = llListFindList(SITTERS, [NULL_KEY]);
if (index != -1)
{
SITTERS = llListReplaceList(SITTERS, [id], index, index);
if (camera_position != ZERO_VECTOR)
{
if (index == 0)
{
llRequestPermissions(id, PERMISSION_CONTROL_CAMERA);
}
else
{
llMessageLinked(LINK_THIS, 90150, (string)id + "|" + (string)camera_position + "|" + (string)camera_focus, (string)index);
}
}
}
}
else if (num == 90065)
{
if (id == playing_sound_for)
{
llPlaySound("ed124764-705d-d497-167a-182cd9fa2e6c", 0);
playing_sound_for = NULL_KEY;
}
integer index = llListFindList(SITTERS, [id]);
remove_sequences(id);
if (index != -1)
{
SITTERS = llListReplaceList(SITTERS, [NULL_KEY], index, index);
check_sitters();
}
}
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 == 90140)
{
if (id == llGetOwner())
{
if (pose_name == "")
{
llMessageLinked(LINK_SET, 90005, "", id);
Owner_Say("Please select an animation first.");
}
else
{
llListenControl(menu_listen_handle, TRUE);
main_menu();
}
}
else
{
llInstantMessage(id, "Sorry, the [EXTRAS] menu is for Owner only.");
llMessageLinked(LINK_SET, 90005, "", id);
}
}
else if (num == 90020 && (integer)msg == get_number_of_scripts(mainscript_basename))
{
Readout_Say("-----EXTRAS------------");
integer i;
for (i = 0; i < llGetListLength(prop_triggers); i++)
{
Readout_Say("PROP " + llList2String(prop_triggers, i) + "|" + llList2String(props, i));
}
for (i = 0; i < llGetListLength(sound_triggers); i++)
{
Readout_Say("SOUND " + llList2String(sound_triggers, i) + "|" + llList2String(sounds, i));
}
for (i = 0; i < llGetListLength(item_triggers); i++)
{
Readout_Say("ITEM " + llList2String(item_triggers, i) + "|" + llList2String(items, i));
}
for (i = 0; i < llGetListLength(anim_triggers); i++)
{
integer x;
list sequence = llParseStringKeepNulls(llList2String(anims, i), [":"], []);
for (x = 0; x < llGetListLength(sequence); x = x + 2)
{
if (IsInteger(llList2String(sequence, x)))
{
sequence = llListReplaceList(sequence, [llList2String(facial_anim_list, (integer)llList2String(sequence, x))], x, x);
}
}
Readout_Say("ANIM " + llList2String(anim_triggers, i) + "|" + llDumpList2String(sequence, ":"));
}
if (camera_position != ZERO_VECTOR)
{
Readout_Say("CAMERA " + (string)camera_position + "|" + (string)camera_focus);
}
}
else if (num == 90200)
{
remove_props();
integer index = llListFindList(prop_triggers, [msg]);
if (index != -1)
{
llSleep(1);
sticky_rez = TRUE;
rez_prop(index);
}
llMessageLinked(LINK_SET, 90005, "", id);
}
}
}
run_time_permissions(integer perm)
{
if (llGetPermissions() & PERMISSION_CONTROL_CAMERA)
{
vector pos = camera_position * llGetRot() + llGetPos();
vector focus = camera_focus * 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 if (llGetPermissions() & PERMISSION_TRACK_CAMERA)
{
camera_menu();
}
}
changed(integer change)
{
if (change & CHANGED_INVENTORY)
{
if (llGetInventoryKey(notecard_name) != notecard_key || get_number_of_scripts(mainscript_basename) != llGetListLength(SITTERS))
{
remove_props();
llResetScript();
}
}
}
dataserver(key query_id, string data)
{
if (query_id == notecard_query)
{
if (data == EOF)
{
Owner_Say("Ready, Memory: " + (string)llGetFreeMemory());
llPlaySound("ed124764-705d-d497-167a-182cd9fa2e6c", 1);
}
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), [" | ", " |", "| ", "|"], []);
data = llDumpList2String(llList2List(parts, 1, -1), "|");
string pose = llList2String(parts, 0);
if (llSubStringIndex(pose, "S:") == 0)
{
pose = llGetSubString(pose, 2, -1);
}
if (command == "PROP")
{
prop_triggers += pose;
props += data;
Owner_Say("Read settings for Prop '" + llList2String(parts, 1) + "'");
}
else if (command == "SOUND")
{
sound_triggers += pose;
sounds += data;
Owner_Say("Read settings for Sound '" + llList2String(parts, 1) + "'");
}
else if (command == "ITEM")
{
item_triggers += pose;
items += data;
Owner_Say("Read settings for Item '" + llList2String(parts, 1) + "'");
}
else if (command == "ANIM")
{
anim_triggers += pose;
list anim_data = llParseStringKeepNulls(data, ["|"], []);
list sequence = llParseStringKeepNulls(llList2String(anim_data, 0), [":"], []);
integer i;
for (i = 0; i < llGetListLength(sequence); i = i + 2)
{
integer index = llListFindList(facial_anim_list, [llList2String(sequence, i)]);
if (index != -1)
{
sequence = llListReplaceList(sequence, [index], i, i);
}
}
anim_data = llListReplaceList(anim_data, [llDumpList2String(sequence, ":")], 0, 0);
anims += llDumpList2String(anim_data, "|");
Owner_Say("Read settings for Expressions for '" + pose + "'");
}
else if (command == "CAMERA")
{
camera_position = (vector)pose;
camera_focus = (vector)llList2String(parts, 1);
Owner_Say("Read settings for Camera");
}
notecard_query = llGetNotecardLine(notecard_name, notecard_line += 1);
}
}
}
}
state nothing
{
state_entry()
{
// do nothing
}
}

43
AVsitter1/AVprop.lsl Normal file
View file

@ -0,0 +1,43 @@
/*
* 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
*/
// script that goes inside AVsitter1 props
integer startparam;
default
{
state_entry()
{
}
on_rez(integer start)
{
if (start)
{
startparam = start;
llListen(startparam, "", "", "REMPROPS");
llListen(startparam, "", "", "PROPSEARCH");
}
}
listen(integer channel, string name, key id, string message)
{
if (message == "REMPROPS")
{
llDie();
}
else if (message == "PROPSEARCH")
{
llShout(startparam, "SAVEPROP");
}
}
}

241
AVsitter1/AVselect.lsl Normal file
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
*/
string product_and_version = "AVsitter™ AVselect 1.62";
integer has_security;
integer has_texture;
integer has_color;
integer select_type;
list BUTTONS;
integer reading_notecard_section = -1;
key notecard_key;
key notecard_query;
string notecard_name = "AVpos";
list SITTERS;
list SYNCS;
integer menu_channel;
integer menu_handle;
integer menu_type;
integer variable1;
Owner_Say(string say)
{
llOwnerSay(llGetScriptName() + ":" + say);
}
string strReplace(string str, string search, string replace)
{
return llDumpList2String(llParseStringKeepNulls((str = "") + 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);
}
menu(key av)
{
integer sitter_index = llListFindList(SITTERS, [av]);
if (sitter_index != -1)
{
list menu_buttons;
integer i;
for (i = 0; i < llGetListLength(BUTTONS); i++)
{
string avname = llKey2Name(llList2Key(SITTERS, i));
if ((!select_type) && llList2Integer(SYNCS, i) == FALSE && avname != "" && av != llList2Key(SITTERS, i))
{
menu_buttons += "⊘" + llGetSubString(strReplace(avname, " Resident", " "), 0, 11);
}
else
{
menu_buttons += llList2String(BUTTONS, i);
}
}
if (llGetAgentSize(llGetLinkKey(llGetNumberOfPrims())) != ZERO_VECTOR)
{
menu_buttons += "[ADJUST]";
}
llListenControl(menu_handle, TRUE);
llDialog(av, "\n" + product_and_version + "\n" + llList2String(BUTTONS, sitter_index), order_buttons(menu_buttons), menu_channel);
}
}
integer get_number_of_scripts()
{
integer i = 1;
while (llGetInventoryType("AVsit " + (string)i) == INVENTORY_SCRIPT)
{
i++;
}
return i;
}
default
{
state_entry()
{
menu_channel = ((integer)llFrand(2147483646) + 1) * -1;
menu_handle = llListen(menu_channel, "", "", "");
llListenControl(menu_handle, FALSE);
integer i;
for (i = 0; i < get_number_of_scripts(); i++)
{
SITTERS += NULL_KEY;
SYNCS += FALSE;
BUTTONS += "SITTER " + (string)i;
}
notecard_key = llGetInventoryKey(notecard_name);
Owner_Say("Reading " + notecard_name);
notecard_query = llGetNotecardLine(notecard_name, variable1);
}
listen(integer listen_channel, string name, key id, string message)
{
integer av_index = llListFindList(SITTERS, [id]);
integer button_index = llListFindList(BUTTONS, [message]);
if (av_index != -1)
{
if (message == "[ADJUST]")
{
llMessageLinked(LINK_SET, 90006, "", id);
}
else if (llGetSubString(message, 0, 0) == "⊘" || (llList2Integer(SYNCS, button_index) == FALSE && llList2Key(SITTERS, button_index) != NULL_KEY && llList2Key(SITTERS, button_index) != id && (!select_type)))
{
menu(id);
}
else if (button_index != -1)
{
llMessageLinked(LINK_SET, 90030, (string)av_index, (string)button_index);
}
}
}
changed(integer change)
{
if (change & CHANGED_INVENTORY)
{
if (llGetInventoryKey(notecard_name) != notecard_key || get_number_of_scripts() != llGetListLength(SITTERS))
{
llResetScript();
}
}
if (change & CHANGED_LINK)
{
if (llGetAgentSize(llGetLinkKey(llGetNumberOfPrims())) == ZERO_VECTOR)
{
llListenControl(menu_handle, FALSE);
}
}
}
link_message(integer sender, integer num, string msg, key id)
{
if (num == 90045)
{
list data = llParseStringKeepNulls(msg, ["|"], []);
integer index = llListFindList(SITTERS, [id]);
if (index != -1)
{
if (llGetSubString(llList2String(data, 0), 0, 1) == "S:")
{
SYNCS = llListReplaceList(SYNCS, [TRUE], index, index);
}
else
{
SYNCS = llListReplaceList(SYNCS, [FALSE], index, index);
}
}
}
else if (num == 90065)
{
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 == 90075)
{
SITTERS = llListReplaceList(SITTERS, [NULL_KEY], (integer)msg, (integer)msg);
}
else if (num == 99899)
{
menu(id);
}
}
dataserver(key query_id, string data)
{
if (query_id == notecard_query)
{
if (data == EOF)
{
integer i;
while (llGetAgentSize(llGetLinkKey(llGetNumberOfPrims())) != ZERO_VECTOR)
{
llUnSit(llGetLinkKey(llGetNumberOfPrims()));
llSleep(0.1);
}
Owner_Say("Ready");
}
else
{
data = llGetSubString(data, llSubStringIndex(data, "◆") + 1, -1);
data = llStringTrim(data, STRING_TRIM);
string command = llGetSubString(data, 0, llSubStringIndex(data, " ") - 1);
list parts = llParseString2List(llGetSubString(data, llSubStringIndex(data, " ") + 1, -1), [" | ", " |", "| ", "|"], []);
string part0 = llList2String(parts, 0);
if (command == "SITTER")
{
reading_notecard_section = (integer)part0;
string button_text = llList2String(parts, 1);
if (reading_notecard_section < llGetListLength(SITTERS))
{
if (button_text != "" && llListFindList(BUTTONS, [button_text]) == -1)
{
BUTTONS = llListReplaceList(BUTTONS, [button_text], reading_notecard_section, reading_notecard_section);
}
}
}
else if (command == "MTYPE")
{
menu_type = (integer)part0;
}
else if (command == "SELECT")
{
select_type = (integer)part0;
}
else if (command == "POSE" || command == "SYNC")
{
if (reading_notecard_section < llGetListLength(SITTERS) && reading_notecard_section != -1)
{
if (llList2String(BUTTONS, reading_notecard_section) == "SITTER " + (string)reading_notecard_section)
{
if (llStringLength(part0) > 23)
{
part0 = llGetSubString(part0, 0, 22);
}
if (llListFindList(BUTTONS, [part0]) == -1)
{
BUTTONS = llListReplaceList(BUTTONS, [part0], reading_notecard_section, reading_notecard_section);
reading_notecard_section = -1;
}
}
}
}
notecard_query = llGetNotecardLine(notecard_name, variable1 += 1);
}
}
}
}

1028
AVsitter1/AVsit.lsl Normal file

File diff suppressed because it is too large Load diff

225
AVsitter1/Helper.lsl Normal file
View file

@ -0,0 +1,225 @@
/*
* 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 base_object_name = "AVhelper";
string instructions = "Please see instructions for using the AVhelper.";
list colors = [<1,0.5,1>, <0.5,1,1>, <1,1,0.5>, <1,0.5,0.5>, <0.5,0.5,1>, <0.5,1,0.5>];
integer start_param;
integer click_registered = FALSE;
integer comm_channel;
key av = NULL_KEY;
vector ball_size = <0.2,0.2,0.2>;
vector default_size = <0.2,0.2,3.5>;
stop_all_anims()
{
if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)
{
if (llGetAgentSize(llGetPermissionsKey()))
{
list anims = llGetAnimationList(llGetPermissionsKey());
integer n;
for (n = 0; n < llGetListLength(anims); n++)
{
llStopAnimation(llList2String(anims, n));
}
}
}
}
set_text()
{
string text = "▽";
integer i;
for (i = 0; i < start_param; i++)
{
text += "\n ";
}
text = "SITTER " + (string)start_param + "\n" + text;
integer hovertext_prim = 0;
if (llGetNumberOfPrims() > 1)
{
if (llGetAgentSize(llGetLinkKey(2)) == ZERO_VECTOR)
{
hovertext_prim = 2;
text += "\n \n \n \n \n \n \n \n \n ";
}
}
llSetLinkPrimitiveParamsFast(hovertext_prim, [PRIM_TEXT, text, llList2Vector(colors, start_param % llGetListLength(colors)), 1]);
}
setup()
{
vector size = default_size;
if (llList2Key(llGetObjectDetails(llGetKey(), [OBJECT_CREATOR]), 0) != llGetInventoryCreator(llGetScriptName()))
{
size = llGetScale();
}
integer i;
for (i = 0; i < start_param; i++)
{
size -= <0.01,0.01,0.01>;
}
set_text();
llSetObjectName(base_object_name + " " + (string)start_param);
llSetPrimitiveParams([PRIM_COLOR, ALL_SIDES, llList2Vector(colors, start_param % llGetListLength(colors)), 0.4, PRIM_SIZE, size]);
llRegionSay(comm_channel, "REG|" + (string)start_param);
}
warp(vector pos)
{
list rules;
integer num = llCeil(llVecDist(llGetPos(), pos) / 10);
while (num--)
rules = (rules = []) + rules + [PRIM_POSITION, pos];
llSetPrimitiveParams(rules);
}
default
{
state_entry()
{
llSetText("", <1,1,1>, 1);
llSetObjectName(base_object_name);
llSetPrimitiveParams([PRIM_TEXTURE, ALL_SIDES, "5748decc-f629-461c-9a36-a35a221fe21f", <1,1,0>, <0,0,0>, 0, PRIM_FULLBRIGHT, ALL_SIDES, TRUE, PRIM_COLOR, ALL_SIDES, llList2Vector(colors, 0), 0.4, PRIM_GLOW, ALL_SIDES, 0.03]);
integer everyonePerms = llGetObjectPermMask(MASK_EVERYONE);
if ((!(everyonePerms & PERM_MOVE)) && llGetOwner() == llGetInventoryCreator(llGetScriptName()))
{
llOwnerSay("WARNING! AVhelper should se set to 'Anyone Can Move'");
}
llSetTimerEvent(604800);
llSitTarget(-<0,0,0.35>, ZERO_ROTATION);
llSetStatus(STATUS_PHANTOM, TRUE);
}
on_rez(integer x)
{
if (x != 0)
{
llSetClickAction(CLICK_ACTION_SIT);
start_param = x % 1000 * -1;
comm_channel = x + start_param;
llListen(comm_channel, "", "", "");
setup();
}
else
{
llSetClickAction(CLICK_ACTION_TOUCH);
llSetText("", <1,1,1>, 1);
if (llList2Key(llGetObjectDetails(llGetKey(), [OBJECT_CREATOR]), 0) == llGetInventoryCreator(llGetScriptName()))
{
llSetPrimitiveParams([PRIM_SIZE, ball_size]);
}
}
}
listen(integer chan, string name, key id, string msg)
{
if (llGetOwnerKey(id) == llGetOwner())
{
list data = llParseString2List(msg, ["|"], []);
if (llList2String(data, 0) == "DONE" && llList2Integer(data, 1) == start_param || llList2String(data, 0) == "DONEA")
{
if (av)
{
stop_all_anims();
llRegionSay(comm_channel, "GETUP|" + (string)start_param + "|" + (string)av);
}
llDie();
}
else if (llList2String(data, 0) == "SWAP")
{
if (llList2Integer(data, 1) == start_param)
{
start_param = llList2Integer(data, 2);
setup();
}
else if (llList2Integer(data, 2) == start_param)
{
start_param = llList2Integer(data, 1);
setup();
}
}
else if (llList2Integer(data, 1) == start_param)
{
if (llList2String(data, 0) == "POS")
{
vector pos = (vector)llList2String(data, 2);
rotation rot = (rotation)llList2String(data, 3);
llSetPrimitiveParams([PRIM_POSITION, pos, PRIM_ROTATION, rot]);
if (llGetPos() != pos)
{
warp(pos);
}
set_text();
}
}
else if (llList2String(data, 0) == "ANIMA" && llList2Key(data, 2) == llAvatarOnSitTarget())
{
llUnSit(llAvatarOnSitTarget());
}
}
}
run_time_permissions(integer perm)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation("sit");
}
}
timer()
{
llDie();
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
if (comm_channel != 0)
{
if (llAvatarOnSitTarget())
{
llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION);
av = llAvatarOnSitTarget();
llRegionSay(comm_channel, "ANIMA|" + (string)start_param + "|" + (string)llAvatarOnSitTarget());
}
else
{
stop_all_anims();
av = NULL_KEY;
llRegionSay(comm_channel, "GETUP|" + (string)start_param + "|" + (string)av);
}
}
else
{
if (llAvatarOnSitTarget())
{
llInstantMessage(llAvatarOnSitTarget(), instructions);
llUnSit(llAvatarOnSitTarget());
}
}
}
}
touch_start(integer total_number)
{
if (llGetStartParameter() != 0)
{
if (llAvatarOnSitTarget() == NULL_KEY)
{
llRegionSay(comm_channel, "ANIMA|" + (string)start_param + "|" + (string)llDetectedKey(0));
}
else if (llAvatarOnSitTarget() == llDetectedKey(0))
{
llRegionSay(comm_channel, "MENU|" + (string)start_param + "|" + (string)llDetectedKey(0));
}
}
else
{
llInstantMessage(llDetectedKey(0), instructions);
}
}
}

View file

@ -0,0 +1,91 @@
/*
* 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
*/
list SECURITY_TYPES = ["ALL", "OWNER ONLY", "GROUP ONLY"];
integer security_index;
integer pass_security(key id)
{
integer access_allowed = FALSE;
string SECURITY_TYPE = llList2String(SECURITY_TYPES, security_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;
}
default
{
touch_end(integer touched)
{
if (pass_security(llDetectedKey(0)) == TRUE)
{
llMessageLinked(LINK_SET, 90005, "", llDetectedKey(0));
}
else
{
llInstantMessage(llDetectedKey(0), "Sorry, the owner of this object has set the menu to: " + llList2String(SECURITY_TYPES, security_index));
}
}
link_message(integer sender, integer num, string msg, key id)
{
if (msg == "[SECURITY]")
{
if (id == llGetOwner())
{
security_index++;
if (security_index == llGetListLength(SECURITY_TYPES))
{
security_index = 0;
}
llMessageLinked(LINK_SET, 0, llList2String(SECURITY_TYPES, security_index), "");
llInstantMessage(id, "Security set to: " + llList2String(SECURITY_TYPES, security_index));
}
else
{
llInstantMessage(id, "Sorry, only the owner can change this.");
}
llMessageLinked(LINK_SET, 90005, "", id);
}
else if (num == 90060 && pass_security(id) == TRUE)
{
llMessageLinked(LINK_SET, 90005, "", id);
}
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
integer i = llGetNumberOfPrims();
while (llGetAgentSize(llGetLinkKey(i)) != ZERO_VECTOR)
{
key av = llGetLinkKey(i);
if (pass_security(av) == FALSE)
{
llSleep(2);
llUnSit(av);
llInstantMessage(av, "Sorry, the owner of this object has set the menu to: " + llList2String(SECURITY_TYPES, security_index));
}
i--;
}
}
}
}

32
AVsitter1/Root.lsl Normal file
View file

@ -0,0 +1,32 @@
/*
* 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 script_basename = "AVsit";
default
{
touch_start(integer touched)
{
llResetTime();
}
touch_end(integer touched)
{
if (llGetLinkNumber() == 1)
{
if (!(llGetInventoryType(script_basename) == INVENTORY_SCRIPT))
{
llMessageLinked(LINK_ALL_OTHERS, 90005, (string)llGetTime(), llDetectedKey(0));
}
}
}
}

View file

@ -0,0 +1,66 @@
/*
* 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
*/
list sittarget_scripts;
default
{
state_entry()
{
if (llGetInventoryType("AVsit") != INVENTORY_SCRIPT)
{
llSitTarget(<0,0,0.01>, ZERO_ROTATION);
llMessageLinked(LINK_SET, 90190, "starget", "");
}
}
link_message(integer sender, integer num, string msg, key id)
{
if (num == 90190 && msg == "starget" && llGetInventoryType("AVsit") != INVENTORY_SCRIPT)
{
if (llListFindList(sittarget_scripts, [sender]) == -1)
{
sittarget_scripts += sender;
sittarget_scripts = llListSort(sittarget_scripts, 1, TRUE);
}
}
if (num == 90180 && sender != llGetLinkNumber() && llGetInventoryType("AVsit") != INVENTORY_SCRIPT)
{
integer sender_channel = (integer)msg;
list data = llParseString2List(id, ["|"], []);
if (sender_channel - 1 == llListFindList(sittarget_scripts, [llGetLinkNumber()]))
{
// this code attempts to set the orientation of the sittarget of the child prim to match the orientation of the first pose in that sitter's menu
list details = [OBJECT_POS, OBJECT_ROT];
vector original_local_target_pos;
rotation original_local_target_rot;
original_local_target_pos = (vector)llList2String(data, 0) - <0,0,0.35>;
original_local_target_rot = llEuler2Rot((vector)llList2String(data, 1) * DEG_TO_RAD);
vector world_avsit_prim_pos = llList2Vector(llGetObjectDetails(llGetLinkKey(sender), [OBJECT_POS]), 0);
vector local_avsit_prim_pos = (world_avsit_prim_pos - llGetRootPosition()) / llGetRootRotation();
rotation local_avsit_prim_rot = original_local_target_rot;
rotation localrot = ZERO_ROTATION;
vector localpos = ZERO_VECTOR;
if (llGetLinkNumber() > 1)
{
localrot = llGetLocalRot();
localpos = llGetLocalPos();
}
vector final_local_target_pos = local_avsit_prim_pos + original_local_target_pos + <0,0,0.35>;
rotation final_local_target_rot = original_local_target_rot / llGetRootRotation();
vector my_target_pos = (final_local_target_pos - localpos) / localrot - <0,0,0.4>;
rotation my_target_rot = original_local_target_rot / localrot;
llSitTarget(my_target_pos, my_target_rot);
}
}
}
}

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();
}
}
}
}

View file

@ -0,0 +1,49 @@
/*
* 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 notecard_basename = "AVpos";
string name = "Anim";
Readout_Say(string say)
{
llSleep(0.2);
string objectname = llGetObjectName();
llSetObjectName("");
llRegionSayTo(llGetOwner(), 0, "◆" + say);
llSetObjectName(objectname);
}
default
{
state_entry()
{
if (llGetInventoryNumber(INVENTORY_ANIMATION) > 0)
{
Readout_Say("");
Readout_Say("--✄--COPY BELOW INTO " + notecard_basename + " NOTECARD--✄--");
Readout_Say("");
integer i;
for (i = 0; i < llGetInventoryNumber(INVENTORY_ANIMATION); i++)
{
Readout_Say("POSE " + name + (string)(i + 1) + "|" + llGetInventoryName(INVENTORY_ANIMATION, i));
}
Readout_Say("");
Readout_Say("--✄--COPY ABOVE INTO " + notecard_basename + " NOTECARD--✄--");
Readout_Say("");
if (llSubStringIndex(llGetObjectName(), "Utilities") == -1) // remove it except from Utilities box
{
llOwnerSay("Removing " + llGetScriptName() + " script");
llRemoveInventory(llGetScriptName());
}
}
}
}

View file

@ -0,0 +1,209 @@
/*
* 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
*/
float version = 1.2;
string notecard_name = "AVpos";
key notecard_query;
integer notecard_line;
vector target_prim_pos;
rotation target_prim_rot;
vector rot_offset;
vector pos_offset;
string cache;
string webkey;
integer webcount;
integer IsVector(string s)
{
list split = llParseString2List(s, [" "], ["<", ">", ","]);
if (llGetListLength(split) != 7)
return FALSE;
return !((string)((vector)s) == (string)((vector)((string)llListInsertList(split, ["-"], 5))));
}
string FormatFloat(float f, integer num_decimals)
{
float rounding = (float)(".5e-" + (string)num_decimals) - 5e-07;
if (f < 0.)
f -= rounding;
else
f += rounding;
string ret = llGetSubString((string)f, 0, num_decimals - (!num_decimals) - 7);
if (llSubStringIndex(ret, ".") != -1)
{
while (llGetSubString(ret, -1, -1) == "0")
{
ret = llGetSubString(ret, 0, -2);
}
}
if (llGetSubString(ret, -1, -1) == ".")
{
ret = llGetSubString(ret, 0, -2);
}
return ret;
}
instructions()
{
llOwnerSay("\n\nINSTRUCTIONS:\n\nFOR MOVING ALL POSE & PROP POSITIONS BY AN OFFSET:\nManual Position: specify a position offset on channel 5, and positions will be converted by that offset. E.g. /5 <0,0,1.5>\nManual Rotation: specify a rotation offset on channel 6 (in degrees), and rotations will be converted by that offset, relative to the prim center. E.g. /6 <0,0,180>\n\nFOR RELOCATING SCRIPTS TO NEW PRIM:\n1. Unlink your object and re-link so that the prim you want to move the animations from is the root prim, then place this script inside the root prim.\n2. Touch the prim you want to locate the poses to. This prim should be empty or contain a script with llPassTouches(TRUE);\n3. The script will read out the notecard in chat, with pos/rot modified to the prim you touched.\n\nHave Fun! :)\n");
}
cut_above_text()
{
webkey = (string)llGenerateKey();
webcount = 0;
Readout_Say("");
Readout_Say("--✄--COPY BELOW INTO \"AVpos\" NOTECARD--✄--");
Readout_Say("");
}
cut_below_text()
{
Readout_Say("");
Readout_Say("--✄--COPY ABOVE INTO \"AVpos\" NOTECARD--✄--");
Readout_Say("");
}
Readout_Say(string say)
{
llSleep(0.1);
string objectname = llGetObjectName();
llSetObjectName("");
llRegionSayTo(llGetOwner(), 0, "◆" + say);
llSetObjectName(objectname);
}
integer check_in_root()
{
if (llGetLinkNumber() > 1 || llGetInventoryType("AVpos") != INVENTORY_NOTECARD)
{
if (llGetInventoryCreator(llGetScriptName()) != llGetOwner())
{
llOwnerSay("This script must be placed only in the root prim and with AVpos notecard! - Removing script!");
llRemoveInventory(llGetScriptName());
return FALSE;
}
}
return TRUE;
}
default
{
state_entry()
{
check_in_root();
instructions();
llListen(5, "", llGetOwner(), "");
llListen(6, "", llGetOwner(), "");
}
touch_start(integer touched)
{
check_in_root();
if (llDetectedLinkNumber(0) > 1)
{
notecard_line = 0;
target_prim_pos = llList2Vector(llGetLinkPrimitiveParams(llDetectedLinkNumber(0), [PRIM_POS_LOCAL]), 0);
target_prim_rot = llList2Rot(llGetLinkPrimitiveParams(llDetectedLinkNumber(0), [PRIM_ROT_LOCAL]), 0);
llOwnerSay("Converting " + notecard_name + " for use in prim #" + (string)llDetectedLinkNumber(0));
cut_above_text();
notecard_query = llGetNotecardLine(notecard_name, notecard_line);
}
}
listen(integer chan, string name, key id, string msg)
{
if (chan == 5)
{
vector v = (vector)msg;
if (v != ZERO_VECTOR)
{
llOwnerSay("Converting positions in " + notecard_name + " by offset: " + (string)v);
cut_above_text();
target_prim_pos = -v;
notecard_query = llGetNotecardLine(notecard_name, notecard_line);
}
else
{
llOwnerSay("You didn't enter a vector!");
}
}
if (chan == 6)
{
vector v = (vector)msg;
if (v != ZERO_VECTOR)
{
target_prim_rot = llEuler2Rot(v * DEG_TO_RAD);
llOwnerSay("Converting rotations in " + notecard_name + " by offset: " + (string)v);
cut_above_text();
notecard_query = llGetNotecardLine(notecard_name, notecard_line);
}
else
{
llOwnerSay("You didn't enter a vector!");
}
}
}
dataserver(key query_id, string data)
{
if (query_id == notecard_query)
{
if (data == EOF)
{
cut_below_text();
llOwnerSay("Conversion complete, removing script.");
llRemoveInventory(llGetScriptName());
}
else
{
data = llStringTrim(llGetSubString(data, llSubStringIndex(data, "◆") + 1, -1), STRING_TRIM);
if (llGetSubString(data, 0, 0) == "{")
{
string command = llStringTrim(llGetSubString(data, 1, llSubStringIndex(data, "}") - 1), STRING_TRIM);
data = llDumpList2String(llParseString2List(data, [" "], [""]), "");
data = llGetSubString(data, llSubStringIndex(data, "}") + 1, -1);
list parts = llParseStringKeepNulls(data, ["<"], []);
vector pos = (vector)("<" + llList2String(parts, 1));
pos = -target_prim_pos / target_prim_rot + pos / target_prim_rot;
rotation rot = llEuler2Rot((vector)("<" + llList2String(parts, 2)) * DEG_TO_RAD);
vector vec_rot = llRot2Euler(rot / target_prim_rot) * RAD_TO_DEG;
string result = "<" + FormatFloat(pos.x, 3) + "," + FormatFloat(pos.y, 3) + "," + FormatFloat(pos.z, 3) + ">";
result += "<" + FormatFloat(vec_rot.x, 1) + "," + FormatFloat(vec_rot.y, 1) + "," + FormatFloat(vec_rot.z, 1) + ">";
Readout_Say("{" + command + "}" + result);
}
else if (llSubStringIndex(llGetSubString(data, 0, 0), "PROP"))
{
integer index;
vector pos;
rotation rot;
list parts = llParseStringKeepNulls(data, ["|"], [""]);
if (IsVector(llList2String(parts, 2)) && IsVector(llList2String(parts, 3)))
{
index = 2;
}
else if (IsVector(llList2String(parts, 3)) && IsVector(llList2String(parts, 4)))
{
index = 3;
}
if (index)
{
pos = (vector)llList2String(parts, index);
rot = llEuler2Rot((vector)llList2String(parts, index + 1) * DEG_TO_RAD);
pos = -target_prim_pos / target_prim_rot + pos / target_prim_rot;
vector vec_rot = llRot2Euler(rot / target_prim_rot) * RAD_TO_DEG;
string pos_string = "<" + FormatFloat(pos.x, 3) + "," + FormatFloat(pos.y, 3) + "," + FormatFloat(pos.z, 3) + ">";
string rot_string = "<" + FormatFloat(vec_rot.x, 1) + "," + FormatFloat(vec_rot.y, 1) + "," + FormatFloat(vec_rot.z, 1) + ">";
parts = llListReplaceList(parts, [pos_string, rot_string], index, index + 1);
}
Readout_Say(llDumpList2String(parts, "|"));
}
else if (data != "")
{
Readout_Say(data);
}
notecard_query = llGetNotecardLine(notecard_name, notecard_line += 1);
}
}
}
}

View file

@ -0,0 +1,64 @@
/*
* 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
*/
Owner_Say(string say)
{
llOwnerSay(llGetScriptName() + ": " + say);
}
default
{
state_entry()
{
integer copy_trans_count;
integer copy_count;
integer trans_count;
Owner_Say(" ");
Owner_Say("================================");
integer total = llGetInventoryNumber(INVENTORY_ANIMATION);
Owner_Say("Checking NEXT_OWNER permissions of ANIMATIONS.");
integer i;
for (i = 0; i < total; i++)
{
string item = llGetInventoryName(INVENTORY_ANIMATION, i);
integer perms = llGetInventoryPermMask(item, MASK_NEXT);
if (perms & PERM_COPY)
{
if (perms & PERM_TRANSFER)
{
Owner_Say(item + " is COPY-TRANSFER!");
copy_trans_count++;
}
else
{
copy_count++;
}
}
else if (perms & PERM_TRANSFER)
{
trans_count++;
}
}
Owner_Say((string)total + " anims total");
Owner_Say((string)trans_count + " anims are TRANSFER");
Owner_Say((string)copy_count + " anims are COPY.");
Owner_Say((string)copy_trans_count + " anims are COPY-TRANSFER!");
Owner_Say("Check complete, removing script.");
Owner_Say("================================");
Owner_Say(" ");
if (llSubStringIndex(llGetObjectName(), "Utilities") == -1) // remove it except from Utilities box
{
llRemoveInventory(llGetScriptName());
}
}
}

View file

@ -1,183 +1,194 @@
// MLP to AVsitter converter
// Converts POSE and SYNC only! (facial expressions, props, submenus are not implemented yet)
// You can enter a position offset vector in the description such as <0,0,0.1>
string product = "AVsitter2 MLP converter";
string version = "2.1";
string notecard_basename = "AVpos";
list NOTECARDS;
list PROPS_NOTECARDS;
string notecard_name;
key notecard_query;
integer notecard_line;
integer notecard_pointer;
integer animator_count;
integer animator_total;
list ommit = ["default","stand"];
integer verbose = 0;
Out(integer level,string out){
if(verbose>=level){
llOwnerSay(llGetScriptName()+"["+version+"] "+out);
}
}
/*
"Fixed number of decimals version" from
http://wiki.secondlife.com/wiki/User:Pedro_Oval/Float_formatting_functions
*/
string FormatFloat(float f, integer num_decimals){
float rounding = (float)(".5e-" + (string)num_decimals) - 0.0000005;
if (f < 0.) f -= rounding; else f += rounding;
string ret = llGetSubString((string)f, 0, num_decimals - !num_decimals - 7);
//if ((float)ret == 0.) ret = "0";
if(llSubStringIndex(ret,".")!=-1){
while(llGetSubString(ret,-1,-1)=="0"){
ret = llGetSubString(ret,0,-2);
}
}
if(llGetSubString(ret,-1,-1)=="."){
ret = llGetSubString(ret,0,-2);
}
return ret;
}
finish(){
if(llSubStringIndex(llGetObjectName(),"Utilities")==-1){
Out(0,"Removing script");
llRemoveInventory(llGetScriptName());
}
}
get_notecards(){
integer i;
for(i=0;i<llGetInventoryNumber(INVENTORY_NOTECARD);i++){
string name = llGetInventoryName(INVENTORY_NOTECARD,i);
if(llGetSubString(name,0,9)==".MENUITEMS" || llGetSubString(name,0,9)==".POSITIONS"){ //must be in alphabetical order (MENUITEMS FIRST)
NOTECARDS+=name;
}
else if(llGetSubString(name,0,5)==".PROPS"){
PROPS_NOTECARDS+=name; // not implemented
}
}
//llOwnerSay(llDumpList2String(NOTECARDS,","));
}
Readout_Say(string say){
string objectname = llGetObjectName();
llSetObjectName("");
llRegionSayTo(llGetOwner(),0,"◆"+say);
llSetObjectName(objectname);
}
default{
state_entry(){
Out(0,"Reading MLP notecards...");
Readout_Say(" ");
get_notecards();
//state part_two;
if(llGetListLength(NOTECARDS)>0){
notecard_name = llList2String(NOTECARDS,notecard_pointer);
Readout_Say("--✄--COPY BELOW INTO "+notecard_basename+" NOTECARD--✄--");
Readout_Say(" ");
//llOwnerSay("N: "+notecard_name);
Readout_Say("SITTER "+(string)animator_count);
notecard_query = llGetNotecardLine(notecard_name,notecard_line);
}
else{
Out(0,"No MLP notecards found!");
finish();
}
}
dataserver(key query_id, string data){
//llOwnerSay((string)notecard_line);
if(query_id==notecard_query){
if(data == EOF){
if(llGetListLength(NOTECARDS)-notecard_pointer>1){
notecard_name = llList2String(NOTECARDS,notecard_pointer+=1);
//llOwnerSay("N: "+notecard_name);
notecard_query = llGetNotecardLine(notecard_name,notecard_line=0);
}
else if (animator_count+1<animator_total){
animator_count++;
Readout_Say(" ");
Readout_Say("SITTER "+(string)animator_count);
notecard_name = llList2String(NOTECARDS,notecard_pointer=0);
notecard_query = llGetNotecardLine(notecard_name,notecard_line=0);
}
else{
//state part_two;
Readout_Say(" ");
Readout_Say("--✄--COPY ABOVE INTO "+notecard_basename+" NOTECARD--✄--");
finish();
}
}
else{
string out;
data = llStringTrim(llList2String(llParseString2List(data,["//"],[]),0),STRING_TRIM);
if(llGetSubString(notecard_name,0,9)==".MENUITEMS"){
string command = llGetSubString(data,0,llSubStringIndex(data," ")-1);
list parts = llParseString2List(llGetSubString(data,llSubStringIndex(data," ")+1,-1),[" | "," |","| ","|"],[]);
if(command=="TOMENU" || command =="MENU"){
/*
if(llListFindList(["-","MAIN MENU","Height","OPTIONS","ShutDown..."],[llList2String(parts,0)])==-1){
if(command =="MENU"){
Readout_Say(" ");
}
out+=command+" "+llList2String(parts,0);
Readout_Say(out);
}
*/
}
else if(command=="POSE"){
if(llListFindList(ommit,[llList2String(parts,0)])==-1){
if(llGetListLength(parts)-1>animator_total){
animator_total=llGetListLength(parts)-1;
}
if(llGetListLength(parts)-animator_count>1){
out = "POSE ";
if(llGetListLength(parts)+animator_count>2){
out = "SYNC ";
}
string pose = llStringTrim(llList2String(parts,animator_count+1),STRING_TRIM);
pose = llList2String(llParseString2List(pose,["::"],[]),0); //remove MLP facial expressions
pose = llList2String(llParseString2List(pose,[";"],[]),0); //remove XPOSE facial expressions
out+=llStringTrim(llList2String(parts,0),STRING_TRIM)+"|"+pose;
Readout_Say(out);
}
}
}
}
else{//POSITIONS
if (llSubStringIndex(data,"{")!=-1){//llGetSubString(data,0,0)=="{"){
string command = llStringTrim(llGetSubString(data,llSubStringIndex(data,"{")+1,llSubStringIndex(data,"}")-1),STRING_TRIM);
if(llListFindList(ommit,[command])==-1){
data = llDumpList2String(llParseString2List(data,[" "],[""]),"");//remove spaces
list parts = llParseString2List(data,["<"],[]);
if(llGetListLength(parts)>animator_count*2+1){
vector pos = (vector)("<"+llList2String(parts,animator_count*2+1));
vector rot = (vector)("<"+llList2String(parts,animator_count*2+2));
pos+= (vector)llGetObjectDesc();
string result = "<"+FormatFloat(pos.x,3)+","+FormatFloat(pos.y,3)+","+FormatFloat(pos.z,3)+">";
result += "<"+FormatFloat(rot.x,1)+","+FormatFloat(rot.y,1)+","+FormatFloat(rot.z,1)+">";
Readout_Say("{"+command+"}"+result);
}
}
}
}
notecard_query = llGetNotecardLine(notecard_name,notecard_line+=1);
}
}
}
}
/*
* 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 = "AVsitter2 MLP converter";
string version = "2.2";
string notecard_basename = "AVpos";
list NOTECARDS;
list PROPS_NOTECARDS;
string notecard_name;
key notecard_query;
integer notecard_line;
integer notecard_pointer;
integer animator_count;
integer animator_total;
list ommit = ["default", "stand"];
integer verbose = 0;
Out(integer level, string out)
{
if (verbose >= level)
{
llOwnerSay(llGetScriptName() + "[" + version + "] " + out);
}
}
string FormatFloat(float f, integer num_decimals)
{
float rounding = (float)(".5e-" + (string)num_decimals) - 5e-07;
if (f < 0.)
f -= rounding;
else
f += rounding;
string ret = llGetSubString((string)f, 0, num_decimals - (!num_decimals) - 7);
if (llSubStringIndex(ret, ".") != -1)
{
while (llGetSubString(ret, -1, -1) == "0")
{
ret = llGetSubString(ret, 0, -2);
}
}
if (llGetSubString(ret, -1, -1) == ".")
{
ret = llGetSubString(ret, 0, -2);
}
return ret;
}
finish()
{
if (llSubStringIndex(llGetObjectName(), "Utilities") == -1) // remove it except from Utilities box
{
Out(0, "Removing script");
llRemoveInventory(llGetScriptName());
}
}
get_notecards()
{
integer i;
for (i = 0; i < llGetInventoryNumber(INVENTORY_NOTECARD); i++)
{
string name = llGetInventoryName(INVENTORY_NOTECARD, i);
if (llGetSubString(name, 0, 9) == ".MENUITEMS" || llGetSubString(name, 0, 9) == ".POSITIONS")
{
NOTECARDS += name;
}
else if (llGetSubString(name, 0, 5) == ".PROPS")
{
PROPS_NOTECARDS += name;
}
}
}
Readout_Say(string say)
{
string objectname = llGetObjectName();
llSetObjectName("");
llRegionSayTo(llGetOwner(), 0, "◆" + say);
llSetObjectName(objectname);
}
default
{
state_entry()
{
Out(0, "Reading MLP notecards...");
Readout_Say(" ");
get_notecards();
if (llGetListLength(NOTECARDS) > 0)
{
notecard_name = llList2String(NOTECARDS, notecard_pointer);
Readout_Say("--✄--COPY BELOW INTO " + notecard_basename + " NOTECARD--✄--");
Readout_Say(" ");
Readout_Say("SITTER " + (string)animator_count);
notecard_query = llGetNotecardLine(notecard_name, notecard_line);
}
else
{
Out(0, "No MLP notecards found!");
finish();
}
}
dataserver(key query_id, string data)
{
if (query_id == notecard_query)
{
if (data == EOF)
{
if (llGetListLength(NOTECARDS) - notecard_pointer > 1)
{
notecard_name = llList2String(NOTECARDS, notecard_pointer += 1);
notecard_query = llGetNotecardLine(notecard_name, notecard_line = 0);
}
else if (animator_count + 1 < animator_total)
{
animator_count++;
Readout_Say(" ");
Readout_Say("SITTER " + (string)animator_count);
notecard_name = llList2String(NOTECARDS, notecard_pointer = 0);
notecard_query = llGetNotecardLine(notecard_name, notecard_line = 0);
}
else
{
Readout_Say(" ");
Readout_Say("--✄--COPY ABOVE INTO " + notecard_basename + " NOTECARD--✄--");
finish();
}
}
else
{
string out;
data = llStringTrim(llList2String(llParseString2List(data, ["//"], []), 0), STRING_TRIM);
if (llGetSubString(notecard_name, 0, 9) == ".MENUITEMS")
{
string command = llGetSubString(data, 0, llSubStringIndex(data, " ") - 1);
list parts = llParseString2List(llGetSubString(data, llSubStringIndex(data, " ") + 1, -1), [" | ", " |", "| ", "|"], []);
if (command == "TOMENU" || command == "MENU")
{
}
else if (command == "POSE")
{
if (llListFindList(ommit, [llList2String(parts, 0)]) == -1)
{
if (llGetListLength(parts) - 1 > animator_total)
{
animator_total = llGetListLength(parts) - 1;
}
if (llGetListLength(parts) - animator_count > 1)
{
out = "POSE ";
if (llGetListLength(parts) + animator_count > 2)
{
out = "SYNC ";
}
string pose = llStringTrim(llList2String(parts, animator_count + 1), STRING_TRIM);
pose = llList2String(llParseString2List(pose, ["::"], []), 0);
pose = llList2String(llParseString2List(pose, [";"], []), 0);
out += llStringTrim(llList2String(parts, 0), STRING_TRIM) + "|" + pose;
Readout_Say(out);
}
}
}
}
else
{
if (llSubStringIndex(data, "{") != -1)
{
string command = llStringTrim(llGetSubString(data, llSubStringIndex(data, "{") + 1, llSubStringIndex(data, "}") - 1), STRING_TRIM);
if (llListFindList(ommit, [command]) == -1)
{
data = llDumpList2String(llParseString2List(data, [" "], [""]), "");
list parts = llParseString2List(data, ["<"], []);
if (llGetListLength(parts) > animator_count * 2 + 1)
{
vector pos = (vector)("<" + llList2String(parts, animator_count * 2 + 1));
vector rot = (vector)("<" + llList2String(parts, animator_count * 2 + 2));
pos += (vector)llGetObjectDesc();
string result = "<" + FormatFloat(pos.x, 3) + "," + FormatFloat(pos.y, 3) + "," + FormatFloat(pos.z, 3) + ">";
result += "<" + FormatFloat(rot.x, 1) + "," + FormatFloat(rot.y, 1) + "," + FormatFloat(rot.z, 1) + ">";
Readout_Say("{" + command + "}" + result);
}
}
}
}
notecard_query = llGetNotecardLine(notecard_name, notecard_line += 1);
}
}
}
}

View file

@ -0,0 +1,124 @@
/*
* 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 notecard_basename = "AVpos";
integer variable1;
key notecard_query;
list ALL_USED_ANIMATIONS;
list UNUSED_ANIMS;
Owner_Say(string say)
{
llOwnerSay(llGetScriptName() + ": " + say);
}
finish()
{
Owner_Say("Check complete, removing script.");
Owner_Say("================================");
Owner_Say(" ");
if (llSubStringIndex(llGetObjectName(), "Utilities") == -1) // remove it except from Utilities box
{
llRemoveInventory(llGetScriptName());
}
}
default
{
state_entry()
{
if (llGetInventoryType(notecard_basename) == INVENTORY_NOTECARD)
{
Owner_Say(" ");
Owner_Say("================================");
Owner_Say("Checking for missing or unused anims.");
notecard_query = llGetNotecardLine(notecard_basename, variable1);
}
else
{
Owner_Say(notecard_basename + " notecard not found. Removing '" + llGetScriptName() + "' from inventory.");
if (llSubStringIndex(llGetObjectName(), "Utilities") == -1)
{
llRemoveInventory(llGetScriptName());
}
}
}
dataserver(key query_id, string data)
{
if (query_id == notecard_query)
{
if (data == EOF)
{
integer i;
for (i = 0; i < llGetInventoryNumber(INVENTORY_ANIMATION); i++)
{
if (llListFindList(ALL_USED_ANIMATIONS, [llGetInventoryName(INVENTORY_ANIMATION, i)]) == -1 && llListFindList(["AVhipfix"], [llGetInventoryName(INVENTORY_ANIMATION, i)]) == -1)
{
Owner_Say("Animation '" + llGetInventoryName(INVENTORY_ANIMATION, i) + "' found in inventory but not used in notecard!");
UNUSED_ANIMS += llGetInventoryName(INVENTORY_ANIMATION, i);
}
}
if (llGetListLength(UNUSED_ANIMS))
{
llDialog(llGetOwner(), "\n" + (string)llGetListLength(UNUSED_ANIMS) + " unused anims were found. Do you want to delete them?\n\nMake sure you take a backup of your work first!", ["YES", "NO"], -268534);
llListen(-268534, "", llGetOwner(), "");
llSetTimerEvent(60);
}
else
{
finish();
}
}
else
{
data = llGetSubString(data, llSubStringIndex(data, "◆") + 1, -1);
data = llStringTrim(data, STRING_TRIM);
string command = llGetSubString(data, 0, llSubStringIndex(data, " ") - 1);
list parts = llParseString2List(llGetSubString(data, llSubStringIndex(data, " ") + 1, -1), [" | ", " |", "| ", "|"], []);
if (command == "POSE" || command == "SYNC")
{
list anims = llList2ListStrided(llDeleteSubList(parts, 0, 0), 0, -1, 2);
integer i;
for (i = 0; i < llGetListLength(anims); i++)
{
if (llGetInventoryType(llList2String(anims, i)) != INVENTORY_ANIMATION)
{
Owner_Say("Animation '" + llList2String(anims, i) + "' not found in inventory!");
}
ALL_USED_ANIMATIONS += llList2String(anims, i);
}
}
notecard_query = llGetNotecardLine(notecard_basename, variable1 += 1);
}
}
}
listen(integer chan, string name, key id, string msg)
{
if (msg == "YES")
{
integer i;
for (i = 0; i < llGetListLength(UNUSED_ANIMS); i++)
{
if (llGetInventoryType(llList2String(UNUSED_ANIMS, i)) == INVENTORY_ANIMATION)
{
llRemoveInventory(llList2String(UNUSED_ANIMS, i));
Owner_Say("Deleted unused anim: '" + llList2String(UNUSED_ANIMS, i) + "'");
}
}
}
finish();
}
timer()
{
Owner_Say("timeout");
finish();
}
}

View file

@ -0,0 +1,96 @@
/*
* 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
*/
/*
* Simple script used for updating a large number of furniture items at once
* This script goes in each furniture prim that expects an update from the sender
* will auto-delete if a non-admin avatar rezzes the furniture
*/
integer pin = -29752;
list admin_avatars = ["b30c9262-9abf-4cd1-9476-adcf5723c029", "f2e0ed5e-6592-4199-901d-a659c324ca94"];
default
{
state_entry()
{
llSetTimerEvent(0.1);
if (llGetStartParameter() == -1)
{
integer i;
while (llGetInventoryNumber(INVENTORY_OBJECT))
{
string item = llGetInventoryName(INVENTORY_OBJECT, llGetInventoryNumber(INVENTORY_OBJECT) - 1);
llRegionSayTo(llGetOwner(), 0, "Removing :" + item);
llRemoveInventory(item);
}
}
llSetRemoteScriptAccessPin(pin);
llListen(pin, "", "", "");
}
timer()
{
if (llGetLinkNumber() == 0 || llGetLinkNumber() == 1 && llGetInventoryType("[AV]object") != INVENTORY_SCRIPT)
{
if (llGetAgentSize(llGetLinkKey(llGetNumberOfPrims())) == ZERO_VECTOR)
{
llSetText(llGetObjectName(), <1,1,0>, 1);
}
}
llSetTimerEvent(10);
}
on_rez(integer start)
{
if (start)
{
if (~llListFindList(admin_avatars, [llGetOwner()]))
{
llRegionSayTo(llGetOwner(), 0, "Removing :" + llGetScriptName());
}
llRemoveInventory(llGetScriptName());
}
}
listen(integer chan, string name, key id, string msg)
{
if (llGetOwnerKey(id) == llGetOwner())
{
list data = llParseStringKeepNulls(msg, ["|"], []);
if (llList2String(data, 0) == "OBJECT_SEARCH")
{
list reply;
integer i;
for (i = 1; i < llGetListLength(data); i++)
{
if (llGetInventoryType(llList2String(data, i)) != INVENTORY_NONE)
{
reply += [llList2String(data, i), (string)llGetInventoryKey(llList2String(data, i))];
}
}
if (llGetListLength(reply) > 0)
{
llRegionSay(pin, "OBJECT_HERE|" + llDumpList2String(reply, "|"));
}
}
}
}
changed(integer change)
{
if (change & CHANGED_OWNER)
{
if (!llListFindList(admin_avatars, [llGetOwner()]))
{
llRemoveInventory(llGetScriptName());
}
}
}
}

View file

@ -0,0 +1,184 @@
/*
* 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
*/
/*
* Simple script used for updating a large number of furniture items at once
* This script goes in a "sender" prim along with the latest copies of the
* (not running) scripts and inventory objects (e.g. prop objects)
* Touching the sender will shout in a radius and update all prims that respond.
*/
integer pin = -29752;
string receiver_script = "update receiver (auto removing)";
list objects_to_update;
list objects_files;
integer menu_handle;
key av;
particles_on(key target)
{
llParticleSystem([
PSYS_PART_FLAGS, 0 | PSYS_PART_INTERP_COLOR_MASK | PSYS_PART_INTERP_SCALE_MASK | PSYS_PART_FOLLOW_VELOCITY_MASK | PSYS_PART_EMISSIVE_MASK | PSYS_PART_TARGET_POS_MASK,
PSYS_SRC_PATTERN, 0 | PSYS_SRC_PATTERN_DROP,
PSYS_PART_START_ALPHA, 1.00000,
PSYS_PART_END_ALPHA, 1,
PSYS_PART_START_COLOR, <1, 0, 0>,
PSYS_PART_END_COLOR, <0, 0, 1>,
PSYS_PART_START_SCALE, <0.08, 0.2, 0>,
PSYS_PART_END_SCALE, <0.08, 0.2, 0>,
PSYS_PART_MAX_AGE, 2.0,
PSYS_SRC_MAX_AGE, 0,
PSYS_SRC_ACCEL, <0, 0, 0>,
PSYS_SRC_BURST_PART_COUNT, 250,
PSYS_SRC_BURST_RADIUS, 0.00000,
PSYS_SRC_BURST_RATE, 0.05766,
PSYS_SRC_BURST_SPEED_MIN, 0.07813,
PSYS_SRC_BURST_SPEED_MAX, 0.15625,
PSYS_SRC_INNERANGLE, 0.09375,
PSYS_SRC_OUTERANGLE, 0.00000,
PSYS_SRC_OMEGA, <0, 0, 0>,
PSYS_SRC_TEXTURE, (key)"",
PSYS_SRC_TARGET_KEY, target
]);
}
default
{
state_entry()
{
llParticleSystem([]);
llListen(pin, "", "", "");
}
on_rez(integer x)
{
llResetScript();
}
timer()
{
llRegionSayTo(av, 0, "Found " + (string)llGetListLength(objects_to_update) + " objects...");
integer i;
for (i = 0; i < llGetListLength(objects_to_update); i++)
{
key object = llList2Key(objects_to_update, i);
list items = llParseStringKeepNulls(llList2String(objects_files, i), ["|"], []);
if (1 == 1)
{
list scripts_to_update;
list other_to_update;
list surplus_to_update;
integer j;
for (j = 0; j < llGetListLength(items); j = j + 2)
{
string item = llList2String(items, j);
key item_key = (key)llList2String(items, j + 1);
if (item_key != llGetInventoryKey(item) || item_key == NULL_KEY)
{
if (llGetInventoryType(item) == INVENTORY_SCRIPT)
{
scripts_to_update += item;
}
else
{
other_to_update += item;
}
}
else if (llGetInventoryType(item) == INVENTORY_OBJECT)
{
surplus_to_update += item;
}
}
if (llGetListLength(scripts_to_update) == 0 && llGetListLength(other_to_update) == 0)
{
}
else
{
particles_on(object);
if (llGetListLength(other_to_update) > 0)
{
if (llListFindList(scripts_to_update, [receiver_script]) == -1)
{
scripts_to_update += receiver_script;
}
}
if (llListFindList(scripts_to_update, [receiver_script]) != -1)
{
other_to_update += surplus_to_update;
}
for (j = 0; j < llGetListLength(scripts_to_update); j++)
{
llRegionSayTo(av, 0, "Sending: " + llList2String(scripts_to_update, j) + " to " + llKey2Name(object));
integer running = TRUE;
if (llSubStringIndex(llKey2Name(object), "[BOX]") != -1 && llList2String(scripts_to_update, j) != receiver_script)
{
running = FALSE; // set scripts not running if the target name contains [BOX]
}
integer remove_objects = -1;
if (llGetListLength(surplus_to_update))
{
remove_objects = -1;
}
llRemoteLoadScriptPin(object, llList2String(scripts_to_update, j), pin, running, remove_objects);
}
for (j = 0; j < llGetListLength(other_to_update); j++)
{
llRegionSayTo(av, 0, "Sending: " + llList2String(other_to_update, j) + " to " + llKey2Name(object));
llGiveInventory(object, llList2String(other_to_update, j));
}
}
}
else
{
llRemoteLoadScriptPin(object, receiver_script, pin, TRUE, -1);
}
}
llRegionSayTo(av, 0, "Updating Complete!");
llResetScript();
}
touch_start(integer touched)
{
if (llDetectedKey(0) == llGetOwner() || llSameGroup(llDetectedKey(0)))
{
av = llDetectedKey(0);
objects_to_update = [];
objects_files = [];
llSetTimerEvent(10);
list items;
integer i;
for (i = 0; i < llGetInventoryNumber(INVENTORY_ALL); i++)
{
if (llGetInventoryName(INVENTORY_ALL, i) != llGetScriptName())
{
items += llGetInventoryName(INVENTORY_ALL, i);
}
}
llRegionSayTo(av, 0, "listening...");
llSay(pin, "OBJECT_SEARCH|" + llDumpList2String(items, "|"));
}
}
listen(integer chan, string name, key id, string msg)
{
if (llGetOwnerKey(id) == llGetOwner())
{
list data = llParseStringKeepNulls(msg, ["|"], []);
if (llList2String(data, 0) == "OBJECT_HERE")
{
vector mysize = llGetScale();
float distance = llVecMag(llGetPos() - llList2Vector(llGetObjectDetails(id, [OBJECT_POS]), 0));
if (distance <= mysize.x / 2)
{
objects_to_update += id;
objects_files += llDumpList2String(llList2List(data, 1, -1), "|");
}
}
}
}
}

866
AVsitter2/[AV]adjuster.lsl Normal file
View file

@ -0,0 +1,866 @@
/*
* 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 OLD_HELPER_METHOD;
key key_request;
string url = "https://avsitter.com/settings.php"; // the settings dump service remains up for AVsitter customers. settings clear periodically.
string version = "2.2";
string helper_name = "[AV]helper";
string prop_script = "[AV]prop";
string expression_script = "[AV]faces";
string camera_script = "[AV]camera";
string mainscript = "[AV]sitA";
string notecard_name = "AVpos";
list POS_LIST;
list ROT_LIST;
list HELPER_KEY_LIST;
list SITTER_POSES;
list SITTERS;
integer sitter_count;
integer end_count;
integer verbose = 0;
integer chat_channel = 5;
integer helper_mode;
integer comm_channel;
integer listen_handle;
integer active_sitter;
key controller;
integer menu_page;
string adding;
integer adding_item_type;
string last_text;
integer menu_pages;
integer number_per_page = 9;
list chosen_animations;
string cache;
string webkey;
integer webcount;
string FormatFloat(float f, integer num_decimals)
{
float rounding = (float)(".5e-" + (string)num_decimals) - 5e-07;
if (f < 0.)
f -= rounding;
else
f += rounding;
string ret = llGetSubString((string)f, 0, num_decimals - (!num_decimals) - 7);
if (~llSubStringIndex(ret, "."))
{
while (llGetSubString(ret, -1, -1) == "0")
{
ret = llGetSubString(ret, 0, -2);
}
}
if (llGetSubString(ret, -1, -1) == ".")
{
ret = llGetSubString(ret, 0, -2);
}
return ret;
}
web(integer force)
{
if (llStringLength(llEscapeURL(cache)) > 1024 || force)
{
if (force)
{
cache += "\n\nend";
}
cache = llEscapeURL(cache);
webcount++;
llHTTPRequest(url, [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded", HTTP_VERIFY_CERT, FALSE], "w=" + webkey + "&c=" + (string)webcount + "&t=" + cache);
cache = "";
}
}
Readout_Say(string say)
{
string objectname = llGetObjectName();
llSetObjectName("");
llRegionSayTo(llGetOwner(), 0, "◆" + say);
llSetObjectName(objectname);
cache += say + "\n";
say = "";
web(FALSE);
}
stop_all_anims(key id)
{
list animations = llGetAnimationList(id);
integer i;
for (i = 0; i < llGetListLength(animations); i++)
{
llMessageLinked(LINK_THIS, 90002, llList2String(animations, i), id);
}
}
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 = "") + str, [search], []), replace);
}
preview_anim(string anim, key id)
{
if (id)
{
stop_all_anims(id);
llMessageLinked(LINK_THIS, 90001, anim, id);
}
}
list get_choices()
{
integer my_number_per_page = number_per_page;
if (adding == "[SYNC]" && sitter_count > 1)
{
my_number_per_page--;
}
list options;
integer i;
integer start = my_number_per_page * menu_page;
integer end = start + my_number_per_page;
if (adding == "[FACE]")
{
list facial_anim_list = ["none", "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"];
i = llGetListLength(facial_anim_list);
options = llList2List(facial_anim_list, start, end - 1);
}
else
{
integer type = INVENTORY_ANIMATION;
if (adding == "[PROP]")
{
type = INVENTORY_OBJECT;
}
i = start;
while (i < end && i < llGetInventoryNumber(type))
{
if (llGetInventoryName(type, i) != helper_name)
{
options += llGetInventoryName(type, i);
}
i++;
}
i = llGetInventoryNumber(type);
}
menu_pages = llCeil((float)i / my_number_per_page);
return options;
}
ask_anim()
{
choice_menu(get_choices(), "Choose anim" + sitter_text(sitter_count) + ":");
}
choice_menu(list options, string menu_text)
{
last_text = menu_text;
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 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";
}
if (adding == "[SYNC]" && sitter_count > 1)
{
menu_items += "[DONE]";
}
menu_items += ["[BACK]", "[<<]", "[>>]"];
}
llDialog(controller, menu_text, order_buttons(menu_items), comm_channel);
}
new_menu()
{
menu_page = 0;
list menu_items = ["[BACK]", "[POSE]", "[SYNC]", "[SUBMENU]"];
if (llList2String(SITTER_POSES, active_sitter) != "")
{
menu_items += ["[PROP]", "[FACE]"];
}
menu_items += "[CAMERA]";
string menu_text = "\nWhat would you like to create?\n";
llDialog(controller, menu_text, order_buttons(menu_items), comm_channel);
}
end_helper_mode()
{
llRegionSay(comm_channel, "DONEA");
helper_mode = FALSE;
}
Out(string out)
{
llOwnerSay(llGetScriptName() + "[" + version + "] " + out);
}
integer get_number_of_scripts()
{
integer i;
while (llGetInventoryType(mainscript + " " + (string)(++i)) == INVENTORY_SCRIPT)
;
return i;
}
string convert_to_world_positions(integer num)
{
list details = llGetObjectDetails(llGetLinkKey(llGetLinkNumber()), [OBJECT_POS, OBJECT_ROT]);
rotation target_rot = llEuler2Rot(llList2Vector(ROT_LIST, num) * DEG_TO_RAD) * llList2Rot(details, 1);
vector target_pos = llList2Vector(POS_LIST, num) * llList2Rot(details, 1) + llList2Vector(details, 0);
return (string)target_pos + "|" + (string)target_rot;
}
string sitter_text(integer sitter)
{
return " for SITTER " + (string)sitter;
}
remove_script(string reason)
{
string message = "\n" + llGetScriptName() + " ==Script Removed==\n\n" + reason;
llDialog(llGetOwner(), message, [], -3675);
llInstantMessage(llGetOwner(), message);
llRemoveInventory(llGetScriptName());
}
done_choosing_anims()
{
string adding_text = llList2String(llParseString2List(adding, ["[", "]"], []), 0);
adding += "2";
integer i;
string text;
for (i = 0; i < llGetListLength(chosen_animations); i++)
{
text += "\nSITTER " + (string)i + ": " + llList2String(chosen_animations, i);
}
llTextBox(controller, "\nType a menu name for " + adding_text + text, comm_channel);
}
camera_menu()
{
string text = "\nCamera:\n\n";
if (llGetInventoryType(camera_script) == INVENTORY_SCRIPT)
{
text += "(using [AV]camera scripts)";
}
else
{
text += "(prim property)";
}
llDialog(controller, text, ["[BACK]", "[SAVE]", "[CLEAR]"], comm_channel);
}
unsit_all()
{
integer i = llGetNumberOfPrims();
while (llGetAgentSize(llGetLinkKey(i)))
{
stop_all_anims(llGetLinkKey(i));
llUnSit(llGetLinkKey(i));
i--;
}
}
toggle_helper_mode()
{
helper_mode = (!helper_mode);
if (helper_mode)
{
if (OLD_HELPER_METHOD)
{
unsit_all();
}
listen_handle = llListen(comm_channel, "", "", "");
integer i;
for (i = 0; i < llGetListLength(SITTERS); i++)
{
integer param = comm_channel + i * -1;
if (llGetListLength(SITTERS) == 1)
{
param = comm_channel + llGetLinkNumber() * -1;
}
vector offset = llList2Vector(POS_LIST, i);
if (llVecMag(offset) > 10)
{
offset = ZERO_VECTOR;
}
llRezObject(helper_name, llGetPos() + offset * llGetRot(), ZERO_VECTOR, llEuler2Rot(llList2Vector(ROT_LIST, i) * DEG_TO_RAD) * llGetRot(), param);
}
}
else
{
end_helper_mode();
}
}
default
{
state_entry()
{
if (~llSubStringIndex(llGetScriptName(), " "))
{
remove_script("Use only one of this script!");
}
llListen(chat_channel, "", llGetOwner(), "");
comm_channel = ((integer)llFrand(99999) + 1) * 1000 * -1;
integer i;
while (i++ < get_number_of_scripts())
{
SITTERS += 0;
POS_LIST += 0;
ROT_LIST += 0;
HELPER_KEY_LIST += 0;
SITTER_POSES += "";
}
if (llGetListLength(SITTERS) == 1)
{
comm_channel -= 1000000000;
}
}
link_message(integer sender, integer num, string msg, key id)
{
integer one = (integer)msg;
integer two = (integer)((string)id);
if (sender == llGetLinkNumber())
{
list data = llParseStringKeepNulls(msg, ["|"], []);
if (num == 90065)
{
integer index = llListFindList(SITTERS, [id]);
if (~index)
{
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));
if (OLD_HELPER_METHOD && helper_mode)
{
integer i = llList2Integer(HELPER_KEY_LIST, (integer)msg);
HELPER_KEY_LIST = llListReplaceList(HELPER_KEY_LIST, [llList2Integer(HELPER_KEY_LIST, (integer)((string)id))], (integer)msg, (integer)msg);
HELPER_KEY_LIST = llListReplaceList(HELPER_KEY_LIST, [i], (integer)((string)id), (integer)((string)id));
llRegionSay(comm_channel, "SWAP|" + (string)msg + "|" + (string)id);
}
}
else if (num == 90070)
{
SITTERS = llListReplaceList(SITTERS, [id], (integer)msg, (integer)msg);
}
else if (num == 90021)
{
integer script_channel = (integer)msg;
list scripts = [prop_script, expression_script, camera_script];
integer index = llListFindList(scripts, [(string)id]);
while (index < llGetListLength(scripts))
{
index++;
string lookfor = llList2String(scripts, index);
if (lookfor == camera_script && script_channel > 0)
{
lookfor = lookfor + " " + (string)script_channel;
}
if (llGetInventoryType(lookfor) == INVENTORY_SCRIPT)
{
llMessageLinked(LINK_THIS, 90020, (string)script_channel, llList2String(scripts, index));
return;
}
}
if (llGetInventoryType(mainscript + " " + (string)(script_channel + 1)) == INVENTORY_SCRIPT)
{
llMessageLinked(LINK_THIS, 90020, (string)(script_channel + 1), "");
}
else
{
Readout_Say("");
Readout_Say("--✄--COPY ABOVE INTO \"AVpos\" NOTECARD--✄--");
Readout_Say("");
web(TRUE);
llRegionSayTo(llGetOwner(), 0, "Settings copy: " + url + "?q=" + webkey);
}
}
else if (num == 90022)
{
if (llGetSubString(msg, 0, 3) == "S:M:" || llGetSubString(msg, 0, 3) == "S:T:")
{
msg = strReplace(msg, "*|", "|");
}
if (llGetSubString(msg, 0, 1) == "V:")
{
if (!(integer)((string)id))
{
webkey = (string)llGenerateKey();
webcount = 0;
Readout_Say("");
Readout_Say("--✄--COPY BELOW INTO \"AVpos\" NOTECARD--✄--");
Readout_Say("");
Readout_Say("\"" + llToUpper(llGetObjectName()) + "\" " + strReplace(llList2String(data, 0), "V:", "AVsitter "));
if ((integer)llList2String(data, 1))
{
Readout_Say("MTYPE " + llList2String(data, 1));
}
if ((integer)llList2String(data, 2) != 1)
{
Readout_Say("ETYPE " + llList2String(data, 2));
}
if ((integer)llList2String(data, 3) > -1)
{
Readout_Say("SET " + llList2String(data, 3));
}
if ((integer)llList2String(data, 4) != 2)
{
Readout_Say("SWAP " + llList2String(data, 4));
}
if (llList2String(data, 6))
{
Readout_Say("TEXT " + strReplace(llList2String(data, 6), "\n", "\\n"));
}
if (llList2String(data, 7))
{
Readout_Say("ADJUST " + strReplace(llList2String(data, 7), "<22>", "|"));
}
if ((integer)llList2String(data, 8))
{
Readout_Say("SELECT " + llList2String(data, 8));
}
if ((integer)llList2String(data, 9) != 2)
{
Readout_Say("AMENU " + llList2String(data, 9));
}
if ((integer)llList2String(data, 10))
{
Readout_Say("HELPER " + llList2String(data, 10));
}
}
Readout_Say("");
if (llGetListLength(SITTERS) > 1 || llList2String(data, 5) != "")
{
string SITTER_TEXT;
if (llList2String(data, 5))
{
SITTER_TEXT = "|" + strReplace(llList2String(data, 5), "<22>", "|");
}
Readout_Say("SITTER " + (string)id + SITTER_TEXT);
Readout_Say("");
}
return;
}
else if (llGetSubString(msg, 0, 0) == "{")
{
msg = strReplace(msg, "{P:", "{");
list parts = llParseStringKeepNulls(llDumpList2String(llParseString2List(llGetSubString(msg, llSubStringIndex(msg, "}") + 1, -1), [" "], [""]), ""), ["<"], []);
string pos = "<" + llList2String(parts, 1);
string rot = "<" + llList2String(parts, 2);
vector pos2 = (vector)pos;
vector rot2 = (vector)rot;
string result = "<" + FormatFloat(pos2.x, 3) + "," + FormatFloat(pos2.y, 3) + "," + FormatFloat(pos2.z, 3) + ">";
result += "<" + FormatFloat(rot2.x, 1) + "," + FormatFloat(rot2.y, 1) + "," + FormatFloat(rot2.z, 1) + ">";
msg = llGetSubString(msg, 0, llSubStringIndex(msg, "}")) + result;
}
else if (llGetSubString(msg, 1, 1) == ":")
{
msg = strReplace(msg, "S:P:", "POSE ");
msg = strReplace(msg, "S:M:", "MENU ");
msg = strReplace(msg, "S:T:", "TOMENU ");
if (llGetSubString(msg, -6, -1) == "|90210")
{
msg = strReplace(msg, "S:B:", "SEQUENCE ");
msg = strReplace(msg, "|90210", "");
}
else
{
msg = strReplace(msg, "S:B:", "BUTTON ");
if (!~llSubStringIndex(msg, "<22>"))
{
msg = strReplace(msg, "|90200", "");
}
}
msg = strReplace(msg, "S:", "SYNC ");
msg = strReplace(msg, "<22>", "|");
}
if (llGetSubString(msg, -1, -1) == "*")
{
msg = llGetSubString(msg, 0, -2);
}
if (llGetSubString(msg, -1, -1) == "|")
{
msg = llGetSubString(msg, 0, -2);
}
if (llGetSubString(msg, 0, 3) == "MENU")
{
Readout_Say("");
}
Readout_Say(msg);
}
else if (num == 90100 || num == 90101)
{
if (llList2String(data, 1) == "[DUMP]")
{
if (id != llGetOwner())
{
llRegionSayTo(id, 0, "Dumping settings to Owner");
}
llMessageLinked(LINK_THIS, 90020, "0", "");
}
else if (llList2String(data, 1) == "[NEW]")
{
controller = (key)llList2String(data, 2);
active_sitter = (integer)llList2String(data, 0);
adding = "";
new_menu();
}
else if (llList2String(data, 1) == "[SAVE]")
{
integer i;
for (i = 0; i < llGetListLength(SITTERS); i++)
{
if (llList2String(SITTER_POSES, i))
{
string type = "SYNC";
string temp_pose_name = llList2String(SITTER_POSES, i);
if (!llSubStringIndex(llList2String(SITTER_POSES, i), "P:"))
{
type = "POSE";
temp_pose_name = llGetSubString(temp_pose_name, 2, -1);
}
llMessageLinked(LINK_THIS, 90301, (string)i, llList2String(SITTER_POSES, i) + "|" + llList2String(POS_LIST, i) + "|" + llList2String(ROT_LIST, i) + "|");
vector pos = llList2Vector(POS_LIST, i);
vector rot = llList2Vector(ROT_LIST, i);
llSay(0, type + " Saved to memory " + sitter_text(i) + ": {" + temp_pose_name + "}" + llList2String(POS_LIST, i) + llList2String(ROT_LIST, i));
}
}
llMessageLinked(LINK_THIS, 90005, "", llDumpList2String([llList2String(data, 2), id], "|"));
}
else if (llList2String(data, 1) == "[HELPER]")
{
controller = id;
OLD_HELPER_METHOD = (integer)llList2String(data, 3);
toggle_helper_mode();
}
else if (llList2String(data, 1) == "[ADJUST]")
{
end_helper_mode();
}
}
else if (num == 90055 || num == 90056)
{
data = llParseStringKeepNulls(id, ["|"], []);
SITTER_POSES = llListReplaceList(SITTER_POSES, [llList2String(data, 0)], one, one);
POS_LIST = llListReplaceList(POS_LIST, [(vector)llList2String(data, 2)], one, one);
ROT_LIST = llListReplaceList(ROT_LIST, [(vector)llList2String(data, 3)], one, one);
if (helper_mode)
{
llRegionSay(comm_channel, "POS|" + (string)one + "|" + convert_to_world_positions(one) + "|" + (string)OLD_HELPER_METHOD + "|" + llList2String(SITTERS, one));
}
}
}
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
if (OLD_HELPER_METHOD)
{
if (llGetAgentSize(llGetLinkKey(llGetNumberOfPrims())))
{
end_helper_mode();
}
}
else if (llGetListLength(SITTERS) == 1 && llAvatarOnSitTarget() == NULL_KEY || llGetAgentSize(llGetLinkKey(llGetNumberOfPrims())) == ZERO_VECTOR)
{
end_helper_mode();
}
}
if (change & CHANGED_INVENTORY)
{
unsit_all();
end_helper_mode();
llResetScript();
}
}
run_time_permissions(integer perm)
{
if (llGetPermissions() & PERMISSION_TRACK_CAMERA)
{
llPlaySound("3d09f582-3851-c0e0-f5ba-277ac5c73fb4", 1.);
vector eye = (llGetCameraPos() - llGetPos()) / llGetRot();
vector at = eye + llRot2Fwd(llGetCameraRot() / llGetRot());
if (llGetInventoryType(camera_script) == INVENTORY_SCRIPT)
{
llMessageLinked(LINK_THIS, 90174, (string)active_sitter, (string)eye + "|" + (string)at);
}
else
{
llMessageLinked(LINK_THIS, 90011, (string)eye, (string)at);
llSay(0, "Camera property saved for all sitters in prim (takes effect next sit).");
}
camera_menu();
}
}
listen(integer chan, string name, key id, string msg)
{
if (chan == chat_channel)
{
if (msg == "cleanup")
{
llRegionSay(comm_channel, "DONEA");
Out("Cleaning \"" + llGetScriptName() + "\" and \"" + helper_name + "\" from prim " + (string)llGetLinkNumber());
if (llGetInventoryType(helper_name) == INVENTORY_OBJECT)
{
llRemoveInventory(helper_name);
}
llRemoveInventory(llGetScriptName());
}
else if (msg == "targets")
{
llMessageLinked(LINK_THIS, 90298, "", "");
}
else if (msg == "helper")
{
if (llGetAgentSize(llGetLinkKey(llGetNumberOfPrims())) != ZERO_VECTOR)
{
llMessageLinked(LINK_SET, 90100, "0|[HELPER]||" + (string)OLD_HELPER_METHOD, llList2Key(SITTERS, 0));
}
}
}
else if (id == controller)
{
if (msg == "[>>]")
{
menu_page++;
if (menu_page >= menu_pages)
{
menu_page = 0;
}
choice_menu(get_choices(), last_text);
}
else if (msg == "[<<]")
{
menu_page--;
if (menu_page < 0)
{
menu_page = menu_pages - 1;
}
choice_menu(get_choices(), last_text);
}
else if (msg == "[BACK]")
{
llMessageLinked(LINK_THIS, 90005, "", llDumpList2String([controller, llList2String(SITTERS, active_sitter)], "|"));
}
else if (msg == "[POSE]" || msg == "[SYNC]")
{
adding = msg;
chosen_animations = [];
sitter_count = active_sitter;
end_count = sitter_count;
if (msg == "[SYNC]")
{
sitter_count = 0;
end_count = llGetListLength(SITTERS) - 1;
}
ask_anim();
}
else if (msg == "[SUBMENU]")
{
adding = msg;
llTextBox(controller, "\n\nName your submenu:", comm_channel);
}
else if (msg == "[PROP]")
{
if (llGetInventoryType(prop_script) == INVENTORY_SCRIPT)
{
adding = msg;
choice_menu(get_choices(), "Choose your prop:");
}
else
{
llSay(0, "For this you need the " + prop_script + " plugin script.");
llMessageLinked(LINK_THIS, 90005, "", llDumpList2String([controller, llList2String(SITTERS, active_sitter)], "|"));
}
}
else if (msg == "[FACE]")
{
if (llGetInventoryType(expression_script) == INVENTORY_SCRIPT)
{
adding = msg;
choice_menu(get_choices(), "Choose your facial anim:");
}
else
{
llSay(0, "For this you need the " + expression_script + " plugin script.");
llMessageLinked(LINK_THIS, 90005, "", llDumpList2String([controller, llList2String(SITTERS, active_sitter)], "|"));
}
}
else if (msg == "[CAMERA]")
{
camera_menu();
}
else if (msg == "[CLEAR]")
{
integer i;
for (i = 0; i < llGetNumberOfPrims(); i++)
{
llSetLinkCamera(i, ZERO_VECTOR, ZERO_VECTOR);
}
if (llGetInventoryType(camera_script) == INVENTORY_SCRIPT)
{
llMessageLinked(LINK_THIS, 90174, (string)active_sitter, "none");
}
else
{
llSay(0, "Camera property cleared from all prims (takes effect next sit).");
}
camera_menu();
}
else if (msg == "[SAVE]")
{
llRequestPermissions(id, PERMISSION_TRACK_CAMERA);
}
else if ((~llListFindList(["[DONE]", "1", "2", "3", "4", "5", "6", "7", "8", "9"], [msg])) && (~llListFindList(["[POSE]", "[SYNC]", "[SYNC]2", "[PROP]", "[FACE]"], [adding])))
{
string choice = llList2String(get_choices(), (integer)msg - 1);
if (adding == "[PROP]")
{
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, 90171, (string)active_sitter, choice);
}
llMessageLinked(LINK_THIS, 90005, "", llDumpList2String([controller, llList2String(SITTERS, active_sitter)], "|"));
}
else if (adding == "[FACE]")
{
llMessageLinked(LINK_THIS, 90172, (string)active_sitter, choice);
llMessageLinked(LINK_THIS, 90005, "", llDumpList2String([controller, llList2String(SITTERS, active_sitter)], "|"));
}
else if (msg == "[DONE]")
{
done_choosing_anims();
}
else if (adding == "[SYNC]" || adding == "[POSE]")
{
chosen_animations += choice;
preview_anim(choice, llList2Key(SITTERS, sitter_count));
sitter_count++;
if (sitter_count > end_count)
{
done_choosing_anims();
}
else
{
ask_anim();
}
}
}
else
{
msg = strReplace(msg, "\n", "");
msg = strReplace(msg, "|", "");
msg = llGetSubString(msg, 0, 22);
if (msg == "")
{
llMessageLinked(LINK_THIS, 90005, "", llDumpList2String([controller, llList2String(SITTERS, active_sitter)], "|"));
}
else if (adding == "[SUBMENU]")
{
llMessageLinked(LINK_THIS, 90300, (string)active_sitter, "T:" + msg + "*" + "||");
llMessageLinked(LINK_THIS, 90300, (string)active_sitter, "M:" + msg + "*" + "||");
llSay(0, "MENU Added: '" + msg + "'" + sitter_text(active_sitter));
llMessageLinked(LINK_THIS, 90005, "", llDumpList2String([controller, llList2String(SITTERS, active_sitter)], "|"));
}
else if (adding == "[POSE]2" || adding == "[SYNC]2")
{
integer start = 0;
integer end = llGetListLength(chosen_animations);
string type = "SYNC";
string prefix;
if (adding == "[POSE]2")
{
prefix = "P:";
type = "POSE";
start = active_sitter;
end = active_sitter + 1;
}
integer x;
integer i;
for (i = start; i < end; i++)
{
llSay(0, type + " Added: '" + msg + "' using anim '" + llList2String(chosen_animations, x) + "' to SITTER " + (string)i);
llMessageLinked(LINK_THIS, 90300, (string)i, prefix + msg + "|" + llList2String(chosen_animations, x) + "|" + llList2String(POS_LIST, i) + "|" + llList2String(ROT_LIST, i));
x++;
}
}
if (msg != "" && (adding == "[POSE]2" || adding == "[SYNC]2"))
{
llMessageLinked(LINK_THIS, 90005, "", llDumpList2String([controller, llList2String(SITTERS, active_sitter)], "|"));
}
}
}
else if (llGetOwnerKey(id) == llGetOwner())
{
list data = llParseString2List(msg, ["|"], []);
integer num = (integer)llList2String(data, 1);
if (llList2String(data, 0) == "REG")
{
HELPER_KEY_LIST = llListReplaceList(HELPER_KEY_LIST, [id], num, num);
llRegionSay(comm_channel, "POS|" + (string)num + "|" + convert_to_world_positions(num) + "|" + (string)OLD_HELPER_METHOD + "|" + llList2String(SITTERS, num));
}
else if (llList2String(data, 0) == "MENU")
{
if (llList2String(data, 1) == controller)
{
llMessageLinked(LINK_SET, 90005, "", llDumpList2String([controller, llList2String(SITTERS, num)], "|"));
}
}
else if (llList2String(data, 0) == "MOVED")
{
list myprim = llGetObjectDetails(llGetLinkKey(llGetLinkNumber()), [OBJECT_POS, OBJECT_ROT]);
rotation f = llList2Rot(myprim, 1);
vector target_rot = llRot2Euler((rotation)llList2String(data, 3) / f) * RAD_TO_DEG;
vector target_pos = ((vector)llList2String(data, 2) - llList2Vector(myprim, 0)) / f;
if ((string)target_pos != (string)llList2Vector(POS_LIST, num) || (string)target_rot != (string)llList2Vector(ROT_LIST, num))
{
POS_LIST = llListReplaceList(POS_LIST, [target_pos], num, num);
ROT_LIST = llListReplaceList(ROT_LIST, [target_rot], num, num);
llMessageLinked(LINK_THIS, 90057, (string)num, (string)target_pos + "|" + (string)target_rot);
}
}
else if (OLD_HELPER_METHOD)
{
integer sitter = (integer)llGetSubString(name, llSubStringIndex(name, " ") + 1, -1);
if (llList2String(data, 0) == "ANIMA")
{
llMessageLinked(LINK_THIS, 90075, (string)sitter, llList2Key(data, 1));
}
else if (llList2String(data, 0) == "GETUP")
{
llMessageLinked(LINK_THIS, 90076, (string)sitter, llList2Key(data, 1));
}
}
}
}
on_rez(integer x)
{
llResetScript();
}
}

272
AVsitter2/[AV]helper.lsl Normal file
View file

@ -0,0 +1,272 @@
/*
* 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 registration_product = "AVsitter2";
string product = "AVhelper";
string version = "2.2";
integer OLD_HELPER_METHOD;
list colors = [<1,0.5,1>, <0.5,0.5,1>, <1,0.5,0.5>, <0.5,1,0.5>, <1,1,0.5>, <0.5,1,1>];
integer helper_index;
float alpha;
integer sitter_number;
key CURRENT_AV;
integer comm_channel;
string base_object_name = "[AV]helper";
vector ball_size = <0.2,0.2,0.2>;
vector default_size = <0.12,0.12,3.5>;
key key_request;
vector my_pos;
rotation my_rot;
stop_all_anims()
{
if (llAvatarOnSitTarget())
{
if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)
{
if (llGetAgentSize(llGetPermissionsKey()))
{
list anims = llGetAnimationList(llGetPermissionsKey());
integer n;
for (n = 0; n < llGetListLength(anims); n++)
{
llStopAnimation(llList2String(anims, n));
}
}
}
}
}
set_text()
{
string text = "▽";
integer i;
string t = "SITTER";
if (llGetStartParameter() < -1000000000)
{
t = "PRIM";
}
for (i = 0; i < sitter_number % 5; i++)
{
text += "\n \n ";
}
text = t + " " + (string)helper_index + "\n" + text;
llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_TEXT, text, llList2Vector(colors, helper_index % llGetListLength(colors)), 1]);
}
setup()
{
alpha = llList2Float(llGetPrimitiveParams([PRIM_COLOR, 0]), 1);
CURRENT_AV = "";
vector size = default_size;
if (llGetCreator() != llGetInventoryCreator(llGetScriptName()))
{
size = llGetScale();
}
integer i;
for (i = 0; i < sitter_number; i++)
{
size -= <0.001,0.001,0.>;
}
set_text();
llSetObjectName(base_object_name + " " + (string)helper_index);
if (llGetCreator() == llGetInventoryCreator(llGetScriptName()))
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_DEFAULT, <0,1,0>, 0, ZERO_VECTOR, <1,1,0>, ZERO_VECTOR, PRIM_TEXTURE, ALL_SIDES, "5748decc-f629-461c-9a36-a35a221fe21f", <1,1,0>, ZERO_VECTOR, 0, PRIM_COLOR, ALL_SIDES, llList2Vector(colors, helper_index % llGetListLength(colors)), alpha, PRIM_COLOR, 1, <1,1,1>, alpha, PRIM_COLOR, 3, <1,1,1>, alpha, PRIM_SIZE, size]);
}
else
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_COLOR, ALL_SIDES, llList2Vector(colors, helper_index % llGetListLength(colors)), alpha, PRIM_SIZE, size]);
}
llRegionSay(comm_channel, "REG|" + (string)sitter_number);
}
default
{
state_entry()
{
llSetText("", <1,1,1>, 1);
llSetObjectName(base_object_name);
if (llGetCreator() == llGetInventoryCreator(llGetScriptName()))
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_TEXTURE, ALL_SIDES, "5748decc-f629-461c-9a36-a35a221fe21f", <1,1,0>, <0,0,0>, 0, PRIM_FULLBRIGHT, ALL_SIDES, TRUE, PRIM_COLOR, ALL_SIDES, llList2Vector(colors, 0), 0.7, PRIM_GLOW, ALL_SIDES, 0.]);
}
else
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_TEXTURE, ALL_SIDES, "5748decc-f629-461c-9a36-a35a221fe21f", <1,1,0>, <0,0,0>, 0, PRIM_FULLBRIGHT, ALL_SIDES, TRUE]);
}
integer everyonePerms = llGetObjectPermMask(MASK_EVERYONE);
if ((!(everyonePerms & PERM_MOVE)) && llGetOwner() == llGetInventoryCreator(llGetScriptName()))
{
llOwnerSay("WARNING! AVhelper should be set to 'Anyone Can Move'");
}
llSitTarget(-<0,0,0.35>, ZERO_ROTATION);
llSetStatus(STATUS_PHANTOM, TRUE);
}
on_rez(integer start)
{
llResetTime();
llSetClickAction(CLICK_ACTION_TOUCH);
if (start == 0)
{
llSetTimerEvent(0);
llSetText("", <1,1,1>, 1);
if (llList2Key(llGetObjectDetails(llGetKey(), [OBJECT_CREATOR]), 0) == llGetInventoryCreator(llGetScriptName()))
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_SIZE, ball_size]);
}
}
else
{
helper_index = start % 1000 * -1;
sitter_number = helper_index;
if (start < -1000000000)
{
helper_index = (sitter_number = 0);
}
comm_channel = llFloor(start / 1000) * 1000;
llListen(5, "", "", "");
llListen(comm_channel, "", "", "");
setup();
}
}
listen(integer chan, string name, key id, string msg)
{
if (chan == 5 && id == CURRENT_AV)
{
key av = (key)msg;
if (av)
{
if (llGetAgentSize(av))
{
list avatar_location = llGetObjectDetails(av, [OBJECT_POS, OBJECT_ROT]);
if (llVecMag(llGetPos() - llList2Vector(avatar_location, 0)) < 10)
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POSITION, llList2Vector(avatar_location, 0), PRIM_ROTATION, llList2Rot(avatar_location, 1)]);
}
else
{
llRegionSayTo(id, 0, "Avatar too far away.");
}
}
else
{
llRegionSayTo(id, 0, "Avatar not found nearby.");
}
}
}
if (llGetOwnerKey(id) == llGetOwner())
{
list data = llParseString2List(msg, ["|"], []);
if (llList2String(data, 0) == "DONE" && llList2Integer(data, 1) == sitter_number || llList2String(data, 0) == "DONEA")
{
if (OLD_HELPER_METHOD)
{
if (llAvatarOnSitTarget())
{
stop_all_anims();
llRegionSay(comm_channel, "GETUP");
}
}
llDie();
}
else if (llList2String(data, 0) == "SWAP")
{
integer one = (integer)llList2String(data, 1);
integer two = (integer)llList2String(data, 2);
if (sitter_number == one)
{
sitter_number = (helper_index = two);
setup();
}
else if (sitter_number == two)
{
sitter_number = (helper_index = one);
setup();
}
}
else if (llList2Integer(data, 1) == sitter_number)
{
if (llList2String(data, 0) == "POS")
{
vector pos = (vector)llList2String(data, 2);
rotation rot = (rotation)llList2String(data, 3);
OLD_HELPER_METHOD = (integer)llList2String(data, 4);
CURRENT_AV = (key)llList2String(data, 5);
if (OLD_HELPER_METHOD)
{
llSetClickAction(CLICK_ACTION_SIT);
}
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POSITION, pos, PRIM_ROTATION, rot]);
if (llGetPos() != pos)
{
llSetRegionPos(pos);
}
my_pos = llGetPos();
my_rot = llGetRot();
llSetTimerEvent(0.01);
}
}
}
}
timer()
{
if (my_pos != llGetPos() || my_rot != llGetRot())
{
my_pos = llGetPos();
my_rot = llGetRot();
llRegionSay(comm_channel, "MOVED|" + (string)sitter_number + "|" + (string)my_pos + "|" + (string)my_rot);
}
else if (llGetTime() > 86400) // auto-remove helper after 1 day
{
llDie();
}
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
key av = llAvatarOnSitTarget();
if (OLD_HELPER_METHOD)
{
if (av)
{
llRequestPermissions(av, PERMISSION_TRIGGER_ANIMATION);
llRegionSay(comm_channel, "ANIMA|" + (string)av);
}
else
{
stop_all_anims();
llRegionSay(comm_channel, "GETUP");
CURRENT_AV = "";
}
}
else if (av)
{
llUnSit(av);
llDialog(av, product + " " + version + "\n\nDo not sit on the helper with AVsitter2 unless you have enabled the old helper mode. Move the helper while sitting on the furniture. Please see instructions at http://avsitter.com", ["OK"], -68154283);
}
}
}
touch_start(integer total_number)
{
if (llGetStartParameter() != 0)
{
llRegionSay(comm_channel, "MENU|" + (string)llDetectedKey(0));
}
}
run_time_permissions(integer perm)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation("sit");
}
}
}

View file

@ -0,0 +1,215 @@
/*
* 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™ Security 2.2";
string script_basename = "[AV]sitA";
string menucontrol_script = "[AV]root-control";
string RLV_script = "[AV]root-RLV";
key active_sitter;
integer active_prim;
integer active_script_channel;
integer menu_channel;
integer menu_handle;
list SIT_TYPES = ["ALL", "OWNER", "GROUP"];
list MENU_TYPES = ["ALL", "OWNER", "GROUP"];
integer SIT_INDEX;
integer MENU_INDEX;
string lastmenu;
integer pass_security(key id, string context)
{
integer ALLOWED = FALSE;
string TYPE = llList2String(SIT_TYPES, SIT_INDEX);
if (context == "MENU")
{
TYPE = llList2String(MENU_TYPES, MENU_INDEX);
}
if (TYPE == "GROUP")
{
if (llSameGroup(id) == TRUE)
{
ALLOWED = TRUE;
}
}
else if (id == llGetOwner() || TYPE == "ALL")
{
ALLOWED = TRUE;
}
return ALLOWED;
}
check_sitters()
{
integer i = llGetNumberOfPrims();
while (llGetAgentSize(llGetLinkKey(i)) != ZERO_VECTOR)
{
key av = llGetLinkKey(i);
if (pass_security(av, "SIT") == FALSE)
{
llUnSit(av);
llDialog(av, product + "\n\nSorry, Sit access is set to: " + llList2String(SIT_TYPES, SIT_INDEX), [], -164289491);
}
i--;
}
}
back_to_adjust(integer SCRIPT_CHANNEL, key sitter)
{
llMessageLinked(LINK_SET, 90101, (string)SCRIPT_CHANNEL + "|[ADJUST]", sitter);
}
list order_buttons(list menu_items)
{
return llList2List(menu_items, -3, -1) + llList2List(menu_items, -6, -4) + llList2List(menu_items, -9, -7) + llList2List(menu_items, -12, -10);
}
register_touch(key id, integer animation_menu_function, integer active_prim, integer giveFailedMessage)
{
if (pass_security(id, "MENU"))
{
if (llGetInventoryType(menucontrol_script) == INVENTORY_SCRIPT)
{
if (check_for_RLV())
{
llMessageLinked(LINK_THIS, 90012, (string)active_prim, id);
}
else
{
llMessageLinked(LINK_THIS, 90007, "", id);
}
}
else
{
llMessageLinked(LINK_SET, 90005, (string)animation_menu_function, id);
}
}
else if (giveFailedMessage)
{
llDialog(id, product + "\n\nSorry, Menu access is set to: " + llList2String(MENU_TYPES, MENU_INDEX), [], -164289491);
}
}
main_menu()
{
dialog("Sit access: " + llList2String(SIT_TYPES, SIT_INDEX) + "\nMenu access: " + llList2String(MENU_TYPES, MENU_INDEX) + "\n\nChange security settings:", ["[BACK]", "Sit", "Menu"]);
lastmenu = "";
}
dialog(string text, list menu_items)
{
llListenRemove(menu_handle);
menu_handle = llListen(menu_channel = ((integer)llFrand(2147483646) + 1) * -1, "", llGetOwner(), "");
llDialog(llGetOwner(), product + "\n\n" + text, order_buttons(menu_items), menu_channel);
llSetTimerEvent(600);
}
integer check_for_RLV()
{
if (llGetInventoryType(RLV_script) == INVENTORY_SCRIPT)
{
return TRUE;
}
return FALSE;
}
default
{
state_entry()
{
llMessageLinked(LINK_SET, 90202, (string)check_for_RLV(), "");
}
timer()
{
llSetTimerEvent(0);
llListenRemove(menu_handle);
}
link_message(integer sender, integer num, string msg, key id)
{
if (num == 90201)
{
llMessageLinked(LINK_SET, 90202, (string)check_for_RLV(), "");
}
else if (num == 90006)
{
if (llGetInventoryType(menucontrol_script) != INVENTORY_SCRIPT)
{
register_touch(id, (integer)msg, sender, FALSE);
}
}
else if (num == 90100)
{
list data = llParseString2List(msg, ["|"], []);
if (llList2String(data, 1) == "[SECURITY]")
{
if (id == llGetOwner())
{
active_prim = sender;
active_script_channel = (integer)llList2String(data, 0);
active_sitter = (key)llList2String(data, 2);
main_menu();
}
else
{
llRegionSayTo(id, 0, "Sorry, only the owner can change security settings.");
llMessageLinked(sender, 90101, llDumpList2String([llList2String(data, 0), "[ADJUST]", id], "|"), llList2String(data, 2));
}
}
}
else if (num == 90033)
{
llListenRemove(menu_handle);
}
}
listen(integer listen_channel, string name, key id, string msg)
{
if (msg == "Sit")
{
dialog("Sit security:", SIT_TYPES);
lastmenu = msg;
return;
}
else if (msg == "Menu")
{
dialog("Menu security:", MENU_TYPES);
lastmenu = msg;
return;
}
else
{
if (msg == "[BACK]")
{
llMessageLinked(LINK_SET, 90101, llDumpList2String([active_script_channel, "[ADJUST]", id], "|"), active_sitter);
}
else if (lastmenu == "Sit")
{
SIT_INDEX = llListFindList(SIT_TYPES, [msg]);
main_menu();
check_sitters();
return;
}
else if (lastmenu == "Menu")
{
MENU_INDEX = llListFindList(MENU_TYPES, [msg]);
main_menu();
return;
}
}
llListenRemove(menu_handle);
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
check_sitters();
}
}
touch_end(integer touched)
{
if (check_for_RLV() || llGetAgentSize(llGetLinkKey(llGetNumberOfPrims())) != ZERO_VECTOR)
{
register_touch(llDetectedKey(0), 0, llDetectedLinkNumber(0), TRUE);
}
}
}

26
AVsitter2/[AV]root.lsl Normal file
View file

@ -0,0 +1,26 @@
/*
* 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 script_basename = "[AV]sitA";
string menu_script = "[AV]menu";
default
{
touch_end(integer touched)
{
if (llGetInventoryType(script_basename) != INVENTORY_SCRIPT && llGetInventoryType(menu_script) != INVENTORY_SCRIPT)
{
llMessageLinked(LINK_ALL_OTHERS, 90005, "", llDetectedKey(0));
}
}
}

244
AVsitter2/[AV]select.lsl Normal file
View file

@ -0,0 +1,244 @@
/*
* 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™ seat select";
string version = "2.2";
integer select_type;
list BUTTONS;
integer reading_notecard_section = -1;
key notecard_key;
key notecard_query;
string notecard_name = "AVpos";
string main_script = "[AV]sitA";
string adjust_script = "[AV]adjuster";
string helper_object = "[AV]helper";
string CUSTOM_TEXT;
list SITTERS;
list SYNCS;
integer menu_channel;
integer menu_handle;
integer menu_type;
integer variable1;
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 = "") + 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);
}
menu(key av)
{
integer sitter_index = llListFindList(SITTERS, [av]);
if (sitter_index != -1)
{
list menu_buttons;
integer i;
for (i = 0; i < llGetListLength(BUTTONS); i++)
{
string avname = llKey2Name(llList2Key(SITTERS, i));
if ((!select_type) && llList2Integer(SYNCS, i) == FALSE || select_type == 2 && avname != "" && av != llList2Key(SITTERS, i))
{
menu_buttons += "⊘" + llGetSubString(strReplace(avname, " Resident", " "), 0, 11);
}
else
{
menu_buttons += llList2String(BUTTONS, i);
}
}
while ((llGetListLength(menu_buttons) + 1) % 3)
{
menu_buttons += " ";
}
menu_buttons += "[ADJUST]";
llListenControl(menu_handle, TRUE);
llDialog(av, product + " " + version + "\n\n" + CUSTOM_TEXT + "[" + llList2String(BUTTONS, sitter_index) + "]", order_buttons(menu_buttons), menu_channel);
}
}
integer get_number_of_scripts()
{
integer i = 1;
while (llGetInventoryType(main_script + " " + (string)i) == INVENTORY_SCRIPT)
{
i++;
}
return i;
}
default
{
state_entry()
{
menu_channel = ((integer)llFrand(2147483646) + 1) * -1;
menu_handle = llListen(menu_channel, "", "", "");
llListenControl(menu_handle, FALSE);
integer i;
for (i = 0; i < get_number_of_scripts(); i++)
{
SITTERS += NULL_KEY;
SYNCS += FALSE;
BUTTONS += "Sitter " + (string)i;
}
notecard_key = llGetInventoryKey(notecard_name);
Out(0, "Loading...");
notecard_query = llGetNotecardLine(notecard_name, variable1);
}
listen(integer listen_channel, string name, key id, string message)
{
integer av_index = llListFindList(SITTERS, [id]);
integer button_index = llListFindList(BUTTONS, [message]);
if (av_index != -1)
{
if (message == "[ADJUST]" || message == "[HELPER]")
{
llMessageLinked(LINK_SET, 90101, llDumpList2String(["X", message, id], "|"), id);
}
else if (llGetSubString(message, 0, 0) == "⊘" || ((!select_type) && llList2Integer(SYNCS, button_index) == FALSE && llList2Key(SITTERS, button_index) != NULL_KEY && llList2Key(SITTERS, button_index) != id))
{
menu(id);
}
else if (button_index != -1)
{
llMessageLinked(LINK_SET, 90030, (string)av_index, (string)button_index);
}
}
}
changed(integer change)
{
if (change & CHANGED_INVENTORY)
{
if (llGetInventoryKey(notecard_name) != notecard_key || get_number_of_scripts() != llGetListLength(SITTERS))
{
llResetScript();
}
}
if (change & CHANGED_LINK)
{
if (llGetAgentSize(llGetLinkKey(llGetNumberOfPrims())) == ZERO_VECTOR)
{
llListenControl(menu_handle, FALSE);
}
}
}
link_message(integer sender, integer num, string msg, key id)
{
if (sender == llGetLinkNumber())
{
if (num == 90055)
{
list data = llParseStringKeepNulls(id, ["|"], []);
if (llGetSubString(llList2String(data, 0), 0, 1) != "P:")
{
SYNCS = llListReplaceList(SYNCS, [TRUE], (integer)msg, (integer)msg);
}
else
{
SYNCS = llListReplaceList(SYNCS, [FALSE], (integer)msg, (integer)msg);
}
}
else if (num == 90065)
{
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 == 90009)
{
menu(id);
}
}
}
dataserver(key query_id, string data)
{
if (query_id == notecard_query)
{
if (data == EOF)
{
integer i;
Out(0, "Ready");
}
else
{
data = llGetSubString(data, llSubStringIndex(data, "◆") + 1, -1);
data = llStringTrim(data, STRING_TRIM);
string command = llGetSubString(data, 0, llSubStringIndex(data, " ") - 1);
list parts = llParseString2List(llGetSubString(data, llSubStringIndex(data, " ") + 1, -1), [" | ", " |", "| ", "|"], []);
string part0 = llList2String(parts, 0);
if (command == "TEXT")
{
CUSTOM_TEXT = llDumpList2String(llParseStringKeepNulls(part0, ["\\n"], []), "\n") + "\n";
}
else if (command == "SITTER")
{
reading_notecard_section = (integer)part0;
string button_text = llList2String(parts, 1);
if (reading_notecard_section < llGetListLength(SITTERS))
{
if (button_text != "" && llListFindList(BUTTONS, [button_text]) == -1)
{
BUTTONS = llListReplaceList(BUTTONS, [button_text], reading_notecard_section, reading_notecard_section);
reading_notecard_section = -1;
}
}
}
else if (command == "MTYPE")
{
menu_type = (integer)part0;
}
else if (command == "SELECT")
{
select_type = (integer)part0;
}
else if (command == "POSE" || command == "SYNC")
{
if (reading_notecard_section < llGetListLength(SITTERS) && reading_notecard_section != -1)
{
if (llList2String(BUTTONS, reading_notecard_section) == "Sitter " + (string)reading_notecard_section)
{
part0 = llGetSubString(part0, 0, 22);
if (llListFindList(BUTTONS, [part0]) == -1)
{
BUTTONS = llListReplaceList(BUTTONS, [part0], reading_notecard_section, reading_notecard_section);
}
}
else
{
BUTTONS = llListReplaceList(BUTTONS, ["Sitter " + (string)reading_notecard_section], reading_notecard_section, reading_notecard_section);
reading_notecard_section = -1;
}
}
}
notecard_query = llGetNotecardLine(notecard_name, variable1 += 1);
}
}
}
}

1203
AVsitter2/[AV]sitA.lsl Normal file

File diff suppressed because it is too large Load diff

611
AVsitter2/[AV]sitB.lsl Normal file
View file

@ -0,0 +1,611 @@
/*
* 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™";
string version = "2.2";
string BRAND;
integer OLD_HELPER_METHOD;
string main_script = "[AV]sitA";
string select_script = "[AV]select";
integer SET;
integer ETYPE;
integer MTYPE;
integer SWAP;
integer AMENU;
integer SELECT;
integer SCRIPT_CHANNEL;
integer number_of_sitters;
string CUSTOM_TEXT;
string ADJUST_MENU;
string SITTER_INFO;
list MENU_LIST;
list DATA_LIST;
list POS_ROT_LIST;
integer helper_mode;
integer has_RLV;
integer ANIM_INDEX;
integer FIRST_INDEX = -1;
integer menu_handle;
integer menu_channel;
integer current_menu = -1;
integer last_menu;
string submenu_info;
integer menu_page;
key MY_SITTER;
key CONTROLLER;
string RLVDesignations;
string onSit;
integer speed_index;
integer verbose = 0;
Out(integer level, string out)
{
if (verbose >= level)
{
llOwnerSay(llGetScriptName() + "[" + version + "]:" + out);
}
}
send_anim_info(integer broadcast)
{
llMessageLinked(LINK_THIS, 90055, (string)SCRIPT_CHANNEL, llDumpList2String([llList2String(MENU_LIST, ANIM_INDEX), llList2String(DATA_LIST, ANIM_INDEX), llList2String(POS_ROT_LIST, ANIM_INDEX * 2), llList2String(POS_ROT_LIST, ANIM_INDEX * 2 + 1), broadcast, speed_index], "|"));
}
Readout_Say(string say)
{
llMessageLinked(LINK_THIS, 90022, say, (string)SCRIPT_CHANNEL);
}
list order_buttons(list buttons)
{
return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4) + llList2List(buttons, -9, -7) + llList2List(buttons, -12, -10);
}
memory()
{
llOwnerSay(llGetScriptName() + "[" + version + "] " + (string)(MENU_LIST != []) + " Items Ready, Mem=" + (string)(65536 - llGetUsedMemory()));
}
integer animation_menu(integer animation_menu_function)
{
if (animation_menu_function == -1 || (MENU_LIST != []) < 2 && (!helper_mode) && llGetInventoryType(select_script) == INVENTORY_SCRIPT)
{
llMessageLinked(LINK_SET, 90009, CONTROLLER, MY_SITTER);
}
else
{
string menu = product + version;
if (BRAND)
menu = BRAND;
if (CONTROLLER != MY_SITTER || has_RLV)
{
menu += "\n\nMenu for " + llKey2Name(MY_SITTER);
}
menu += "\n\n";
if (CUSTOM_TEXT)
{
menu += CUSTOM_TEXT + "\n";
}
if (SITTER_INFO)
{
menu += "[" + llList2String(llParseStringKeepNulls(SITTER_INFO, ["<22>"], []), 0) + "]";
}
else if (number_of_sitters > 1)
{
menu += "[Sitter " + (string)SCRIPT_CHANNEL + "]";
}
integer anim_has_speeds;
string animation_file = llList2String(llParseStringKeepNulls(llList2String(DATA_LIST, ANIM_INDEX), ["<22>"], []), 0);
if (llGetInventoryType(animation_file + "+") == INVENTORY_ANIMATION)
{
anim_has_speeds = TRUE;
}
string CURRENT_POSE_NAME;
if (~FIRST_INDEX)
{
CURRENT_POSE_NAME = llList2String(MENU_LIST, ANIM_INDEX);
menu += " [" + llList2String(llParseString2List(CURRENT_POSE_NAME, ["P:"], []), 0);
if (anim_has_speeds)
{
if (speed_index < 0)
{
menu += ", Soft";
}
else if (speed_index > 0)
{
menu += ", Hard";
}
}
menu += "]";
}
integer total_items;
integer i = current_menu + 1;
while (i++ < (MENU_LIST != []) && llSubStringIndex(llList2String(MENU_LIST, i), "M:"))
{
++total_items;
}
list menu_items0;
list menu_items2;
if ((~current_menu) || llGetInventoryType(select_script) == INVENTORY_SCRIPT)
{
menu_items0 += "[BACK]";
}
string submenu_info;
if (~current_menu)
{
submenu_info = llList2String(DATA_LIST, current_menu);
}
if (helper_mode)
{
menu_items2 += "[NEW]";
if (CURRENT_POSE_NAME)
{
menu_items2 += "[DUMP]";
menu_items2 += "[SAVE]";
}
}
else if (~llSubStringIndex(submenu_info, "V"))
{
menu_items0 += "<< Softer";
menu_items0 += "Harder >>";
}
if (AMENU == 2 || (AMENU == 1 && (!~current_menu)) || (~llSubStringIndex(submenu_info, "A")))
{
if (!(OLD_HELPER_METHOD && helper_mode))
{
menu_items2 += "[ADJUST]";
}
}
if (llSubStringIndex(onSit, "ASK") && ((!~current_menu) && SWAP == 1 || SWAP == 2 || (~llSubStringIndex(submenu_info, "S"))) && (number_of_sitters > 1 && (!(llGetInventoryType(select_script) == INVENTORY_SCRIPT))))
{
menu_items2 += "[SWAP]";
}
if (!~current_menu)
{
if (has_RLV && (llGetSubString(RLVDesignations, SCRIPT_CHANNEL, SCRIPT_CHANNEL) == "D" || CONTROLLER != MY_SITTER))
{
menu_items2 += "[STOP]";
if (!helper_mode)
{
menu_items2 += ["Control..."];
}
}
}
integer items_per_page = 12 - (menu_items2 != []) - (menu_items0 != []);
if (items_per_page < total_items)
{
menu_items2 += ["[<<]", "[>>]"];
items_per_page -= 2;
}
list menu_items1;
integer page_start = i = current_menu + 1 + menu_page * items_per_page;
do
{
if (i < (MENU_LIST != []))
{
string m = llList2String(MENU_LIST, i);
if (!llSubStringIndex(m, "M:"))
{
jump end;
}
if (!~llListFindList(["T:", "P:", "B:"], [llGetSubString(m, 0, 1)]))
{
menu_items1 += m;
}
else
{
menu_items1 += llGetSubString(m, 2, -1);
}
}
}
while (++i < page_start + items_per_page);
@end;
if (animation_menu_function == 1)
{
integer pages = total_items / (12 - (menu_items2 != []) - (menu_items0 != []));
if (!(total_items % (12 - (menu_items2 != []) - (menu_items0 != []))))
{
pages--;
}
return pages;
}
if (submenu_info == "V")
{
while ((menu_items1 != []) < items_per_page)
{
menu_items1 += " ";
}
}
llListenRemove(menu_handle);
menu_handle = llListen(menu_channel, "", CONTROLLER, "");
llDialog(CONTROLLER, menu, order_buttons(menu_items0 + menu_items1 + menu_items2), menu_channel);
}
return 0;
}
default
{
state_entry()
{
memory();
SCRIPT_CHANNEL = (integer)llGetSubString(llGetScriptName(), llSubStringIndex(llGetScriptName(), " "), -1);
if (SCRIPT_CHANNEL)
main_script += " " + (string)SCRIPT_CHANNEL;
if (llGetInventoryType(main_script) == INVENTORY_SCRIPT)
{
llResetOtherScript(main_script);
}
}
listen(integer listen_channel, string name, key id, string msg)
{
string channel;
integer index = llListFindList(MENU_LIST, [msg]);
if (!~index)
{
channel = (string)SCRIPT_CHANNEL;
index = llListFindList(MENU_LIST, ["P:" + msg]);
}
if (~index)
{
llMessageLinked(LINK_THIS, 90050, (string)channel + "|" + msg + "|" + (string)SET, MY_SITTER);
llMessageLinked(LINK_THIS, 90000, msg, channel);
if (MTYPE != 2 && MTYPE != 4)
{
llMessageLinked(LINK_THIS, 90005, "", llDumpList2String([id, MY_SITTER], "|"));
}
return;
}
index = llListFindList(MENU_LIST, ["M:" + msg]);
if (~index)
{
llMessageLinked(LINK_SET, 90051, (string)channel + "|" + llGetSubString(msg, 0, -2) + "|" + (string)SET, MY_SITTER);
menu_page = 0;
last_menu = current_menu;
current_menu = index;
animation_menu(0);
return;
}
index = llListFindList(MENU_LIST, ["B:" + msg]);
if (~index)
{
list button_data = llParseStringKeepNulls(llList2String(DATA_LIST, index), ["<22>"], []);
if (llList2String(button_data, 1))
{
msg = llList2String(button_data, 1);
}
integer n = llList2Integer(button_data, 0);
if (llGetListLength(button_data) > 2)
{
id = llList2String(button_data, 2);
}
else if (CONTROLLER != MY_SITTER)
{
id = llDumpList2String([CONTROLLER, MY_SITTER], "|");
}
llMessageLinked(LINK_SET, n, msg, id);
return;
}
if (msg == "[>>]" || msg == "[<<]")
{
if (msg == "[<<]")
{
if (!~--menu_page)
{
menu_page = animation_menu(1);
}
}
else
{
if (++menu_page > animation_menu(1))
{
menu_page = 0;
}
}
animation_menu(0);
}
else if (msg == "[BACK]")
{
menu_page = 0;
if (!~current_menu)
{
if (llGetInventoryType(select_script) == INVENTORY_SCRIPT)
{
llMessageLinked(LINK_SET, 90009, "", id);
}
return;
}
else
{
if (~last_menu)
{
current_menu = last_menu;
last_menu = -1;
}
else
{
current_menu = llListFindList(MENU_LIST, ["T:" + llGetSubString(llList2String(MENU_LIST, current_menu), 2, -1)]);
if (~current_menu)
{
current_menu -= 1;
while ((~current_menu) && llSubStringIndex(llList2String(MENU_LIST, current_menu), "M:") != 0)
{
current_menu--;
}
}
}
}
animation_menu(0);
}
else if (msg == "Control..." || msg == "[STOP]")
{
llMessageLinked(LINK_SET, 90100, llDumpList2String([SCRIPT_CHANNEL, msg, MY_SITTER], "|"), id);
}
else if (!~index)
{
llMessageLinked(LINK_SET, 90101, llDumpList2String([SCRIPT_CHANNEL, msg, CONTROLLER], "|"), MY_SITTER);
}
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
if (llGetAgentSize(llGetLinkKey(llGetNumberOfPrims())) == ZERO_VECTOR)
{
speed_index = 0;
if (!OLD_HELPER_METHOD)
{
helper_mode = FALSE;
}
MY_SITTER = "";
ANIM_INDEX = FIRST_INDEX;
}
else
{
if (OLD_HELPER_METHOD)
{
helper_mode = FALSE;
}
}
}
}
link_message(integer sender, integer num, string msg, key id)
{
integer one = (integer)msg;
integer two = (integer)((string)id);
if (num == 90000 || num == 90010 || num == 90003)
{
integer index = llListFindList(MENU_LIST, [msg]);
if (!~index)
{
index = llListFindList(MENU_LIST, ["P:" + msg]);
}
integer doit;
if (id == "")
{
doit = TRUE;
}
else if (id)
{
if (id == MY_SITTER)
{
doit = TRUE;
}
}
else if (two == SCRIPT_CHANNEL)
{
doit = TRUE;
}
if (doit && ((~index) || msg == ""))
{
ANIM_INDEX = index;
integer broadcast = TRUE;
send_anim_info(broadcast);
return;
}
if (ETYPE == 2)
{
if (num != 90010 && llGetSubString(llList2String(MENU_LIST, ANIM_INDEX), 0, 1) != "P:")
{
if (MY_SITTER != "")
{
llUnSit(MY_SITTER);
}
}
}
}
else if (num == 90045 && sender == llGetLinkNumber() && (ETYPE == 1 || ETYPE == 2))
{
list data = llParseStringKeepNulls(msg, ["|"], []);
string OLD_SYNC = llList2String(data, 5);
if (OLD_SYNC != "" && llList2String(MENU_LIST, ANIM_INDEX) == OLD_SYNC)
{
ANIM_INDEX = FIRST_INDEX;
send_anim_info(TRUE);
}
}
else if (num == 90033)
{
llListenRemove(menu_handle);
}
else if (num == 90004 || num == 90005)
{
list data = llParseStringKeepNulls(id, ["|"], []);
if ((key)llList2String(data, -1) == MY_SITTER)
{
key lastController = CONTROLLER;
CONTROLLER = (key)llList2String(data, 0);
integer index = llListFindList(MENU_LIST, ["M:" + msg + "*"]);
if (num == 90004)
{
current_menu = -1;
}
else if (~index)
{
last_menu = -1;
menu_page = 0;
current_menu = index;
msg = "";
}
animation_menu((integer)msg);
}
}
else if (num == 90030 && (one == SCRIPT_CHANNEL || two == SCRIPT_CHANNEL))
{
CONTROLLER = (MY_SITTER = "");
}
else if (num == 90100 || num == 90101)
{
list data = llParseStringKeepNulls(msg, ["|"], []);
if (llList2String(data, 1) == "[HELPER]")
{
menu_page = 0;
helper_mode = (!helper_mode);
if ((key)llList2String(data, 2) == MY_SITTER && (!OLD_HELPER_METHOD))
{
animation_menu(0);
}
}
else if (llList2String(data, 1) == "[ADJUST]")
{
helper_mode = FALSE;
menu_page = 0;
}
else if (llList2String(data, 1) == "Harder >>")
{
++speed_index;
if (speed_index > 1)
speed_index = 1;
send_anim_info(FALSE);
}
else if (llList2String(data, 1) == "<< Softer")
{
--speed_index;
if (speed_index < -1)
speed_index = -1;
send_anim_info(FALSE);
}
}
else if (num == 90201)
{
has_RLV = FALSE;
}
else if (num == 90202)
{
has_RLV = (integer)msg;
}
else if (one == SCRIPT_CHANNEL)
{
list data = llParseStringKeepNulls(id, ["|"], []);
integer index = llListFindList(MENU_LIST, [llList2String(data, 0)]);
if (!~index)
{
index = llListFindList(MENU_LIST, ["P:" + llList2String(data, 0)]);
}
if (num == 90299)
{
MENU_LIST = (DATA_LIST = (POS_ROT_LIST = []));
}
else if (num == 90070)
{
CONTROLLER = (MY_SITTER = id);
menu_page = 0;
current_menu = -1;
menu_channel = ((integer)llFrand(2147483646) + 1) * -1;
llListenRemove(menu_handle);
}
else if (num == 90065 && sender == llGetLinkNumber())
{
CONTROLLER = (MY_SITTER = "");
llListenRemove(menu_handle);
}
else if (num == 90300)
{
integer place_to_add = llGetListLength(MENU_LIST);
if (llGetListLength(data) > 2)
{
place_to_add = current_menu;
while (place_to_add < llGetListLength(MENU_LIST) && llSubStringIndex(llList2String(MENU_LIST, place_to_add + 1), "M:"))
{
++place_to_add;
}
if (!llSubStringIndex(llList2String(MENU_LIST, place_to_add + 1), "M:"))
{
++place_to_add;
}
}
MENU_LIST = llListInsertList(MENU_LIST, [llList2String(data, 0)], place_to_add);
DATA_LIST = llListInsertList(DATA_LIST, [llList2String(data, 1)], place_to_add);
POS_ROT_LIST = llListInsertList(POS_ROT_LIST, [0, 0], place_to_add * 2);
if (llGetListLength(data) == 4)
{
if (!~FIRST_INDEX)
{
FIRST_INDEX = place_to_add;
}
if (~index)
{
place_to_add = index;
}
POS_ROT_LIST = llListReplaceList(POS_ROT_LIST, [(vector)llList2String(data, 2), (vector)llList2String(data, 3)], place_to_add * 2, place_to_add * 2 + 1);
ANIM_INDEX = place_to_add;
send_anim_info(TRUE);
memory();
}
}
else if (num == 90301)
{
if (~index)
{
POS_ROT_LIST = llListReplaceList(POS_ROT_LIST, [(vector)llList2String(data, 1), (vector)llList2String(data, 2)], index * 2, index * 2 + 1);
if (llGetListLength(data) != 3)
{
send_anim_info(FALSE);
}
}
}
else if (num == 90302)
{
number_of_sitters = (integer)llList2String(data, 0);
SITTER_INFO = llList2String(data, 1);
SET = (integer)llList2String(data, 2);
MTYPE = (integer)llList2String(data, 3);
ETYPE = (integer)llList2String(data, 4);
SWAP = (integer)llList2String(data, 5);
FIRST_INDEX = (ANIM_INDEX = llListFindList(MENU_LIST, [llList2String(data, 6)]));
BRAND = llList2String(data, 7);
CUSTOM_TEXT = llList2String(data, 8);
ADJUST_MENU = llList2String(data, 9);
SELECT = (integer)llList2String(data, 10);
AMENU = (integer)llList2String(data, 11);
OLD_HELPER_METHOD = (integer)llList2String(data, 12);
RLVDesignations = llList2String(data, 13);
onSit = llList2String(data, 14);
memory();
}
else if (num == 90020 && llList2String(data, 0) == "")
{
Readout_Say("V:" + llDumpList2String([version, MTYPE, ETYPE, SET, SWAP, SITTER_INFO, CUSTOM_TEXT, ADJUST_MENU, SELECT, AMENU, OLD_HELPER_METHOD], "|"));
integer i = -1;
while (++i < (MENU_LIST != []))
{
llSleep(0.5);
Readout_Say("S:" + llList2String(MENU_LIST, i) + "|" + llList2String(DATA_LIST, i));
}
i = -1;
while (++i < (MENU_LIST != []))
{
if (llList2Vector(POS_ROT_LIST, i * 2))
{
llSleep(0.2);
Readout_Say("{" + llList2String(MENU_LIST, i) + "}" + llList2String(POS_ROT_LIST, i * 2) + llList2String(POS_ROT_LIST, i * 2 + 1));
}
}
llMessageLinked(LINK_THIS, 90021, (string)SCRIPT_CHANNEL, "");
}
}
}
}

View file

@ -0,0 +1,302 @@
# AVsitter2&trade; Developer Link Message Reference
The following [link messages](http://wiki.secondlife.com/wiki/Link_message) are used in AVsitter2.
This list is not intended for the casual user. Public API info for general users can be found [here](https://avsitter.github.io/avsitter2.html).
This page may provide additional info if the purpose of a link message is not initially clear.
**AVsitter2 uses link messages in the range 90000-90500.**
### 90000
Play an animation defined in AVpos notecard.
lMessageLinked(LINK_THIS,90000,<POSE_NAME>,<CUSTOM>);
Where for <CUSTOM>:
"" = try to play the pose for all SITTERS.
UUID = try to play the pose to avatar by UUID.
integer = apply the pose to a sitter e.g. SITTER 0.
### 90001
Play an overlay animation ([AV]adjuster, [AV]faces).
llMessageLinked(LINK_THIS,90001,<ANIMATION_FILE>,<AVATAR_UUID>);
### 90002
Stop an additional animation ([AV]adjuster, [AV]faces).
llMessageLinked(LINK_THIS,90002,<ANIMATION_FILE>,<AVATAR_UUID>);
### 90003
Same as 90000 but ignored by [AV]sequence script to prevent from stopping sequences when [AV]sequence itself plays poses.
### 90004
Same as 90005 but returns to top level of the menu (used by [AV]root-RLV when press [MENU]).
### 90005
Give the menu. Optionally set controller avatar and submenu.
llMessageLinked(LINK_SET,90005,"",<AVATAR_UUID>);
llMessageLinked(LINK_SET,90005,<TOMENU>,[<AVATAR_UUID>|<CONTROLLER_UUID>]);
TOMENU=-1 ensures when sitters first sit they will get [AV]select menu if the [AV]seclect] script is present
### 90006
Register touch or sit to [AV]root-security script from [AV]sitA after permissions granted.
llMessageLinked(LINK_SET,90006,"",<AVATAR_UUID>);
llMessageLinked(LINK_SET,90006,<FUNCTION>,<AVATAR_UUID>); // for AVselect!
FUNCTION=-1 ensures when sitters first sit they will get [AV]select menu if the [AV]seclect] script is present
### 90007
[AV]root-security passes touch to [AV]root-control.
llMessageLinked(LINK_SET,90007,"",<CONTROLLER_UUID>);
### 90009
Bring up [AV]select menu, sent by [AV]sitB.
llMessageLinked(LINK_SET,90009,"",<AVATAR_UUID>);
### 90010
Same as 90000 but ignores ETYPE.
### 90011
[AV]adjuster tells [AV]sitA scripts to set the llSetLinkCamera().
### 90012
[AV]root-security passes touch or sit to [AV]root-RLV.
llMessageLinked(LINK_THIS, 90012,<ACTIVE_PRIM>,<CONTROLLER_UUID>);
### 90014
[AV]root-RLV notifies user scripts of the controlling avatar & captive avatars.
llMessageLinked(LINK_SET,90014,llDumpList2String([CONTROLLER_UUID,llDumpList2String(CAPTIVES,",")],"|"),"");
### 90020
Tells a script to [DUMP] settings.
llMessageLinked(LINK_THIS,90020,<SITTER>,<SCRIPT_NAME>);
### 90021
Tells [AV]adjuster to ask the next script to [DUMP] settings.
llMessageLinked(LINK_THIS,90021,<SITTER#>,<SCRIPT_NAME>);
### 90022
Tell [AV]adjuster a read out settings [DUMP] line.
llMessageLinked(LINK_THIS,90022,<TEXT>,<SITTER#>);
### 90030
Tell [AV]sit scripts and [AV]adjuster to [SWAP] between two sitters.
llMessageLinked(LINK_THIS,90030,<SITTER#>,<SITTER#>);
### 90033
[AV]control tells listeners in [AV]sit & [AV]root-security scripts to reset after capture to prevent captive using an open menu, and when someone "takes control of menu".
llMessageLinked(LINK_SET,90033,"","");
### 90045
[AV]sitA gives info about the pose just played. Received by many scripts.
link_message(integer sender, integer num, string msg, key id){
if(num==90045){
// The avatar UUID
key AVATAR_UUID = id;
// Extract the data into a list
list data = llParseStringKeepNulls(msg,["|"],[]);
// The SITTER# the pose is playing for
integer SITTER_NUMBER = (integer)llList2String(data,0);
// The name of the pose
string POSE_NAME = llList2String(data,1);
// The animation file
string ANIM_FILE = llList2String(data,2);
// The SET#
integer SET = (integer)llList2String(data,3);
// A list of UUIDs of all sitting avatars separated by the ( @ ) character
list ALL_SITTERS = llParseStringKeepNulls(llList2String(data,4),["@"],[]);
// The name the SYNC pose the avatar is leaving
string OLD_SYNC_NAME = llList2String(data,5);
// TRUE if the pose is a SYNC pose
integer IS_SYNC = (integer)llList2String(data,6);
}
}
### 90050
A pose is selected from the menu
default{
link_message(integer sender, integer num, string msg, key id){
if(num==90050){
key AVATAR_UUID = id;
list data = llParseStringKeepNulls(msg,["|"],[]);
string SITTER_NUMBER = llList2String(data,0);
string POSE_NAME = llList2String(data,1);
string SET = llList2String(data,2);
}
}
}
### 90051
Same as 90050 but when a TOMENU is selected from the menu.
### 90055
[AV]sitB sends anim info to other scripts.
llMessageLinked(LINK_THIS,90055,<SITTER#>,<POSE_NAME,ANIMATION_FILE,POSITION,ROTATION,BROADCAST>);
Where <BROADCAST> is if we want to send a 90045 in response.
### 90056
Same as 90055 but sent from [AV]sitA when an avatar sits (so helper sticks know where to go).
### 90057
Sent by [AV]adjuster when helper moves, so [AV]sitA can update position.
llMessageLinked(LINK_THIS,90057,<SITTER#>,<POSITION,ROTATION>);
### 90060
Welcome new sitter!
llMessageLinked(LINK_SET,90060,"",<AVATAR_UUID>);
### 90065
Goodbye Sitter! Received by several scripts.
llMessageLinked(LINK_SET,90065,<SITTER#>,<AVATAR_UUID>);
### 90070
Update list of SITTERS in various scripts after permissions granted. Received by several scripts.
llMessageLinked(LINK_THIS,90070,<SITTER#>,<AVATAR_UUID>);
### 90075
Used by oldschool HELPER 1 method - ask to animate.
### 90076
Used by oldschool HELPER 1 method - stop animate.
### 90100
Menu choice from [AV]sitA. Also sent by [AV]sitB for [RLV] button and by [AV]root-RLV-extra for [BACK]
### 90101
Menu choice. Sent and received by several scripts.
llMessageLinked(LINK_SET,90101,<SITTER#,MSG,CONTROLLER_UUID>,<AVATAR_UUID>);
### 90150
[AV]sitA for SITTER 0 requests all [AV]sitA scripts re-place their sittarget.
### 90171
[AV]adjuster add PROP line to [AV]prop.
### 90172
[AV]adjuster add ANIM line to [AV]faces.
### 90173
[AV]menu add PROP line to [AV]prop.
### 90174
[AV]adjuster add CAMERA line to [AV]camera.
### 90200
Default integer for a BUTTON line in the AVpos notecard. Used to rez props. If UUID is specified, menu is returned to that avatar. A second UUID can be specified to rez the prop for one avatar, but return the menu to another.
### 90220
Same as 90200 but no menu is returned.
### 90201
[AV]sitA asks for info about what plugins are available.
### 90202
Reply that script exists in root: [AV]root-security (and [AV]root-RLV).
### 90203 (not used)
Reply that script exists in root: [AV]texture.
### 90204 (not used)
Reply that script exists in root: [AV]color.
### 90205
Toggle sound in the [AV]sequence script.
### 90206
[AV]root-RLV sends information to [AV]control.
### 90207
RLV sends hovertext details.
### 90208
[AV]root-RLV tells [AV]root-RLV-extra to open "Un/Dress" menu.
### 90209
[AV]root-RLV tells [AV]root-RLV-extra to open "Restrict" menu.
### 90210
Default integer for a SEQUENCE line in the AVpos notecard. Used by [AV]sequence.
### 90211
[AV]control sends [CAPTURE] message to [AV]root-RLV.
llMessageLinked(LINK_THIS,90211,"",<CONTROLLER_UUID>);
### 90230
Control [AV]camera with BUTTON or link message.
llMessageLinked(LINK_THIS,90230,<CAMERA_NAME>,<AVATAR_UUID>);
### 90298
[AV]djuster tells [AV]sitA to show SitTargets (/5 targets).
### 90299
[AV]sitA resets [AV]sitB
llMessageLinked(LINK_THIS,90299,<SITTER#>,"");
### 90300
[AV]sitA, [AV]adjuster updates [AV]sitB.
### 90301
More [AV]sitA, [AV]adjuster updates to [AV]sitB.
### 90302
[AV]sitA sends initial notecard settings data to [AV]sitB.
### 90500
[AV]prop reports on prop events (ATTACHED,DETACHED,REZ,DEREZ).
default{
link_message(integer sender, integer num, string msg, key id){
if(num==90500){
list data = llParseStringKeepNulls(msg,["|"],[]);
key AVATAR_UUID = id;
string EVENT = llList2String(data,0);
string SITTER_NUMBER = llList2String(data,1);
string PROP_NAME = llList2String(data,2);
string PROP_OBJECT = llList2String(data,3);
string PROP_GROUP = llList2String(data,4);
string PROP_UUID = llList2String(data,5);
llOwnerSay(llDumpList2String([EVENT, SITTER_NUMBER, PROP_NAME, PROP_OBJECT, PROP_GROUP, PROP_UUID, AVATAR_UUID],","));
}
}
}

View file

@ -1,87 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and modification follow.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS

373
LICENSE Normal file
View file

@ -0,0 +1,373 @@
Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
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/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.

14
LICENSE_script_header Normal file
View file

@ -0,0 +1,14 @@
/*
* 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
*/

View file

@ -1,9 +1,33 @@
# [AVsitter™](https://avsitter.com)
# [AVsitter](https://avsitter.github.io)™
Respository for some of the open-source components of [AVsitter™](https://avsitter.com) - a furniture pose system for [Second Life™](https://www.secondlife.com)
## About
* [AVsitter™](https://avsitter.com) uses the [Linden Scripting Language (LSL)](https://wiki.secondlife.com/wiki/LSL_Portal).
Repository for [AVsitter](https://avsitter.github.io)&trade; - a furniture pose system for [Second Life](https://www.secondlife.com)&reg; and [Opensim](https://en.wikipedia.org/wiki/OpenSimulator).
* Scripts are written in LSL ([Linden Scripting Language](https://wiki.secondlife.com/wiki/LSL_Portal)).
* User instructions are found at [https://avsitter.github.io](https://avsitter.github.io).
* Contributor guidelines are found [https://avsitter.github.io/contribute.html](https://avsitter.github.io/contribute.html).
Please support the official development by....
The AVsitter scripts can be freely obtained from this GitHub repository, however if you would like a packaged version of the latest release, and to receive packaged [in-world updates](https://avsitter.github.io/updates.html) of future releases, visit the [SL Marketplace](https://marketplace.secondlife.com/stores/79645) or [Kitely Market](https://www.kitely.com/market).
Proceeds are shared with open-source contributors and will help support continued development of AVsitter. Those who purchased AVsitter in the past will continue to receive [in-world updates](https://avsitter.github.io/updates.html) without needing to purchase it again.
## License
AVsitter LSL scripts are licensed under the [Mozilla Public License Version 2.0](https://www.mozilla.org/en-US/MPL/2.0/).
This basically means that: _you must make the source code for any of your changes available under MPL, but you can combine the MPL code with proprietary code, as long as you keep the MPL code in separate files._
For increased script memory, scripts can be run through [LSL-PyOptimizer online](http://lsl.project.zone/lsl-pyoptimizer/online.php). If you do this, please keep the [license notification](/LICENSE_script_header) intact in the header of any scripts you distribute.
## Trademarks and branding
If you distrubute the scripts in this repository or a derivation, you may only use our brand as permitted. See our [Trademark Guidelines](/TRADEMARK.md) for permitted use of the AVsitter&trade; brand. We also suggest [http://fossmarks.org](http://fossmarks.org) for a practical guide to understanding trademarks in the context of Free and Open Source Software.
---
[Second Life™](https://www.secondlife.com) is a trademark of Linden Research, Inc. [AVsitter™](https://avsitter.com) is not affiliated with or sponsored by Linden Research.
Second Life&reg; is a trademark of Linden Research, Inc. AVsitter&trade; is not affiliated with or sponsored by Linden Research.
Scripts were formatted by [LSL-PyOptimizer](http://lsl.project.zone/lsl-pyoptimizer/) and created using [SL forge](https://github.com/raysilent/lslforge). A sincere thanks goes to the creators of those projects! Many thanks go also to Philip Rosedale and all Lindens (past and present).

174
TRADEMARK.mediawiki Normal file
View file

@ -0,0 +1,174 @@
=AVsitter Trademark Guidelines 0.1=
__TOC__
==Introduction==
This document, the "Policy," outlines the AVsitter project's (the "Project") policy for trademark use. While our software is available under a free and open source software license, the copyright license does not include an implied right or license to use our trademarks.
The role of trademarks is to provide assurance about the quality of the products or services with which the trademark is associated. But because an open source license allows your unrestricted modification of the software, we cannot be sure that your modifications to the software are ones that will not be misleading if distributed under the same name. This Policy describes the circumstances under which you may use our trademarks.
In this Policy we are not trying to limit the lawful use of our trademarks, but rather describe for you what we consider the parameters of lawful use to be. Trademark law can be ambiguous, so we hope to provide enough clarity for you to understand whether we will consider your use licensed or non-infringing.
The sections that follow describe what trademarks are covered by this Policy, as well as uses of the trademarks that are allowed without additional permission from us. If you want to use our trademarks in ways that are not described in this Policy, please see [[#Where to get further information|"Where to get further information"]] below. Any use that does not comply with this Policy or for which we have not separately provided written permission is not a use that we have approved.
==Our commitment to open source principles==
We want to encourage the use of our software by the community, but do so in a way that still ensures that our trademarks are meaningful as a source and quality indicator for our software and the associated goods and services and continue to embody the high reputation of the software and the community associated with it. This Policy therefore tries to strike the proper balance between: 1) our need to ensure that our trademarks remain reliable indicators of the qualities that they are meant to preserve and 2) our community members' desire to be full participants in the Project.
==Trademarks subject to the guidelines==
===Our trademarks===
This Policy covers:
1. Our word trademarks and service marks (the "Word Marks"):
{| class="wikitable"
! align="left"| Mark
! Common descriptive name for the goods or services
|-
|AV and [AV]
|prefixes used broadly throughout the AVsitter range of virtual world products.
|-
|AVsitter&trade;
|furniture pose system for virtual worlds.
|-
|AVsit&trade;
|short form of AVsitter, and main script name.
|-
|AVmenu&trade;
|menu creation system.
|-
|AVprop&trade;
|script plugin to enable rezzing/derezzing of props.
|-
|AVfaces&trade;
|script plugin to enable sequencing of avatar expressions.
|-
|AVcontrol&trade;
|script plugin to enable menu control by other avatars.
|-
|AVsequence&trade;
|script plugin to enable creation of pose sequences.
|}
2. Our logos (the "Logos"):
[[Image: ./images/AVsitter-logo.jpg]]
[[Image: ./images/AVsitter-logo2.jpg]]
==Universal considerations for all uses==
Whenever you use one of the Marks, you must always do so in a way that does not mislead anyone, either directly or by omission, about exactly what they are getting and from whom. The law reflects this requirement in two major ways described in more detail [[#General considerations about trademarks and their use|below]]: it prohibits creating a [[#What is "likelihood of confusion"?|"likelihood of confusion"]] but allows for [[#What is "nominative" use?|"nominative use."]] For example, you cannot say you are distributing the AVsitter software when you're distributing a modified version of it, because people would be confused when they are not getting the same features and functionality and support they would get if they obtain the software directly from us. You also cannot use our logo on your website in a way that suggests that your website is an official website or that we endorse your website. You can, though, say you like the AVsitter software, that you participate in the AVsitter community, that you are providing an unmodified version of the AVsitter software, or that you wrote a book describing how to use the AVsitter software.
This fundamental requirement, that it is always clear to people what they are getting and from whom, is reflected throughout this Policy. It should also serve as your guide if you are not sure about how you are using the Marks.
In addition:
You may not use the Marks in association with the use or distribution of software if you are also not in compliance with the copyright license for the software.
You may not use or register, in whole or in part, the Marks as part of your own trademark, service mark, domain name, company name, trade name, product name or service name.
Trademark law does not allow your use of names or trademarks that are too similar to ours. You therefore may not use an obvious variation of any of our Marks or any phonetic equivalent, foreign language equivalent, takeoff, or abbreviation for a similar or compatible product or service.
Regarding the "AV" prefix:
The use of the prefix "AV" and "[AV]" in your product names or trademarks must be avoided if it may create [[#What is "likelihood of confusion"?|"a likelihood of confusion"]]. The Project uses this prefix throughout its product range, and therefore you should not use this prefix when distributing derivatives, forks, plugins, or competing products of the Project as it may give the impression that your project is affiliated with or endorsed by the Project.
==Use for software==
See [[#Universal considerations for all uses|Universal considerations for all uses]], above, which also apply.
===Distribution of unmodified source code or unmodified executable code we have compiled===
When you redistribute an unmodified copy of our software, you are not changing the quality or nature of it. Therefore, you may retain the Word Marks as we have placed them in the software (for example, the Word Mark AVsitter as it appears in the software menu). This kind of use only applies if you are redistributing an official distribution or scripts from the Project that have not been changed in any way (for example, you have placed unmodified scripts inside products you distribute).
In addition, you may retain the Word Marks as we have placed them in the software in versions of the software you have modified provided that modifications are limited to switching on or off features already included in the software, translations into other languages, or incorporating a small number of minor changes or bug-fix patches without making significant change to existing functionality.
===Distribution of executable code that you have compiled, or modified source code===
You may use the Word Marks, but not the Logos, to truthfully describe the origin of the software that you are providing, that is, that the code you are distributing is a modification of our software. You may say, for example, that "this software is derived from the source code for AVsitter software."
Of course, you can place your own trademarks or logos on versions of the software to which you have made substantive modifications, because by modifying the software you have become the origin of that exact version. In that case, you should not use our Word Marks, or Logos.
===Statements about compatibility, interoperability or derivation===
You may use the Word Marks, but not the Logos, to truthfully describe the relationship between your software and the Project. Our Mark should be used after a verb or preposition that describes the relationship between your software and ours. So you may say, for example, "Bob's software for the AVsitter platform" but may not say "Bob's AVsitter software." Some other examples that may work for you are:
* [Your software] works with AVsitter software
* [Your software] uses AVsitter software
* [Your software] is compatible with AVsitter software
* [Your software] is powered by AVsitter software
* [Your software] is derived from AVsitter software
* [Your software] for use with AVsitter software
* [Your software] for AVsitter software
==Use for non-software goods and services==
See [[#Universal considerations for all uses|Universal considerations for all uses]], above, which also apply.
====Websites====
You may use the Word Marks and Logos, on your webpage to show your support for the Project as long as:
* The website has branding that is easily distinguished from the Project;
* Your own branding and naming is more prominent than any Project Marks;
* The Logos hyperlink to the Project website;
* The site does not mislead customers into thinking that either your website, service, or product is our website, service, or product; and
* The site clearly states that you are not affiliated with or endorsed by the Project.
====Publications and presentations====
You can use the Word Marks in book and article titles, and the Logo in illustrations within the document, as long as the use does not suggest that we have published, endorse, or agree with your work.
====User groups and educational groups====
You can use the Word Marks as part of your user group or educational group name provided that:
* The main focus of the group is the software and not to make a profit;
* Any software the group provides is without cost;
* The group does not lead members into thinking that it is an official group affiliated with or endorsed by the Project.
==Word Marks usage==
Always use Word Marks in their exact form with the correct spelling, neither abbreviated, hyphenated, or combined with any other word or words.
* Correct: AVsitter, avsitter, AVSITTER
* Incorrect: AV-sitter, AV Sitter
==Logo usage==
You may not change any Logo except to scale it. This means you may not add decorative elements, change the colors, change the proportions, distort it, add elements, or combine it with other logos.
However, when the context requires the use of black-and-white graphics and the logo is color, you may reproduce the logo in a manner that produces a black-and-white image.
==Where to get further information==
If you have any questions about this Policy, would like to ask about the use of our Marks in ways not described in the Policy, or bring attention to any abuse of our Marks, please open an issue in the [https://github.com/AVsitter/AVsitter/issues|AVsitter GitHub repository].
==General considerations about trademarks and their use==
===What is a trademark?===
A trademark is a word, phrase, symbol or design, or a combination of words, phrases, symbols or designs, that identifies and distinguishes the source of the goods of one party from those of others. A service mark is the same as a trademark, except that it identifies and distinguishes the source of a service rather than a product. Throughout this Policy, the terms "trademark" and "mark" refer to both trademarks and service marks.
===What is "likelihood of confusion"?===
There is trademark infringement if your use of a trademark has created a "likelihood of confusion." This means using a trademark in a way that will likely confuse or deceive the relevant consuming public about the source of a product or service using the mark in question. For example, if the "Foo" software extension removes all double spaces after periods, but someone else later creates "Foo" software that adds a third space after periods, consumers would be confused between the two and the newcomer will likely be a trademark infringer. As another example, if a company makes "Foobar" software and a third party offers training called "Foobar Certification," a person is likely to believe, wrongly, that the certification is being offered by the makers of Foobar software. The third party has likely misled consumers about the source of its training and is a trademark infringer.
===What is "nominative" use?===
So-called "nominative use" (or "nominative fair use"), which is the name of the doctrine under U.S. trademark law, allows the use of another's trademark where it is necessary for understanding. Other countries' trademark laws also have similar provisions. For example, a car repair shop that specializes in a particular brand of automobile, VW for example, must be allowed to say that they repair VW cars. Here is what you should consider when deciding whether your use of a trademark is a nominative fair use:
* Whether you can identify the product or service in question without using the trademark;
* Whether you are avoiding a likelihood of confusion in the way that you have used the trademark; and
* Whether you have used only as much as is necessary to identify the product or service.
With our "Foobar Certification" example above, the person offering the certification would be allowed to say, under the nominative fair use doctrine, that she is offering "Maude's Certification for Foobar software."
It is almost never the case that using a Logo will be a nominative fair use since it will be a rare case where the logo is needed for strictly informational purposes.
==Trademark Guidelines Attribution==
These guidelines are based on the [http://www.modeltrademarkguidelines.org|Model Trademark Guidelines], used under a [https://creativecommons.org/licenses/by/3.0/deed.en_US|Creative Commons Attribution 3.0 Unported license].

20
WELCOME.notecard Normal file
View file

@ -0,0 +1,20 @@
****************************************
Welcome to AVsitter2™ Copyright (c) 2017
****************************************
Visit these links for product information:
GUIDE:
http://avsitter.github.io
GITHUB:
https://github.com/AVsitter
MARKETPLACE:
https://marketplace.secondlife.com/stores/79645
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
We hope you enjoy using AVsitter in your creations!

BIN
images/AVsitter-logo.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
images/AVsitter-logo2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9 KiB