Skip to content
lsl.devlsl.devLSL Dev

LlGetDisplayName

Looking for the current API? Open the llGetDisplayName reference →

Function notes

id must specify a valid avatar key, present in or otherwise known to the sim in which the script is running, otherwise an empty string is returned. This function will still return a valid display name if the avatar is a child agent of the sim (i.e., in an adjacent sim, but presently able to see into the one the script is in), or for a short period after the avatar leaves the sim (specifically, when the client completely disconnects from the sim, either as a main or child agent).

Return value notes

Returns a string that is the non-unique display name of the avatar specified by id.

Caveats

  • To get around the "avatar must be present" limitation, you can use the llRequestDisplayName function and the dataserver event to obtain the avatar's display name from a key (this is slower).
  • There is no opposite function (llDisplayName2Key) available since display names are non-unique.
  • Either of ??? or <abbr title="empty string">""</abbr> is returned if the region is unable to return display names. This can happen even if display names are enabled on the region, especially the first time a given key is checked. At least one retry may be advisable. Do not rely on this function to verify avatar presence.
  • It is possible for Loading... to be returned if called before the region has had a chance to resolve the agent's display name.
    • Do not retry failed attempts indefinitely in a loop. In a few cases, a display name or username will not be returned for as long as the avatar is in the region.
  • If you merely wish to show the agent display name in the viewer window, it may be more straightforward to use Viewer URI Name Space, e.g.:
    llSay(0, "secondlife:///app/agent/" + (string)id + "/displayname");

Examples

// Best viewed in Chat History (ctrl-h)
default
{
    collision_start(integer a)//Announce who collided
    {
        llSay(0, "llGetDisplayName: " + llGetDisplayName(llDetectedKey(0)) +
                 "\nllDetectedName: " + llDetectedName(0));
    }
    touch_start(integer a)
    {
        llSay(0, "llGetDisplayName: " + llGetDisplayName(llDetectedKey(0)) +
                 "\nllDetectedName: " + llDetectedName(0));
    }
}

See also: functions

Shared wiki helpers

The original page also injects shared parameter notes, caveats or issue information through these helpers. Their conditional MediaWiki logic is not reproduced here; inspect the preserved helper source for additional material.

Template:LSL Function/warning

Original shared helper source (conditional wiki logic is not evaluated)
<noinclude>{{Multi-lang|category=LSL}}</noinclude>{{#if:{{#var:fw-multiple}}|{{#vardefine:fw-multiple|{{#expr:{{#var:fw-multiple}}+1}}}}
<span style="font-size:120%;">'''{{{1}}} Warning'''<span>
<div>
{{{2}}}
</div>
|{{#vardefine:header|{{#var:header}}{{#vardefine:fw-multiple|0}}{{#if:{{{2}}}}}{{#vardefine:fw-title|{{{1}}} Warning{{#ifexpr:{{#var:fw-multiple}} > 1|s}}!}}
{{{!}} style="background-color:#AAAAAA; margin-bottom:10px;" cellpadding="3" cellspacing="1"
{{!}} style="background:white;" valign="top" rowspan="2" {{!}} [[Image:Emblem-important-red.png]]
{{!}} style="color:white; background:#990000;" title="{{#var:fw-title}}" width="100%" {{!}} '''{{#var:fw-title}}'''
{{!}}-
{{!}} style="background:#F9F9F9; font-size:90%;" {{!}}
{{{2}}}
{{!}}} }}{{#if:{{{inline|}}}<noinclude>t</noinclude>|{{#var:header}}|{{LSL Injection Test}}}}{{#vardefine:fw-multiple|}}{{#vardefine:fw-title|}}}}

Template:Issues/SVC-6290

Original shared helper source (conditional wiki logic is not evaluated)
{{Issues|SVC-6290|[[llGetDisplayName]] periodically returns an empty string ({{String}})|type=bug}}

Template:LSL Function/avatar

Original shared helper source (conditional wiki logic is not evaluated)
{{LSL Injection Test}}<noinclude>{{Multi-lang|category=LSL}}</noinclude>{{#if:

{{#vardefine:p_{{{1|none}}}_desc|avatar {{#if:{{{group|}}}|or group}} {{HoverLink|UUID|Universally Unique Identifier}} {{#if:{{{sim|}}}{{{region|}}}|that is in the same [[region]] {{#ifeq:{{{sim|}}}{{{region|}}}|known|or is otherwise known to the region{{Footnote|handle=known}}}}}}}}

{{#vardefine:p_{{{1|none}}}_hover|avatar {{#if:{{{group|}}}|or group}} UUID {{#if:{{{sim|}}}{{{region|}}}|that is in the same region {{#ifeq:{{{sim|}}}{{{region|}}}|known|or is otherwise known to the region}}}}}}

<includeonly>
{{#if:{{{nc|}}}||{{#vardefine:hidden-text|{{#var:hidden-text}}
{{#if:{{#pos:{{#var:moded}}|r}}{{#pos:{{#var:moded}}|u}}||{{LSLC|Avatar/As A Parameter||{{#var:lang}}}}}}
}}}}
</includeonly>

}}<noinclude>
{| {{Prettytable}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|p_{{{1|none}}}_desc}}
|-
{{VarPair|p_{{{1|none}}}_hover}}
|}
</noinclude>
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.