first commit
This commit is contained in:
parent
e7d01132b3
commit
34f30ac80a
48 changed files with 13160 additions and 534 deletions
502
AVsitter1/AVadjuster.lsl
Normal file
502
AVsitter1/AVadjuster.lsl
Normal 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
967
AVsitter1/AVplus.lsl
Normal 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
43
AVsitter1/AVprop.lsl
Normal 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
241
AVsitter1/AVselect.lsl
Normal 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
1028
AVsitter1/AVsit.lsl
Normal file
File diff suppressed because it is too large
Load diff
225
AVsitter1/Helper.lsl
Normal file
225
AVsitter1/Helper.lsl
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
91
AVsitter1/Root-Security.lsl
Normal file
91
AVsitter1/Root-Security.lsl
Normal 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
32
AVsitter1/Root.lsl
Normal 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
66
AVsitter1/Sittarget-Add.lsl
Normal file
66
AVsitter1/Sittarget-Add.lsl
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue