wolfEnvironmentGet
Wolf Territoriesstring wolfEnvironmentGet(integer scope)
The Wolf Environment document of this region (WOLF_ENV_REGION) or of the parcel this object is over (WOLF_ENV_PARCEL), as JSON (read it with llJsonGetValue), or "" when there is none. "" with wolfGetLastError set when it could not be read.
Reads the Wolf Environment - the sky, time of day, weather and light set in World > Wolf World > Wolf Environment - of the whole region, or of the parcel this object is over. You get the whole document as JSON, so llJsonGetValue picks out any part of it: ["weather", "type"], ["time", "hour"], ["sky", "suns", 0, "color"]. An empty string means there is no Wolf Environment there (the sky is the region's own); if it could not be read, the empty string comes with wolfGetLastError saying why. Anyone's script may read it. A read is kept for 10 seconds, so a script that asks again within that time gets the same answer without asking the grid.
Parameters
| Type | Name | What it does |
|---|---|---|
| integer | scope | WOLF_ENV_REGION for the whole region, or WOLF_ENV_PARCEL for the parcel under this object. |
Example
default
{
touch_start(integer n)
{
string doc = wolfEnvironmentGet(WOLF_ENV_REGION);
if (doc == "")
{
if (wolfGetLastError() != "") llOwnerSay("Could not read it: " + wolfGetLastError());
else llOwnerSay("This region has no Wolf Environment.");
return;
}
llOwnerSay("Weather: " + llJsonGetValue(doc, ["weather", "source"])
+ ", time: " + llJsonGetValue(doc, ["time", "mode"]));
}
}Is it a fixed storm right now?
integer stormy = llJsonGetValue(wolfEnvironmentGet(WOLF_ENV_REGION), ["weather", "type"]) == "storm";
Ours alone. Grid features you will not find on any other OpenSimulator grid.