Jump to content
Rider Linden

LSL EEP Scripting Documentation

Recommended Posts

The LSL wiki has not yet been fully updated with the new functions.  I'm posting them here for reference. 

 


llReplaceAgentEnvironment

Override the entire environment applied to an agent.  

Function

Integer llReplaceAgentEnvironment(key agent_id, float transition, string environment)

 

The llReplaceAgentEnvironment function overrides the current region and parcel environment seen by an agent. The new environment persists until the agent crosses to a new region or this function is called with the NULL_KEY or empty string for the particular agent. This function must be executed as part of an experience. 

  • agent_id: The key for an agent in the region.  The agent must be in the region and must be participating in the experience. 
  • transition: The number of seconds over which to transition to the new settings.
  • env: The name of an environmental setting in the objects inventory or the asset ID for an environment.

Return Values

Value
Constant
Description
  1 The agent has been instructed to change their environment.
ENV_NOT_EXPERIENCE -1 The script is not running as part of an experience with a valid experience key.
ENV_NO_EXPERIENCE_PERMISSION -2 The agent has not granted permission.
ENV_NO_ENVIRONMENT -3 The environment inventory object could not be found.
ENV_INVALID_AGENT -4 Unable to find specified agent.

Caveats

  • The agent's viewer may choose to ignore this command.
  • An environment set locally on the viewer will override any environment set from this function
  • If a UUID is passed as the environment parameter and that UUID does not specify an environment setting, the viewer will quietly ignore the instruction.

 


llSetAgentEnvironment

 
Last modified Jan 16, 2019
 

Sets the environment values for an agent.  

Function

Integer llSetAgentEnvironment(key agent_id, float transition, list params)

 

This function sets environment values for an individual agent in an experience.  The changes to the environment persist until the agent moves to a new region or llSetAgentEnvironment is called for an agent with an empty list.

  • agent_id: The key for an agent in the region.  The agent must be in the region and must be participating in the experience. 
  • transition: The number of seconds over which to transition to the new settings.
  • params: A list of parameters to retrieve from the current environment. See table below for details.

If an unknown rule is encountered in the parameter list an error is emitted to the debug channel. 

Return Values

Value
Constant
Description
  1 The agent has been instructed to change their environment.
ENV_NOT_EXPERIENCE -1 The script is not running as part of an experience with a valid experience key.
ENV_NO_EXPERIENCE_PERMISSION -2 The agent has not granted permission.
ENV_INVALID_AGENT -4 Unable to find specified agent.
ENV_INVALID_RULE -5 There was an issue with one of the rules.

Caveats

Note.  The list of valid parameters differs from those available for llGetEnvironment.

Parameters

parameter return values description
SKY_CLOUDS 2 vector color, float coverage, float scale, float variance, vector scroll, vector density, vector detail

Environmental cloud information.

  • color: The color used for the clouds. 
  • coverage: The coverage percentage.
  • scale: The scaling applied to the cloud textures. 
  • variance: A randomizing factor applied to the main cloud layer
  • scroll: The scroll speed of the clouds. 
    X is east/west
    Y is north/south
    Z is unused
  • density: The X/Y and D parameter used to generate cloud density
  • detail: The X/Y and D parameter used to generate cloud details.
SKY_CLOUD_TEXTURE 19 string texture_ident Name of item in inventory or UUID for texture to be used for the clouds.
SKY_DOME 4 float offset, float radius, float max_altitude

Sky dome information.

  • offset
  • radius
  • maximum altitude
SKY_GAMMA 5 float gamma The gamma value applied to the scene.
SKY_GLOW 6 vector glow_colorfloat size, float focus Glow color applied to the sun and moon.
SKY_MOON 9 rotation rot, float scale, float brightness

Detailed moon information

  • rot: The current rotation applied to the moon.
  • scale: The current scale applied to the moon's texture
  • brightness: The moon's brightness
SKY_MOON_TEXTURE 20 string texture_ident Name of texture in inventory or UUID for texture to be used for the moon.
SKY_STAR_BRIGHTNESS 13 float brightness  
SKY_SUN 14 rotation rot, float scale, vector sun_color

