Set the media params for a particular face on the linked prim(s) without a delay.

Syntax

integer llSetLinkMedia( integer link, integer face, list params );

Forced delay: 0.0 seconds. Energy: 0.0.

Parameters

integer link (link)
Link number (0: unlinked, 1: root prim, >1: child prims) or a LINK_* flag
integer face
face number
list params (instructions)
a set of name/value pairs (in no particular order)

Return value

Returns a status (an integer) that is a STATUS_* flag which details the success/failure of the operation(s).

Constants

FlagDescription
LINK_ROOT1refers to the root prim in a multi-prim linked set[1]
FlagDescription
LINK_THIS-4refers to the prim the script is in
Success/Failure FlagsDescription
STATUS_OK0Result of function call was success
STATUS_MALFORMED_PARAMS1000Function was called with malformed parameters
STATUS_TYPE_MISMATCH1001Argument(s) passed to function had a type mismatch
STATUS_BOUNDS_ERROR1002Argument(s) passed to function had a bounds error
STATUS_NOT_FOUND1003Object or other item was not found
STATUS_NOT_SUPPORTED1004Feature not supported
STATUS_INTERNAL_ERROR1999An internal error occurred
STATUS_WHITELIST_FAILED2001Whitelist Failed
ParameterAdditional ParametersDescription
[ PRIM_MEDIA_ALT_IMAGE_ENABLE ]0[ integer boolean ]Sets the default image state (the image that the user sees before a piece of media is active) for the chosen face. The default image is specified by Second Life's server for that media type.

Note: This flag is not currently implemented.

[ PRIM_MEDIA_CONTROLS ]1[ integer control ]Sets the style of controls. Can be either PRIM_MEDIA_CONTROLS_STANDARD or PRIM_MEDIA_CONTROLS_MINI.
controls FlagsDescription
PRIM_MEDIA_CONTROLS_STANDARD0Standard web navigation controls.
PRIM_MEDIA_CONTROLS_MINI1Mini web navigation controls; does not include an address bar.
[ PRIM_MEDIA_CURRENT_URL ]2[ string current_url ]Sets the current url displayed on the chosen face. Changing this URL causes navigation. 1024 characters Max
[ PRIM_MEDIA_HOME_URL ]3[ string home_url ]Sets the home url for the chosen face. 1024 characters max
[ PRIM_MEDIA_AUTO_LOOP ]4[ integer boolean ]Sets whether auto-looping is enabled.
[ PRIM_MEDIA_AUTO_PLAY ]5[ integer boolean ]Sets whether the media auto-plays when a Resident can view it.
[ PRIM_MEDIA_AUTO_SCALE ]6[ integer boolean ]Sets whether auto-scaling is enabled. Auto-scaling forces the media to the full size of the texture.
[ PRIM_MEDIA_AUTO_ZOOM ]7[ integer boolean ]Sets whether clicking the media triggers auto-zoom and auto-focus on the media.
[ PRIM_MEDIA_FIRST_CLICK_INTERACT ]8[ integer boolean ]Sets whether the first click interaction is enabled.

Note: This flag appears not to work.

[ PRIM_MEDIA_WIDTH_PIXELS ]9[ integer width ]Sets the width of the media in pixels.
[ PRIM_MEDIA_HEIGHT_PIXELS ]10[ integer height ]Sets the height of the media in pixels.
[ PRIM_MEDIA_WHITELIST_ENABLE ]11[ integer boolean ]Sets whether navigation is restricted to URLs in PRIM_MEDIA_WHITELIST.
[ PRIM_MEDIA_WHITELIST ]12[ string CSV ]Sets the whitelist as a string of escaped, comma-separated URLs. This string can hold up to 64 URLs or 1024 characters, whichever comes first.
[ PRIM_MEDIA_PERMS_INTERACT ]13[ integer perms ]Sets the permissions mask that control who can interact with the object:
[ PRIM_MEDIA_PERMS_CONTROL ]14[ integer perms ]Sets the permissions mask that control who can see the media control bar above the object:

Caveats

Examples

Useful snippets

//-- expand media textures greater than 1024 pixel in a direction to fit the media face
//-- does exactly what the "align" button does in the edit window
//-- original by Edelman Linden (or Kate Linden), tweaked by Void Singer
uExpandMediaTexture( integer vIntWidth, integer vIntHeight, integer vIntFace ){
    integer vIntTemp;
    vector  vSizScale;

    while (vIntWidth >> ++vIntTemp);
    vSizScale.x = vIntWidth / (float)(1 << vIntTemp);
    vIntTemp = 0;
    while (vIntHeight >> ++vIntTemp);
    vSizScale.y = vIntHeight / (float)(1 << vIntTemp);
    llSetLinkPrimitiveParamsFast( LINK_THIS,
                                  [PRIM_TEXTURE, vIntFace] +
                                  llListReplaceList( llGetLinkPrimitiveParams(LINK_THIS, [PRIM_TEXTURE, vIntFace] ),
                                                    [vSizScale, ((vSizScale - <1.0, 1.0, 0.0>) / 2.0)],
                                                    1,
                                                    2 ) );
}

Notes

Link Numbers

Each prim that makes up an object has an address, a link number. To access a specific prim in the object, the prim's link number must be known. In addition to prims having link numbers, avatars seated upon the object do as well.

When an avatar sits on an object, it is added to the end of the link set and will have the largest link number. In addition to this, while an avatar is seated upon an object, the object is unable to link or unlink prims without unseating all avatars first.

Counting Prims & Avatars

There are two functions of interest when trying to find the number of prims and avatars on an object.

integer GetPrimCount() { //always returns only the number of prims
    if(llGetAttached())//Is it attached?
        return llGetNumberOfPrims();//returns avatars and prims but attachments can't be sat on.
    return llGetObjectPrimCount(llGetKey());//returns only prims but won't work on attachments.
}

See llGetNumberOfPrims for more about counting prims and avatars.

Errata

If a script located in a child prim erroneously attempts to access link 0, it will get or set the property of the linkset's root prim. This bug (BUG-5049) is preserved for broken legacy scripts.

See also

Functions

Articles

Deep notes

Issues

History

Date of Release 10/08/2011

Footnotes

  1. LINK_ROOT does not work on single prim objects. Unless there is an avatar sitting on the object.