Commit graph

20 commits

Author SHA1 Message Date
Sei Lisa
7b0c49ffaa Never ever use llRezObject 2020-02-22 00:10:35 +01:00
Sei Lisa
f1ec6bde26 Add code that forces an error if compiled in LSO to all scripts
This should prevent accidents when saving in inventory in the official viewer.
2018-10-10 13:50:07 +02:00
Sei Lisa
ffb4f73550 Change \u007F to \x7F, as the former gives error in the preprocessor
Problem reported by BraylaSana in #107.
2018-10-10 13:29:24 +02:00
Sei Lisa
bf8f10bfe6 Fix several calls that had wraparound hazards.
llGetSubString("abc", 3, -1) gives "abc"; llList2List(L, 1, -1) gives L when L has length 1. In general, llGetSubString or llList2List return the whole thing when the starting index is grater than the last element in the list.

There were a number of spots with that hazard, so fix all we found.
2017-11-19 18:38:33 +01:00
Sei Lisa
aa9cba13a5 Add the script name at the top, with a one-line description
It should help ensuring that you have the right script contents when saving. It also provides a short description, to get a rough idea of what it's about.

The only code change is the product name in [AV]xcite! to add a TM symbol to Xcite!
2017-11-19 18:33:04 +01:00
Sei Lisa
f599fb8f85 Hand optimizations to some scripts.
Gains in bytes:

- [AV]sitA: 3584
- [AV]sitB: 2048
- [AV]adjuster: 1024
- [AV]faces: 1024
- [AV]Xcite!: 0
- [AV]root-security: 0
2017-10-31 22:36:23 +01:00
Sei Lisa
d36b812760 Hotfix for screwup in fc69221896
One 'mainscript' was not changed.
2017-10-30 19:38:42 +01:00
Sei Lisa
fc69221896 Change mainscript -> main_script for consistency with the others. 2017-10-29 12:11:50 +01:00
Sei Lisa
b191988334 OSS: Use "\u007F" instead of assigning it at runtime. 2017-10-29 12:11:50 +01:00
Sei Lisa
d23699fbe6 Change the strategy for the U+FFFD separator handling.
Use a global variable instead. In SL, the optimizer does the replacement automatically, therefore no memory penalty is incurred. In OpenSim, the variable is assigned at run time with llUnescapeURL. The OpenSim separator is also changed from U+001F to U+007F, because most control characters under U+0020 cause problems with exporting when present in script memory.

Fixes #41.
2017-09-15 17:43:48 +02:00
Sei Lisa
4ed043d823 Fix precedence of the "!" logical NOT operator.
We knew that in OpenSim, the bitwise NOT "~" operator's precedence was broken (see <http://opensimulator.org/mantis/view.php?id=3268>), but it appears that the same bug affects the logical NOT operator "!" as well, so it needs parentheses when followed by more expressions.
2017-09-02 09:45:52 +02:00
Sei Lisa
7bf262c61e Fix llDialog with empty buttons list for OpenSim.
The optimizer removes the extra "OK" for SL.
2017-09-02 09:45:52 +02:00
Sei Lisa
1d9717b16b Revert osReplaceString change.
osReplaceString requires a regular expression, causing problems with regex-reserved characters.
2017-09-02 09:45:52 +02:00
Sei Lisa
90bd72e1ff Further fixes for OpenSim.
In OpenSim, llGetLinkNumber() returns 0 for single prims with a sitting avatar. On top of that, in older versions llGetLinkKey returns NULL_KEY for link number 0, and in newer ones it does so for link number 1.

The present changes try to make sure that under either situation, the code behaves correctly for the core scripts.
2017-09-02 09:45:52 +02:00
Sei Lisa
65c067cc30 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.
2017-09-02 09:45:52 +02:00
Sei Lisa
610890951d 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.
2017-09-02 09:45:52 +02:00
Sei Lisa
202b4503d1 Remove or add parentheses as necessary to improve clarity.
There should be no changes in the code compiled from source directly.
2017-09-02 09:45:52 +02:00
Sei Lisa
2488349a1b Comment and formatting changes; no actual code changes.
- Add spaces between functions.
- Add comments on numeric codes and a few others.
- Reformat lists and one function.
- Remove spaces at EOL.
- Use actual copyright symbol.
2017-09-02 09:45:52 +02:00
Sei-Lisa
2d9b5aebfa Fix menu activation on helper click for all avatars. (#21)
It was broken for some.
2017-08-29 18:48:51 +10:00
codeviolet
34f30ac80a first commit 2017-07-31 17:43:31 +10:00