Cool VL Viewer forum
http://sldev.free.fr/forum/

Lua scripting related requests
http://sldev.free.fr/forum/viewtopic.php?f=9&t=1737
Page 1 of 10

Author:  Henri Beauchamp [ 2017-01-14 11:21:37 ]
Post subject:  Lua scripting related requests

My motivations for this new feature were to provide a way for the Cool VL Viewer users (me included) to add new functions or customizations to it without having to modify the code of the viewer itself. It also brings the possibilities to use the viewer to run bot avatars, and to extend the capabilities of scripted items to things they cannot do so far (even with RestrainedLove which the Lua scripting will complement nicely for non BDSM RP usages).

The current implementation is just a "skeleton" one and I already got many projects for it, such as:
  • Extending its viewer UI interface (such as new buttons in the toolbar or overlay bar, configurable by the automation script, or perhaps a new specific toolbar for Lua buttons), to provide something akin to (but also more powerful and customizable than) the "flexible UI" of v3 viewers. (done)
  • Adding more bot-like features (give inventory, initiate IM sessions, etc) (done).
  • Implementing some form of threading for Lua scripts (several possibilities exist, and I'm still investigating to determine which might be the best option) (I finally decided against it: Lua should be restricted to short callbacks, not expand into a parallel viewer process of its own: implementing threading would complicate things to the point of making short callbacks taxing the main viewer thread more than when directly executed, since the required thread creation and the handling of the necessary mutexes would cost a lot in overhead; if you really need complex tasks, such as implementing the A.I. of a bot avatar, consider implementing them in LSL and exchanging data with Lua via llOwnerSay() and SendChat() to a non-zero channel).

This said, I might not have yet explored all the possibilities such a feature could offer and if you have any request related to Lua scripting in the Cool VL Viewer, please use this thread to post them.

Author:  kathrine [ 2017-01-21 09:37:53 ]
Post subject:  Re: Lua scripting related requests

Hi Henri,

just a big thanks for Lua Scripting.

I would love for options to use Lua scripting for better inventory management.

- For example adding/removing filters dynamically.
- Storing searches
- Regexp style searches
- Ignoring search hits in (no modify)(no transfer) etc. permission tags
- Search in WORN, than expand folders (e.g. to find the colours HUD to some worn item quickly)
- Scrolling to open folders
- Creating/Deleting inventory links
- Creating/Deleting inventory folders
- Parsing names/permissions of selected items (only explicitly selected to not make it a security hole)
(those last three would allow 'auto-rlv-folderization', e.g. select the new items, etc., script creates a new rlv subfolder, and subfolders for non mod items, adds proper links there)

Kathrine

Author:  Henri Beauchamp [ 2017-01-21 15:12:42 ]
Post subject:  Re: Lua scripting related requests

kathrine wrote:
- For example adding/removing filters dynamically.
Problem: there may be several Inventory floaters simultaneously open (or none at all) and for each floater, there are as many search filters as there are tabs (full inventory, recent items, worn items, last open folder...)... Not sure how you'd like this implemented.

Quote:
- Storing searches
Search results ? But how ? The inventory search filter updates in real time with the inventory contents and search filter input line editing while Lua scripts are restricted to callbacks that execute in only a few dozens of thousands of instructions maximum (or else they timeout)...

Quote:
- Regexp style searches
Not doable from Lua alone: this would involve modifying the search feature for the inventory, but the latter is already very time consuming despite the presence of a caching scheme. Adding regexp support to it would make it super-laggy.

Quote:
- Ignoring search hits in (no modify)(no transfer) etc. permission tags
Same remark as above: it's beyond Lua scripting scope and belongs to the implementation of the Inventory floater itself.

Quote:
- Search in WORN, than expand folders (e.g. to find the colours HUD to some worn item quickly)
Same as above. Note that you can use this trick for an equivalent result: close and re-open the folder you want to see in full, in the Worn tab, then switch to the "Last open" tab: the folder will be listed there (and you may "Lock" it too, with the corresponding check box).

Quote:
- Scrolling to open folders
Again, an inventory floater implementation detail that won't belong to Lua scripting (even if, once implemented, it could be called via a special Lua command).

Quote:
- Creating/Deleting inventory links
- Creating/Deleting inventory folders
Doable...

Quote:
- Parsing names/permissions of selected items (only explicitly selected to not make it a security hole)
I could possibly implement a function that lists the contents of an inventory folder, returning the item names into a Lua table. Parsing for permissions would then just be a matter of checking for "(no transfer)", "(no copy)", "(no modify)" sub-strings in each item name...

Author:  Henri Beauchamp [ 2017-01-23 12:58:26 ]
Post subject:  Re: Lua scripting related requests

I added the following inventory-related Lua functions, so far, for next release:
  • FindInventoryObject(): finds an inventory object (by full path + name or by UUID) and returns in a Lua table the object UUID, name, inventory object type, copy_ok, mod_ok and xfer_ok permissions (as booleans).
  • MakeInventoryLink(): takes an item (by full path + name or by UUID) and link path and creates the a new link to that item in this path.
  • DeleteInventoryLink(): takes a link item (by full path + name or by UUID) and deletes it.
  • NewInventoryFolder(): takes a path (or folder UUID) and a folder name and creates the corresponding folder.
  • ListInventoryFolder(): takes a path (or folder UUID) and dumps its contents into a Lua table (as UUID, name pairs).
The path separator was also changed from '/' (which is a legit inventory name character and should therefore not be used as a separator) to '|' (pipe character, illegal in inventory names) and extended GiveInventory() to accept as well inventory objects UUIDs.

I'm not sure about allowing to delete folders (might be dangerous), or only move them to the Trash, or only when empty of anything but links...

Author:  GeoffEarnshaw [ 2017-01-26 17:00:06 ]
Post subject:  Re: Lua scripting related requests

I like the idea of creating new inventory links just so I don't have to make a new outfit when I change or delete a HUD or item that I use for all my outfits. Just being able to create a linked item and copy and paste it in my outfit folders would be very handy!

Geoff

Author:  Henri Beauchamp [ 2017-01-26 20:17:24 ]
Post subject:  Re: Lua scripting related requests

GeoffEarnshaw wrote:
I like the idea of creating new inventory links just so I don't have to make a new outfit when I change or delete a HUD or item that I use for all my outfits. Just being able to create a linked item and copy and paste it in my outfit folders would be very handy!
This is already the case and does not need Lua scripting... Just "Copy" the item from the inventory context menu, then "Paste as link" still from the Inventory context menu, in another folder... Lua scripting will however allow to automate such creations (with user-written Lua scripts).

Author:  GeoffEarnshaw [ 2017-01-26 20:57:06 ]
Post subject:  Re: Lua scripting related requests

Oh Sweet, LOL I should have known that. Thanks!

Geoff

Author:  ZaneZimer [ 2017-02-14 00:48:44 ]
Post subject:  Re: Lua scripting related requests

Would there be any way to clear a push event for an id after an onAgentPush() event or have the event trigger more than once for the same push? I was recently griefed, which hasn't happened in years. The callback seems less useful if you are in a situation when you might need to trigger the same response again. For example, in the auto-sit example you provide, if your avatar stands it would fail to auto-sit again.

Author:  Henri Beauchamp [ 2017-02-14 14:01:16 ]
Post subject:  Re: Lua scripting related requests

ZaneZimer wrote:
Would there be any way to clear a push event for an id after an onAgentPush() event or have the event trigger more than once for the same push? I was recently griefed, which hasn't happened in years. The callback seems less useful if you are in a situation when you might need to trigger the same response again. For example, in the auto-sit example you provide, if your avatar stands it would fail to auto-sit again.

For next release, I moved the call to that Lua callback so that it is invoked each time a push is detected (and even if a former push from the same perpetrator occurred before).

Author:  ZaneZimer [ 2017-02-14 19:34:04 ]
Post subject:  Re: Lua scripting related requests

Henri Beauchamp wrote:
For next release, I moved the call to that Lua callback so that it is invoked each time a push is detected (and even if a former push from the same perpetrator occurred before).


That's great. Thank you. As an aside, I am enjoying customizing my viewer experience with Lua. I appreciate you adding it as a feature.

Page 1 of 10 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/