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:
parent
4278710ce8
commit
65c067cc30
18 changed files with 236 additions and 69 deletions
11
.gitignore
vendored
11
.gitignore
vendored
|
@ -4,14 +4,23 @@ NOTES.md
|
|||
MARKETPLACE.md
|
||||
optimized
|
||||
|
||||
# Compressed/optimized LSL scripts
|
||||
# Release
|
||||
AVsitter2/AVsitter2.zip
|
||||
AVsitter2/AVsitter2-oss.zip
|
||||
|
||||
# Compressed/optimized/processed LSL scripts
|
||||
*.lslz
|
||||
*.lslo
|
||||
*.oss
|
||||
|
||||
.project
|
||||
.buildpath
|
||||
.settings
|
||||
.externalToolBuilders
|
||||
|
||||
# Linux backup files
|
||||
*~
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
|
87
AVsitter2/Makefile
Normal file
87
AVsitter2/Makefile
Normal file
|
@ -0,0 +1,87 @@
|
|||
# Configuration area
|
||||
|
||||
# Full path to Python. For Windows this is typically
|
||||
# C:\Python27\python.exe; if it is in your path you don't need to change it.
|
||||
PYTHON=python
|
||||
|
||||
# Full path to main.py in the optimizer. Depends on where it was unpacked.
|
||||
OPTIMIZER=/l/pyoptimizer/main.py
|
||||
|
||||
# Which preprocessor to use. Use 'gcpp' for GNU cpp (typical on Linux);
|
||||
# use 'mcpp' for mcpp.
|
||||
PREPROC_KIND=mcpp
|
||||
|
||||
# Full path to the preprocessor. Depends on where you have downloaded it.
|
||||
# If the preprocessor is mcpp and it is in your path, you can leave it as is.
|
||||
PREPROC_PATH=mcpp
|
||||
|
||||
# Command to remove files in your system. Use 'del' for Windows.
|
||||
RM=rm -f
|
||||
|
||||
# Name of the zipped file to generate for SL
|
||||
SLZIP=AVsitter2.zip
|
||||
|
||||
# Name of the zipped file to generate for OpenSim
|
||||
OSZIP=AVsitter2-oss.zip
|
||||
|
||||
# End of configuration area
|
||||
|
||||
|
||||
|
||||
# Note some of these scripts don't strictly need to be optimized for memory.
|
||||
|
||||
OPTIMIZED=[AV]sitA.lslo\
|
||||
[AV]sitB.lslo\
|
||||
[AV]adjuster.lslo\
|
||||
[AV]helper.lslo\
|
||||
[AV]root-security.lslo\
|
||||
[AV]root.lslo\
|
||||
[AV]select.lslo\
|
||||
Plugins/AVcamera/[AV]camera.lslo\
|
||||
Plugins/AVcontrol/Xcite!-Sensations/[AV]Xcite!.lslo\
|
||||
Plugins/AVcontrol/[AV]root-RLV-extra.lslo\
|
||||
Plugins/AVcontrol/[AV]root-RLV.lslo\
|
||||
Plugins/AVcontrol/[AV]root-control.lslo\
|
||||
Plugins/AVfaces/[AV]faces.lslo\
|
||||
Plugins/AVprop/[AV]menu.lslo\
|
||||
Plugins/AVprop/[AV]prop.lslo\
|
||||
Plugins/AVprop/[AV]object.lslo\
|
||||
Plugins/AVsequence/[AV]sequence.lslo\
|
||||
Utilities/AVpos-generator.lslo\
|
||||
Utilities/AVpos-shifter.lslo\
|
||||
Utilities/Anim-perm-checker.lslo\
|
||||
Utilities/MLP-converter.lslo\
|
||||
Utilities/Missing-anim-finder.lslo
|
||||
|
||||
UNOPTIMIZED=Plugins/AVcontrol/LockGuard/[AV]LockGuard.lsl\
|
||||
Plugins/AVcontrol/LockGuard/[AV]LockGuard-object.lsl
|
||||
|
||||
OPENSIM=[AV]sitA.oss\
|
||||
[AV]sitB.oss\
|
||||
[AV]adjuster.oss\
|
||||
[AV]helper.oss
|
||||
|
||||
all: $(SLZIP) $(OSZIP)
|
||||
|
||||
clean:
|
||||
$(RM) $(SLZIP) $(OSZIP) $(OPTIMIZED) $(OPENSIM)
|
||||
|
||||
optimized: $(OPTIMIZED)
|
||||
|
||||
opensim: $(OPENSIM)
|
||||
|
||||
$(SLZIP): $(OPTIMIZED) $(UNOPTIMIZED)
|
||||
$(RM) $@
|
||||
zip $@ $(OPTIMIZED) $(UNOPTIMIZED)
|
||||
|
||||
%.lslo: %.lsl
|
||||
$(PYTHON) $(OPTIMIZER) -H -O addstrings,shrinknames,-extendedglobalexpr -p $(PREPROC_KIND) --precmd=$(PREPROC_PATH) $< -o $@
|
||||
|
||||
$(OSZIP): $(OPENSIM)
|
||||
$(RM) $@
|
||||
zip $@ $(OPENSIM)
|
||||
|
||||
%.oss: %.lsl
|
||||
$(PYTHON) prepare-for-oss.py $< > $@
|
||||
|
||||
.PHONY : all clean optimized
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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")
|
||||
{
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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?
|
||||
{
|
||||
|
|
|
@ -275,7 +275,7 @@ default
|
|||
}
|
||||
else if (command == "SEQUENCE")
|
||||
{
|
||||
if (CURRENT_SEQUENCE_NAME)
|
||||
if (CURRENT_SEQUENCE_NAME != "")
|
||||
{
|
||||
commit_sequence_data();
|
||||
}
|
||||
|
|
41
AVsitter2/RELEASE.md
Normal file
41
AVsitter2/RELEASE.md
Normal file
|
@ -0,0 +1,41 @@
|
|||
# Creating a release version
|
||||
|
||||
## Needed tools
|
||||
|
||||
To create a release version like the ones available for download, you need to have the following tools:
|
||||
|
||||
### For Linux
|
||||
|
||||
- **zip**. It comes in most distributions, e.g. for Debian or Ubuntu use `sudo apt-get install zip`; if it isn't available in yours, try this link: <http://www.info-zip.org/Zip.html#Downloads>
|
||||
- **Python 2.7**. It comes in most distributions, e.g. for Debian or Ubuntu use `sudo apt-get install python`; if it isn't available in yours, try this link: <https://www.python.org/downloads/>. **Important:** Python 3.x won't work; only Python 2.x will. Usually Python 2 and Python 3 can be installed side-by-side.
|
||||
- **make**. It comes in most distributions, e.g. for Debian or Ubuntu use `sudo apt-get install make`; if it isn't available in yours, try this link: <https://www.gnu.org/software/make/#download>
|
||||
- **GNU cpp**. It comes in most distributions, e.g. for Debian or Ubuntu use `sudo apt-get install cpp`. If it isn't available in yours, or you have trouble installing it, you can instead use **mcpp**, which is much more lightweight and is included in most distributions. It is also available at this link: <http://mcpp.sourceforge.net/download.html>.
|
||||
- [**LSL-PyOptimizer**](https://github.com/Sei-Lisa/LSL-PyOptimizer). Currently the latest master branch is used to create the releases, which you can download by clicking on "Clone or Download" in the top right of the linked page.
|
||||
|
||||
### For Mac OS/X
|
||||
|
||||
- **zip** (comes preinstalled)
|
||||
- **Python 2.7** (comes preinstalled) **Important:** Python 3.x won't work; only Python 2.x will.
|
||||
- **make** - It comes as part of **Xcode** which you can get for free from the App Store.
|
||||
- [**mcpp**](http://mcpp.sourceforge.net/download.html). There's a DMG for download.
|
||||
- [**LSL-PyOptimizer**](https://github.com/Sei-Lisa/LSL-PyOptimizer). Currently the latest master branch is used to create the releases, which you can download by clicking on "Clone or Download" in the top right of the linked page.
|
||||
|
||||
### For Windows
|
||||
|
||||
- [**zip**](http://www.info-zip.org/Zip.html#Downloads)
|
||||
- [**Python 2.7**](https://www.python.org/downloads/) **Important:** Python 3.x won't work; only Python 2.x will.
|
||||
- [**make**](http://gnuwin32.sourceforge.net/packages/make.htm#download)
|
||||
- [**mcpp**](http://mcpp.sourceforge.net/download.html)
|
||||
- [**LSL-PyOptimizer**](https://github.com/Sei-Lisa/LSL-PyOptimizer). Currently the latest master branch is used to create the releases, which you can download by clicking on "Clone or Download" in the top right of the linked page.
|
||||
|
||||
## Creating the release
|
||||
|
||||
Once you have the required tools, edit the Makefile in the AVsitter2 folder to suit your needs, then using a terminal (also called command interpreter, shell, console... depending on the operating system) change to that folder using `cd <path-to-folder>` and type `make`. That should generate a file called `AVsitter2.zip` with the packaged version for SL, and another file called `AVsitter2-oss.zip` with the packaged version for OpenSim.
|
||||
|
||||
If you only want the Second Life optimized scripts without zipping them, use `make optimized`. The optimized files will have an `.lslo` extension, and they are ready to be copied and pasted each into a Second Life script.
|
||||
|
||||
If you only want the OpenSim scripts without zipping them, use `make opensim`. The OpenSim files will have an `.oss` extension.
|
||||
|
||||
If you only want the SL zip, use `make AVsitter2.zip`; if you only want the OS zip, use `make AVsitter2-oss.zip`.
|
||||
|
||||
If you want to remove the optimized scripts and the zip files, use `make clean` (you can regenerate them at any time by typing `make`).
|
|
@ -46,7 +46,7 @@ integer IsVector(string s)
|
|||
|
||||
string FormatFloat(float f, integer num_decimals)
|
||||
{
|
||||
float rounding = (float)(".5e-" + (string)num_decimals) - 5e-07;
|
||||
float rounding = (float)(".5e-" + (string)num_decimals) - .5e-6;
|
||||
if (f < 0.)
|
||||
f -= rounding;
|
||||
else
|
||||
|
|
|
@ -36,7 +36,7 @@ Out(integer level, string out)
|
|||
|
||||
string FormatFloat(float f, integer num_decimals)
|
||||
{
|
||||
float rounding = (float)(".5e-" + (string)num_decimals) - 5e-07;
|
||||
float rounding = (float)(".5e-" + (string)num_decimals) - .5e-6;
|
||||
if (f < 0.)
|
||||
f -= rounding;
|
||||
else
|
||||
|
|
|
@ -49,7 +49,7 @@ integer webcount;
|
|||
|
||||
string FormatFloat(float f, integer num_decimals)
|
||||
{
|
||||
float rounding = (float)(".5e-" + (string)num_decimals) - 5e-07;
|
||||
float rounding = (float)(".5e-" + (string)num_decimals) - .5e-6;
|
||||
if (f < 0.)
|
||||
f -= rounding;
|
||||
else
|
||||
|
@ -112,12 +112,12 @@ list order_buttons(list buttons)
|
|||
|
||||
string strReplace(string str, string search, string replace)
|
||||
{
|
||||
return llDumpList2String(llParseStringKeepNulls(str, [search], []), replace);
|
||||
return llDumpList2String(llParseStringKeepNulls(str, [search], []), replace); // OSS::return osReplaceString(str, search, replace, -1, 0);
|
||||
}
|
||||
|
||||
preview_anim(string anim, key id)
|
||||
{
|
||||
if (id)
|
||||
if (id) // OSS::if (osIsUUID(id) && id != NULL_KEY)
|
||||
{
|
||||
stop_all_anims(id);
|
||||
llMessageLinked(LINK_THIS, 90001, anim, id);
|
||||
|
@ -311,7 +311,7 @@ camera_menu()
|
|||
unsit_all()
|
||||
{
|
||||
integer i = llGetNumberOfPrims();
|
||||
while (llGetAgentSize(llGetLinkKey(i)))
|
||||
while (llGetAgentSize(llGetLinkKey(i)) != ZERO_VECTOR)
|
||||
{
|
||||
stop_all_anims(llGetLinkKey(i));
|
||||
llUnSit(llGetLinkKey(i));
|
||||
|
@ -471,11 +471,11 @@ default
|
|||
{
|
||||
Readout_Say("SWAP " + llList2String(data, 4));
|
||||
}
|
||||
if (llList2String(data, 6))
|
||||
if (llList2String(data, 6) != "")
|
||||
{
|
||||
Readout_Say("TEXT " + strReplace(llList2String(data, 6), "\n", "\\n"));
|
||||
}
|
||||
if (llList2String(data, 7))
|
||||
if (llList2String(data, 7) != "")
|
||||
{
|
||||
Readout_Say("ADJUST " + strReplace(llList2String(data, 7), "<22>", "|"));
|
||||
}
|
||||
|
@ -496,7 +496,7 @@ default
|
|||
if (llGetListLength(SITTERS) > 1 || llList2String(data, 5) != "")
|
||||
{
|
||||
string SITTER_TEXT;
|
||||
if (llList2String(data, 5))
|
||||
if (llList2String(data, 5) != "")
|
||||
{
|
||||
SITTER_TEXT = "|" + strReplace(llList2String(data, 5), "<22>", "|");
|
||||
}
|
||||
|
@ -574,7 +574,7 @@ default
|
|||
integer i;
|
||||
for (i = 0; i < llGetListLength(SITTERS); i++)
|
||||
{
|
||||
if (llList2String(SITTER_POSES, i))
|
||||
if (llList2String(SITTER_POSES, i) != "")
|
||||
{
|
||||
string type = "SYNC";
|
||||
string temp_pose_name = llList2String(SITTER_POSES, i);
|
||||
|
@ -622,7 +622,7 @@ default
|
|||
{
|
||||
if (OLD_HELPER_METHOD)
|
||||
{
|
||||
if (llGetAgentSize(llGetLinkKey(llGetNumberOfPrims())))
|
||||
if (llGetAgentSize(llGetLinkKey(llGetNumberOfPrims())) != ZERO_VECTOR)
|
||||
{
|
||||
end_helper_mode();
|
||||
}
|
||||
|
|
|
@ -31,11 +31,11 @@ rotation my_rot;
|
|||
|
||||
stop_all_anims()
|
||||
{
|
||||
if (llAvatarOnSitTarget())
|
||||
if (llAvatarOnSitTarget()) // OSS::if (llAvatarOnSitTarget() != NULL_KEY)
|
||||
{
|
||||
if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)
|
||||
{
|
||||
if (llGetAgentSize(llGetPermissionsKey()))
|
||||
if (llGetAgentSize(llGetPermissionsKey()) != ZERO_VECTOR)
|
||||
{
|
||||
list anims = llGetAnimationList(llGetPermissionsKey());
|
||||
integer n;
|
||||
|
@ -148,9 +148,9 @@ default
|
|||
if (chan == 5 && id == CURRENT_AV)
|
||||
{
|
||||
key av = (key)msg;
|
||||
if (av)
|
||||
if (av) // OSS::if (osIsUUID(av) && av != NULL_KEY)
|
||||
{
|
||||
if (llGetAgentSize(av))
|
||||
if (llGetAgentSize(av) != ZERO_VECTOR)
|
||||
{
|
||||
list avatar_location = llGetObjectDetails(av, [OBJECT_POS, OBJECT_ROT]);
|
||||
if (llVecMag(llGetPos() - llList2Vector(avatar_location, 0)) < 10)
|
||||
|
@ -175,7 +175,7 @@ default
|
|||
{
|
||||
if (OLD_HELPER_METHOD)
|
||||
{
|
||||
if (llAvatarOnSitTarget())
|
||||
if (llAvatarOnSitTarget()) // OSS::if (llAvatarOnSitTarget() != NULL_KEY)
|
||||
{
|
||||
stop_all_anims();
|
||||
llRegionSay(comm_channel, "GETUP");
|
||||
|
@ -244,7 +244,7 @@ default
|
|||
key av = llAvatarOnSitTarget();
|
||||
if (OLD_HELPER_METHOD)
|
||||
{
|
||||
if (av)
|
||||
if (av) // OSS::if (osIsUUID(av) && av != NULL_KEY)
|
||||
{
|
||||
llRequestPermissions(av, PERMISSION_TRIGGER_ANIMATION);
|
||||
llRegionSay(comm_channel, "ANIMA|" + (string)av);
|
||||
|
@ -256,7 +256,7 @@ default
|
|||
CURRENT_AV = "";
|
||||
}
|
||||
}
|
||||
else if (av)
|
||||
else if (av) // OSS::if (osIsUUID(av) && av != NULL_KEY)
|
||||
{
|
||||
llUnSit(av);
|
||||
llDialog(av, product + " " + version + "\n\nDo not sit on the helper with AVsitter2 unless you have enabled the old helper mode. Move the helper while sitting on the furniture. Please see instructions at http://avsitter.com", ["OK"], -68154283);
|
||||
|
|
|
@ -107,7 +107,7 @@ integer get_number_of_scripts()
|
|||
dialog(string text, list menu_items)
|
||||
{
|
||||
llListenRemove(menu_handle);
|
||||
menu_handle = llListen(menu_channel = ((integer)llFrand(0x7FFFFF80) + 1) * -1, "", CONTROLLER, ""); // 7FFFFF80 = max float < 2^31
|
||||
menu_handle = llListen((menu_channel = ((integer)llFrand(0x7FFFFF80) + 1) * -1), "", CONTROLLER, ""); // 7FFFFF80 = max float < 2^31
|
||||
llDialog(CONTROLLER, product + " " + version + "\n\n" + text, order_buttons(menu_items), menu_channel);
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@ release_sitter(integer i)
|
|||
{
|
||||
if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)
|
||||
{
|
||||
if (MY_SITTER)
|
||||
if (MY_SITTER) // OSS::if (osIsUUID(MY_SITTER) && MY_SITTER != NULL_KEY)
|
||||
{
|
||||
llMessageLinked(LINK_SET, 90065, (string)SCRIPT_CHANNEL, MY_SITTER); // 90065=sitter gone
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ apply_current_anim(integer broadcast)
|
|||
}
|
||||
if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)
|
||||
{
|
||||
if (llGetAgentSize(MY_SITTER))
|
||||
if (llGetAgentSize(MY_SITTER) != ZERO_VECTOR)
|
||||
{
|
||||
if (broadcast)
|
||||
{
|
||||
|
@ -368,7 +368,7 @@ apply_current_anim(integer broadcast)
|
|||
{
|
||||
sit_using_prim_params();
|
||||
}
|
||||
if (CURRENT_ANIMATION_FILENAME)
|
||||
if (CURRENT_ANIMATION_FILENAME != "")
|
||||
{
|
||||
llStartAnimation(CURRENT_ANIMATION_FILENAME);
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ apply_current_anim(integer broadcast)
|
|||
sit_using_prim_params()
|
||||
{
|
||||
integer sitter_prim = llGetNumberOfPrims();
|
||||
while (llGetAgentSize(llGetLinkKey(sitter_prim)))
|
||||
while (llGetAgentSize(llGetLinkKey(sitter_prim)) != ZERO_VECTOR)
|
||||
{
|
||||
if (llGetLinkKey(sitter_prim) == MY_SITTER)
|
||||
{
|
||||
|
@ -425,9 +425,9 @@ sit_using_prim_params()
|
|||
end_sitter()
|
||||
{
|
||||
llSetTimerEvent(0);
|
||||
if (MY_SITTER)
|
||||
if (MY_SITTER) // OSS::if (osIsUUID(MY_SITTER) && MY_SITTER != NULL_KEY)
|
||||
{
|
||||
if (CURRENT_ANIMATION_FILENAME)
|
||||
if (CURRENT_ANIMATION_FILENAME != "")
|
||||
{
|
||||
llStopAnimation(CURRENT_ANIMATION_FILENAME);
|
||||
}
|
||||
|
@ -485,9 +485,9 @@ default
|
|||
update_current_anim_name();
|
||||
if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)
|
||||
{
|
||||
if (llGetAgentSize(MY_SITTER))
|
||||
if (llGetAgentSize(MY_SITTER) != ZERO_VECTOR)
|
||||
{
|
||||
if (CURRENT_ANIMATION_FILENAME)
|
||||
if (CURRENT_ANIMATION_FILENAME != "")
|
||||
{
|
||||
llStartAnimation(CURRENT_ANIMATION_FILENAME);
|
||||
}
|
||||
|
@ -657,7 +657,7 @@ default
|
|||
{
|
||||
reused_key = llList2Key(SITTERS, two);
|
||||
}
|
||||
if (reused_key)
|
||||
if (reused_key) // OSS::if (osIsUUID(reused_key) && reused_key != NULL_KEY)
|
||||
{
|
||||
SWAPPED = TRUE;
|
||||
llRequestPermissions(reused_key, PERMISSION_TRIGGER_ANIMATION);
|
||||
|
@ -833,7 +833,7 @@ default
|
|||
{
|
||||
if (sitterGender)
|
||||
{
|
||||
if (MALE_POSENAME)
|
||||
if (MALE_POSENAME != "")
|
||||
{
|
||||
if (CURRENT_POSE_NAME == FIRST_POSENAME)
|
||||
{
|
||||
|
@ -844,7 +844,7 @@ default
|
|||
}
|
||||
else
|
||||
{
|
||||
if (FEMALE_POSENAME)
|
||||
if (FEMALE_POSENAME != "")
|
||||
{
|
||||
if (CURRENT_POSE_NAME == FIRST_POSENAME)
|
||||
{
|
||||
|
@ -875,7 +875,7 @@ default
|
|||
{
|
||||
if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)
|
||||
{
|
||||
if (MY_SITTER)
|
||||
if (MY_SITTER) // OSS::if (osIsUUID(MY_SITTER) && MY_SITTER != NULL_KEY)
|
||||
{
|
||||
llMessageLinked(LINK_SET, 90065, (string)SCRIPT_CHANNEL, MY_SITTER); // 90065=sitter gone
|
||||
}
|
||||
|
@ -900,7 +900,7 @@ default
|
|||
{
|
||||
actual_sitter = llAvatarOnSitTarget();
|
||||
}
|
||||
if (existing_sitter)
|
||||
if (existing_sitter != "")
|
||||
{
|
||||
if (actual_sitter == NULL_KEY)
|
||||
{
|
||||
|
@ -909,13 +909,13 @@ default
|
|||
release_sitter(i);
|
||||
}
|
||||
}
|
||||
else if (actual_sitter)
|
||||
else if (actual_sitter) // OSS::else if (osIsUUID(actual_sitter) && actual_sitter != NULL_KEY)
|
||||
{
|
||||
if (i == SCRIPT_CHANNEL)
|
||||
{
|
||||
if (llList2Integer(llGetObjectDetails(actual_sitter, [OBJECT_BODY_SHAPE_TYPE]), 0))
|
||||
{
|
||||
if (MALE_POSENAME)
|
||||
if (MALE_POSENAME != "")
|
||||
{
|
||||
if (CURRENT_POSE_NAME == FIRST_POSENAME)
|
||||
{
|
||||
|
@ -926,7 +926,7 @@ default
|
|||
}
|
||||
else
|
||||
{
|
||||
if (FEMALE_POSENAME)
|
||||
if (FEMALE_POSENAME != "")
|
||||
{
|
||||
if (CURRENT_POSE_NAME == FIRST_POSENAME)
|
||||
{
|
||||
|
@ -994,7 +994,7 @@ default
|
|||
animation_menu_function = -1;
|
||||
}
|
||||
reused_key = "";
|
||||
SITTERS = llListReplaceList(SITTERS, [CONTROLLER = MY_SITTER = llGetPermissionsKey()], SCRIPT_CHANNEL, SCRIPT_CHANNEL);
|
||||
SITTERS = llListReplaceList(SITTERS, [(CONTROLLER = MY_SITTER = llGetPermissionsKey())], SCRIPT_CHANNEL, SCRIPT_CHANNEL);
|
||||
string channel_or_swap = (string)SCRIPT_CHANNEL;
|
||||
integer lnk = 90000; // 90000=play pose
|
||||
if (SWAPPED)
|
||||
|
|
|
@ -86,18 +86,18 @@ integer animation_menu(integer animation_menu_function)
|
|||
else
|
||||
{
|
||||
string menu = product + version;
|
||||
if (BRAND)
|
||||
if (BRAND != "")
|
||||
menu = BRAND;
|
||||
if (CONTROLLER != MY_SITTER || has_RLV)
|
||||
{
|
||||
menu += "\n\nMenu for " + llKey2Name(MY_SITTER);
|
||||
}
|
||||
menu += "\n\n";
|
||||
if (CUSTOM_TEXT)
|
||||
if (CUSTOM_TEXT != "")
|
||||
{
|
||||
menu += CUSTOM_TEXT + "\n";
|
||||
}
|
||||
if (SITTER_INFO)
|
||||
if (SITTER_INFO != "")
|
||||
{
|
||||
menu += "[" + llList2String(llParseStringKeepNulls(SITTER_INFO, ["<22>"], []), 0) + "]";
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ integer animation_menu(integer animation_menu_function)
|
|||
if (helper_mode)
|
||||
{
|
||||
menu_items2 += "[NEW]";
|
||||
if (CURRENT_POSE_NAME)
|
||||
if (CURRENT_POSE_NAME != "")
|
||||
{
|
||||
menu_items2 += "[DUMP]";
|
||||
menu_items2 += "[SAVE]";
|
||||
|
@ -189,7 +189,7 @@ integer animation_menu(integer animation_menu_function)
|
|||
items_per_page -= 2;
|
||||
}
|
||||
list menu_items1;
|
||||
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
|
||||
{
|
||||
if (i < llGetListLength(MENU_LIST))
|
||||
|
@ -281,7 +281,7 @@ default
|
|||
if (index != -1)
|
||||
{
|
||||
list button_data = llParseStringKeepNulls(llList2String(DATA_LIST, index), ["<22>"], []);
|
||||
if (llList2String(button_data, 1))
|
||||
if (llList2String(button_data, 1) != "")
|
||||
{
|
||||
msg = llList2String(button_data, 1);
|
||||
}
|
||||
|
@ -398,7 +398,7 @@ default
|
|||
{
|
||||
doit = TRUE;
|
||||
}
|
||||
else if (id)
|
||||
else if (id) // OSS::else if (osIsUUID(id) && id != NULL_KEY)
|
||||
{
|
||||
if (id == MY_SITTER)
|
||||
{
|
||||
|
@ -608,7 +608,7 @@ default
|
|||
i = -1;
|
||||
while (++i < llGetListLength(MENU_LIST))
|
||||
{
|
||||
if (llList2Vector(POS_ROT_LIST, i * 2))
|
||||
if (llList2Vector(POS_ROT_LIST, i * 2) != ZERO_VECTOR)
|
||||
{
|
||||
llSleep(0.2);
|
||||
Readout_Say("{" + llList2String(MENU_LIST, i) + "}" + llList2String(POS_ROT_LIST, i * 2) + llList2String(POS_ROT_LIST, i * 2 + 1));
|
||||
|
|
30
AVsitter2/prepare-for-oss.py
Normal file
30
AVsitter2/prepare-for-oss.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env python
|
||||
# coding: utf8
|
||||
|
||||
import sys, re
|
||||
|
||||
def prterr(s):
|
||||
sys.stderr.write(s + "\n")
|
||||
|
||||
def main(argc, argv):
|
||||
if argc < 2:
|
||||
prterr(u'Need exactly 1 argument (input filename)')
|
||||
return 1
|
||||
|
||||
# Regex that replaces a line by its OSS version when one's specified.
|
||||
os_re = re.compile(r'^( *)(.*?) // OSS::(.*)$', re.MULTILINE)
|
||||
|
||||
f = open(argv[1], "r");
|
||||
s = f.read()
|
||||
f.close()
|
||||
# The U+FFFD character that AVsitter uses causes problems in OpenSim.
|
||||
# Replace it with U+001F (Unit Separator) which works fine.
|
||||
s = s.replace(b'\xEF\xBF\xBD', b'\x1F')
|
||||
|
||||
s = os_re.sub(r'\1\3', s)
|
||||
sys.stdout.write(s)
|
||||
return 0
|
||||
|
||||
ret = main(len(sys.argv), sys.argv)
|
||||
if ret is not None and ret > 0:
|
||||
sys.exit(ret)
|
Loading…
Reference in a new issue