LsSetWindlightSceneTargeted
From OpenSimulator
m (Robot: Cosmetic changes) |
|||
(11 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
= lsSetWindlightSceneTargeted = | = lsSetWindlightSceneTargeted = | ||
+ | |||
+ | <div style="background-color:#FFA0A0; padding:10px; padding-bottom:5px; border: 1px #FF544F solid"> | ||
+ | '''Caution !''' This function is temporary not supported ... | ||
+ | </div> | ||
+ | |||
== Function == | == Function == | ||
'''integer''' lsSetWindlightSceneTargeted('''list''' rules,'''key''' who); | '''integer''' lsSetWindlightSceneTargeted('''list''' rules,'''key''' who); | ||
Line 17: | Line 22: | ||
== Examples == | == Examples == | ||
<source lang="lsl"> | <source lang="lsl"> | ||
− | + | // | |
− | + | // lsSetWindlightSceneTargeted Script Exemple | |
− | + | // Author: djphil | |
− | + | // | |
− | + | ||
− | + | integer switch; // Variable to switch between colors | |
− | + | ||
− | + | default | |
− | + | { | |
− | + | // Event handler triggered when the script is initialized | |
+ | state_entry() | ||
+ | { | ||
+ | // Send a message to public channel informing users to touch to see usage | ||
+ | llSay(PUBLIC_CHANNEL, "Touch to see lsSetWindlightSceneTargeted usage."); | ||
+ | } | ||
+ | |||
+ | // Event handler triggered when the object is touched | ||
+ | touch_start(integer number) | ||
+ | { | ||
+ | vector color = <4.0, 38.0, 64.0>; // Default color | ||
+ | |||
+ | // Switch between default color and random color | ||
+ | if (switch = !switch) | ||
+ | { | ||
+ | color = <llFrand(255.0), llFrand(255.0), llFrand(255.0)>; // Generate a random color | ||
+ | } | ||
+ | |||
+ | // Define settings list with water color setting | ||
+ | list settings = [WL_WATER_COLOR, color]; | ||
+ | |||
+ | // Get the key of the touched avatar | ||
+ | key targetKey = llDetectedKey(0); | ||
+ | |||
+ | // Call lsSetWindlightSceneTargeted function to set the Windlight scene with the new settings for the targeted user | ||
+ | integer result = lsSetWindlightSceneTargeted(settings, targetKey); | ||
+ | |||
+ | // Check if the settings were applied successfully | ||
+ | if (result == TRUE) | ||
+ | { | ||
+ | // Notify users about the success and display the current water color | ||
+ | llSay(PUBLIC_CHANNEL, "The Windlight Scene Targeted was changed with success."); | ||
+ | llSay(PUBLIC_CHANNEL, "The current water color is: " + (string)color); | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | // Notify users about the failure to change the Windlight Scene for the targeted user | ||
+ | llSay(PUBLIC_CHANNEL, "The Windlight Scene Targeted was changed without success."); | ||
+ | } | ||
} | } | ||
− | + | } | |
</source> | </source> | ||
Line 44: | Line 87: | ||
* [[lsGetWindlightScene]] | * [[lsGetWindlightScene]] | ||
* [[lsSetWindlightScene]] | * [[lsSetWindlightScene]] | ||
+ | * [[lsSetWindlightSceneTargeted]] | ||
+ | * [[lsClearWindlightScene]] | ||
=== Articles === | === Articles === | ||
Line 52: | Line 97: | ||
=== 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]] |
Latest revision as of 02:03, 5 March 2024
Contents |
[edit] lsSetWindlightSceneTargeted
Caution ! This function is temporary not supported ...
[edit] 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
[edit] 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.
[edit] Examples
// // lsSetWindlightSceneTargeted Script Exemple // Author: djphil // integer switch; // Variable to switch between colors default { // Event handler triggered when the script is initialized state_entry() { // Send a message to public channel informing users to touch to see usage llSay(PUBLIC_CHANNEL, "Touch to see lsSetWindlightSceneTargeted usage."); } // Event handler triggered when the object is touched touch_start(integer number) { vector color = <4.0, 38.0, 64.0>; // Default color // Switch between default color and random color if (switch = !switch) { color = <llFrand(255.0), llFrand(255.0), llFrand(255.0)>; // Generate a random color } // Define settings list with water color setting list settings = [WL_WATER_COLOR, color]; // Get the key of the touched avatar key targetKey = llDetectedKey(0); // Call lsSetWindlightSceneTargeted function to set the Windlight scene with the new settings for the targeted user integer result = lsSetWindlightSceneTargeted(settings, targetKey); // Check if the settings were applied successfully if (result == TRUE) { // Notify users about the success and display the current water color llSay(PUBLIC_CHANNEL, "The Windlight Scene Targeted was changed with success."); llSay(PUBLIC_CHANNEL, "The current water color is: " + (string)color); } else { // Notify users about the failure to change the Windlight Scene for the targeted user llSay(PUBLIC_CHANNEL, "The Windlight Scene Targeted was changed without success."); } } }
[edit] 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.
[edit] See Also
[edit] Functions
- lsGetWindlightScene
- lsSetWindlightScene
- lsSetWindlightSceneTargeted
- lsClearWindlightScene