Prepare the core scripts for OpenSim.

- Add Makefile and release creation instructions.
- Add a simple Python program to automate the OpenSim conversion based on markings in the code.
- Add .gitignore entries for the generated files.
- Add parentheses around assignments as required by OpenSim. This is done only to the core scripts.
- OpenSim isn't compatible with SL when there are conditions of type key. Those are all converted. Conditions of other types, except integer, are expanded for clarity and optimization, as they generate the same or better code that way, and currently the optimizer can do a better job when they are expanded.
- Floats in scientific notation need a dot.
- llParseStringXXXX doesn't work the same in OpenSim as in SL, when the separator is an Unicode codepoint that doesn't represent a character. For that reason, the internal separator, which is U+FFFD ("Replacement Character") is changed automatically by the Python program to U+001F (Unit Separator control character). For further safety, function strReplace is altered to use osReplaceString instead of llParseStringKeepNulls/llDumpList2String.

Furthermore, the ~ operator has the wrong precedence in OpenSim, but that was handled by a previous commit. Note that appearances of the ~ operator that were not preceded by a ! have only been replaced in the core scripts.
This commit is contained in:
Sei Lisa 2017-08-15 17:40:58 +02:00 committed by Sei-Lisa
parent 4278710ce8
commit 65c067cc30
18 changed files with 236 additions and 69 deletions

View file