Detailed sun information

  • rot: The current rotation applied to the sun.
  • scale: The current scale applied to the sun's texture
  • sun_color: 
SKY_SUN_TEXTURE 21 string texture_ident Name of texture in inventory or UUID for texture to be used for the sun.
SKY_PLANET 10 float planet_radius, float sky_bottom_radius, float sky_top_radius

Planet information used in rendering the sky

  • planet_radius
  • sky_bottom_radius
  • sky_top_radius
SKY_REFRACTION 11 float moisture_level, float droplet_radius, float ice_level

Sky refraction parameters for rainbows and optical effects. 

  • moisture_level
  • droplet_radius
  • ice_level
WATER_BLUR_MULTIPLIER 100 float multiplier Multiplier applied to blur the scene when under water.
WATER_FOG 101 vector color, float density, fload modulation

Fog parameters applied when underwater

  • color: The color of the underwater fog
  • density: Density exponent applied to the fog
  • modulation: 
WATER_FRESNEL 102 float offset, float scale

Fresnel scattering applied to the surface of the water.

  • offset
  • scale
WATER_NORMAL_TEXTURE 107 string texture_ident Name of texture in inventory or UUID of texture to be used for the water normal.
WATER_NORMAL_SCALE 104 vector scale Scaling applied to the water normal map.
WATER_REFRACTION 105 float scale_above, float scale_below

Refraction factors when looking through the surface of the water.

  • scale_above
  • scale_below
WATER_WAVE_DIRECTION 106 vector large_wave, vector small_wave

Vector for the directions of the waves  Y represents north/south and X represents movement east/west.

  • large_wave: Large wave speed and direction.
  • small_wave: Small wave speed and direction.

 


llGetEnvironment

 
Last modified Jan 16, 2019
 

Retrieves the current environmental settings for a region or parcel in the specified layer. 

Function

list llGetEnvironment(vector pos, list params)

 

These functions return the current environment values for the parcel and the region as a list of attributes. They take a list of attributes to retrieve in params and returns them in the order requested.

  • pos: A position in region coordinates. X and Y are in region coordinates and determine the parcel.  If X and Y are both -1 the environment for the entire region is inspected.  Z is the altitude in the region and determines which sky track is accessed. 
  • params: A list of parameters to retrieve from the current environment. See table below for details.

If an unknown rule is encountered in the parameter list an error is emitted to the debug channel. 

Caveats

  • If the script can not run in the requested parcel this function returns an empty list and issues a warning in the debug channel.

 

Parameters

parameter return values description
SKY_TRACKS 15 float sky2, float sky3, float sky4 Altitudes for sky transitions in the region.
SKY_AMBIENT 0 vector ambient_color The ambient color of the environment
SKY_TEXTURE_DEFAULTS 1 Integer bloom_is_default, integer halo_is_default, integer rainbow_is_default Checks if the textures are currently set to use the default. For default values the returned integer is 1, if the texture uses something other than the default this value is 0.
SKY_CLOUDS 2 vector color, float coverage, float scale, float variance, vector scroll, vector density, vector detail, integer is_default

Environmental cloud information.

  • color: The color used for the clouds. 
  • coverage: The coverage percentage.
  • scale: The scaling applied to the cloud textures. 
  • variance: A randomizing factor applied to the main cloud layer
  • scroll: The scroll speed of the clouds. 
    X is east/west
    Y is north/south
    Z is unused
  • density: The X/Y and D parameter used to generate cloud density
  • detail: The X/Y and D parameter used to generate cloud details.
  • is_default: 1 if the clouds are using the default texture.
SKY_DOME 4 float offset, float radius, float max_altitude

Sky dome information.

  • offset
  • radius
  • maximum altitude
SKY_GAMMA 5 float gamma The gamma value applied to the scene.
SKY_GLOW 6 vector glow_colorfloat size, float focus Glow color applied to the sun and moon.
SKY_MOON 9 rotation rot, float scale, float brightness, integer is_default_texture, vector direction, vector ambient_color, vector diffuse_color

