Cool VL Viewer forum

View unanswered posts | View active topics It is currently 2019-06-19 11:05:24



Reply to topic  [ 88 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9
Lua scripting related requests 
Author Message

Joined: 2009-03-17 18:42:51
Posts: 3992
Reply with quote
ZaneZimer wrote:
GetAgentInfo() and control_flags:

I've been trying to determine if there is a way to distinguish between sitting on an object vs sitting on the ground. I know GetAgentInfo() provides the `sitting` Boolean, but it is for any type of sit. I thought perhaps the control_flags could indicate this distinction, since indra/llcommon/llagentconstants.h contains AGENT_CONTROL_SIT_ON_GROUND. I'm likely misinterpreting what that flag is used for and/or means, as I have only found it in use at line 5457 in indra/newview/llviewermenu.cpp. A little tracing makes it seem like that flag means that I think it does, but I didn't go too far. I have also tried the various ways to sit on the ground, including the AgentSit() method but the control_flags remain 0 while sitting. I have used AGENT_CONTROL_AWAY from control_flags successfully, however, so I know some of the flags are as I expect them. Cheers and thanks for reading.

Alas, most control flags are ephemeral (reset on agent update after they have been sent to the sim server) and AGENT_CONTROL_SIT_ON_GROUND is one such flag. I added a specific flag for next release, and the corresponding "sitting_on_ground" key/boolean pair in the table returned by GetAgentInfo().


2018-07-26 13:52:03
Profile WWW

Joined: 2016-06-19 21:33:37
Posts: 124
Location: San Francisco bay area, CA, USA
Reply with quote
Henri Beauchamp wrote:
[Alas, most control flags are ephemeral (reset on agent update after they have been sent to the sim server) and AGENT_CONTROL_SIT_ON_GROUND is one such flag. I added a specific flag for next release, and the corresponding "sitting_on_ground" key/boolean pair in the table returned by GetAgentInfo().
I wondered if it was something like that. I appreciate you adding the additional flag and boolean.


2018-07-26 16:06:53
Profile

Joined: 2011-12-13 14:11:38
Posts: 147
Reply with quote
I was looking into Lua scripting to see if I could do something I've always wanted: give a specific color to the avatar tag and/or the minimap dot to people for whom I've entered something into the 'My notes' tab in their profile, and/or to people I've already talked to. Changing name tags or minimap dot colors for a given avatar seems to be quite easy, thanks to the Lua script example provided in the Lua reference post. But I can't find a way to figure out the conditions, i.e something is present in the av's 'My notes' tab, or there's something recorded for the av in the IM history. I saw that Lua can be called from LSL, but I can't find anything about these conditions in LSL either. And anyway, it feels to me that I would then need a call the other way: since changing the colors would be done via the OnAvatarRezzing Lua callback, it looks like I would need to call some LSL from there rather than the other way round.

Did I miss something? Is there any way to do what I want to do or is it hopeless?


2019-05-22 12:25:12
Profile

Joined: 2009-03-17 18:42:51
Posts: 3992
Reply with quote
ErikaThorkveld wrote:
I was looking into Lua scripting to see if I could do something I've always wanted: give a specific color to the avatar tag and/or the minimap dot to people for whom I've entered something into the 'My notes' tab in their profile, and/or to people I've already talked to. Changing name tags or minimap dot colors for a given avatar seems to be quite easy, thanks to the Lua script example provided in the Lua reference post. But I can't find a way to figure out the conditions, i.e something is present in the av's 'My notes' tab, or there's something recorded for the av in the IM history. I saw that Lua can be called from LSL, but I can't find anything about these conditions in LSL either. And anyway, it feels to me that I would then need a call the other way: since changing the colors would be done via the OnAvatarRezzing Lua callback, it looks like I would need to call some LSL from there rather than the other way round.

Did I miss something? Is there any way to do what I want to do or is it hopeless?

Not sure what you mean by "condition" neither what you try to achieve... In the example script I gave, you simply set the avatar name tag/dot color via the Lua pie menu for that avatar (popped up with SHIFT + right click on the avatar). You could also auto-color the the avatars in your friends list via the OnAvatarRezzing() callback function and the IsAgentFriend() function, for example.

If you wish to make those color settings permanent as well (so that they are remembered over sessions), you can by using the GetPerAccountData() and SetPerAccountData() (or GetGlobalData() and SetGlobalData()) functions, for example.

There is no need for LSL scripts... even though you could as well use one to interact with Lua (via the AutomationMessage() function and OnAutomationMessage() callback, for the LSL to Lua communication and via SendChat() for the Lua to LSL communication).

There is however no way to recover the contents of the avatar profile "My notes" tab from either Lua or LSL. This info in only retrieved when you open the corresponding tab in the Profile floater for an avatar.


2019-05-22 13:43:34
Profile WWW

Joined: 2011-12-13 14:11:38
Posts: 147
Reply with quote
Mmm, rereading my question, no wonder why it was difficult to understand. That'll teach me to ask something when I'm not sure about what I actually want to do. ;)
Anyway, you answered half of the question:
Henri Beauchamp wrote:
There is however no way to recover the contents of the avatar profile "My notes" tab from either Lua or LSL. This info in only retrieved when you open the corresponding tab in the Profile floater for an avatar.

That was one of the things I wanted to do: read the "My notes" tab in someone's profile and if there's something in it, give them a specific color on the minimap. So it seems I can't do that.
I also wanted to give another specific color to people I've already talked to, which would - I guess - require to read my IM logs. So that would have to be on client side, since the server knows nothing about my logs. And since I haven't seen anything allowing to read IM logs in Lua, I guess it's dead too.
Well, OK, that was a silly idea. :D


2019-05-23 11:22:02
Profile

Joined: 2009-03-17 18:42:51
Posts: 3992
Reply with quote
ErikaThorkveld wrote:
That was one of the things I wanted to do: read the "My notes" tab in someone's profile and if there's something in it, give them a specific color on the minimap. So it seems I can't do that.
I also wanted to give another specific color to people I've already talked to, which would - I guess - require to read my IM logs. So that would have to be on client side, since the server knows nothing about my logs. And since I haven't seen anything allowing to read IM logs in Lua, I guess it's dead too.
I could implement a Lua function to check whether an avatar got a corresponding IM log file, but I'm not sure many would use it, you taken apart...

On the other hand, you could achieve a similar result with the existing functions (and for all future IM conversations) with the OnInstantMsg() callback, registering the UUID of the avatar IMing you into a Lua table of the automation.lua script, and saving that table with the SetPerAccountData() (or SetGlobalData()) function and restoring it on login with GetPerAccountData() or (GetGlobalData()). Then you could color the name tags and dots accordingly to what is in that table...

As for the notes, you could achieve the same result (classifying avatars following your own criteria) with the provided Lua pie coloring example (perhaps replacing the color names in the pie menu with meaningful adjectives for your classification: e.g. "Friendly", "Interested", "Indifferent", "Aggressive")... And of course also saving the resulting table and restoring it at each session.


2019-05-23 17:11:30
Profile WWW

Joined: 2011-12-13 14:11:38
Posts: 147
Reply with quote
Henri Beauchamp wrote:
On the other hand, you could achieve a similar result with the existing functions (and for all future IM conversations) with the OnInstantMsg() callback, registering the UUID of the avatar IMing you into a Lua table of the automation.lua script, and saving that table with the SetPerAccountData() (or SetGlobalData()) function and restoring it on login with GetPerAccountData() or (GetGlobalData()). Then you could color the name tags and dots accordingly to what is in that table...

And that works very nicely, thanks for the solution! :) I just got a bit confused by the fact that apparently, the OnAvatarRezzing callback can be called before any call to the OnLogin callback, which seems quite strange to me, but once I understood it could happen, everything worked fine.


2019-05-28 06:53:25
Profile

Joined: 2009-03-17 18:42:51
Posts: 3992
Reply with quote
ErikaThorkveld wrote:
I just got a bit confused by the fact that apparently, the OnAvatarRezzing callback can be called before any call to the OnLogin callback, which seems quite strange to me, but once I understood it could happen, everything worked fine.
That's because OnLogin() is called only at the very end of the login process, which happens after many things have already started rezzing, avatars included...


2019-05-28 07:37:02
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 88 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9

Who is online

Users browsing this forum: No registered users and 4 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:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.