llSetAgentEnvironment
Requires Experience
integer llSetAgentEnvironment(key agent_id, float transition, list Settings)Sets an agent's environmental values to the specified values. Must be used as part of an experience.
Parameters
-
agent_id(key) - Agent to receive new environment settings.
-
transition(float) - Number of seconds over which to apply new settings.
-
Settings(list) - List of environment settings to replace for agent.
float gTransitionTime = 3.0;list gListEnvironmentParams = [ SKY_CLOUD_TEXTURE, TEXTURE_PLYWOOD, SKY_GAMMA, 10.0, WATER_NORMAL_SCALE, <5.0, 5.0, 5.0>];
default{ touch_start(integer total_number) { key person = llDetectedKey(0); if (llGetAgentSize(person) != ZERO_VECTOR) { llRequestExperiencePermissions(person, ""); } else { llInstantMessage(person, "You need to be in the same region to change environment"); } }
experience_permissions(key agent_id) { integer envTest = llSetAgentEnvironment(agent_id, gTransitionTime, gListEnvironmentParams); if (envTest == 1) { llRegionSayTo(agent_id, 0, "Applying environment for " + (string)agent_id); } else { llRegionSayTo(agent_id, 0, "Cannot apply environment for " + (string)agent_id + " due to reason id: " + (string)envTest); } }
experience_permissions_denied(key agent_id, integer reason) { llRegionSayTo(agent_id, 0, "Denied experience permissions for " + (string)agent_id + " due to reason id: " + (string)reason); }}Caveats
Section titled “Caveats”- The list of valid parameters differs from those available for llGetEnvironment
- 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
Return Values
Section titled “Return Values”The function returns an integer indicating the result:
1- The agent has been instructed to change their environmentENV_NOT_EXPERIENCE(-1) - The script is not running as part of an experience with a valid experience keyENV_NO_EXPERIENCE_PERMISSION(-2) - The agent has not granted permissionENV_NO_ENVIRONMENT(-3) - The environment inventory object could not be foundENV_INVALID_AGENT(-4) - Unable to find specified agentENV_INVALID_RULE(-5) - There was an issue with one of the rulesENV_VALIDATION_FAIL(-6) - Unable to validate values passedENV_NO_EXPERIENCE_LAND(-7) - The experience has not been enabled or cannot run on the landENV_THROTTLE(-8) - The scripts have exceeded the throttle; wait and retry the request