Detailed moon information

  • rot: The current rotation applied to the moon.
  • scale: The current scale applied to the moon's texture
  • brightness: The moon's brightness
  • is_default_texture: 1 if the moon texture is set to the default. 0 otherwise
  • direction: A unit vector pointing at the moon.
  • ambient_color: The ambient color of the moon
  • diffuse_color: The diffuse color applied to the moon.
SKY_STAR_BRIGHTNESS 13 float brightness  
SKY_SUN 14 rotation rot, float scale, vector sun_color, integer is_default_texture, vector direction, vector ambient_color, vector diffuse_color

Detailed sun information

  • rot: The current rotation applied to the sun.
  • scale: The current scale applied to the sun's texture
  • sun_color: 
  • is_default_texture: 1 if the moon texture is set to the default. 0 otherwise
  • direction: A unit vector pointing at the moon.
  • ambient_color: The ambient color of the moon
  • diffuse_color: The diffuse color applied to the moon.
SKY_PLANET 10 float planet_radius, float sky_bottom_radius, float sky_top_radius

Planet information used in rendering the sky

  • planet_radius
  • sky_bottom_radius
  • sky_top_radius
SKY_REFRACTION 11 float moisture_level, float droplet_radius, float ice_level

Sky refraction parameters for rainbows and optical effects. 

  • moisture_level
  • droplet_radius
  • ice_level
SKY_LIGHT 8 vector light_direction, vector fade_color, vector total_ambient

Miscellaneous lighting values

  • light_direction: unit vector indicating the direction of the dominant light source. 
WATER_BLUR_MULTIPLIER 100 float multiplier Multiplier applied to blur the scene when under water.
WATER_FOG 101 vector color, float density, float modulation

Fog parameters applied when underwater

  • color: The color of the underwater fog
  • density: Density exponent applied to the fog
  • modulation: 
WATER_FRESNEL 102 float offset, float scale

Fresnel scattering applied to the surface of the water.

  • offset
  • scale
WATER_TEXTURE_DEFAULTS 103 integer normal_is_default, integer transparent_is_default Checks if the textures are currently set to use the default. For default values the returned integer is 1, if the texture uses something other than the default this value is 0.
WATER_NORMAL_SCALE 104 vector scale Scaling applied to the water normal map.
WATER_REFRACTION 105 float scale_above, float scale_below

Refraction factors when looking through the surface of the water.

  • scale_above
  • scale_below
WATER_WAVE_DIRECTION 106 vector large_wave, vector small_wave

Vector for the directions of the waves  Y represents north/south and X represents movement east/west.

  • large_wave: Large wave speed and direction.
  • small_wave: Small wave speed and direction.

 

 


llGetSunDirection/llGetRegionSunDirection

Returns a normalized vector to the current sun position at the location of object containing the script.  llGetSunDirection is the vector to the parcel's sun, llGetRegionSunDirection is the vector to region's sun. If there is no custom environment set for the current parcel llGetSunDirection returns the direction to the region's sun. These functions are altitude aware.

Function

vector llGetSunDirection()
vector llGetRegionSunDirection()

See Also

  • llGetMoonDirection/llGetRegionMoonDirection
  • llGetSunRotation/llGetRegionSunRotation
  • llGetMoonRotation/llGetRegionMoonRotation
  • llGetDayLength/llGetRegionDayLength
  • llGetDayOffset//llGetRegionDayOffset

 


llGetMoonDirection/llGetRegionMoonDirection

Returns a normalized vector to the current moon position at the location of object containing the script.  llGetMoonDirection is the vector to the parcel's moon, llGetRegionSunDirection is the vector to region's moon. If there is no custom environment set for the current parcel llGetMoonDirection returns the direction to the region's moon. These functions are altitude aware.

Function

vector llGetMoonDirection()
vector llGetRegionMoonDirection()

See Also

  • llGetSunDirection/llGetRegionSunDirection
  • llGetSunRotation/llGetRegionSunRotation
  • llGetMoonRotation/llGetRegionMoonRotation
  • llGetDayLength/llGetRegionDayLength
  • llGetDayOffset//llGetRegionDayOffset

 