@ -55,7 +55,7 @@ Readout_Say(string say, string SCRIPT_CHANNEL)
set_camera(integer byButton)
{
if (mySitter)
if (mySitter) // OSS::if (osIsUUID(mySitter) && mySitter != NULL_KEY)
{
if (llGetPermissions() & PERMISSION_CONTROL_CAMERA)
{

View file

@ -297,14 +297,14 @@ state running
integer i;
for (i = 0; i < llGetListLength(CLOTHING_LAYERS); i++)
{
if (llList2String(CLOTHING_LAYERS, i))
if (llList2String(CLOTHING_LAYERS, i) != "")
{
relay(SLAVE, "@remoutfit:" + llList2String(CLOTHING_LAYERS, i) + "=force");
}
}
for (i = 0; i < llGetListLength(ATTACHMENT_POINTS); i++)
{
if (llList2String(ATTACHMENT_POINTS, i))
if (llList2String(ATTACHMENT_POINTS, i) != "")
{
if (i != 2)
{

View file

@ -183,7 +183,7 @@ relay_select_menu()
playpose(string pose, string target_sitter)
{
if (pose)
if (pose != "")
{
llSleep(1);
llMessageLinked(LINK_SET, 90000, pose, target_sitter);
@ -289,7 +289,7 @@ reset()
unsit_all()
{
integer i = llGetNumberOfPrims();
while (llGetAgentSize(llGetLinkKey(i)))
while (llGetAgentSize(llGetLinkKey(i)) != ZERO_VECTOR)
{
llUnSit(llGetLinkKey(i));
i--;
@ -401,7 +401,7 @@ select_submissive_rlv()
{
if (llList2String(SITTER_DESIGNATIONS_MASTER, i) == "S")
{
if (llList2Key(DESIGNATIONS_NOW, i))
if (llList2Key(DESIGNATIONS_NOW, i)) // OSS::key k = llList2Key(DESIGNATIONS_NOW, i); if (osIsUUID(k) && k != NULL_KEY)
{
menu_items += llGetSubString(strReplace(llKey2Name(llList2Key(DESIGNATIONS_NOW, i)), " Resident", ""), 0, 11);
SITTERS_MENUKEYS += llList2Key(DESIGNATIONS_NOW, i);
@ -635,7 +635,7 @@ state running
{
release_all();
}
if (des1)
if (des1) // OSS::if (osIsUUID(des1) && des1 != NULL_KEY)
{
DESIGNATIONS_NOW = llListReplaceList(DESIGNATIONS_NOW, [des1], two, two);
}
@ -643,7 +643,7 @@ state running
{
DESIGNATIONS_NOW = llListReplaceList(DESIGNATIONS_NOW, [role2], two, two);
}
if (des2)
if (des2) // OSS::if (osIsUUID(des2) && des2 != NULL_KEY)
{
DESIGNATIONS_NOW = llListReplaceList(DESIGNATIONS_NOW, [des2], one, one);
}
@ -895,7 +895,7 @@ state running
{
if (~llListFindList(DESIGNATIONS_NOW, ["S"]))
{
if (CONTROLLER)
if (CONTROLLER) // OSS::if (osIsUUID(CONTROLLER) && CONTROLLER != NULL_KEY)
{
PairWhoStartedCapture = (string)CONTROLLER + (string)llGetOwnerKey(id);
}
@ -935,7 +935,7 @@ state running
}
else if (msg == "[BACK]")
{
if (menu)
if (menu != "")
{
rlv_top_menu();
}

View file

@ -155,7 +155,7 @@ sequence()
{
anim = llStringTrim(llList2String(sequence_anims, j - 1), STRING_TRIM);
}
if (anim)
if (anim != "")
{
if (IsInteger(anim))
{
@ -204,7 +204,7 @@ remove_sequences(key id)
list sequence = llParseStringKeepNulls(llList2String(anim_animsequences, llList2Integer(running_sequence_indexes, index)), ["|"], []);
running_sequence_indexes = llDeleteSubList(running_sequence_indexes, index, index);
running_pointers = llDeleteSubList(running_pointers, index, index);
while (sequence)
while (sequence != [])
{
if (!IsInteger(llList2String(sequence, 0)) && llList2String(sequence, 0) != "none")
{

View file

@ -323,7 +323,7 @@ default
listen(integer listen_channel, string name, key id, string msg)
{
if (choice)
if (choice != "")
{
if (msg == "")
{
@ -376,11 +376,11 @@ default
if (mindex_test != -1)
{
list button_data = llParseStringKeepNulls(llList2String(DATA_LIST, mindex_test), ["<22>"], []);
if (llList2String(button_data, 1))
if (llList2String(button_data, 1) != "")
{
msg = llList2String(button_data, 1);
}
if (llList2String(button_data, 2))
if (llList2String(button_data, 2) != "")
{
id = llList2String(button_data, 2);
}
@ -447,7 +447,7 @@ default
Readout_Say("");
Readout_Say("--✄--COPY BELOW INTO \"AVpos\" NOTECARD--✄--");
Readout_Say("");
if (custom_text)
if (custom_text != "")
{
Readout_Say("TEXT " + strReplace(custom_text, "\n", "\\n"));
}

View file

@ -27,7 +27,7 @@ key give_prop_warning_request;
unsit_all()
{
integer i = llGetNumberOfPrims();
while (llGetAgentSize(llGetLinkKey(i)))
while (llGetAgentSize(llGetLinkKey(i)) != ZERO_VECTOR)
{
llUnSit(llGetLinkKey(i));
i--;
@ -83,7 +83,7 @@ state prop
{
if (llGetInventoryType("[AV]sitA") == INVENTORY_NONE)
{
llSetClickAction(-1);
llSetClickAction(-1); // OSS::llSetClickAction(CLICK_ACTION_DEFAULT);
}
}
else
@ -231,7 +231,7 @@ state prop
}
else
{
if (llGetAgentSize(llGetLinkKey(llGetNumberOfPrims())))
if (llGetAgentSize(llGetLinkKey(llGetNumberOfPrims())) != ZERO_VECTOR)
{
unsit_all();
llSleep(1);

View file

@ -223,7 +223,7 @@ remove_props_by_sitter(string sitter, integer remove_type3)
{
command = "REM_WORLD";
}
if (text)
if (text != [])
{
send_command(llDumpList2String([command] + text, "|"));
}
@ -248,7 +248,7 @@ remove_sitter_props_by_pose(string sitter_pose, integer remove_type3)
}
}
}
if (text)
if (text != [])
{
send_command(llDumpList2String(["REM_INDEX"] + text, "|"));
}
@ -286,7 +286,7 @@ remove_props_by_group(integer gp)
{
command = "REM_WORLD";
}
if (text)
if (text != [])
{
send_command(llDumpList2String([command] + text, "|"));
}
@ -413,7 +413,7 @@ default
}
}
}
if (sitting_av_or_sitter)
if (sitting_av_or_sitter) // OSS::if (osIsUUID(sitting_av_or_sitter) && sitting_av_or_sitter != NULL_KEY)
{
if (num == 90200) // send menu back?
{

View file

@ -275,7 +275,7 @@ default
}
else if (command == "SEQUENCE")
{
if (CURRENT_SEQUENCE_NAME)
if (CURRENT_SEQUENCE_NAME != "")
{
commit_sequence_data();
}