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

open the inventory directly to a specific folder
http://sldev.free.fr/forum/viewtopic.php?f=6&t=2354
Page 1 of 3

Author:  DonFranko [ 2023-03-25 17:37:51 ]
Post subject:  open the inventory directly to a specific folder

Hi again!

Is it possible to make the inventory floater open directly into a particular folder ?

If not natively, would it be possible to achieve that via a lua sidebar button ? I've tried to add an UUID to the command, but it's not doing it.

Code:
SideBarButton(4, "In", "OpenFloater('inventory', '85703343-dc52-ea1e-80fc-16e5df786dcb')", "Opens Inventory")

Author:  Henri Beauchamp [ 2023-03-25 22:43:10 ]
Post subject:  Re: open the inventory directly to a specific folder

The normal inventory floater does not take a parameter/target, but you can create your own custom inventory floaters... An example is given in appendix B of the Lua manual.

A simpler floater could be (save this file as "skins/default/xui/en-us/floater_lua_inventory.xml" in your Secondlife user settings folder (i.e. "~/.secondlife/" under Linux, "%AppDAta%\Secondlife" under WIndows):
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater name="lua_floater_inventory" title="Inventory"
can_close="true" can_drag_on_left="false" can_minimize="true" can_resize="true"
width="284" height="400" min_width="284" min_height="400">
<inventory_panel name="inventory1" allow_multi_select="true" border="true"
left="10" right="-10" top="-20" bottom="10" follows="left|top|right|bottom" />
</floater>

Then to open it, type in chat
Code:
/lua OpenLuaFloater("inventory")

And to change the root of the inventory to the Objects folder:
Quote:
/lua SetLuaFloaterValue("inventory","inventory1", "Objects")

Or to a "Subfolder" of Objects (when it exists):
Quote:
/lua SetLuaFloaterValue("inventory","inventory1", "Objects|Subfolder")

Or to your folder UUID:
Quote:
/lua SetLuaFloaterValue("inventory","inventory1", "85703343-dc52-ea1e-80fc-16e5df786dcb")

And thus, for your side bar button:
Code:
SideBarButton(4, "In", "OpenLuaFloater('inventory');SetLuaFloaterValue('inventory','inventory1','85703343-dc52-ea1e-80fc-16e5df786dcb')", "Opens Inventory")

Author:  DonFranko [ 2023-03-26 12:42:50 ]
Post subject:  Re: open the inventory directly to a specific folder

That works - Thank you ! .. and I'm learning more and more to not ask you so many questions in future ;)

Please allow me two more questions on this topic:
- do these own floaters always start in the middle of the screen or is there a way to make them learn the last position as it is the case with the built in floaters?
- I'm also working on the new radar example to finally some day get the infos that I want to have (it's only a bit code needed but I still don't know how to address radar data into the different columns.. anyhow.. in that example the code takes a detour to bet to the wanted inventory folder within that new radar. Would it be possible to avoid that second click (which opens all folders what makes it really messy to get to the desired folder) and to get to the desired folder directly as in that easy floater example in here?

Author:  DonFranko [ 2023-03-26 13:04:13 ]
Post subject:  Re: open the inventory directly to a specific folder

some happy news:

I managed to create a working cancel-button in that new floater.. juchuuuuuuuuuuuuuuuu :)))

Author:  Henri Beauchamp [ 2023-03-27 09:08:34 ]
Post subject:  Re: open the inventory directly to a specific folder

DonFranko wrote:
do these own floaters always start in the middle of the screen
Yes.
Quote:
or is there a way to make them learn the last position as it is the case with the built in floaters?
No. This would involve adding from Lua a per-floater debug setting, which cannot be done since the list of debug settings is hard-coded (in app_settings/settings.xml). For next release I however added support for an additional parameter in OpenLuaFloater(), allowing to give a position other than the center of the screen (e.g. "top", "bottom", "left", "right", "bottom-left", etc).