llGetSunRotation/llGetRegionSunRotation

Return the rotation applied to the sun for the parcel or region at the location of the object containing the script.  These function are altitude aware and so will pick up the sun for their current track. llGetRegionSunRotation returns the rotation applied at the region level, llGetSunRoation does the same for the parcel.  If there is no custom environment applied to parcel llGetSunRotation returns the same value as llGetRegionSunRotation.

Function

rotation llGetSunRotation()
rotation llGetRegionSunRotation()

See Also

  • llGetSunDirection/llGetRegionSunDirection
  • llGetMoonDirection/llGetRegionMoonDirection
  • llGetMoonRotation/llGetRegionMoonRotation
  • llGetDayLength/llGetRegionDayLength
  • llGetDayOffset//llGetRegionDayOffset

 


llGetMoonRotation/llGetRegionMoonRotation

Return the rotation applied to the moon for the parcel or region at the location of the object containing the script.  These function are altitude aware and so will pick up the moon for their current track. llGetRegionMoonRotation returns the rotation applied at the region level, llGetMoonRoation does the same for the parcel.  If there is no custom environment applied to parcel llGetMoonRotation returns the same value as llGetRegionMoonRotation.

Function

rotation llGetMoonRotation()
rotation llGetRegionMoonRotation()

See Also

  • llGetSunDirection/llGetRegionSunDirection
  • llGetMoonDirection/llGetRegionMoonDirection
  • llGetSunRotation/llGetRegionSunRotation
  • llGetDayLength/llGetRegionDayLength
  • llGetDayOffset//llGetRegionDayOffset

 


llGetDayLength/llGetRegionDayLength

Return the number of seconds in the day cycle applied to the current parcel and region. llGetDayLength returns the number of seconds for the current parcel, llGetRegionDay length is the number of seconds in the day cycle applied to the entire region.

Function

integer llGetDayLength()
integer llGetRegionDayLength()

See Also

  • llGetSunDirection/llGetRegionSunDirection
  • llGetMoonDirection/llGetRegionMoonDirection
  • llGetSunRotation/llGetRegionSunRotation
  • llGetDayLength/llGetRegionDayLength
  • llGetDayOffset//llGetRegionDayOffset

 


llGetDayOffset/llGetRegionDayOffset

Return the number of seconds added to the current time before calculating the current environmental time for the parcel or the region.  llGetDayOffset returns the value for the current parcel, llGetRegionDayOffset produces the same value for the entire region.

Function

integer llGetDayOffset()
integer llGetRegionDayOffset()

See Also

  • llGetSunDirection/llGetRegionSunDirection
  • llGetMoonDirection/llGetRegionMoonDirection
  • llGetSunRotation/llGetRegionSunRotation
  • llGetDayLength/llGetRegionDayLength
  • llGetDayLength/llGetRegionDayLength

 


llGetTimeOfDay/llGetRegionTimeOfDay

 
Nov 08, 2018
 

Gets the number of seconds, with sub-second precision, since environmental midnight.  llGetTimeOfDay returns this value for the current parcel, llGetRegionTimeOfDay returns the seconds since midnight for the entire region.

Function

float llGetTimeOfDay()
float llGetRegionTimeOfDay( )

 

Caveats

This function previously assumed a 4 hour day.  Day length is now configurable for regions and parcels. 

Edited by Rider Linden
  • Like 1
  • Thanks 2

Share this post


Link to post
Share on other sites

Just noticed that both in the OP and in the wiki, the description for the SKY_SUN parameter for llGetEnvironment refers to "moon" rather than "sun" in the last four bulleted items.

Share this post


Link to post
Share on other sites
On 3/23/2019 at 5:29 PM, KT Kingsley said:

Just noticed that both in the OP and in the wiki, the description for the SKY_SUN parameter for llGetEnvironment refers to "moon" rather than "sun" in the last four bulleted items.

Thank you KT.  I've fixed the documentation. 

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...