OsResetEnvironment
From OpenSimulator
(Difference between revisions)
(Created page with "{{osslfunc |threat_level=ignored |permissions=Prim owner must have estate manager rights or parcel and parcel environment change rights |delay=0 |function_syntax=integer osRes...") |
(Adding second exemple) |
||
| (7 intermediate revisions by 2 users not shown) | |||
| Line 4: | Line 4: | ||
|delay=0 | |delay=0 | ||
|function_syntax=integer osResetEnvironment(integer ParcelOrRegion, integer transition) | |function_syntax=integer osResetEnvironment(integer ParcelOrRegion, integer transition) | ||
| + | |description= Resets parcel or region environment.<br> | ||
| + | * if ParcelOrRegion == 1 parcel environment is removed, region will be used, else region environment is set to the default. | ||
| + | * transition should be the viewer transition time to the new one. May not work on most viewers. | ||
| + | * if return is negative the operation failed. | ||
| + | ''' The errors returned on region are: ''' | ||
| + | return 0 : never 0 for now | ||
| + | return 1 : if daycycle applied with success | ||
| + | return -1 : never -1, it is on parcel only | ||
| + | return -2 : never -2, it is on parcel only | ||
| + | return -3 : if no rights to edit region | ||
| + | ''' The errors returned on parcel 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 | ||
|ossl_example=<source lang="lsl"> | |ossl_example=<source lang="lsl"> | ||
| + | // | ||
| + | // osResetEnvironment Script Example | ||
| + | // Author: djphil | ||
| + | // | ||
| + | integer transition = 3; | ||
| + | integer switch; | ||
| + | |||
| + | default | ||
| + | { | ||
| + | state_entry() | ||
| + | { | ||
| + | llSay(PUBLIC_CHANNEL, "Touch to see osResetEnvironment usage."); | ||
| + | llSay(PUBLIC_CHANNEL, "Transition: " + (string)transition + " second(s)."); | ||
| + | } | ||
| + | |||
| + | touch_start(integer number) | ||
| + | { | ||
| + | integer result; | ||
| + | |||
| + | if (switch = !switch) | ||
| + | { | ||
| + | result = osResetEnvironment(switch, transition); | ||
| + | } | ||
| + | |||
| + | else | ||
| + | { | ||
| + | result = osResetEnvironment(switch, transition); | ||
| + | } | ||
| + | |||
| + | if (switch == 1 && result > 0) | ||
| + | { | ||
| + | llSay(PUBLIC_CHANNEL, "The parcel environment was removed with success."); | ||
| + | llSay(PUBLIC_CHANNEL, "The region environment is now used."); | ||
| + | } | ||
| + | |||
| + | else if (switch == 1 && result < 0) | ||
| + | { | ||
| + | llSay(PUBLIC_CHANNEL, "The parcel environment was removed without success."); | ||
| + | } | ||
| + | |||
| + | else if (switch == 0 && result > 0) | ||
| + | { | ||
| + | llSay(PUBLIC_CHANNEL, "The region environment was set to the default with success."); | ||
| + | } | ||
| + | |||
| + | else if (switch == 0 && result < 0) | ||
| + | { | ||
| + | llSay(PUBLIC_CHANNEL, "The region environment was set to the default without success."); | ||
| + | } | ||
| + | } | ||
| + | } | ||
</source> | </source> | ||
| − | + | '''With all errors message:''' | |
| − | + | <source lang="lsl"> | |
| − | + | // | |
| + | // osResetEnvironment Script Example | ||
| + | // Author: djphil | ||
| + | // | ||
| + | |||
| + | integer transition = 3; | ||
| + | integer switch; | ||
| + | |||
| + | default | ||
| + | { | ||
| + | state_entry() | ||
| + | { | ||
| + | llSay(PUBLIC_CHANNEL, "Touch to see osResetEnvironment usage."); | ||
| + | llSay(PUBLIC_CHANNEL, "Transition: " + (string)transition + " second(s)."); | ||
| + | } | ||
| + | |||
| + | touch_start(integer number) | ||
| + | { | ||
| + | integer result; | ||
| + | |||
| + | if (switch = !switch) | ||
| + | { | ||
| + | result = osResetEnvironment(switch, transition); | ||
| + | } | ||
| + | |||
| + | else | ||
| + | { | ||
| + | result = osResetEnvironment(switch, transition); | ||
| + | } | ||
| + | |||
| + | if (switch == 1 && result > 0) | ||
| + | { | ||
| + | llSay(PUBLIC_CHANNEL, "The parcel environment was removed with success."); | ||
| + | llSay(PUBLIC_CHANNEL, "The region environment is now used."); | ||
| + | } | ||
| + | |||
| + | else if (switch == 1 && result < 0) | ||
| + | { | ||
| + | llSay(PUBLIC_CHANNEL, "The parcel environment was removed 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 ..."); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | else if (switch == 0 && result > 0) | ||
| + | { | ||
| + | llSay(PUBLIC_CHANNEL, "The region environment was set to the default with success."); | ||
| + | } | ||
| + | |||
| + | else if (switch == 0 && result < 0) | ||
| + | { | ||
| + | llSay(PUBLIC_CHANNEL, "The region environment was set to the default without success."); | ||
| + | |||
| + | if (result == -3) | ||
| + | { | ||
| + | llSay(PUBLIC_CHANNEL, "You have no rights to edit region ..."); | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </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:25, 21 December 2020
integer osResetEnvironment(integer ParcelOrRegion, integer transition)
| |
Resets parcel or region environment.
The errors returned on region are: return 0 : never 0 for now return 1 : if daycycle applied with success return -1 : never -1, it is on parcel only return -2 : never -2, it is on parcel only return -3 : if no rights to edit region The errors returned on parcel 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
| |
| Threat Level | This function does not do a threat level check |
| Permissions | Prim owner must have estate manager rights or parcel and parcel environment change rights |
| Extra Delay | 0 seconds |
| Example(s) | |
// // osResetEnvironment Script Example // Author: djphil // integer transition = 3; integer switch; default { state_entry() { llSay(PUBLIC_CHANNEL, "Touch to see osResetEnvironment usage."); llSay(PUBLIC_CHANNEL, "Transition: " + (string)transition + " second(s)."); } touch_start(integer number) { integer result; if (switch = !switch) { result = osResetEnvironment(switch, transition); } else { result = osResetEnvironment(switch, transition); } if (switch == 1 && result > 0) { llSay(PUBLIC_CHANNEL, "The parcel environment was removed with success."); llSay(PUBLIC_CHANNEL, "The region environment is now used."); } else if (switch == 1 && result < 0) { llSay(PUBLIC_CHANNEL, "The parcel environment was removed without success."); } else if (switch == 0 && result > 0) { llSay(PUBLIC_CHANNEL, "The region environment was set to the default with success."); } else if (switch == 0 && result < 0) { llSay(PUBLIC_CHANNEL, "The region environment was set to the default without success."); } } } With all errors message: // // osResetEnvironment Script Example // Author: djphil // integer transition = 3; integer switch; default { state_entry() { llSay(PUBLIC_CHANNEL, "Touch to see osResetEnvironment usage."); llSay(PUBLIC_CHANNEL, "Transition: " + (string)transition + " second(s)."); } touch_start(integer number) { integer result; if (switch = !switch) { result = osResetEnvironment(switch, transition); } else { result = osResetEnvironment(switch, transition); } if (switch == 1 && result > 0) { llSay(PUBLIC_CHANNEL, "The parcel environment was removed with success."); llSay(PUBLIC_CHANNEL, "The region environment is now used."); } else if (switch == 1 && result < 0) { llSay(PUBLIC_CHANNEL, "The parcel environment was removed 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 ..."); } } else if (switch == 0 && result > 0) { llSay(PUBLIC_CHANNEL, "The region environment was set to the default with success."); } else if (switch == 0 && result < 0) { llSay(PUBLIC_CHANNEL, "The region environment was set to the default without success."); if (result == -3) { llSay(PUBLIC_CHANNEL, "You have no rights to edit region ..."); } } } } | |
| Notes | |
| Added in 0.9.2 | |
[edit] See Also
- osReplaceAgentEnvironment
- osReplaceParcelEnvironment
- osReplaceRegionEnvironment
- osResetEnvironment