Commit graph

24 commits

Author SHA1 Message Date
Sei Lisa
1e40fe9c32 Reuse the position/rotation vectors when they occur multiple times
This change has the potential of saving memory when there are multiple poses with the same position or rotation.

Based on a suggestion by @ohhmye (thanks).
2021-01-10 16:27:10 +01:00
Sei-Lisa
f6f6fb533a
Merge pull request #127 from Sei-Lisa/sei-add-versions
Add version code to most scripts
2020-09-11 13:18:28 +02:00
Sei Lisa
edf88da354 Add message 90008 to play poses as if they were selected by menu 2020-09-11 13:11:45 +02:00
Sei Lisa
4b5003294e Change the versioning scheme and add full version to all scripts
The new versioning scheme uses a letter instead of the dash. The letter is a p for a work-in-progress/pre-release version, or an r for a release version. For example:

2.2p04 - work in progress for version 2.2r04
2.2r04 - release version (2.2-04 with the previous scheme)

The two digit number will be increasing even for minor changes. The last minor changes indicator is dropped.
2020-09-07 22:42:58 +02:00
Sei Lisa
04c008db42 Add automatic version numbering to the build system.
Closes avsitter/avsitter.github.io#46
2020-09-07 22:42:47 +02:00
Sei Lisa
fec2ba1ff5 Reset the menu page when message 90004 is received
Fixes an issue reported by Arsone.Danick; it happens e.g. when the menu was left in a page other than the first, and another avatar takes control.
2020-04-04 00:10:01 +02: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
9936f50cc5 Allow passing single IDs when calling external scripts
BUTTON is documented to pass the UUIDs of the controller *and* the sitter when they are different, separated by a "|".

ADJUST is not documented to do that (yet), but it behaves that way.

Both behaviours are undesirable for generic scripts that respond to a link message without being specifically designed for AVsitter, because they don't expect the extra UUID. This can be seen as an AVsitter shortcoming, therefore we implement backwards-compatible workarounds.

For ADJUST, the AMENU argument's range has been extended:

  0, 1 and 2 behave the same as before.
  4, 5 and 6 behave as 0, 1 and 2 respectively, but also inhibit sending the second UUID.

For BUTTON, two special values have been added for the ID field: <C> and <S>, which will be replaced with CONTROLLER and SITTER respectively. For example:

    BUTTON text|num|str

behaves the same as before, sending both CONTROLLER and SITTER in the UUID field when they differ; however:

    BUTTON text|num|str|<C>

always passes only the UUID of the person who controls the menu. Similarly for <S>.
2018-08-18 10:39:55 +02:00
Sei Lisa
367cea2212 Fix BUTTON link message
Follow-up to a65d7cd, which failed for the main menu. That's because current_menu is -1 for the main menu.

Since current menu is either -1 or points to a MENU entry, it's safe to add 1 to it and bring it to a correct range.

While on it, remove redundant `if`.

Per bug report by RiderDavis.

Fixes #95.
2018-04-22 00:29:51 +02:00
Sei Lisa
a65d7cdc82 Fix distinguishing BUTTON by submenu
When the same BUTTON appears in different submenus, with different parameters, pressing it always picked the one that appeared first in the notecard.

Fix that by making the search start at the current menu.

Per bug report by AceyXx.
2018-01-25 12:17:14 +01: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
b191988334 OSS: Use "\u007F" instead of assigning it at runtime. 2017-10-29 12:11:50 +01:00
Sei Lisa
032e0369bf Provisional fix for OpenSim event timeouts during dumping.
This is a provisional fix for #45. As discussed there, a proper fix will come later.
2017-09-20 10:15:15 +02: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
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
4278710ce8 Fix some marginal bugs, and the version of [AV]faces.
- Bump version of [AV]faces to 2.2.
- With very bad luck, some channel numbers could overflow the range of an integer due to float rounding, and produce DEBUG_CHANNEL or PUBLIC_CHANNEL as output.
- If both CHANGED_INVENTORY and CHANGED_LINK came at the same time, [AV]prop would fail to handle both.
- There was code that did nothing in [AV]faces. While it caused no bug per se, if it was reused in future then it could be affected by the same problem as that in [AV]prop.
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
codeviolet
34f30ac80a first commit 2017-07-31 17:43:31 +10:00