Lua scripting related requests
Author |
Message |
Henri Beauchamp
Joined: 2009-03-17 18:42:51 Posts: 5899
|
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 |
|
|
ZaneZimer
Joined: 2016-06-19 21:33:37 Posts: 384 Location: Columbus area, OH, USA
|
I wondered if it was something like that. I appreciate you adding the additional flag and boolean.
|
2018-07-26 16:06:53 |
|
|
ErikaThorkveld
Joined: 2011-12-13 14:11:38 Posts: 186
|
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 |
|
|
Henri Beauchamp
Joined: 2009-03-17 18:42:51 Posts: 5899
|
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 |
|
|
ErikaThorkveld
Joined: 2011-12-13 14:11:38 Posts: 186
|
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: 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.
|
2019-05-23 11:22:02 |
|
|
Henri Beauchamp
Joined: 2009-03-17 18:42:51 Posts: 5899
|
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 |
|
|
ErikaThorkveld
Joined: 2011-12-13 14:11:38 Posts: 186
|
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 |
|
|
Henri Beauchamp
Joined: 2009-03-17 18:42:51 Posts: 5899
|
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 |
|
|
Catten
Joined: 2011-09-17 11:12:19 Posts: 368
|
Will it be possible to get a lua command to enable and disable the avatar hitboxes?
Edit: In theory a lua command that would let you edit the debug settings on the fly would be rather cool.
|
2020-07-31 19:22:03 |
|
|
Henri Beauchamp
Joined: 2009-03-17 18:42:51 Posts: 5899
|
This is already possible... Just white-list the "RenderDebugHitBox" debug setting and use the SetDebugSeting() Lua command... Please, see the existing documentation.
|
2020-07-31 19:33:50 |
|
|
Who is online |
Users browsing this forum: No registered users and 3 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
|
|