Undo some hand optimizations.

Many of them cause problems with OpenSim.

All of them are applied by the optimizer, except (str="")+str, which produces gains only in LSO, not in Mono, and doesn't work in OpenSim.

A few are undone only for clarity, relying on the fact that the optimizer will apply them again.
This commit is contained in:
Sei Lisa 2017-08-14 20:57:57 +02:00 committed by Sei-Lisa
parent 202b4503d1
commit 610890951d
12 changed files with 70 additions and 70 deletions

View file

@ -62,7 +62,7 @@ set_camera(integer byButton)
if (llGetPermissionsKey() == mySitter) if (llGetPermissionsKey() == mySitter)
{ {
integer index = llListFindList(camera_triggers, [myPose]); integer index = llListFindList(camera_triggers, [myPose]);
if (!~index) if (index == -1)
{ {
if (~lastByButton) if (~lastByButton)
{ {

View file

@ -109,13 +109,13 @@ default
CURRENT_POSE = llList2String(data, 1); CURRENT_POSE = llList2String(data, 1);
SITTERS = llParseStringKeepNulls(llList2String(data, 4), ["@"], []); SITTERS = llParseStringKeepNulls(llList2String(data, 4), ["@"], []);
integer index = llListFindList(POSE_AND_SITTER, [CURRENT_POSE + "|" + (string)script_channel]); integer index = llListFindList(POSE_AND_SITTER, [CURRENT_POSE + "|" + (string)script_channel]);
if (!~index) if (index == -1)
{ {
index = llListFindList(POSE_AND_SITTER, [CURRENT_POSE + "|*"]); index = llListFindList(POSE_AND_SITTER, [CURRENT_POSE + "|*"]);
if (!~index) if (index == -1)
{ {
index = llListFindList(POSE_AND_SITTER, ["*|*"]); index = llListFindList(POSE_AND_SITTER, ["*|*"]);
if (!~index) if (index == -1)
{ {
return; return;
} }

View file

@ -264,7 +264,7 @@ state running
{ {
integer index = llListFindList(CLOTHING_LAYERS, [msg]); integer index = llListFindList(CLOTHING_LAYERS, [msg]);
command = "outfit"; command = "outfit";
if (!~index) if (index == -1)
{ {
index = llListFindList(ATTACHMENT_POINTS, [msg]); index = llListFindList(ATTACHMENT_POINTS, [msg]);
command = "attach"; command = "attach";
@ -420,7 +420,7 @@ state running
integer j; integer j;
while (j < llGetListLength(subRestrictions)) while (j < llGetListLength(subRestrictions))
{ {
if (!~llListFindList(currentRestrictions, [llList2String(subRestrictions, j)])) if (llListFindList(currentRestrictions, [llList2String(subRestrictions, j)]) == -1)
{ {
inActive = TRUE; inActive = TRUE;
} }

View file

@ -164,7 +164,7 @@ relay_select_menu()
integer i; integer i;
for (i = 0; i < llGetListLength(DETECTED_AVATAR_KEYS); i++) for (i = 0; i < llGetListLength(DETECTED_AVATAR_KEYS); i++)
{ {
if (!~llListFindList(SITTING_AVATARS, [llList2Key(DETECTED_AVATAR_KEYS, i)])) if (llListFindList(SITTING_AVATARS, [llList2Key(DETECTED_AVATAR_KEYS, i)]) == -1)
{ {
menu_items += llList2String(DETECTED_AVATAR_SHORTNAMES, i); menu_items += llList2String(DETECTED_AVATAR_SHORTNAMES, i);
} }
@ -203,7 +203,7 @@ rlv_top_menu()
integer designationIndex = llListFindList(DESIGNATIONS_NOW, [SLAVE]); integer designationIndex = llListFindList(DESIGNATIONS_NOW, [SLAVE]);
if (RLV_ON) if (RLV_ON)
{ {
if (!~llListFindList(CAPTIVES, [SLAVE])) if (llListFindList(CAPTIVES, [SLAVE]) == -1)
{ {
if (slaveWearingRelay) if (slaveWearingRelay)
{ {
@ -236,7 +236,7 @@ rlv_top_menu()
} }
if (llList2String(SITTER_DESIGNATIONS_MASTER, designationIndex) == "S") if (llList2String(SITTER_DESIGNATIONS_MASTER, designationIndex) == "S")
{ {
if (!~llListFindList(SITTING_AVATARS, [CONTROLLER])) if (llListFindList(SITTING_AVATARS, [CONTROLLER]) == -1)
{ {
menu_items += ["[STOP]"]; menu_items += ["[STOP]"];
} }
@ -463,12 +463,12 @@ find_seat(key id, integer index, string msg, integer captureSub)
} }
} }
DESIGNATIONS_NOW = llListReplaceList(DESIGNATIONS_NOW, [id], first_available, first_available); DESIGNATIONS_NOW = llListReplaceList(DESIGNATIONS_NOW, [id], first_available, first_available);
if (!~llListFindList(DESIGNATIONS_NOW, ["S"])) if (llListFindList(DESIGNATIONS_NOW, ["S"]) == -1)
{ {
integer i = llGetListLength(CAPTIVES) - 1; integer i = llGetListLength(CAPTIVES) - 1;
while (i > 0) while (i > 0)
{ {
if (!~llListFindList(SITTING_AVATARS, [llList2Key(CAPTIVES, i)])) if (llListFindList(SITTING_AVATARS, [llList2Key(CAPTIVES, i)]) == -1)
{ {
CAPTIVES = llDeleteSubList(CAPTIVES, i - 1, i); CAPTIVES = llDeleteSubList(CAPTIVES, i - 1, i);
} }
@ -759,7 +759,7 @@ state running
} }
if (onSit == "ASK") if (onSit == "ASK")
{ {
if (!~designationIndex) if (designationIndex == -1)
{ {
ask_role(id); ask_role(id);
return; return;
@ -859,7 +859,7 @@ state running
TimelockSecUntilRelease = defaultTimelock; TimelockSecUntilRelease = defaultTimelock;
} }
llSay(0, newSlaveName + " was captured!"); llSay(0, newSlaveName + " was captured!");
if (!~llListFindList(CAPTIVES, [newSlave])) if (llListFindList(CAPTIVES, [newSlave]) == -1)
{ {
CAPTIVES += [newSlaveName, newSlave]; CAPTIVES += [newSlaveName, newSlave];
if (llGetListLength(CAPTIVES) / 2 > llGetListLength(DESIGNATIONS_NOW)) if (llGetListLength(CAPTIVES) / 2 > llGetListLength(DESIGNATIONS_NOW))
@ -917,7 +917,7 @@ state running
else if (channel == RELAY_SEARCH_CHANNEL && expecting_relay_results) else if (channel == RELAY_SEARCH_CHANNEL && expecting_relay_results)
{ {
key relay_owner = llGetOwnerKey(id); key relay_owner = llGetOwnerKey(id);
if (!~llListFindList(DETECTED_AVATAR_KEYS, [relay_owner])) if (llListFindList(DETECTED_AVATAR_KEYS, [relay_owner]) == -1)
{ {
DETECTED_AVATAR_KEYS += relay_owner; DETECTED_AVATAR_KEYS += relay_owner;
DETECTED_AVATAR_SHORTNAMES += llGetSubString(strReplace(llKey2Name(relay_owner), " Resident", ""), 0, 11); DETECTED_AVATAR_SHORTNAMES += llGetSubString(strReplace(llKey2Name(relay_owner), " Resident", ""), 0, 11);
@ -1066,7 +1066,7 @@ state running
llSetTimerEvent(0); llSetTimerEvent(0);
PairWhoStartedCapture = (string)CONTROLLER + (string)SLAVE; PairWhoStartedCapture = (string)CONTROLLER + (string)SLAVE;
integer index = llListFindList(SITTERS, [(string)SLAVE]); integer index = llListFindList(SITTERS, [(string)SLAVE]);
if (!~index) if (index == -1)
{ {
index = 0; index = 0;
} }

View file

@ -62,7 +62,7 @@ controller_menu(key id)
} }
else else
{ {
if (llGetListLength(SITTERS) == 1 && ((!check_for_RLV()) || (!~llListFindList(DESIGNATIONS_NOW, ["S"])) || llGetListLength(DESIGNATIONS_NOW) == 1)) if (llGetListLength(SITTERS) == 1 && ((!check_for_RLV()) || (llListFindList(DESIGNATIONS_NOW, ["S"]) == -1) || llGetListLength(DESIGNATIONS_NOW) == 1))
{ {
if (check_for_RLV()) if (check_for_RLV())
{ {

View file

@ -282,7 +282,7 @@ default
if (llList2String(anim_triggers, i) == given_posename) if (llList2String(anim_triggers, i) == given_posename)
{ {
integer reference = llListFindList(anim_triggers, [(string)sitter + "|" + llList2String(anim_animsequences, i)]); integer reference = llListFindList(anim_triggers, [(string)sitter + "|" + llList2String(anim_animsequences, i)]);
if (!~reference) if (reference == -1)
{ {
reference = i; reference = i;
} }
@ -338,7 +338,7 @@ default
integer i; integer i;
for (i = 0; i < llGetListLength(anim_triggers); i++) for (i = 0; i < llGetListLength(anim_triggers); i++)
{ {
if (!llSubStringIndex(llList2String(anim_triggers, i), msg + "|")) if (llSubStringIndex(llList2String(anim_triggers, i), msg + "|") == 0)
{ {
list trigger = llParseString2List(llList2String(anim_triggers, i), ["|"], []); list trigger = llParseString2List(llList2String(anim_triggers, i), ["|"], []);
list sequence = llParseString2List(llList2String(anim_animsequences, i), ["|"], []); list sequence = llParseString2List(llList2String(anim_animsequences, i), ["|"], []);

View file

@ -294,7 +294,7 @@ integer prop_menu(integer return_pages, key av)
string strReplace(string str, string search, string replace) string strReplace(string str, string search, string replace)
{ {
return llDumpList2String(llParseStringKeepNulls((str = "") + str, [search], []), replace); return llDumpList2String(llParseStringKeepNulls(str, [search], []), replace);
} }
naming() naming()

View file

@ -261,7 +261,7 @@ remove_sitter_props_by_pose_group(string msg)
for (; i < llGetListLength(props); i++) for (; i < llGetListLength(props); i++)
{ {
string prop_group = llList2String(prop_groups, llList2Integer(props, i)); string prop_group = llList2String(prop_groups, llList2Integer(props, i));
if (!~llListFindList(groups, [prop_group])) if (llListFindList(groups, [prop_group]) == -1)
{ {
groups += prop_group; groups += prop_group;
remove_props_by_group(llListFindList(sequential_prop_groups, [prop_group])); remove_props_by_group(llListFindList(sequential_prop_groups, [prop_group]));
@ -394,7 +394,7 @@ default
if (llList2Key(SITTERS, i) == sitting_av_or_sitter || id == "" || (string)sitting_av_or_sitter == (string)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]); integer index = llListFindList(prop_triggers, [(string)i + "|" + msg]);
if (!~index) if (index == -1)
{ {
if (llGetInventoryType(main_script) != INVENTORY_SCRIPT) if (llGetInventoryType(main_script) != INVENTORY_SCRIPT)
{ {

View file

@ -55,7 +55,7 @@ string FormatFloat(float f, integer num_decimals)
else else
f += rounding; f += rounding;
string ret = llGetSubString((string)f, 0, num_decimals - !num_decimals - 7); string ret = llGetSubString((string)f, 0, num_decimals - !num_decimals - 7);
if (~llSubStringIndex(ret, ".")) if (llSubStringIndex(ret, ".") != -1)
{ {
while (llGetSubString(ret, -1, -1) == "0") while (llGetSubString(ret, -1, -1) == "0")
{ {
@ -112,7 +112,7 @@ list order_buttons(list buttons)
string strReplace(string str, string search, string replace) string strReplace(string str, string search, string replace)
{ {
return llDumpList2String(llParseStringKeepNulls((str = "") + str, [search], []), replace); return llDumpList2String(llParseStringKeepNulls(str, [search], []), replace);
} }
preview_anim(string anim, key id) preview_anim(string anim, key id)
@ -355,7 +355,7 @@ default
{ {
state_entry() state_entry()
{ {
if (~llSubStringIndex(llGetScriptName(), " ")) if (llSubStringIndex(llGetScriptName(), " ") != -1)
{ {
remove_script("Use only one of this script!"); remove_script("Use only one of this script!");
} }
@ -386,7 +386,7 @@ default
if (num == 90065) if (num == 90065)
{ {
integer index = llListFindList(SITTERS, [id]); integer index = llListFindList(SITTERS, [id]);
if (~index) if (index != -1)
{ {
SITTERS = llListReplaceList(SITTERS, [NULL_KEY], index, index); SITTERS = llListReplaceList(SITTERS, [NULL_KEY], index, index);
} }
@ -530,7 +530,7 @@ default
else else
{ {
msg = strReplace(msg, "S:B:", "BUTTON "); msg = strReplace(msg, "S:B:", "BUTTON ");
if (!~llSubStringIndex(msg, "<22>")) if (llSubStringIndex(msg, "<22>") == -1)
{ {
msg = strReplace(msg, "|90200", ""); msg = strReplace(msg, "|90200", "");
} }
@ -578,7 +578,7 @@ default
{ {
string type = "SYNC"; string type = "SYNC";
string temp_pose_name = llList2String(SITTER_POSES, i); string temp_pose_name = llList2String(SITTER_POSES, i);
if (!llSubStringIndex(llList2String(SITTER_POSES, i), "P:")) if (llSubStringIndex(llList2String(SITTER_POSES, i), "P:") == 0)
{ {
type = "POSE"; type = "POSE";
temp_pose_name = llGetSubString(temp_pose_name, 2, -1); temp_pose_name = llGetSubString(temp_pose_name, 2, -1);
@ -779,7 +779,7 @@ default
{ {
llRequestPermissions(id, PERMISSION_TRACK_CAMERA); 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])) else if (llListFindList(["[DONE]", "1", "2", "3", "4", "5", "6", "7", "8", "9"], [msg]) != -1 && llListFindList(["[POSE]", "[SYNC]", "[SYNC]2", "[PROP]", "[FACE]"], [adding]) != -1)
{ {
string choice = llList2String(get_choices(), (integer)msg - 1); string choice = llList2String(get_choices(), (integer)msg - 1);
if (adding == "[PROP]") if (adding == "[PROP]")

View file

@ -42,7 +42,7 @@ Out(integer level, string out)
string strReplace(string str, string search, string replace) string strReplace(string str, string search, string replace)
{ {
return llDumpList2String(llParseStringKeepNulls((str = "") + str, [search], []), replace); return llDumpList2String(llParseStringKeepNulls(str, [search], []), replace);
} }
list order_buttons(list buttons) list order_buttons(list buttons)

View file

@ -477,7 +477,7 @@ default
{ {
SEQUENCE_POINTER += 2; SEQUENCE_POINTER += 2;
list SEQUENCE = llParseStringKeepNulls(CURRENT_ANIMATION_SEQUENCE, ["<22>"], []); list SEQUENCE = llParseStringKeepNulls(CURRENT_ANIMATION_SEQUENCE, ["<22>"], []);
if (SEQUENCE_POINTER >= llGetListLength(SEQUENCE) || ~llListFindList(["M", "F"], llList2List(SEQUENCE, SEQUENCE_POINTER, SEQUENCE_POINTER))) if (SEQUENCE_POINTER >= llGetListLength(SEQUENCE) || llListFindList(["M", "F"], llList2List(SEQUENCE, SEQUENCE_POINTER, SEQUENCE_POINTER)) != -1)
{ {
SEQUENCE_POINTER = 0; SEQUENCE_POINTER = 0;
} }
@ -621,7 +621,7 @@ default
} }
adjust_pose_menu(); adjust_pose_menu();
} }
else if (msg == "[HELPER]" && id != llGetOwner() && !~llSubStringIndex(llGetLinkName(!!llGetLinkNumber()), "HELPER")) else if (msg == "[HELPER]" && id != llGetOwner() && llSubStringIndex(llGetLinkName(!!llGetLinkNumber()), "HELPER") == -1)
{ {
dialog("Only the owner can rez the helpers. If the owner is nearby they can type '/5 helper' in chat.", ["[BACK]"]); dialog("Only the owner can rez the helpers. If the owner is nearby they can type '/5 helper' in chat.", ["[BACK]"]);
} }
@ -945,9 +945,9 @@ default
} }
} }
} }
if (stood && !llStringLength(llDumpList2String(SITTERS, ""))) if (stood && (string)SITTERS == "")
{ {
if (DFLT || !~llSubStringIndex(CURRENT_POSE_NAME, "P:")) if (DFLT || llSubStringIndex(CURRENT_POSE_NAME, "P:") == -1)
{ {
DEFAULT_POSITION = FIRST_POSITION; DEFAULT_POSITION = FIRST_POSITION;
DEFAULT_ROTATION = FIRST_ROTATION; DEFAULT_ROTATION = FIRST_ROTATION;

View file

@ -74,12 +74,12 @@ list order_buttons(list buttons)
memory() memory()
{ {
llOwnerSay(llGetScriptName() + "[" + version + "] " + (string)(MENU_LIST != []) + " Items Ready, Mem=" + (string)(65536 - llGetUsedMemory())); llOwnerSay(llGetScriptName() + "[" + version + "] " + (string)llGetListLength(MENU_LIST) + " Items Ready, Mem=" + (string)(65536 - llGetUsedMemory()));
} }
integer animation_menu(integer animation_menu_function) integer animation_menu(integer animation_menu_function)
{ {
if ((animation_menu_function == -1 || (MENU_LIST != []) < 2) && !helper_mode && llGetInventoryType(select_script) == INVENTORY_SCRIPT) if ((animation_menu_function == -1 || llGetListLength(MENU_LIST) < 2) && !helper_mode && llGetInventoryType(select_script) == INVENTORY_SCRIPT)
{ {
llMessageLinked(LINK_SET, 90009, CONTROLLER, MY_SITTER); llMessageLinked(LINK_SET, 90009, CONTROLLER, MY_SITTER);
} }
@ -112,7 +112,7 @@ integer animation_menu(integer animation_menu_function)
anim_has_speeds = TRUE; anim_has_speeds = TRUE;
} }
string CURRENT_POSE_NAME; string CURRENT_POSE_NAME;
if (~FIRST_INDEX) if (FIRST_INDEX != -1)
{ {
CURRENT_POSE_NAME = llList2String(MENU_LIST, ANIM_INDEX); CURRENT_POSE_NAME = llList2String(MENU_LIST, ANIM_INDEX);
menu += " [" + llList2String(llParseString2List(CURRENT_POSE_NAME, ["P:"], []), 0); menu += " [" + llList2String(llParseString2List(CURRENT_POSE_NAME, ["P:"], []), 0);
@ -131,18 +131,18 @@ integer animation_menu(integer animation_menu_function)
} }
integer total_items; integer total_items;
integer i = current_menu + 1; integer i = current_menu + 1;
while (i++ < (MENU_LIST != []) && llSubStringIndex(llList2String(MENU_LIST, i), "M:")) while (i++ < llGetListLength(MENU_LIST) && llSubStringIndex(llList2String(MENU_LIST, i), "M:"))
{ {
++total_items; ++total_items;
} }
list menu_items0; list menu_items0;
list menu_items2; list menu_items2;
if (~current_menu || llGetInventoryType(select_script) == INVENTORY_SCRIPT) if (current_menu != -1 || llGetInventoryType(select_script) == INVENTORY_SCRIPT)
{ {
menu_items0 += "[BACK]"; menu_items0 += "[BACK]";
} }
string submenu_info; string submenu_info;
if (~current_menu) if (current_menu != -1)
{ {
submenu_info = llList2String(DATA_LIST, current_menu); submenu_info = llList2String(DATA_LIST, current_menu);
} }
@ -155,23 +155,23 @@ integer animation_menu(integer animation_menu_function)
menu_items2 += "[SAVE]"; menu_items2 += "[SAVE]";
} }
} }
else if (~llSubStringIndex(submenu_info, "V")) else if (llSubStringIndex(submenu_info, "V") != -1)
{ {
menu_items0 += "<< Softer"; menu_items0 += "<< Softer";
menu_items0 += "Harder >>"; menu_items0 += "Harder >>";
} }
if (AMENU == 2 || (AMENU == 1 && !~current_menu) || ~llSubStringIndex(submenu_info, "A")) if (AMENU == 2 || (AMENU == 1 && current_menu == -1) || llSubStringIndex(submenu_info, "A") != -1)
{ {
if (!(OLD_HELPER_METHOD && helper_mode)) if (!(OLD_HELPER_METHOD && helper_mode))
{ {
menu_items2 += "[ADJUST]"; 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)) if (llSubStringIndex(onSit, "ASK") && ((current_menu == -1 && SWAP == 1) || SWAP == 2 || llSubStringIndex(submenu_info, "S") != -1) && (number_of_sitters > 1 && llGetInventoryType(select_script) != INVENTORY_SCRIPT))
{ {
menu_items2 += "[SWAP]"; menu_items2 += "[SWAP]";
} }
if (!~current_menu) if (current_menu == -1)
{ {
if (has_RLV && (llGetSubString(RLVDesignations, SCRIPT_CHANNEL, SCRIPT_CHANNEL) == "D" || CONTROLLER != MY_SITTER)) if (has_RLV && (llGetSubString(RLVDesignations, SCRIPT_CHANNEL, SCRIPT_CHANNEL) == "D" || CONTROLLER != MY_SITTER))
{ {
@ -182,7 +182,7 @@ integer animation_menu(integer animation_menu_function)
} }
} }
} }
integer items_per_page = 12 - (menu_items2 != []) - (menu_items0 != []); integer items_per_page = 12 - llGetListLength(menu_items2) - llGetListLength(menu_items0);
if (items_per_page < total_items) if (items_per_page < total_items)
{ {
menu_items2 += ["[<<]", "[>>]"]; menu_items2 += ["[<<]", "[>>]"];
@ -192,14 +192,14 @@ integer animation_menu(integer animation_menu_function)
integer page_start = i = current_menu + 1 + menu_page * items_per_page; integer page_start = i = current_menu + 1 + menu_page * items_per_page;
do do
{ {
if (i < (MENU_LIST != [])) if (i < llGetListLength(MENU_LIST))
{ {
string m = llList2String(MENU_LIST, i); string m = llList2String(MENU_LIST, i);
if (!llSubStringIndex(m, "M:")) if (!llSubStringIndex(m, "M:"))
{ {
jump end; jump end;
} }
if (!~llListFindList(["T:", "P:", "B:"], [llGetSubString(m, 0, 1)])) if (llListFindList(["T:", "P:", "B:"], [llGetSubString(m, 0, 1)]) == -1)
{ {
menu_items1 += m; menu_items1 += m;
} }
@ -213,8 +213,8 @@ integer animation_menu(integer animation_menu_function)
@end; @end;
if (animation_menu_function == 1) if (animation_menu_function == 1)
{ {
integer pages = total_items / (12 - (menu_items2 != []) - (menu_items0 != [])); integer pages = total_items / (12 - llGetListLength(menu_items2) - llGetListLength(menu_items0));
if (!(total_items % (12 - (menu_items2 != []) - (menu_items0 != [])))) if (!(total_items % (12 - llGetListLength(menu_items2) - llGetListLength(menu_items0))))
{ {
pages--; pages--;
} }
@ -222,7 +222,7 @@ integer animation_menu(integer animation_menu_function)
} }
if (submenu_info == "V") if (submenu_info == "V")
{ {
while ((menu_items1 != []) < items_per_page) while (llGetListLength(menu_items1) < items_per_page)
{ {
menu_items1 += " "; menu_items1 += " ";
} }
@ -252,12 +252,12 @@ default
{ {
string channel; string channel;
integer index = llListFindList(MENU_LIST, [msg]); integer index = llListFindList(MENU_LIST, [msg]);
if (!~index) if (index == -1)
{ {
channel = (string)SCRIPT_CHANNEL; channel = (string)SCRIPT_CHANNEL;
index = llListFindList(MENU_LIST, ["P:" + msg]); index = llListFindList(MENU_LIST, ["P:" + msg]);
} }
if (~index) if (index != -1)
{ {
llMessageLinked(LINK_THIS, 90050, (string)channel + "|" + msg + "|" + (string)SET, MY_SITTER); llMessageLinked(LINK_THIS, 90050, (string)channel + "|" + msg + "|" + (string)SET, MY_SITTER);
llMessageLinked(LINK_THIS, 90000, msg, channel); llMessageLinked(LINK_THIS, 90000, msg, channel);
@ -268,7 +268,7 @@ default
return; return;
} }
index = llListFindList(MENU_LIST, ["M:" + msg]); index = llListFindList(MENU_LIST, ["M:" + msg]);
if (~index) if (index != -1)
{ {
llMessageLinked(LINK_SET, 90051, (string)channel + "|" + llGetSubString(msg, 0, -2) + "|" + (string)SET, MY_SITTER); llMessageLinked(LINK_SET, 90051, (string)channel + "|" + llGetSubString(msg, 0, -2) + "|" + (string)SET, MY_SITTER);
menu_page = 0; menu_page = 0;
@ -278,7 +278,7 @@ default
return; return;
} }
index = llListFindList(MENU_LIST, ["B:" + msg]); index = llListFindList(MENU_LIST, ["B:" + msg]);
if (~index) if (index != -1)
{ {
list button_data = llParseStringKeepNulls(llList2String(DATA_LIST, index), ["<22>"], []); list button_data = llParseStringKeepNulls(llList2String(DATA_LIST, index), ["<22>"], []);
if (llList2String(button_data, 1)) if (llList2String(button_data, 1))
@ -301,7 +301,7 @@ default
{ {
if (msg == "[<<]") if (msg == "[<<]")
{ {
if (!~--menu_page) if (--menu_page == -1)
{ {
menu_page = animation_menu(1); menu_page = animation_menu(1);
} }
@ -318,7 +318,7 @@ default
else if (msg == "[BACK]") else if (msg == "[BACK]")
{ {
menu_page = 0; menu_page = 0;
if (!~current_menu) if (current_menu == -1)
{ {
if (llGetInventoryType(select_script) == INVENTORY_SCRIPT) if (llGetInventoryType(select_script) == INVENTORY_SCRIPT)
{ {
@ -328,7 +328,7 @@ default
} }
else else
{ {
if (~last_menu) if (last_menu != -1)
{ {
current_menu = last_menu; current_menu = last_menu;
last_menu = -1; last_menu = -1;
@ -336,10 +336,10 @@ default
else else
{ {
current_menu = llListFindList(MENU_LIST, ["T:" + llGetSubString(llList2String(MENU_LIST, current_menu), 2, -1)]); current_menu = llListFindList(MENU_LIST, ["T:" + llGetSubString(llList2String(MENU_LIST, current_menu), 2, -1)]);
if (~current_menu) if (current_menu != -1)
{ {
current_menu -= 1; current_menu -= 1;
while (~current_menu && llSubStringIndex(llList2String(MENU_LIST, current_menu), "M:") != 0) while (current_menu != -1 && llSubStringIndex(llList2String(MENU_LIST, current_menu), "M:") != 0)
{ {
current_menu--; current_menu--;
} }
@ -352,7 +352,7 @@ default
{ {
llMessageLinked(LINK_SET, 90100, llDumpList2String([SCRIPT_CHANNEL, msg, MY_SITTER], "|"), id); llMessageLinked(LINK_SET, 90100, llDumpList2String([SCRIPT_CHANNEL, msg, MY_SITTER], "|"), id);
} }
else if (!~index) else if (index == -1)
{ {
llMessageLinked(LINK_SET, 90101, llDumpList2String([SCRIPT_CHANNEL, msg, CONTROLLER], "|"), MY_SITTER); llMessageLinked(LINK_SET, 90101, llDumpList2String([SCRIPT_CHANNEL, msg, CONTROLLER], "|"), MY_SITTER);
} }
@ -389,7 +389,7 @@ default
if (num == 90000 || num == 90010 || num == 90003) if (num == 90000 || num == 90010 || num == 90003)
{ {
integer index = llListFindList(MENU_LIST, [msg]); integer index = llListFindList(MENU_LIST, [msg]);
if (!~index) if (index == -1)
{ {
index = llListFindList(MENU_LIST, ["P:" + msg]); index = llListFindList(MENU_LIST, ["P:" + msg]);
} }
@ -409,7 +409,7 @@ default
{ {
doit = TRUE; doit = TRUE;
} }
if (doit && (~index || msg == "")) if (doit && (index != -1 || msg == ""))
{ {
ANIM_INDEX = index; ANIM_INDEX = index;
integer broadcast = TRUE; integer broadcast = TRUE;
@ -453,7 +453,7 @@ default
{ {
current_menu = -1; current_menu = -1;
} }
else if (~index) else if (index != -1)
{ {
last_menu = -1; last_menu = -1;
menu_page = 0; menu_page = 0;
@ -511,7 +511,7 @@ default
{ {
list data = llParseStringKeepNulls(id, ["|"], []); list data = llParseStringKeepNulls(id, ["|"], []);
integer index = llListFindList(MENU_LIST, [llList2String(data, 0)]); integer index = llListFindList(MENU_LIST, [llList2String(data, 0)]);
if (!~index) if (index == -1)
{ {
index = llListFindList(MENU_LIST, ["P:" + llList2String(data, 0)]); index = llListFindList(MENU_LIST, ["P:" + llList2String(data, 0)]);
} }
@ -538,11 +538,11 @@ default
if (llGetListLength(data) > 2) if (llGetListLength(data) > 2)
{ {
place_to_add = current_menu; place_to_add = current_menu;
while (place_to_add < llGetListLength(MENU_LIST) && llSubStringIndex(llList2String(MENU_LIST, place_to_add + 1), "M:")) while (place_to_add < llGetListLength(MENU_LIST) && llSubStringIndex(llList2String(MENU_LIST, place_to_add + 1), "M:") != 0)
{ {
++place_to_add; ++place_to_add;
} }
if (!llSubStringIndex(llList2String(MENU_LIST, place_to_add + 1), "M:")) if (llSubStringIndex(llList2String(MENU_LIST, place_to_add + 1), "M:") == 0)
{ {
++place_to_add; ++place_to_add;
} }
@ -552,11 +552,11 @@ default
POS_ROT_LIST = llListInsertList(POS_ROT_LIST, [0, 0], place_to_add * 2); POS_ROT_LIST = llListInsertList(POS_ROT_LIST, [0, 0], place_to_add * 2);
if (llGetListLength(data) == 4) if (llGetListLength(data) == 4)
{ {
if (!~FIRST_INDEX) if (FIRST_INDEX == -1)
{ {
FIRST_INDEX = place_to_add; FIRST_INDEX = place_to_add;
} }
if (~index) if (index != -1)
{ {
place_to_add = index; place_to_add = index;
} }
@ -568,7 +568,7 @@ default
} }
else if (num == 90301) else if (num == 90301)
{ {
if (~index) if (index != -1)
{ {
POS_ROT_LIST = llListReplaceList(POS_ROT_LIST, [(vector)llList2String(data, 1), (vector)llList2String(data, 2)], index * 2, index * 2 + 1); POS_ROT_LIST = llListReplaceList(POS_ROT_LIST, [(vector)llList2String(data, 1), (vector)llList2String(data, 2)], index * 2, index * 2 + 1);
if (llGetListLength(data) != 3) if (llGetListLength(data) != 3)
@ -600,13 +600,13 @@ default
{ {
Readout_Say("V:" + llDumpList2String([version, MTYPE, ETYPE, SET, SWAP, SITTER_INFO, CUSTOM_TEXT, ADJUST_MENU, SELECT, AMENU, OLD_HELPER_METHOD], "|")); Readout_Say("V:" + llDumpList2String([version, MTYPE, ETYPE, SET, SWAP, SITTER_INFO, CUSTOM_TEXT, ADJUST_MENU, SELECT, AMENU, OLD_HELPER_METHOD], "|"));
integer i = -1; integer i = -1;
while (++i < (MENU_LIST != [])) while (++i < llGetListLength(MENU_LIST))
{ {
llSleep(0.5); llSleep(0.5);
Readout_Say("S:" + llList2String(MENU_LIST, i) + "|" + llList2String(DATA_LIST, i)); Readout_Say("S:" + llList2String(MENU_LIST, i) + "|" + llList2String(DATA_LIST, i));
} }
i = -1; i = -1;
while (++i < (MENU_LIST != [])) while (++i < llGetListLength(MENU_LIST))
{ {
if (llList2Vector(POS_ROT_LIST, i * 2)) if (llList2Vector(POS_ROT_LIST, i * 2))
{ {