LsSetWindlightScene

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Examples)
m (Change See Also)
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
= lsSetWindlightScene =
 
= lsSetWindlightScene =
 
== Function ==
 
== Function ==
[[integer]] lsSetWindlightScene([[list]] rules);
+
'''integer''' lsSetWindlightScene('''list''' rules);
  
Set a list of [[Windlight]] settings in the scene to new values
+
Set a list of [http://wiki.secondlife.com/wiki/WindLight_settings Windlight settings] in the scene to new values
* [[list]] rules - a list containing pairs of [[LightShare Parameters]] and values to set
+
* '''list''' rules - a list containing pairs of [[LightShare Parameters]] and values to set
  
 
== Caveats ==
 
== Caveats ==
The list used by this function cannot be passed directly from [[lsGetWindlightScene]] without triggering C# exceptions from the [[Simulator]].
+
The list used by this function cannot be passed directly from [[lsGetWindlightScene]] without triggering C# exceptions from the Simulator.
  
[[LightShare]] must be enabled in the [[Simulator]].
+
[[LightShare]] must be enabled in the Simulator.
  
 
This script function is restricted to the region owner only.
 
This script function is restricted to the region owner only.
Line 15: Line 15:
 
== Examples ==
 
== Examples ==
 
<source lang="lsl">
 
<source lang="lsl">
  list settings = [ WL_WATER_COLOR, <4.000000,38.000000,64.000000> ];
+
//
  integer success;
+
// lsSetWindlightScene Script Exemple
  default {
+
// Author: djphil
    state_entry() {
+
//
      success = lsSetWindlightScene(settings);
+
 
      if ( success == TRUE ) {
+
integer switch;
         llOwnerSay("Success!");
+
 
      } else {
+
default
         llOwnerSay("Failed!");
+
{
      }
+
    state_entry()
 +
    {
 +
        llSay(PUBLIC_CHANNEL, "Touch to see lsSetWindlightScene usage.");
 +
        llSetText("lsSetWindlightScene", <1.0, 1.0, 1.0>, 1.0);
 +
    }
 +
 
 +
    touch_start(integer number)
 +
    {
 +
        vector color = <4.0, 38.0, 64.0>;
 +
 
 +
        if (switch = !switch)
 +
        {
 +
            color = <llFrand(255.0), llFrand(255.0), llFrand(255.0)>;
 +
        }
 +
 
 +
        list settings = [WL_WATER_COLOR, color];
 +
        integer result = lsSetWindlightScene(settings);
 +
 
 +
        if (result == TRUE)
 +
         {
 +
            llSay(PUBLIC_CHANNEL, "The Windlight Scene was changed with success.");
 +
            llSay(PUBLIC_CHANNEL, "The current water color is: " + (string)color);
 +
        }
 +
 
 +
        else
 +
         {
 +
            llSay(PUBLIC_CHANNEL, "The Windlight Scene was changed without success.");
 +
        }
 
     }
 
     }
  }
+
}
 
</source>
 
</source>
  
Line 40: Line 67:
 
== See Also ==
 
== See Also ==
 
=== Functions ===
 
=== Functions ===
*[[lsGetWindlightScene]]
+
* [[lsGetWindlightScene]]
*[[lsSetWindlightSceneTargeted]]
+
* [[lsSetWindlightScene]]
 +
* [[lsSetWindlightSceneTargeted]]
 +
* [[lsClearWindlightScene]]
  
 
=== Articles ===
 
=== Articles ===
*[[LightShare]]
+
* [[LightShare]]
*[[LightShare Parameters]]
+
* [[LightShare Parameters]]
  
 
== Deep Notes ==
 
== Deep Notes ==
 
=== All Issues ===
 
=== All Issues ===
*http://opensimulator.org/mantis/search.php?project_id=1&search=lsSetWindlightScene&hide_status_id=-2
+
* http://opensimulator.org/mantis/search.php?project_id=1&search=lsSetWindlightScene&hide_status_id=-2
 +
 
 +
[[Category:Scripting]]

Revision as of 02:12, 19 December 2020

Contents

lsSetWindlightScene

Function

integer lsSetWindlightScene(list rules);

Set a list of Windlight settings in the scene to new values

Caveats

The list used by this function cannot be passed directly from lsGetWindlightScene without triggering C# exceptions from the Simulator.

LightShare must be enabled in the Simulator.

This script function is restricted to the region owner only.

Examples

//
// lsSetWindlightScene Script Exemple
// Author: djphil
//
 
integer switch;
 
default
{
    state_entry()
    {
        llSay(PUBLIC_CHANNEL, "Touch to see lsSetWindlightScene usage.");
        llSetText("lsSetWindlightScene", <1.0, 1.0, 1.0>, 1.0);
    }
 
    touch_start(integer number)
    {
        vector color = <4.0, 38.0, 64.0>;
 
        if (switch = !switch)
        {
            color = <llFrand(255.0), llFrand(255.0), llFrand(255.0)>;
        }
 
        list settings = [WL_WATER_COLOR, color];
        integer result = lsSetWindlightScene(settings);
 
        if (result == TRUE)
        {
            llSay(PUBLIC_CHANNEL, "The Windlight Scene was changed with success.");
            llSay(PUBLIC_CHANNEL, "The current water color is: " + (string)color);
        }
 
        else
        {
            llSay(PUBLIC_CHANNEL, "The Windlight Scene was changed without success.");
        }
    }
}

Notes

Rules contain pairs of data in the form of the parameter followed by the value to set.

Setting new parameters with this function commits the new changes to the regionwindlight database table immediately.

Excessive use of this function can cause unnecessary database requests.

Use lsSetWindlightSceneTargeted if you wish to avoid database loading with this function.

See Also

Functions

Articles

Deep Notes

All Issues

Personal tools
General
About This Wiki