LsSetWindlightSceneTargeted
From OpenSimulator
(Replace script exemple) |
|||
Line 17: | Line 17: | ||
== Examples == | == Examples == | ||
<source lang="lsl"> | <source lang="lsl"> | ||
− | + | // | |
− | + | // 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."); | ||
+ | } | ||
} | } | ||
− | + | } | |
</source> | </source> | ||
Line 53: | Line 80: | ||
=== All Issues === | === All Issues === | ||
* http://opensimulator.org/mantis/search.php?project_id=1&search=lsSetWindlightSceneTargeted&hide_status_id=-2 | * http://opensimulator.org/mantis/search.php?project_id=1&search=lsSetWindlightSceneTargeted&hide_status_id=-2 | ||
− | |||
[[Category:Scripting]] | [[Category:Scripting]] |
Revision as of 00:56, 19 December 2020
Contents |
lsSetWindlightSceneTargeted
Function
integer lsSetWindlightSceneTargeted(list rules,key who);
Set a list of Windlight settings in the scene to new values for a specific targeted user.
- list rules - a list containing pairs of LightShare Parameters and values to set
- key who - the UUID of the person to change Windlight settings for
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, who may use it to set Windlight settings for others in the region.
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 lsSetWindlightScene commits the new changes to the regionwindlight database table immediately.
Excessive use of this function can cause unnecessary database requests.
Use this function if you wish to avoid database loading with lsSetWindlightScene.