Table of Contents

Set Viewer Effect

31 July 2019

  • C10 - added the selection optional parameter.

19 May 2015

  • Release 8.12 - range is now an optional parameter and not required to locate the item.

28 February 2015

  • Release 7.78 - finalised.

28 February 2015

  • Release 7.75 - initial add.
setviewereffect (Commands)
TypeCorrade progressive command
Commandsetviewereffect
DescriptionThe setviewereffect updates or creates a viewer effect (either LookAt, PointAt, beam or sphere).
Permissionsinteract
Parametersgroup, password, effect
Last ChangesRelease 8.12 - range is now an optional parameter and not required to locate the item.

The setviewereffect updates or creates a viewer effect (either LookAt, PointAt, beam or sphere).

Command Required Parameters Required Corrade Permissions Example
setviewereffect group, password, effect interact
llInstantMessage(CORRADE,
    wasKeyValueEncode(
        [
            // Start a beam effect to the
            // primitive in which this
            // script is placed.
            "command", "setviewereffect",
            "group", wasURLEscape(GROUP),
            "password", wasURLEscape(PASSWORD),
            "effect", "beam",
            "item", wasURLEscape(llGetKey()),
            "range", 5,
            "callback", wasURLEscape(URL)
        ]
    )
);

With the possible parameter tree:

Parameter Possible Value Sub-Parameter Possible Value Description
effect look item, range or agent by UUID (agent) or by firstname and lastname Sets a LookAt on either an item in range or an avatar by agent UUID or by firstname and lastname.
offset A vector describing an offset from Corrade.
type A LookAt type.
point item, range or agent by UUID (agent) or by firstname and lastname Sets a PointAt on either an item in range or an avatar by agent UUID or by firstname and lastname.
offset A vector describing an offset from Corrade.
type A PointAt type.
beam item, (optional range) or agent by UUID (agent) or by firstname and lastname Sets a beam on either an item in range or an avatar by agent UUID or by firstname and lastname.
color An LSL color vector.
alpha A value in the interval $[0, 1]$ describing the color alpha.
duration The duration (in seconds) for the effect.
offset A vector describing an offset from Corrade.
sphere color An LSL color vector. Creates a particle swirl effect.
alpha A value in the interval $[0, 1]$ describing the color alpha.
duration The duration (in seconds) for the effect.
offset A vector describing an offset from Corrade.

The command takes an optional parameter id, an UUID corresponding to an effect:

Optional Parameter Possible Value Description
id An UUID. The UUID of the effect to set.
selection attached, rezzed or all (default: all) Either attached, rezzed or all for selecting only primitives or objects attached to avatars, primitives or objects rezzed in-world or all primitives or objects respectively.

and in case id is not specified, then Corrade will generate a random UUID and, in the case of the look viewer effect, it will create a new beacon.

Notes

Look at Object or Avatar

The setviewereffect is a powerful command with which you can also make Corrade look at something or someone. Suppose that your name is Leslie Resident and that you would like your Corrade to look at you. In that case, you would issue the command as:

llInstantMessage(CORRADE, 
    wasKeyValueEncode(
        [
            "command", "setviewereffect",
            "group", llEscapeURL(GROUP),
            "password", llEscapeURL(PASSWORD),
            "effect", "look",
            "firstname", "Leslie",
            "lastname", "Resident",
            "offset", ZERO_VECTOR,
            "type", "Mouselook",
            "callback", llEscapeURL(URL)
        ]
    )
);

which will make Corrade look at Leslie Resident. You can also make Corrade look at an object the same way by using the item and optional range parameter.

If the command is successful, then Corrade will return the effect UUID in the data key to the callback URL. Suppose that Corrade returned the UUID af61fb35-8f84-4e28-a8d7-dd88c33ab99f, then this UUID can be used to make Corrade look at a different object by moving the beacon:

llInstantMessage(CORRADE, 
    wasKeyValueEncode(
        [
            "command", "setviewereffect",
            "group", llEscapeURL(GROUP),
            "password", llEscapeURL(PASSWORD),
            "effect", "look",
            "item", "46eda187-9382-4333-81df-4976ac5d8031",
            "range", 5,
            "offset", ZERO_VECTOR,
            "type", "Mouselook",
            "id", "af61fb35-8f84-4e28-a8d7-dd88c33ab99f",
            "callback", llEscapeURL(URL)
        ]
    )
);

Note the id that references the previous look beacon (af61fb35-8f84-4e28-a8d7-dd88c33ab99f). It is important to track the viewer effects because they can then be manipulated and set to different objects. The setviewereffect by default creates a new beacon in case an existing UUID is not supplied as the value of the id parameter. In other words, if you do not track your effects, Corrade will just create new beacons every time setviewereffect is called - this is especially true for the look viewer effect that cannot be deleted.