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

Group notifications manager
http://sldev.free.fr/forum/viewtopic.php?f=10&t=2646
Page 1 of 1

Author:  g0rd0ngrfr33mailgr [ 2025-04-21 12:22:19 ]
Post subject:  Group notifications manager

It's 90% Henri's work and 10% mine, lol, since he helped all the way, but here it is:
Image

All group notifications are not shown in the top-right corner, but instead feed the scroll list in the floater, which opens automatically to show them. By clicking on a line and the first button "show", the notification is printed in local chat and also in a Lua notification box (green) in the top-right. The second button "Clear" clears the scroll list entirely.

First, we make the floater ~/.secondlife/cvlv-skins/default/xui/en-us/floater_lua_gnm.xml:
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater name="lua_floater_gnm" title="Group Notifications Manager"
 can_close="true" can_drag_on_left="false" can_minimize="true" can_resize="true" width="650" height="340" min_width="700" min_height="250">
    <scroll_list name="list1" multi_select="true" background_visible="true" draw_border="true" draw_stripes="true" draw_heading="true" left="12" right="-12" width="700" top="-20" bottom="20" height="180" follows="left|top|right">
        <column name="col0" label="Group name" width="70" />
        <column name="col1" label="Time" width="56" />
        <column name="col2" label="Sender" width="70" />
        <column name="col3" label="Subject" width="100" />
        <column name="col4" label="Message" dynamicwidth="true" />
        <column name="col5" label="Inventory" width="20" />
    </scroll_list>
        <button name="button1" label="Show" font="SansSerif" left="12" bottom="0" width="42" height="20" follows="bottom|right" />
        <button name="button2" label="Clear" font="SansSerif" left_delta="56" bottom_delta="0" width="42" height="20" follows="bottom|right" />
</floater>


Then in the automation script automation.lua:
Code:
function OnLuaFloaterAction(name, control, value)
if name == "gnm" and control == "button1" then
          local line = GetLuaFloaterListLine("gnm", "list1")
          local message = line.col1 ..", " .. line.col0 ..", " .. line.col2 .. ", " .. line.col3 ..": \n " .. line.col5 .." \n " .. line.col4
          print(message)
          OpenNotification(1,message)
      end
      if name == "gnm" and control == "button2" then SetLuaFloaterValue("gnm", "list1", "") end
end


and
Code:
function OnGroupNotification(group_name, group_id, dialog_id, timestamp, sender, subject, message, inventory)
    local notice
    notice = "<BOLD>" .. group_name .. "|" .. GetTimeStamp(-7,'%H:%M:%S') .. "|" .. sender .. "|" .. "<ITALIC>" .. subject .. "|" .. message .. "|" .. inventory
    OpenLuaFloater("gnm")
    SetLuaFloaterValue("gnm", "list1", notice)
    CancelNotification(dialog_id)
end

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