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

Extra chat bar (kind of)
http://sldev.free.fr/forum/viewtopic.php?f=10&t=2443
Page 1 of 1

Author:  g0rd0ngrfr33mailgr [ 2023-12-20 23:50:14 ]
Post subject:  Extra chat bar (kind of)

It's often useful to have an extra chat bar. It took me an afternoon, but I managed to do it! In your automation.lua file, just add a button like so:
Code:
SideBarButton(10, "c", "MakeDialog('Lua chat bar', 'Type your text', '', 'Say',  'Shout', 'Whisper', 'SendChat(GetDialogInput(),[[normal]]);DialogClose()', 'SendChat(GetDialogInput(),[[shout]]); DialogClose()', 'SendChat(GetDialogInput(),[[whisper]]);DialogClose()')", "Lua Chat Bar (almost)")

Author:  RossoAms [ 2023-12-21 12:20:09 ]
Post subject:  Re: Extra chat bar (kind of)

g0rd0ngrfr33mailgr wrote:
It's often useful to have an extra chat bar. It took me an afternoon, but I managed to do it! In your automation.lua file, just add a button like so:
Code:
SideBarButton(10, "c", "MakeDialog('Lua chat bar', 'Type your text', '', 'Say',  'Shout', 'Whisper', 'SendChat(GetDialogInput(),[[normal]]);DialogClose()', 'SendChat(GetDialogInput(),[[shout]]); DialogClose()', 'SendChat(GetDialogInput(),[[whisper]]);DialogClose()')", "Lua Chat Bar (almost)")

Hey nice, thanks!

Author:  g0rd0ngrfr33mailgr [ 2024-01-16 19:18:27 ]
Post subject:  Re: Extra chat bar (kind of)

A better version, using a custom Lua floater.

