# llClearLinkMedia

*LSL function*

```lsl
integer integer llClearLinkMedia(integer link, integer face);
```

- `integer link`: The link number (0: unlinked, 1: root prim, >1: child prims) or a LINK_* flag representing the target prim.
- `integer face`: Face number to clear.

- Returns: `integer`
- Energy: 10

Clears (deletes) the media and all `params` from the given **face** on the **link**ed prim(s).

Returns an [integer](https://wiki.secondlife.com/wiki/integer) that is a STATUS\_\* flag which details the success/failure of the operation.

```lsl title="How to use" frame="terminal"
integer result = llClearLinkMedia(0, 0);
```

## Specification

| Constant | Type | Value | Description |
| --- | --- | --- | --- |
| [STATUS_OK](/constants/STATUS_OK/) | integer | `0` | Result of function call was success |
| [STATUS_MALFORMED_PARAMS](/constants/STATUS_MALFORMED_PARAMS/) | integer | `1000` | Function was called with malformed parameters |
| [STATUS_TYPE_MISMATCH](/constants/STATUS_TYPE_MISMATCH/) | integer | `1001` | Argument(s) passed to function had a type mismatch |
| [STATUS_BOUNDS_ERROR](/constants/STATUS_BOUNDS_ERROR/) | integer | `1002` | Argument(s) passed to function had a bounds error |
| [STATUS_NOT_FOUND](/constants/STATUS_NOT_FOUND/) | integer | `1003` | Object or other item was not found |
| [STATUS_NOT_SUPPORTED](/constants/STATUS_NOT_SUPPORTED/) | integer | `1004` | Feature not supported |
| [STATUS_INTERNAL_ERROR](/constants/STATUS_INTERNAL_ERROR/) | integer | `1999` | An internal error occurred |
| [STATUS_WHITELIST_FAILED](/constants/STATUS_WHITELIST_FAILED/) | integer | `2001` | Whitelist Failed |

<table>
	<tr>
		<th>Success/Failure Flags</th>
		<th></th>
		<th colspan="6">Description</th>
	</tr>
</table>

## Examples

<details open>
<summary>Example 1</summary>

```lsl collapse={1-26, 33-49, 55-71}
//  when dropping this script into an object
//  it will remove all set media-on-a-prim
//  on all sides of every prim and then
//  the script will delete itself

integer GetPrimCount()
{
    if(llGetAttached())
        return llGetNumberOfPrims();

    return llGetObjectPrimCount(llGetKey());
}

publish_returned_status_flag(integer inputLink, integer inputFace, integer inputStatus)
{
    /* if (inputInteger == 0) */ string outputStatus = "STATUS_OK";
    if (inputStatus == 1000) outputStatus = "STATUS_MALFORMED_PARAMS";
    else if (inputStatus == 1001) outputStatus = "STATUS_TYPE_MISMATCH";
    else if (inputStatus == 1002) outputStatus = "STATUS_BOUNDS_ERROR";
    else if (inputStatus == 1003) outputStatus = "STATUS_NOT_FOUND";
    else if (inputStatus == 1004) outputStatus = "STATUS_NOT_SUPPORTED";
    else if (inputStatus == 1999) outputStatus = "STATUS_INTERNAL_ERROR";
    else if (inputStatus == 2001) outputStatus = "STATUS_WHITELIST_FAILED";

    // PUBLIC_CHANNEL has the integer value 0
    llSay(PUBLIC_CHANNEL, "llClearLinkMedia(link " + (string)inputLink
        + ", face " + (string)inputFace + ") = " + outputStatus + ";");
}

default
{
    state_entry()
    {
        integer numOfPrims = GetPrimCount();
        integer numOfSides;

        integer link;
        integer face;

        if (1 < numOfPrims)
            link = 1;

        do
        {
            numOfSides = llGetLinkNumberOfSides(link);
            face = 0;
            do
            {
                integer clearLinkMediaSuccessFlag = llClearLinkMedia(link, face);
                publish_returned_status_flag(link, face, clearLinkMediaSuccessFlag);

                ++face;
            }
            while (face < numOfSides);

            if (numOfPrims == 1)
                jump continue;

            ++link;
        }
        while (link <= numOfPrims);

        @continue;

        string thisScript = llGetScriptName();
        llRemoveInventory(thisScript);
    }
}
```

</details>

## History

Date of Release [10/08/2011](https://wiki.secondlife.com/wiki/Release_Notes/Second_Life_Server/11#11-08-10-238207)

## Known issues

From the issue templates included by the wiki article:

- SVC-7422 (bug): ll\*LinkMedia functions do not work with LINK\_\* flags

## See also

### Functions

- [llClearPrimMedia](/functions/llClearPrimMedia/)
- [llSetLinkMedia](/functions/llSetLinkMedia/)
- [llGetLinkMedia](/functions/llGetLinkMedia/)

---

*Source: [LlClearLinkMedia](https://wiki.secondlife.com/wiki/LlClearLinkMedia) on the Second Life Wiki. Content from the Second Life Wiki articles LlClearLinkMedia (revision 1194071, 2015-01-22), Template:LSL Constants/ReturnStatus (revision 1185325, 2013-12-19), Template:LSL Function/face (revision 1175878, 2013-01-06), Template:LSL Function/link (revision 1216622, 2024-05-04) and Template:Issues/SVC-7422 (revision 1167333, 2012-05-16), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llClearLinkMedia/