Quote:
I'm also working on the new radar example to finally some day get the infos that I want to have (it's only a bit code needed but I still don't know how to address radar data into the different columns.. anyhow.. in that example the code takes a detour to bet to the wanted inventory folder within that new radar. Would it be possible to avoid that second click (which opens all folders what makes it really messy to get to the desired folder) and to get to the desired folder directly as in that easy floater example in here?
Not sure what you mean, there... Not knowing what your code is doing exactly, I am rather clueless, but you can already limit an inventory list element in a custom Lua floater to a top folder which is not the root of the inventory, so...
For next release, I however added yet another boolean parameter to OpenLuaFloater() so that you can tell it not to open the floater immediately, allowing you to setup its UI elements as you see fit (e.g. the inventory list root) before showing the floater with a new ShowLuaFloater() function (that will also be usable to hide a custom Lua floater without closing it).

Author:  DonFranko [ 2023-04-01 11:17:16 ]
Post subject:  ...LuaFloater improvements

Hi Henry,

thank you for the improvements of the OpenLuaFloater function ! :)

Author:  DonFranko [ 2023-04-01 12:10:13 ]
Post subject:  Re: open the inventory directly to a specific folder

Quote:
For next release I however added support for an additional parameter in OpenLuaFloater(), allowing to give a position other than the center of the screen (e.g. "top", "bottom", "left", "right", "bottom-left", etc).
Thank you !

Unfortunately I don't know where to place it in that code; what I tried so far broke the sidebar:

That is the working sidebar button:
Code:
SideBarButton(4, "In", "OpenLuaFloater('inventory');SetLuaFloaterValue('inventory','inventory1','2713ef76-7923-521c-8498-38b8647cf373')", "Opens Inventory in Folder Spot On Blue Rezz Objects")
Where do I put the placement info?

Author:  DonFranko [ 2023-04-01 12:30:45 ]
Post subject:  Re: open the inventory directly to a specific folder

Quote:
Not sure what you mean, there... Not knowing what your code is doing exactly, I am rather clueless, but you can already limit an inventory list element in a custom Lua floater to a top folder which is not the root of the inventory, so...
I'm still trying to create the new radar floater with more info for me from the avatars in the radar (currently worn group tag, maybe some nice to have tag like Artist(Singer/Painter)/Venue Owner/Host/Music Manager/.. , time since my arrival).

For that I took your example and edited a bit as far as my knowledge took me. I attached my current automation.lua and the relevant .xml.
Attachment:
DF automation_lus.zip [10.02 KiB]
Downloaded 50 times


In that example of yours the lua takes a detour to select one specific folder using lineedit1 input.. Now I think it's not needed anymore, is that correct?

My current biggest problem is how to put the avatar info into separated columns to get a step further with it.

And I have no clue how to get to that AvatarPieMenu to color-tag avatars.

So much to learn.

Thank you very very much for your help!

Author:  Henri Beauchamp [ 2023-04-01 13:30:40 ]
Post subject:  Re: open the inventory directly to a specific folder

I am sorry, but I am not going to write Lua code for you (no time for this, sorry).

You need to read the documentation (*) (everything is explained there, in minute details, with examples even) and learn by yourself by trial and error.


(*) The documentation was updated for OpenLuaFloater() (page 25), but make sure your browser is not using a cached (and deprecated) copy of the PDF file: clear the browser cache before pointing the browser to the PDF file (this is also true for the viewer built-in browser plugin: in "Preferences" -> "Network & Web", click on "Clear browser cache" before using "Help" -> "Lua scripting help...").

Author:  DonFranko [ 2023-04-01 15:56:12 ]
Post subject:  Re: open the inventory directly to a specific folder

Henri, I didn't and I don't want to bother you.

I was not asking for code. I attached the file because you said
Quote:
Not sure what you mean, there... Not knowing what your code is doing exactly, I am rather clueless,
.

I wanted you to get some clue about the code and yes, I was hoping for a little hint, nothing more.

I have the documentation open, but I have not yet figured out what all the brackets mean ;)
Quote:
OpenLuaFloater(floater_name[, parameter, [position [, show]]]
and yes I will find it out

I beg your pardon, but I'm a coding beginner who is just asking for some help.

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