Cool VL Viewer forum

View unanswered posts | View active topics It is currently 2024-06-18 08:34:26



Reply to topic  [ 9 posts ] 
Extra chat bar (kind of) 
Author Message

Joined: 2011-09-27 11:18:31
Posts: 185
Reply with quote
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)")


2023-12-20 23:50:14
Profile

Joined: 2023-10-03 14:07:30
Posts: 50
Reply with quote
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!


2023-12-21 12:20:09
Profile

Joined: 2011-09-27 11:18:31
Posts: 185
Reply with quote
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!


2024-01-16 19:18:27
Profile

Joined: 2023-10-03 14:07:30
Posts: 50
Reply with quote
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.


2024-01-17 10:13:48
Profile

Joined: 2011-09-27 11:18:31
Posts: 185
Reply with quote
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.


2024-01-17 11:20:41
Profile

Joined: 2009-03-17 18:42:51
Posts: 5629
Reply with quote
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...


2024-01-17 11:30:23
Profile WWW

Joined: 2023-10-03 14:07:30
Posts: 50
Reply with quote
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.


2024-01-17 11:44:59
Profile

Joined: 2009-03-17 18:42:51
Posts: 5629
Reply with quote
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.


2024-01-17 13:08:43
Profile WWW

Joined: 2023-10-03 14:07:30
Posts: 50
Reply with quote
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.


2024-01-17 13:14:45
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 9 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.