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

760
Functions
934
Constants
4
Wolf Territories only

The wolf* functions

Written for this grid and available nowhere else. A script may only do what the object’s owner could do by hand, so region weather needs the estate and parcel weather needs the parcel.

string wolfGetLastError()

The last error from a wolf* call on this script, or an empty string.

list wolfGetRegionWeather()

This region's stored weather as key/value pairs, or an empty list.

integer wolfSetParcelWeather(list rules)

Force the weather on the parcel this prim stands in, by writing the keyword form into THIS prim's description — the mechanism the viewers already read. The script's owner must own the parcel (or hold the region).

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.

The rules list, shared by both setters

Key/value pairs in any order; kind is required. 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 rather than ignored, 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.

wolfSetRegionWeather

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.

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 ]);

wolfGetRegionWeather

Reads the region's weather as the same key/value list the setter takes, so a script can read it, change one value and hand the whole list straight back. Returns an empty list when the region has no weather record. The list always starts with "kind" and "on"; the integer keys follow, then "colour", "sound", "amb" and "near" when they are stored.

Example

default
{
    touch_start(integer n)
    {
        list w = wolfGetRegionWeather();
        llOwnerSay("Weather now: " + llDumpList2String(w, " "));

        // Make it one level heavier, keeping everything else as it is.
        integer i = llListFindList(w, ["level"]);
        if (i != -1)
        {
            integer level = llList2Integer(w, i + 1);
            if (level < 4) w = llListReplaceList(w, [level + 1], i + 1, i + 1);
            wolfSetRegionWeather(w);
        }
    }
}

wolfSetParcelWeather

Weather for ONE parcel, carried by the prim the script is in: the function writes the weather keyword into the prim's description (the same "wolfrain3 dens=170 amb=thunder" form a builder can type by hand) and the viewers read it from there. The prim must stand on a parcel the script's owner owns (or the owner must hold the region). Parcel weather beats region weather; "clear" on a parcel keeps a region storm out of a cave or a covered market. Returns 1 or 0, and refuses rather than truncates when the options would not fit a 127-character description.

Example

// Put this in a prim on your parcel. The prim can be anything — a rock, a sign,
// an invisible cube — it only needs to sit on the parcel.
default
{
    state_entry()
    {
        // Light rain with leaves rustling nearby, only on this parcel.
        if (!wolfSetParcelWeather([ "kind", "rain", "level", 1,
                                    "near", "leaves", "vol", 50 ]))
        {
            llOwnerSay("Parcel weather refused: " + wolfGetLastError());
        }
    }

    touch_start(integer n)
    {
        // Touch to make this parcel a dry spot even when the region is raining.
        wolfSetParcelWeather([ "kind", "clear" ]);
    }
}

Turn it off again

llSetObjectDesc("");   // no keyword, no parcel weather — the region's weather returns

wolfGetLastError

Why the last wolf* call returned 0: the region refused it (the owner does not hold the region or the parcel, a bad key or value, the weather service could not be reached, or the functions are not enabled on this region). Empty after a call that succeeded.

Example

default
{
    touch_start(integer n)
    {
        // A deliberate mistake: 5 is out of range (1 - 4), so this is refused.
        if (!wolfSetRegionWeather([ "kind", "rain", "level", 5 ]))
        {
            llSay(0, "Refused: " + wolfGetLastError());   // "level must be 1..4"
        }
    }
}

Browse by family

A – Z

By the first letter after the prefix.

A B C D E F G H I J K L M N O P R S T U V W X

This reference is generated from the region software Wolf Territories runs, so it lists what the grid actually implements rather than what a wiki says it should. 181 of them have no written description yet; those say so rather than guessing.