OsReplaceParcelEnvironment
From OpenSimulator
(Difference between revisions)
m (Typo) |
|||
(10 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{osslfunc | {{osslfunc | ||
|threat_level=ignored | |threat_level=ignored | ||
− | |permissions= | + | |permissions= Prim owner must have rights to change parcel and parcel environment and region must allow parcel environments |
|delay=0 | |delay=0 | ||
|function_syntax=integer osReplaceParcelEnvironment(integer transition, string daycycle) | |function_syntax=integer osReplaceParcelEnvironment(integer transition, string daycycle) | ||
− | |||
− | |||
− | |||
− | |||
|description= Replaces parcel daycycle.<br> | |description= Replaces parcel daycycle.<br> | ||
* If parameter daycycle is NULL_KEY or "", parcel environment is removed, | * If parameter daycycle is NULL_KEY or "", parcel environment is removed, | ||
* daycycle can be a name of a daycycle asset on prim contents. If it is a UUID it can also be grid asset.<br> | * daycycle can be a name of a daycycle asset on prim contents. If it is a UUID it can also be grid asset.<br> | ||
− | |||
− | |||
* 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. | ||
+ | ''' The errors returned are: ''' | ||
+ | return 0 : Never 0 for now | ||
+ | return 1 : if daycycle applied with success | ||
+ | return -1 : if "Parcel Owners May Override Environment" isn't checked | ||
+ | (See menu "World/Region Details" on tab "Environment") | ||
+ | return -2 : if parcel not found (This is a bad thingy) | ||
+ | return -3 : if no rights to edit parcel | ||
+ | return -4 : if daycycle asset not found | ||
+ | return -5 : if fail to decode daycycle asset | ||
+ | |ossl_example=<source lang="lsl"> | ||
+ | // | ||
+ | // osReplaceParcelEnvironment Script Example | ||
+ | // Author: djphil | ||
+ | // | ||
− | | | + | // Can be daycycle's name in object's inventory or the daycycle uuid |
+ | string daycycle_a = "Daycycle_A"; | ||
+ | string daycycle_b = "Daycycle_B"; | ||
+ | integer transition = 3; | ||
+ | integer switch; | ||
+ | |||
+ | default | ||
+ | { | ||
+ | state_entry() | ||
+ | { | ||
+ | llSay(PUBLIC_CHANNEL, "Touch to see osReplaceParcelEnvironment usage."); | ||
+ | llSay(PUBLIC_CHANNEL, "Transition: " + (string)transition + " second(s)."); | ||
+ | } | ||
+ | |||
+ | touch_start(integer number) | ||
+ | { | ||
+ | integer result; | ||
+ | |||
+ | if (switch =! switch) | ||
+ | { | ||
+ | result = osReplaceParcelEnvironment(transition, daycycle_a); | ||
+ | llSay(PUBLIC_CHANNEL, "daycycle_a: " + daycycle_a); | ||
+ | } | ||
+ | |||
+ | else | ||
+ | { | ||
+ | result = osReplaceParcelEnvironment(transition, daycycle_b); | ||
+ | llSay(PUBLIC_CHANNEL, "daycycle_b: " + daycycle_b); | ||
+ | } | ||
+ | |||
+ | if (daycycle_a == "" || daycycle_a == NULL_KEY || daycycle_b == "" || daycycle_b == NULL_KEY) | ||
+ | { | ||
+ | llSay(PUBLIC_CHANNEL, "The environment of the parcel has been deleted"); | ||
+ | } | ||
+ | |||
+ | if (result > 0) | ||
+ | { | ||
+ | llSay(PUBLIC_CHANNEL, "The Parcel Environment was replaced with success."); | ||
+ | } | ||
+ | |||
+ | else if (result < 0) | ||
+ | { | ||
+ | llSay(PUBLIC_CHANNEL, "The Parcel Environment was replaced without success."); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
+ | '''With all errors message:''' | ||
+ | <source lang="lsl"> | ||
+ | // | ||
+ | // osReplaceParcelEnvironment Script Example | ||
+ | // Author: djphil | ||
+ | // | ||
+ | |||
+ | // Can be daycycle's name in object's inventory or the daycycle uuid | ||
+ | string daycycle_a = "Daycycle_A"; | ||
+ | string daycycle_b = "Daycycle_B"; | ||
+ | integer transition = 3; | ||
+ | integer switch; | ||
+ | |||
+ | default | ||
+ | { | ||
+ | state_entry() | ||
+ | { | ||
+ | llSay(PUBLIC_CHANNEL, "Touch to see osReplaceParcelEnvironment usage."); | ||
+ | llSay(PUBLIC_CHANNEL, "Transition: " + (string)transition + " second(s)."); | ||
+ | } | ||
+ | |||
+ | touch_start(integer number) | ||
+ | { | ||
+ | integer result; | ||
+ | |||
+ | if (switch =! switch) | ||
+ | { | ||
+ | result = osReplaceParcelEnvironment(transition, daycycle_a); | ||
+ | llSay(PUBLIC_CHANNEL, "daycycle_a: " + daycycle_a); | ||
+ | } | ||
+ | |||
+ | else | ||
+ | { | ||
+ | result = osReplaceParcelEnvironment(transition, daycycle_b); | ||
+ | llSay(PUBLIC_CHANNEL, "daycycle_b: " + daycycle_b); | ||
+ | } | ||
+ | |||
+ | if (daycycle_a == "" || daycycle_a == NULL_KEY || daycycle_b == "" || daycycle_b == NULL_KEY) | ||
+ | { | ||
+ | llSay(PUBLIC_CHANNEL, "The environment of the parcel has been deleted"); | ||
+ | } | ||
+ | |||
+ | if (result > 0) | ||
+ | { | ||
+ | llSay(PUBLIC_CHANNEL, "The Parcel Environment was replaced with success."); | ||
+ | } | ||
+ | |||
+ | else if (result < 0) | ||
+ | { | ||
+ | llSay(PUBLIC_CHANNEL, "The Parcel Environment was replaced without success."); | ||
+ | |||
+ | if (result == -1) | ||
+ | { | ||
+ | llSay(PUBLIC_CHANNEL, "The \"Parcel Owners May Override Environment\" isn't checked ..."); | ||
+ | llSay(PUBLIC_CHANNEL, "(See menu \"World/Region Details\" on tab \"Environment\")"); | ||
+ | } | ||
+ | |||
+ | if (result == -2) | ||
+ | { | ||
+ | llSay(PUBLIC_CHANNEL, "The parcel is not found (This is a bad thingy) ..."); | ||
+ | } | ||
+ | |||
+ | if (result == -3) | ||
+ | { | ||
+ | llSay(PUBLIC_CHANNEL, "You have no rights to edit parcel ..."); | ||
+ | } | ||
+ | |||
+ | if (result == -4) | ||
+ | { | ||
+ | llSay(PUBLIC_CHANNEL, "The daycycle asset is not found ..."); | ||
+ | } | ||
+ | |||
+ | if (result == -5) | ||
+ | { | ||
+ | llSay(PUBLIC_CHANNEL, "Fail to decode daycycle asset ..."); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
|additional_info=Added in 0.9.2 | |additional_info=Added in 0.9.2 | ||
}} | }} | ||
+ | == See Also == | ||
+ | * [[osReplaceAgentEnvironment]] | ||
+ | * [[osReplaceParcelEnvironment]] | ||
+ | * [[osReplaceRegionEnvironment]] | ||
+ | * [[osResetEnvironment]] |
Latest revision as of 12:22, 21 December 2020
integer osReplaceParcelEnvironment(integer transition, string daycycle)
| |
Replaces parcel daycycle.
The errors returned are: return 0 : Never 0 for now return 1 : if daycycle applied with success return -1 : if "Parcel Owners May Override Environment" isn't checked (See menu "World/Region Details" on tab "Environment") return -2 : if parcel not found (This is a bad thingy) return -3 : if no rights to edit parcel return -4 : if daycycle asset not found return -5 : if fail to decode daycycle asset | |
Threat Level | This function does not do a threat level check |
Permissions | Prim owner must have rights to change parcel and parcel environment and region must allow parcel environments |
Extra Delay | 0 seconds |
Example(s) | |
// // osReplaceParcelEnvironment Script Example // Author: djphil // // Can be daycycle's name in object's inventory or the daycycle uuid string daycycle_a = "Daycycle_A"; string daycycle_b = "Daycycle_B"; integer transition = 3; integer switch; default { state_entry() { llSay(PUBLIC_CHANNEL, "Touch to see osReplaceParcelEnvironment usage."); llSay(PUBLIC_CHANNEL, "Transition: " + (string)transition + " second(s)."); } touch_start(integer number) { integer result; if (switch =! switch) { result = osReplaceParcelEnvironment(transition, daycycle_a); llSay(PUBLIC_CHANNEL, "daycycle_a: " + daycycle_a); } else { result = osReplaceParcelEnvironment(transition, daycycle_b); llSay(PUBLIC_CHANNEL, "daycycle_b: " + daycycle_b); } if (daycycle_a == "" || daycycle_a == NULL_KEY || daycycle_b == "" || daycycle_b == NULL_KEY) { llSay(PUBLIC_CHANNEL, "The environment of the parcel has been deleted"); } if (result > 0) { llSay(PUBLIC_CHANNEL, "The Parcel Environment was replaced with success."); } else if (result < 0) { llSay(PUBLIC_CHANNEL, "The Parcel Environment was replaced without success."); } } } With all errors message: // // osReplaceParcelEnvironment Script Example // Author: djphil // // Can be daycycle's name in object's inventory or the daycycle uuid string daycycle_a = "Daycycle_A"; string daycycle_b = "Daycycle_B"; integer transition = 3; integer switch; default { state_entry() { llSay(PUBLIC_CHANNEL, "Touch to see osReplaceParcelEnvironment usage."); llSay(PUBLIC_CHANNEL, "Transition: " + (string)transition + " second(s)."); } touch_start(integer number) { integer result; if (switch =! switch) { result = osReplaceParcelEnvironment(transition, daycycle_a); llSay(PUBLIC_CHANNEL, "daycycle_a: " + daycycle_a); } else { result = osReplaceParcelEnvironment(transition, daycycle_b); llSay(PUBLIC_CHANNEL, "daycycle_b: " + daycycle_b); } if (daycycle_a == "" || daycycle_a == NULL_KEY || daycycle_b == "" || daycycle_b == NULL_KEY) { llSay(PUBLIC_CHANNEL, "The environment of the parcel has been deleted"); } if (result > 0) { llSay(PUBLIC_CHANNEL, "The Parcel Environment was replaced with success."); } else if (result < 0) { llSay(PUBLIC_CHANNEL, "The Parcel Environment was replaced without success."); if (result == -1) { llSay(PUBLIC_CHANNEL, "The \"Parcel Owners May Override Environment\" isn't checked ..."); llSay(PUBLIC_CHANNEL, "(See menu \"World/Region Details\" on tab \"Environment\")"); } if (result == -2) { llSay(PUBLIC_CHANNEL, "The parcel is not found (This is a bad thingy) ..."); } if (result == -3) { llSay(PUBLIC_CHANNEL, "You have no rights to edit parcel ..."); } if (result == -4) { llSay(PUBLIC_CHANNEL, "The daycycle asset is not found ..."); } if (result == -5) { llSay(PUBLIC_CHANNEL, "Fail to decode daycycle asset ..."); } } } } | |
Notes | |
Added in 0.9.2 |
[edit] See Also
- osReplaceAgentEnvironment
- osReplaceParcelEnvironment
- osReplaceRegionEnvironment
- osResetEnvironment