wolfEffect
Wolf Territoriesinteger wolfEffect(string effect, vector pos, list rules)
A script effect drawn by Wolf viewers, e.g. wolfEffect("explosion", llGetPos() + <0,0,1>, ["size", 6, "shake", 0.8]). Effects: explosion, fireball, smoke, sparks, fire, fireworks, dust, shockwave. Keys: size (metres), colour, colour2 (vectors 0..1), duration (seconds), intensity (0.1..2), shake (0..1), shake_radius (metres), sound (TRUE/FALSE), volume (0..1), direction (vector). In this region, within 96 m of the object; an object may start 5 at once then 2 a second. 1 when sent, 0 (wolfGetLastError says why) when refused.
Sets off an explosion, fireball, smoke, sparks, fire, fireworks, dust or a shockwave at a point, drawn by WolfViewer and WolfStorm (other viewers hear the sound but see nothing). The point must be in this region, within 96 m of the object, and over the object's own parcel or land its owner controls: no explosions on the neighbours. Numbers outside a key's range are held to it; an unknown effect or key, a key given twice or a value of the wrong type refuses the call. An object may set off 5 effects at once and then 2 a second, all of one owner's objects together 10 and then 3 a second, the region 30 and then 10 a second. Returns 1 when sent, or 0 with wolfGetLastError saying why.
Parameters
| Type | Name | What it does |
|---|---|---|
| string | effect | explosion, fireball, smoke, sparks, fire, fireworks, dust or shockwave. |
| vector | pos | Where, in region coordinates (metres). |
| list | rules | Key/value pairs, any order, may be empty for the defaults. Every key is in the table below. At most 16 pairs. |
The effects
| Effect | Size | Lasts | What it is |
|---|---|---|---|
| explosion | 4 m | 1 s | A white flash, a fireball cooling from white-hot to dark red, a shock ring along the ground, sparks and dark debris that bounce, and a smoke column. Shakes the view (0.6) and booms by default. |
| fireball | 3 m | 1 s | A flash and a fireball with a little smoke: no shock ring, sparks or debris, and no shake unless you ask. Booms by default. |
| smoke | 3 m | 6 s | A column that keeps rising and spreading for the duration, grey by default. |
| sparks | 1.5 m | 0.5 s | Hot sparks streaking out along "direction" and falling, bouncing where they land, for the duration. |
| fire | 1.5 m | 10 s | Flames with embers and smoke above them, burning for the duration and leaning along "direction". |
| fireworks | 12 m | 1 s | A sphere of streaking stars: two in three are "colour", one in three "colour2". Plays the firework sound by default. |
| dust | 3 m | 1 s | A cloud of dust rolling out along the ground. |
| shockwave | 6 m | 1 s | A faint flash and a white ring racing out along the ground. |
The rules list
Key/value pairs in any order, or an empty list for the defaults. A number outside a key's range is held to it; an unknown key, a key given twice or a value of the wrong type is refused, and wolfGetLastError says which.
| Key | Type | Values | Meaning |
|---|---|---|---|
| size | float | 0.2 – 30 (metres) | The radius. The default depends on the effect (table above). |
| duration | float | 0.1 – 30 (seconds) | How long it lasts. Matters most for fire, smoke and sparks. |
| intensity | float | 0.1 – 2 | How many particles, 1 = normal. |
| colour | vector | <r, g, b>, each 0 – 1 | The main colour: the fireball, flames, smoke, dust or firework stars. Each effect has its own default (fire orange, smoke grey, dust brown, fireworks red). Sparks are always white-hot to orange and ignore it. |
| colour2 | vector | <r, g, b>, each 0 – 1 | The second colour: an explosion's debris and smoke, a fireball's smoke, one firework star in three (yellow by default). |
| direction | vector | any vector but ZERO_VECTOR | Which way sparks fly and flames lean. Straight up, <0, 0, 1>, by default. |
| shake | float | 0 – 1 | How hard the view shakes at the centre, fading to nothing at shake_radius. 0.6 for an explosion, 0 for the rest. |
| shake_radius | float | 0 – 150 (metres) | How far the shake reaches. By default 8 × size, at most 150 m. |
| sound | integer | TRUE or FALSE | Whether it makes a sound. On by default for explosion, fireball and fireworks. |
| volume | float | 0 – 1 | Sound volume, 1 by default. |
Example
default
{
touch_start(integer n)
{
// A big bang a metre above this object: 6 m across, a strong shake nearby.
if (!wolfEffect("explosion", llGetPos() + <0, 0, 1>, [ "size", 6, "shake", 0.8 ]))
{
llOwnerSay("Effect refused: " + wolfGetLastError());
}
}
}A campfire that burns for half a minute
wolfEffect("fire", llGetPos(), [ "size", 0.8, "duration", 30 ]);Green and white fireworks 40 m up
wolfEffect("fireworks", llGetPos() + <0, 0, 40>,
[ "colour", <0.2, 1, 0.3>, "colour2", <1, 1, 1>, "size", 15 ]);Sparks from a grinder, flying out sideways for 3 seconds
wolfEffect("sparks", llGetPos(), [ "direction", <1, 0, 0.3>, "duration", 3 ]);Black smoke from a wreck
wolfEffect("smoke", llGetPos(), [ "colour", <0.1, 0.1, 0.1>, "duration", 20, "size", 4 ]);A quiet explosion that shakes nobody
wolfEffect("explosion", llGetPos(), [ "shake", 0, "sound", FALSE ]);Ours alone. Grid features you will not find on any other OpenSimulator grid.