From 4ed043d823f64624608deb41dda7ff269aad4b94 Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Tue, 29 Aug 2017 12:56:15 +0200 Subject: [PATCH] Fix precedence of the "!" logical NOT operator. We knew that in OpenSim, the bitwise NOT "~" operator's precedence was broken (see ), but it appears that the same bug affects the logical NOT operator "!" as well, so it needs parentheses when followed by more expressions. --- AVsitter2/Plugins/AVfaces/[AV]faces.lsl | 4 ++-- AVsitter2/Plugins/AVprop/[AV]object.lsl | 2 +- AVsitter2/Utilities/MLP-converter.lsl | 2 +- AVsitter2/[AV]adjuster.lsl | 4 ++-- AVsitter2/[AV]helper.lsl | 2 +- AVsitter2/[AV]select.lsl | 4 ++-- AVsitter2/[AV]sitA.lsl | 2 +- AVsitter2/[AV]sitB.lsl | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/AVsitter2/Plugins/AVfaces/[AV]faces.lsl b/AVsitter2/Plugins/AVfaces/[AV]faces.lsl index b2f3144..3008982 100644 --- a/AVsitter2/Plugins/AVfaces/[AV]faces.lsl +++ b/AVsitter2/Plugins/AVfaces/[AV]faces.lsl @@ -206,7 +206,7 @@ remove_sequences(key id) running_pointers = llDeleteSubList(running_pointers, index, index); while (sequence != []) { - if (!IsInteger(llList2String(sequence, 0)) && llList2String(sequence, 0) != "none") + if ((!IsInteger(llList2String(sequence, 0))) && llList2String(sequence, 0) != "none") { llMessageLinked(LINK_THIS, 90002, llList2String(sequence, 0), id); } @@ -253,7 +253,7 @@ default llMessageLinked(sender, 90101, llDumpList2String([llList2String(data, 0), "[ADJUST]", id], "|"), llList2String(data, 2)); if (id == llGetOwner()) { - is_running = (!is_running); + is_running = !is_running; if (sender == llGetLinkNumber()) { llRegionSayTo(id, 0, "Facial Expressions " + llList2String(["OFF", "ON"], is_running)); diff --git a/AVsitter2/Plugins/AVprop/[AV]object.lsl b/AVsitter2/Plugins/AVprop/[AV]object.lsl index 91c82c0..b467f0b 100644 --- a/AVsitter2/Plugins/AVprop/[AV]object.lsl +++ b/AVsitter2/Plugins/AVprop/[AV]object.lsl @@ -128,7 +128,7 @@ state prop touch_start(integer touched) { - if (!llGetAttached() && (prop_type == 2 || prop_type == 1)) + if ((!llGetAttached()) && (prop_type == 2 || prop_type == 1)) { llRequestExperiencePermissions(llDetectedKey(0), ""); } diff --git a/AVsitter2/Utilities/MLP-converter.lsl b/AVsitter2/Utilities/MLP-converter.lsl index 2c2a60e..ed7248b 100644 --- a/AVsitter2/Utilities/MLP-converter.lsl +++ b/AVsitter2/Utilities/MLP-converter.lsl @@ -41,7 +41,7 @@ string FormatFloat(float f, integer num_decimals) f -= rounding; else 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, ".") != -1) { while (llGetSubString(ret, -1, -1) == "0") diff --git a/AVsitter2/[AV]adjuster.lsl b/AVsitter2/[AV]adjuster.lsl index 4334665..ba686d7 100644 --- a/AVsitter2/[AV]adjuster.lsl +++ b/AVsitter2/[AV]adjuster.lsl @@ -54,7 +54,7 @@ string FormatFloat(float f, integer num_decimals) f -= rounding; else 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, ".") != -1) { while (llGetSubString(ret, -1, -1) == "0") @@ -784,7 +784,7 @@ default if (adding == "[PROP]") { integer perms = llGetInventoryPermMask(choice, MASK_NEXT); - if (!(perms & PERM_COPY)) + if ((perms & PERM_COPY) == 0) { llSay(0, "Could not add prop '" + choice + "'. Props and their content must be COPY-OK for NEXT owner."); } diff --git a/AVsitter2/[AV]helper.lsl b/AVsitter2/[AV]helper.lsl index 0456e6b..9ff7789 100644 --- a/AVsitter2/[AV]helper.lsl +++ b/AVsitter2/[AV]helper.lsl @@ -107,7 +107,7 @@ default llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_TEXTURE, ALL_SIDES, "5748decc-f629-461c-9a36-a35a221fe21f", <1,1,0>, <0,0,0>, 0, PRIM_FULLBRIGHT, ALL_SIDES, TRUE]); } integer everyonePerms = llGetObjectPermMask(MASK_EVERYONE); - if (!(everyonePerms & PERM_MOVE) && llGetOwner() == llGetInventoryCreator(llGetScriptName())) + if ((everyonePerms & PERM_MOVE) == 0 && llGetOwner() == llGetInventoryCreator(llGetScriptName())) { llOwnerSay("WARNING! AVhelper should be set to 'Anyone Can Move'"); } diff --git a/AVsitter2/[AV]select.lsl b/AVsitter2/[AV]select.lsl index cdecaaa..9e0a6fb 100644 --- a/AVsitter2/[AV]select.lsl +++ b/AVsitter2/[AV]select.lsl @@ -60,7 +60,7 @@ menu(key av) for (i = 0; i < llGetListLength(BUTTONS); i++) { string avname = llKey2Name(llList2Key(SITTERS, i)); - if ((!select_type && llList2Integer(SYNCS, i) == FALSE || select_type == 2) && avname != "" && av != llList2Key(SITTERS, i)) + if ((select_type == 0 && llList2Integer(SYNCS, i) == FALSE || select_type == 2) && avname != "" && av != llList2Key(SITTERS, i)) { menu_buttons += "⊘" + llGetSubString(strReplace(avname, " Resident", " "), 0, 11); } @@ -115,7 +115,7 @@ default { llMessageLinked(LINK_SET, 90101, llDumpList2String(["X", message, id], "|"), id); } - else if (llGetSubString(message, 0, 0) == "⊘" || (!select_type && llList2Integer(SYNCS, button_index) == FALSE && llList2Key(SITTERS, button_index) != NULL_KEY && llList2Key(SITTERS, button_index) != id)) + else if (llGetSubString(message, 0, 0) == "⊘" || (select_type == 0 && llList2Integer(SYNCS, button_index) == FALSE && llList2Key(SITTERS, button_index) != NULL_KEY && llList2Key(SITTERS, button_index) != id)) { menu(id); } diff --git a/AVsitter2/[AV]sitA.lsl b/AVsitter2/[AV]sitA.lsl index ad601c6..9632702 100644 --- a/AVsitter2/[AV]sitA.lsl +++ b/AVsitter2/[AV]sitA.lsl @@ -498,7 +498,7 @@ default touch_end(integer touched) { - if (!SCRIPT_CHANNEL && !has_security && MTYPE < 3) + if (SCRIPT_CHANNEL == 0 && (!has_security) && MTYPE < 3) { llMessageLinked(LINK_SET, 90005, "", llDetectedKey(0)); // 90005=send menu to user } diff --git a/AVsitter2/[AV]sitB.lsl b/AVsitter2/[AV]sitB.lsl index f6985fa..896b994 100644 --- a/AVsitter2/[AV]sitB.lsl +++ b/AVsitter2/[AV]sitB.lsl @@ -79,7 +79,7 @@ memory() integer animation_menu(integer animation_menu_function) { - if ((animation_menu_function == -1 || llGetListLength(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); } @@ -214,7 +214,7 @@ integer animation_menu(integer animation_menu_function) if (animation_menu_function == 1) { integer pages = total_items / (12 - llGetListLength(menu_items2) - llGetListLength(menu_items0)); - if (!(total_items % (12 - llGetListLength(menu_items2) - llGetListLength(menu_items0)))) + if ((total_items % (12 - llGetListLength(menu_items2) - llGetListLength(menu_items0))) == 0) { pages--; }