Skip to content
lsl.devlsl.devLSL Dev

LlSetAlpha

Looking for the current API? Open the llSetAlpha reference →

Wiki description

Sets the Blinn-Phong alpha on face

Caveats

  • llSetAlpha will have no visible effect on faces with a PBR material. To work on faces both with and without a PBR material, use one of these snippets:
    • invisible
      if (llIsLinkGLTFMaterial(LINK_THIS, ALL_SIDES)) {
          llSetLinkGLTFOverrides(LINK_THIS, ALL_SIDES, [OVERRIDE_GLTF_BASE_ALPHA_MODE, PRIM_GLTF_ALPHA_MODE_BLEND, OVERRIDE_GLTF_BASE_ALPHA, 0.0]);
      } else {
          llSetAlpha(0.0, ALL_SIDES);
      }
    • visible
      if (llIsLinkGLTFMaterial(LINK_THIS, ALL_SIDES)) {
          llSetLinkGLTFOverrides(LINK_THIS, ALL_SIDES, [OVERRIDE_GLTF_BASE_ALPHA_MODE, "", OVERRIDE_GLTF_BASE_ALPHA, ""]);
      } else {
          llSetAlpha(1.0, ALL_SIDES);
      }

Examples

float cloakSpeed = 0.1;

default
{
    touch_end(integer total_number)
    {
        float alpha = 1.0;
        while(alpha > 0.0)
        {
            alpha -= 0.1;
            llSetAlpha(alpha, ALL_SIDES);
            llSleep(cloakSpeed);
        }
        state cloaked;
    }
}

state cloaked
{
    touch_end(integer total_number)
    {
        float alpha;
        while (alpha < 1.0)
        {
            alpha += 0.1;
            llSetAlpha(alpha, ALL_SIDES);
            llSleep(cloakSpeed);
        }
        state default;
    }
}

Notes

In practical terms, "alpha" means "transparency" or "visibility".
To be clear, llSetAlpha will only affect the prim that the script it is in. It will not affect any linked prims. To set the alpha state for those, use llSetLinkAlpha

See also: functions

See also: events

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/face

Original shared helper source (conditional wiki logic is not evaluated)
{{LSL Injection Test}}{{#if:

{{#vardefine:header|{{#var:header}}{{#if:{{{nc|}}}{{#pos:{{#var:moded}}|r}}||{{#switch:{{NAMESPACE}}|Template=|User=|[[Category:LSL Face{{#var:lang}}]][[Category:LSL Face{{#var:lang}}/{{#if:{{{return|}}}{{{returns|}}}|Get|Set}}]]}}}}}}

{{#vardefine:ALL_SIDES|{{LSL Const|ALL_SIDES|integer|-1|hex=0xFFFFFFFF}}}}

{{#vardefine:p_{{{1|none}}}_desc|{{LSLGC|Face{{#var:lang}}|face}} number{{#ifeq:{{{notall|}}}|*||<nowiki> </nowiki>or {{#var:ALL_SIDES}}}}}}

{{#vardefine:p_{{{1|none}}}_hover|face number{{#ifeq:{{{notall|}}}|*||<nowiki> </nowiki>or ALL_SIDES (-1)}}}}

{{#ifeq:{{{notall|}}}|*||{{#vardefine:facechoise|If {{LSLP|{{{1|none}}}}} is {{#var:ALL_SIDES}} then the {{#if:{{{2|}}}|{{{2|}}}|function}} {{#if:{{{get|}}}|{{{get|}}}|{{#if:{{{ALL_SIDES|}}}|{{{ALL_SIDES|}}}|works on all sides.}}}}}}}}

{{#vardefine:header_footnote|{{#var:header_footnote}}{{#if:{{{!footer|}}}||{{PBR}}
{{#var:facechoise}}{{PBR}}}}}}

{{#vardefine:caveats|{{#var:caveats}}{{#if:{{{!footer|}}}|
*{{#var:facechoise}}|}}{{#if:{{{return|}}}{{{returns|}}}|
*If {{LSLP|{{{1|none}}}}} indicates a face that does not exist the {{#if:{{{2|}}}|{{{2|}}}}} {{#if:{{{return|}}}|return is {{{return|}}}| returns {{{returns|}}}}}|
*The {{#if:{{{2|}}}|{{{2|}}}|function}} silently fails if its {{LSLP|{{{1|none}}}}} value indicates a face that does not exist.}}}}

}}<noinclude>
{| {{Prettytable}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|ALL_SIDES}}
|-
{{VarPair|p_{{{1|none}}}_desc}}
|-
{{VarPair|p_{{{1|none}}}_hover}}
|-
{{VarPair|facechoise}}
|-
{{VarPair|header_footnote}}
|-
{{VarPair|caveats}}
|}
</noinclude>

Template:LSL Function/alpha

Original shared helper source (conditional wiki logic is not evaluated)
{{LSL Injection Test}}{{#if:

{{#vardefine:p_{{{1|none}}}_hover|from 0.0 (clear) to 1.0 (solid) (0.0 &lt;{{=}} {{{1|none}}} &lt;{{=}} 1.0)}}
{{#vardefine:p_{{{1|none}}}_desc|from 0.0 (clear) to 1.0 (solid) (0.0 &lt;{{=}} {{LSLP|{{{1|none}}}}} &lt;{{=}} 1.0)}}

{{#vardefine:also_articles|{{#var:also_articles}}
{{LSL DefineRow||{{LSLGC|Alpha|Translucent Color}} {{#switch:{{#if:{{{nc|}}}|Template|{{NAMESPACE}}}}|Template=|User=|{{LSLC|Alpha}}}}}}}}

}}<noinclude>
{| {{Prettytable}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|p_{{{1|none}}}_desc}}
|-
{{VarPair|p_{{{1|none}}}_hover}}
|-
{{VarPairTable|also_articles}}
|}
</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.