Set Viewer Effect

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 Description
id The UUID of the effect to set.

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

  • The command will return an UUID referenced by the data key via the callback which represents the UUID of the effect created or modified. This UUID can be used as a reference for both ulterior setviewereffect or deteleviewereffect calls. You most likely want to track the viewer effects for LookAt and PointAt in order to be able to change them.

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.


secondlife/scripted_agents/corrade/api/progressive/commands/setviewereffect.txt ยท Last modified: 2017/02/22 18:29 (external edit)

Access website using Tor


For the copyright, license, warranty and privacy terms for the usage of this website please see the license and privacy pages.