First, add a "floater_lua_chat2.xml" file to your custom skins directory ("~/.secondlife/skins/default/xui/en-us/" under Linux and "%appdata%\SecondLife\skins\default\xui\en-us\" under Windows) containing the following XUI floater definition:

Code:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater name="lua_floater_chat2" title="Extra chat floater"
 can_close="true" can_drag_on_left="false" can_minimize="true" can_resize="true"
 width="284" height="120" min_width="284" min_height="120">
   <text_editor name="textedit1" font="SansSerif" word_wrap="true" max_length="1023"
    left="12" bottom="-86" width="260" height="64" follows="left|top|right" />
   <button name="button1" label="Say" font="SansSerif"
    left="12" bottom_delta="-26" width="80" height="20" follows="bottom|right" />
   <button name="button2" label="Shout" font="SansSerif"
    left_delta="90" bottom_delta="0" width="80" height="20" follows="bottom|right" />
   <button name="button3" label="Whisper" font="SansSerif"
    left_delta="90" bottom_delta="0" width="80" height="20" follows="bottom|right" />
</floater>


Then modify your automation.lua script in order to contain the following:
Code:
function OnLuaFloaterOpen(name, parameter)
   print("Opened floater: " .. name .. " with parameter: " .. parameter)
end

function OnLuaFloaterClose(name, parameter)
   print("Closed floater: " .. name .. " - Parameter: " .. parameter)
end

function OnLuaFloaterAction(name, control, value)
   print("Floater: " .. name .. " - Control: " .. control .. " - Value: " .. value)
   if value ~= "" and (string.find(control, "list") or string.find(control, "inventory")) then
      local values = GetLuaFloaterValues(name, control)
      local i
      for i = 1, #values, 1 do
         print("  --> value #" .. i .. " = " .. values[i])
      end
   end
      if name == "chat2" and control == "textedit1" then
      SetLuaFloaterCommand("chat2","button1","SendChat(GetLuaFloaterValue(GetFloaterName(),'textedit1'),[[normal]])")
      SetLuaFloaterCommand("chat2","button2","SendChat(GetLuaFloaterValue(GetFloaterName(),'textedit1'),[[shout]])")
      SetLuaFloaterCommand("chat2","button3","SendChat(GetLuaFloaterValue(GetFloaterName(),'textedit1'),[[whisper]])")
      end
end


Also, add/modify a button in the automation.lua script to look like
Code:
SideBarButton(10, "c", "OpenLuaFloater('chat2')", "Lua Chat Bar (almost)")


I stole Henri's custom floater and kept only the relevant bits, and I hope I did them well.

Texts starting with "/" are sent as plain text (i.e. one can't send gestures with that) and I don't know why, but, compared to the previous version, the length of the chat is much larger (1023 characters, as many as the viewer's proper chat bar).

If anyone can make this better, feel free to tell me how :D

Thanks, Henri, for Lua!

Author:  RossoAms [ 2024-01-17 10:13:48 ]
Post subject:  Re: Extra chat bar (kind of)

g0rd0ngrfr33mailgr wrote:
A better version, using a custom Lua floater.
First, add a "floater_lua_chat2.xml" file to your custom skins directory ("~/.secondlife/skins/default/xui/en-us/" under Linux


Nice revision!
My skins however, using Linux, are in $INSTALLDIR/skins, not in any dot-directory in $HOME.

Author:  g0rd0ngrfr33mailgr [ 2024-01-17 11:20:41 ]
Post subject:  Re: Extra chat bar (kind of)

Yes, true. But you can create a folder ~/.secondlife/skins/default/xui/en-us and put the file there. From what Henri has said, I understand that the viewer looks in both directories for floaters. That one's own contributions should be in their home directory, while the viewer itself, as it comes from upstream, should be at $INSTALLDIR. That way, when a new major version comes and you uninstall the old major version before installing the new major version, or if you want to have both for any reason (say, a stable version and a development version), your own scripts and floaters and whatnot won't be lost or they'll be accessible from both versions.

Author:  Henri Beauchamp [ 2024-01-17 11:30:23 ]
Post subject:  Re: Extra chat bar (kind of)

RossoAms wrote:
My skins however, using Linux, are in $INSTALLDIR/skins, not in any dot-directory in $HOME.
For overrides (modifications of the skin), and additions (such as Lua floaters), you should use the skin override feature, that is install your custom files in the ~/.secondlife/skins/ sub-directory; it ensures that your modifications will stay in force after viewer updates and upgrades, or reinstallation from scratch...

Author:  RossoAms [ 2024-01-17 11:44:59 ]
Post subject:  Re: Extra chat bar (kind of)

Henri Beauchamp wrote:
RossoAms wrote:
My skins however, using Linux, are in $INSTALLDIR/skins, not in any dot-directory in $HOME.
For overrides (modifications of the skin), and additions (such as Lua floaters), you should use the skin override feature, that is install your custom files in the ~/.secondlife/skins/ sub-directory; it ensures that your modifications will stay in force after viewer updates and upgrades, or reinstallation from scratch...

Can I just create it in ~/.cool_vl then, as I start the viewer after export SECONDLIFE_USER_DIR="/home/mich/.cool_vl"?
Creating a ~/.secondlife directory while there is no current Unix version of that viewer just feels odd.

Author:  Henri Beauchamp [ 2024-01-17 13:08:43 ]
Post subject:  Re: Extra chat bar (kind of)

RossoAms wrote:
Can I just create it in ~/.cool_vl then, as I start the viewer after export SECONDLIFE_USER_DIR="/home/mich/.cool_vl"?
Yes, the SECONDLIFE_USER_DIR environment variable override is accounted for in the cool_vl_viewer wrapper script.

Author:  RossoAms [ 2024-01-17 13:14:45 ]
Post subject:  Re: Extra chat bar (kind of)

Henri Beauchamp wrote:
RossoAms wrote:
Can I just create it in ~/.cool_vl then, as I start the viewer after export SECONDLIFE_USER_DIR="/home/mich/.cool_vl"?
Yes, the SECONDLIFE_USER_DIR environment variable override is accounted for in the cool_vl_viewer wrapper script.

Okay thanks for the explanation.

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