OsReplaceAgentEnvironment
From OpenSimulator
(Difference between revisions)
(Add exemple) |
|||
| Line 4: | Line 4: | ||
|delay=0 | |delay=0 | ||
|function_syntax=integer osReplaceAgentEnvironment(key agentKey, integer transition, string daycycle) | |function_syntax=integer osReplaceAgentEnvironment(key agentKey, integer transition, string daycycle) | ||
| − | |||
| − | |||
| − | |||
| − | |||
|description= Forces a dayclycle on a agent. Will do nothing if the agent is using a viewer local environment<br> | |description= Forces a dayclycle on a agent. Will do nothing if the agent is using a viewer local environment<br> | ||
* If parameter daycycle is NULL_KEY or "", agent will see normal environment for parcel or region, | * If parameter daycycle is NULL_KEY or "", agent will see normal environment for parcel or region, | ||
| Line 13: | Line 9: | ||
* if return value is negative, it failed. | * if return value is negative, it failed. | ||
* transition should be the viewer transition time to the new one. May not work on most viewers. | * transition should be the viewer transition time to the new one. May not work on most viewers. | ||
| + | |ossl_example=<source lang="lsl"> | ||
| + | // | ||
| + | // osReplaceAgentEnvironment Script Example | ||
| + | // | ||
| − | + | // Can be asset's name in object's inventory or the asset uuid | |
| − | |additional_info= | + | string daycycle = "A-12AM"; |
| + | integer transition = 3; | ||
| + | |||
| + | default | ||
| + | { | ||
| + | state_entry() | ||
| + | { | ||
| + | llSay(PUBLIC_CHANNEL, "Touch to see osReplaceAgentEnvironment usage."); | ||
| + | } | ||
| + | |||
| + | touch_start(integer number) | ||
| + | { | ||
| + | key agentKey = llDetectedKey(0); | ||
| + | |||
| + | if (llGetAgentSize(agentKey) != ZERO_VECTOR) | ||
| + | { | ||
| + | integer result = osReplaceAgentEnvironment(agentKey, transition, daycycle); | ||
| + | |||
| + | if (result == 1) | ||
| + | { | ||
| + | llRegionSayTo(agentKey, PUBLIC_CHANNEL, "Applying environment for " + osKey2Name(agentKey)); | ||
| + | } | ||
| + | |||
| + | else | ||
| + | { | ||
| + | llRegionSayTo(agentKey, PUBLIC_CHANNEL, "Cannot apply environment for " + osKey2Name(agentKey) + " due to reason id : " + (string)result); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | else | ||
| + | { | ||
| + | llRegionSayTo(agentKey, PUBLIC_CHANNEL, "You need to be in the same region to change environment."); | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </source> | ||
| + | |additional_info=This function was added in 0.9.2 | ||
}} | }} | ||
Revision as of 15:35, 24 November 2020
integer osReplaceAgentEnvironment(key agentKey, integer transition, string daycycle)
| |
Forces a dayclycle on a agent. Will do nothing if the agent is using a viewer local environment
| |
| Threat Level | Moderate |
| Permissions | ${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER |
| Extra Delay | 0 seconds |
| Example(s) | |
// // osReplaceAgentEnvironment Script Example // // Can be asset's name in object's inventory or the asset uuid string daycycle = "A-12AM"; integer transition = 3; default { state_entry() { llSay(PUBLIC_CHANNEL, "Touch to see osReplaceAgentEnvironment usage."); } touch_start(integer number) { key agentKey = llDetectedKey(0); if (llGetAgentSize(agentKey) != ZERO_VECTOR) { integer result = osReplaceAgentEnvironment(agentKey, transition, daycycle); if (result == 1) { llRegionSayTo(agentKey, PUBLIC_CHANNEL, "Applying environment for " + osKey2Name(agentKey)); } else { llRegionSayTo(agentKey, PUBLIC_CHANNEL, "Cannot apply environment for " + osKey2Name(agentKey) + " due to reason id : " + (string)result); } } else { llRegionSayTo(agentKey, PUBLIC_CHANNEL, "You need to be in the same region to change environment."); } } } | |
| Notes | |
| This function was added in 0.9.2 | |