Forgot? Join

Scripting

LSL Guide

Every script function this grid actually runs, read straight from the region software rather than copied from a wiki — including the wolf* functions that exist only here.

Functions · Constants

wolfSetRegionWeather

Wolf Territories
integer wolfSetRegionWeather(list rules)

Set this region's weather. The script's OWNER must hold the region. Key/value pairs: see Wolf_Api.WeatherRulesToJson. TRUE when the grid accepted it, FALSE otherwise.

Sets the weather for the whole region: what falls, how heavily, its colour, movement, density, size and sound. Returns 1 when the grid accepted it and 0 when it refused; wolfGetLastError says why. The script's owner must hold the region (estate owner or manager), exactly as the About Land > Weather tab requires, because a script may only do what its owner could do by hand.

Parameters

TypeName What it does
list rules Key/value pairs, in any order: "kind" is required, everything else is optional. See the rule table below for every key, its range and what it does. An unknown key or an out-of-range value is refused rather than ignored — a typo that quietly does nothing is the worst thing a script API can do.

The rules list

Key/value pairs in any order. Every value is an integer percent except move, which is hundredths of a metre per second. An unknown key or an out-of-range value is refused, and wolfGetLastError says which.

KeyTypeValuesMeaning
kind string clear, rain or snow What falls. Required by both setters. "clear" on a parcel means no weather THERE even when the region is raining — a cave, a covered market.
level integer 1 – 4 How heavy: 1 light, 2 moderate, 3 heavy, 4 torrential rain / blizzard. The level sets the base particle count and fall speed the other percentages scale.
bright integer 0 – 200 (%) Brightness of the precipitation's lit colour. 100 is neutral.
colour string #rrggbb The tint colour ("color" is accepted too). Rain's neutral is #aaccff, snow's is #ffffff.
tint integer 0 – 100 (%) How far from the kind's neutral colour towards the tint colour.
move integer 0 – 300 (hundredths m/s) Sideways drift the weather leans on. 60 = 0.60 m/s. The direction turns slowly on its own.
density integer 10 – 300 (%) Particle count as a percentage of the level's own figure.
velocity integer 10 – 300 (%) Fall speed as a percentage of the level's own figure.
size integer 10 – 400 (%) Particle size as a percentage of the kind's own width.
sound integer 0 or 1 Whether the weather makes any sound at all.
vol integer 0 – 100 (%) Weather sound volume.
amb string none, thunder, steady, wind, distant The ambience bed. "thunder" and "distant" are storms: they fork lightning and roll thunder in both viewers.
near string none, soft, heavy, leaves, water The near layer — the sound of rain on what is around you.
on integer 0 or 1 Region only. Whether the region weather is switched on. A script that sets a kind turns it on unless it says otherwise.

Example

default
{
    touch_start(integer n)
    {
        // A heavy thunderstorm: dense rain, leaning on a 1.8 m/s wind, loud.
        if (!wolfSetRegionWeather([ "kind", "rain", "level", 3,
                                    "density", 140, "move", 180,
                                    "amb", "thunder", "near", "heavy", "vol", 85 ]))
        {
            llOwnerSay("Weather refused: " + wolfGetLastError());
        }
    }
}

A snowy night, quiet

wolfSetRegionWeather([ "kind", "snow", "level", 2, "colour", "#e6f0ff",
                       "tint", 60, "velocity", 80, "amb", "wind", "vol", 40 ]);

Clear skies again

wolfSetRegionWeather([ "kind", "clear" ]);

Switch the region weather off without forgetting the settings

wolfSetRegionWeather([ "kind", "rain", "on", FALSE ]);
Energy 10

Ours alone. Grid features you will not find on any other OpenSimulator grid.

More in Wolf Territories