Cool VL Viewer forum

View unanswered posts | View active topics It is currently 2025-05-13 10:29:44



Reply to topic  [ 7 posts ] 
new personal radar - scroll list - I need help 
Author Message

Joined: 2021-06-21 12:39:03
Posts: 177
Reply with quote
Hi!

I tried for so many hours now again to make the automation script fill my new personal radar with some useful informations. I tried the given example of a lua_floater where the scroll list is filt with <string> informations: SetLuaFloaterValue("test","list1","<BOLD>Item 1|<1.0,0.5,0.25>2019-01-08") which was working then for me in my new radar. But that is not what I want and need, I want to fill that list1 with GetRadarData related informations.

To start with I tried with GetAgentInfo()...
When I try that like:
SetLuaFloaterValue("newRadar","avatar_list",GetAgentInfo().id)
that works fine and I see the UUID in col0

But then when I try that:
SetLuaFloaterValue("newRadar","avatar_list",GetAgentInfo().id|GetAgentInfo().name)
I get nothing and an error warning: .secondlife/user_settings/automation.lua:530: attempt to perform bitwise operation on a string value (field 'id')

Please tell me how to do that so I can fill that scroll list columns with the wanted data..

Many thanks in advance!
Frank


2024-12-13 16:40:12
Profile

Joined: 2009-03-17 18:42:51
Posts: 5984
Reply with quote
DonFranko wrote:
But then when I try that:
SetLuaFloaterValue("newRadar","avatar_list",GetAgentInfo().id|GetAgentInfo().name)
I get nothing and an error warning: .secondlife/user_settings/automation.lua:530: attempt to perform bitwise operation on a string value (field 'id')
You cannot concatenate strings that way.

You need to use the Lua concatenation operator:
Code:
SetLuaFloaterValue("newRadar","avatar_list", GetAgentInfo().id .. "|" .. GetAgentInfo().name)

Also, for speed, you should place the array returned by GetAgentInfo() in a variable, instead of calling it twice, like so:
Code:
info=GetAgentInfo();SetLuaFloaterValue("newRadar", "avatar_list", info.id .. "|" .. info.name)

However, that won't work for a radar because GetAgentInfo() applies to your own avatar only (the "agent", in SL viewer jargon). You will need to use the avatar UUID and the GetAvatarName() function to fill up each line of your list, that is, when avatar_id contains the UUID of an avatar to add to your list:
Code:
SetLuaFloaterValue("newRadar", "avatar_list", avatar_id .. "|" .. GetAvatarName(avatar_id))


Not sure what you are trying to achieve, but it would be easier to fill up your secondary radar list by reusing the data transmitted by the built-in radar to the Lua automation script, via the OnRadar() callback (just make sure the built-in Radar is configured to keep running in the background while its floater is closed by checking the "Announce incoming avatars even when closed" box in the "Options" tab of the Radar); that callback gets passed the avatars UUID and name...


2024-12-13 19:24:37
Profile WWW

Joined: 2021-06-21 12:39:03
Posts: 177
Reply with quote
Henri Beauchamp wrote:
DonFranko wrote:
But then when I try that:
SetLuaFloaterValue("newRadar","avatar_list",GetAgentInfo().id|GetAgentInfo().name)
I get nothing and an error warning: .secondlife/user_settings/automation.lua:530: attempt to perform bitwise operation on a string value (field 'id')

You cannot concatenate strings that way.

You need to use the Lua concatenation operator: GetAgentInfo().id .. "|" .. GetAgentInfo().name
Also, for speed, you should place the array returned by GetAgentInfo() in a variable, instead of calling it twice, like so:
info=GetAgentInfo();SetLuaFloaterValue("newRadar", "avatar_list", info.id .. "|" .. info.name)
But why is it working like I quoted your lua-example with only the | instead of "|" ? I remember that I tried that "|" connection but then it worked only in ONE COLUMN and was not filing the other columns.. mmmhh..
Quote:
However, that won't work for a radar because GetAgentInfo() applies to your own avatar only (the "Agent", in SL viewer jargon). You will need to use the avatar UUID and the GetAvatarName() function to fill up each line of your list.
I know that and just used the GetAgentInfo to try to get it into columns before I try to script that OnRadar() which I still also don't know how to use in the automation script....

Quote:
Not sure what you are trying to achieve, but it would be easier to fill up your secondary radar list by reusing the data transmitted by the built-in radar to the Lua automation script, via the OnRadar() callback (just make sure the built-in Radar is configured to keep running in the background while its floater is closed by checking the "Announce incoming avatars even when closed" box in the "Options" tab of the Radar); the OnRadar() callback gets passed the avatars UUID and name...
That is what I want, but what I don't know is how to get all the different fields into columns in that radar when it's not working like in your example with the strings and only the | to get it into seperate columns instead of only one as I believe the "|" is just a string shown and not a symbol to put the info in the next column...

Quote:
Also, for speed, you should place the array returned by GetAgentInfo() in a variable, instead of calling it twice, like so:
info=GetAgentInfo();SetLuaFloaterValue("newRadar", "avatar_list", info.id .. "|" .. info.name)
Thank you for that important scripting hint!!


2024-12-13 19:41:53
Profile

Joined: 2009-03-17 18:42:51
Posts: 5984
Reply with quote
Sorry, but I cannot give you a Lua programming crash course on this forum... I will only reply about viewer-specific Lua functions/features.

For Lua specific matters, try Programming in Lua (*), and the Lua reference manual.


(*) Skip anything related to the lua interpreter program itself in this manual: simply use the viewer Lua console (CTRL ALT L) to experiment with Lua. You can also ignore chapters 8, 9, 15, 21, 22, 23 to 29 which relate to features not used by the viewer, or to C programming which is of no concern when scripting with Lua.


2024-12-13 19:50:35
Profile WWW

Joined: 2021-06-21 12:39:03
Posts: 177
Reply with quote
Quote:
Sorry, but I cannot give you a Lua programming crash course on this forum... I will only reply about viewer-specific Lua functions/features.
I know, Henri. And I understand that perfectly. I'm happy that you take the time to look over our humble trys and errors to guide us on our way.

Thank you for the lua learning links!!

PS: I'm still wondering why that | connection in scroll lists is only working with strings, tho..


2024-12-13 20:01:35
Profile

Joined: 2009-03-17 18:42:51
Posts: 5984
Reply with quote
DonFranko wrote:
PS: I'm still wondering why that | connection in scroll lists is only working with strings, tho..
Not sure what you don't understand about it...

When used directly (without quotes) in an Lua expression, it is a bit-wise or operator applying to numbers only; thus the error you got when you used it, unquoted, between two string values.

In the context of a string passed to the SetLuaFloaterValue() function on a list, it is used to mark the separation between values applying to successive columns in the list.


2024-12-13 20:07:13
Profile WWW

Joined: 2021-06-21 12:39:03
Posts: 177
Reply with quote
gosh, I must have done something wrong. Now I got it working. Thanks for your patience.

Now heading on my way to fill that radar with some of the original radar data and some that I'd like to see.. If I'd only knew how ;)


2024-12-18 13:42:58
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


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.