Cool VL Viewer forum

View unanswered posts | View active topics It is currently 2024-04-27 15:34:32



Reply to topic  [ 1 post ] 
Quick preferences floater 
Author Message

Joined: 2011-09-27 11:18:31
Posts: 176
Reply with quote
Hello! I wanted to contribute a Quick Preferences floater I made for my own use. I'm pretty sure it can be made much better, but it works.

First we make ~/.secondlife/skins/en-us/floater_lua_qp.xml:
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater name="lua_floater_qp" title="Quick Preferences"
 can_close="true" can_drag_on_left="false" can_minimize="true" can_resize="false"
 width="240" height="250" min_width="240" min_height="250">
    <text name="groupdesc" font="SansSerifSmall" length="1" enabled="true" mouse_opaque="false"
    halign="left" tab_stop="false" drop_shadow_visible="true"
    left="12" bottom="-36" width="248" height="16" follows="left|top">
        Name tags visibility
   </text>
   <radio_group name="radio1" draw_border="false" label="Name tags"
    top_delta="10" left="12" bottom_delta="-20" width="260" height="16" follows="left|bottom">
      <radio_item name="2" value="2"
       left="0" bottom="-16" width="25" height="16" follows="left|bottom">
         always
      </radio_item>
      <radio_item name="1" value="1"
       left_delta="30" bottom_delta="0" width="25" height="16" follows="left|bottom">
         fade
      </radio_item>
      <radio_item name="0" value="0"
       left_delta="30" bottom_delta="0" width="25" height="16" follows="left|bottom">
         never
      </radio_item>
   </radio_group>
    <text name="groupdesc" font="SansSerifSmall" length="1" enabled="true" mouse_opaque="false"
    halign="left" tab_stop="false" drop_shadow_visible="true"
    left="12" width="248" height="10" follows="left|top">
        Voice chat
   </text>
   <button name="button1" label="voice on" font="SansSerif"
    left="12" bottom_delta="-26" width="80" height="20" follows="bottom|right" />
   <button name="button2" label="voice off" font="SansSerif"
    left_delta="90" bottom_delta="0" width="80" height="20" follows="bottom|right" />
    <text name="groupdesc" font="SansSerifSmall" length="1" enabled="true" mouse_opaque="false"
    halign="left" tab_stop="false" drop_shadow_visible="true"
    left="12" width="248" height="10" follows="left|top">
        Camera position
   </text>
   <button name="button3" label="rear" font="SansSerif"
    left="12" bottom_delta="-26" width="40" height="20" follows="bottom|right" />
   <button name="button4" label="rear up" font="SansSerif"
    left_delta="50" bottom_delta="0" width="60" height="20" follows="bottom|right" />
   <button name="button5" label="front" font="SansSerif"
    left_delta="70" bottom_delta="0" width="40" height="20" follows="bottom|right" />
   <button name="button6" label="reset" font="SansSerif"
    left_delta="50" bottom_delta="0" width="40" height="20" follows="bottom|right" />
   <spinner name="spin1" label="Hover" font="SansSerif" label_width="50"
    decimal_digits="2" increment="0.05" min_val="-9.0" max_val="9.0"
    left="12" bottom_delta="-28" width="120" height="24" follows="left|bottom" />
   <button name="button7" label="ground sit" font="SansSerif"
    left="12" bottom_delta="-26" width="80" height="20" follows="bottom|right" />
   <button name="button8" label="99stop" font="SansSerif"
    left_delta="90" bottom_delta="0" width="60" height="20" follows="bottom|right" />
    <button name="button9" label="PBR on" font="SansSerif"
    left="12" bottom_delta="-26" width="80" height="20" follows="bottom|right" />
   <button name="button10" label="PBR off" font="SansSerif"
    left_delta="90" bottom_delta="0" width="60" height="20" follows="bottom|right" />

</floater>


Then in the automation script, in the section function OnLuaFloaterAction(name, control, value) we add
Code:
      if name == "qp" then
      SetLuaFloaterCommand("qp","radio1","SetDebugSetting('RenderName',GetValue())")
      SetLuaFloaterCommand("qp","radio2","SetDebugSetting('EnableVoiceChat',GetValue())")
      SetLuaFloaterCommand("qp","spin1","SetDebugSetting('AvatarOffsetZ',GetValue())")
      SetLuaFloaterCommand("qp","button1","SetDebugSetting('EnableVoiceChat',true)")
      SetLuaFloaterCommand("qp","button2","SetDebugSetting('EnableVoiceChat',false)")
      SetLuaFloaterCommand("qp","button3","SetDebugSetting('CameraFrontView',false);SetDebugSetting('CameraOffsetDefault','-2.000','0.000','-0.200');SetDebugSetting('FocusOffsetDefault','0.900','0.000','0.200')")
      SetLuaFloaterCommand("qp","button4","SetDebugSetting('CameraFrontView',false);SetDebugSetting('CameraOffsetDefault','-2.800','0.000','1.000');SetDebugSetting('FocusOffsetDefault','1.000','0.000','1.000')")
      SetLuaFloaterCommand("qp","button5","SetDebugSetting('CameraFrontView',true)")
      SetLuaFloaterCommand("qp","button6","SetCameraMode('-2')")
      SetLuaFloaterCommand("qp","button7","AgentSit()")
      SetLuaFloaterCommand("qp","button8","SendChat('/99stop')")
      SetLuaFloaterCommand("qp","button9","SetDebugSetting('RenderUsePBR',true)")
      SetLuaFloaterCommand("qp","button10","SetDebugSetting('RenderUsePBR',false)")
      end


Also, in the section function OnLuaFloaterOpen(name, parameter)
Code:
   print("Opened floater: " .. name .. " with parameter: " .. parameter)
   if name == "qp" then
   SetLuaFloaterCommand("qp","radio1","print('Radio=' .. GetValue())")
   SetLuaFloaterCommand("qp","radio2","print('Radio=' .. GetValue())")
   SetLuaFloaterCommand("qp","spin1","print('Spinner=' .. GetValue())")
   SideBarButton(1, "\u{2699}", "CloseLuaFloater('qp')")
   SideBarButtonToggle(1,true)
   end


Finally, to open/close it, in the automation script in the section function OnLogin(location)
Code:
   SideBarButton(1, "\u{2699}", "OpenLuaFloater('qp','','bottom-right')", "Quick Preferences")
   SideBarButtonToggle(1,false)

and in the section function OnLuaFloaterOpen(name, parameter)
Code:
   SideBarButton(1, "\u{2699}", "CloseLuaFloater('qp')")
   SideBarButtonToggle(1,true)


2024-04-21 17:56:01
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 15 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

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.