Cool VL Viewer forum

View unanswered posts | View active topics It is currently 2024-03-28 16:01:44



Reply to topic  [ 95 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 10  Next
Lua scripting related requests 
Author Message

Joined: 2016-06-19 21:33:37
Posts: 337
Location: Columbus area, OH, USA
Reply with quote
Would it be possible to have more than 12 SideBarButtons?


2017-03-29 13:35:16
Profile

Joined: 2009-03-17 18:42:51
Posts: 5523
Reply with quote
ZaneZimer wrote:
Would it be possible to have more than 12 SideBarButtons?

Actually, the current code may already deal with up to 20 buttons...

All you have to do is copy the skins/default/xui/en-us/panel_lua_sidebar.xml file into a skins/default/xui/en-us/ subdirectory of the viewers data storage (~/.secondlife/ directory under Linux, some SecondLife directory in the program data path for Windows, etc) and edit it to add more buttons to it...

The edited file will override the viewer's bundled one (and since "panel_lua_sidebar.xml" does not exist in other v1 viewers, this won't be a problem for them; v2+ viewers use "en" instead of "en-us", so it won't be an issue at all either, for any XUI file override you could put inside skins/default/xui/en-us/).

Here is the file for the full 20 buttons:
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<panel name="lua_side_bar" enabled="true" hidden="false" mouse_opaque="false"
 width="32" height="600" follows="top|left">
   <button name="btn19" label="19" font="SansSerif" visible="false"
    left="2" bottom_delta="-30" width="28" height="28" follows="top|left" />
   <button name="btn17" label="17" font="SansSerif" visible="false"
    left="2" bottom_delta="-30" width="28" height="28" follows="top|left" />
   <button name="btn15" label="15" font="SansSerif" visible="false"
    left="2" bottom_delta="-30" width="28" height="28" follows="top|left" />
   <button name="btn13" label="13" font="SansSerif" visible="false"
    left="2" bottom_delta="-30" width="28" height="28" follows="top|left" />
   <button name="btn11" label="11" font="SansSerif" visible="false"
    left="2" bottom_delta="-30" width="28" height="28" follows="top|left" />
   <button name="btn9" label="9" font="SansSerif" visible="false"
    left="2" bottom_delta="-30" width="28" height="28" follows="top|left" />
   <button name="btn7" label="7" font="SansSerif" visible="false"
    left="2" bottom_delta="-30" width="28" height="28" follows="top|left" />
   <button name="btn5" label="5" font="SansSerif" visible="false"
    left="2" bottom_delta="-30" width="28" height="28" follows="top|left" />
   <button name="btn3" label="3" font="SansSerif" visible="false"
    left="2" bottom_delta="-30" width="28" height="28" follows="top|left" />
   <button name="btn1" label="1" font="SansSerif" visible="false"
    left="2" bottom_delta="-30" width="28" height="28" follows="top|left" />
   <button name="btn2" label="2" font="SansSerif" visible="false"
    left="2" bottom_delta="-30" width="28" height="28" follows="top|left" />
   <button name="btn4" label="4" font="SansSerif" visible="false"
    left="2" bottom_delta="-30" width="28" height="28" follows="top|left" />
   <button name="btn6" label="6" font="SansSerif" visible="false"
    left="2" bottom_delta="-30" width="28" height="28" follows="top|left" />
   <button name="btn8" label="8" font="SansSerif" visible="false"
    left="2" bottom_delta="-30" width="28" height="28" follows="top|left" />
   <button name="btn10" label="10" font="SansSerif" visible="false"
    left="2" bottom_delta="-30" width="28" height="28" follows="top|left" />
   <button name="btn12" label="12" font="SansSerif" visible="false"
    left="2" bottom_delta="-30" width="28" height="28" follows="top|left" />
   <button name="btn14" label="14" font="SansSerif" visible="false"
    left="2" bottom_delta="-30" width="28" height="28" follows="top|left" />
   <button name="btn16" label="16" font="SansSerif" visible="false"
    left="2" bottom_delta="-30" width="28" height="28" follows="top|left" />
   <button name="btn18" label="18" font="SansSerif" visible="false"
    left="2" bottom_delta="-30" width="28" height="28" follows="top|left" />
   <button name="btn20" label="20" font="SansSerif" visible="false"
    left="2" bottom_delta="-30" width="28" height="28" follows="top|left" />
</panel>
You can easily adapt it, by removing the buttons you don't want (remove the higher numbers first, since the code would stop looking for buttons as soon as one is missing in the series from "btn1" to "btn20").


2017-03-29 15:20:42
Profile WWW

Joined: 2016-06-19 21:33:37
Posts: 337
Location: Columbus area, OH, USA
Reply with quote
Quote:
Actually, the current code may already deal with up to 20 buttons...

All you have to do is copy the skins/default/xui/en-us/panel_lua_sidebar.xml file into a skins/default/xui/en-us/ subdirectory of the viewers data storage (~/secondlife/ directory under Linux, some SecondLife directory in the program data path for Windows, etc) and edit it to add more buttons to it...
Awesome. I'll give it a try later on today and post my results. :)


2017-03-29 16:01:43
Profile

Joined: 2016-06-19 21:33:37
Posts: 337
Location: Columbus area, OH, USA
Reply with quote
It works as you described with one small 'tweak'. The panel needs to have its height adjusted:
Code:
<panel name="lua_side_bar" enabled="true" hidden="false" mouse_opaque="false"
 width="32" height="600" follows="top|left">
It appears each button is 28 + 2 pixels, so 20 buttons requires a height of 600. If this height is not adjusted some buttons are not 'clickable', as the panel is too small for them even though they are visible.


2017-03-29 17:44:20
Profile

Joined: 2009-03-17 18:42:51
Posts: 5523
Reply with quote
ZaneZimer wrote:
It works as you described with one small 'tweak'. The panel needs to have its height adjusted:
Code:
<panel name="lua_side_bar" enabled="true" hidden="false" mouse_opaque="false"
 width="32" height="600" follows="top|left">
It appears each button is 28 + 2 pixels, so 20 buttons requires a height of 600. If this height is not adjusted some buttons are not 'clickable', as the panel is too small for them even though they are visible.

Correct. And fixed/edited in my former post.

Also, obviously using that many buttons present the risk that some of them will go out of the screen area, if the viewer window is shrank down too much.


2017-03-29 19:14:58
Profile WWW

Joined: 2016-06-19 21:33:37
Posts: 337
Location: Columbus area, OH, USA
Reply with quote
Quote:
Also, obviously using that many buttons present the risk that some of them will go out of the screen area, if the viewer window is shrank down too much.
Yes, I have considered that. As with any such customization, I consider them at 'the user's own risk'. :)


2017-03-30 13:49:38
Profile

Joined: 2016-06-19 21:33:37
Posts: 337
Location: Columbus area, OH, USA
Reply with quote
The OnAgentPush() supplies the 'pusher_id' and the new IsAvatar() and isObject() methods will presumably operate on that to determine what the id represents. Is there any way to determine a name or some info about the avatar or object causing the push? I have yet to encounter a push since coding up my 'alert' but it says something like 'A push from an <avatar|object> of <type> with <magnitude> was detected'. I was thinking it would be nice to have the name of said 'offender'. I think I can use a SLURL for the avatar but I don't think there is a corresponding 'path' for object.


2017-04-06 22:41:36
Profile

Joined: 2009-03-17 18:42:51
Posts: 5523
Reply with quote
ZaneZimer wrote:
The OnAgentPush() supplies the 'pusher_id' and the new IsAvatar() and isObject() methods will presumably operate on that to determine what the id represents. Is there any way to determine a name or some info about the avatar or object causing the push? I have yet to encounter a push since coding up my 'alert' but it says something like 'A push from an <avatar|object> of <type> with <magnitude> was detected'. I was thinking it would be nice to have the name of said 'offender'. I think I can use a SLURL for the avatar but I don't think there is a corresponding 'path' for object.

'pusher_id' is always an avatar name (the pusher itself or the owner of the object doing the push). I will add an avatar name (and a group name) resolver function, however such a resolving is asynchronous (when the avatar or group name is not yet cached by the viewer), so the function may return an empty string and would have to be retried (e.g. with CallbackAfter()) to get the name...

As for object names, there is no caching scheme implemented in the viewer and here again, it would require an asynchronous operation. Not sure it's worth it...


2017-04-06 23:32:13
Profile WWW

Joined: 2016-06-19 21:33:37
Posts: 337
Location: Columbus area, OH, USA
Reply with quote
Quote:
'pusher_id' is always an avatar name (the pusher itself or the owner of the object doing the push).
Ah, I had not realized this.
Quote:
I will add an avatar name (and a group name) resolver function...
You should only add them if you feel they are useful. Since I didn't quite understand how the event callback worked, I made assumptions. I can certainly just construct a SLURL out of the id prior to my 'print'. That will get me what I want, I think.


2017-04-07 02:54:04
Profile

Joined: 2016-06-19 21:33:37
Posts: 337
Location: Columbus area, OH, USA
Reply with quote
I haven't isolated a pattern yet, but there might be something wrong with the new Lua pie menu functionality. First, when I stop the automation script the pie menu doesn't always revert to default. I was trying to use pie menu type 4, slice 1 to add a simple, clickable SendChat() greeting. Second, sometimes stopping or loading a new script causes the viewer to crash. I will try to provide more details as I learn them.

In OnLogin(), I have:
Code:
LuaPieMenuSlice(4, 1, "Howdy...", "AutomationMessage(\"avatar-say-howdy|\" .. GetPickedObjectID())")


2017-04-09 19:31:41
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 95 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 10  Next

Who is online

Users browsing this forum: No registered users and 30 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.