OsResetEnvironment

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Add exemple)
Line 4: Line 4:
 
|delay=0
 
|delay=0
 
|function_syntax=integer osResetEnvironment(integer ParcelOrRegion, integer transition)
 
|function_syntax=integer osResetEnvironment(integer ParcelOrRegion, integer transition)
|ossl_example=<source lang="lsl">
 
 
</source>
 
 
|description= Resets parcel or region environment.<br>
 
|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.
 
* 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.
 
* transition should be the viewer transition time to the new one. May not work on most viewers.
 
if return is negative the operation failed.
 
if return is negative the operation failed.
 +
|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.");
 +
    }
 +
 +
    touch_start(integer number)
 +
    {
 +
        integer result;
 +
 
 +
        if (switch =! switch)
 +
        {
 +
            result = osResetEnvironment(switch, transition);
 +
        }
 +
 
 +
        else
 +
        {
 +
            result = osResetEnvironment(switch, transition);
 +
        }
 +
 
 +
        llSay(PUBLIC_CHANNEL, "transition: " + (string)transition);
 +
        llSay(PUBLIC_CHANNEL, "switch: " + (string)switch);
 +
        llSay(PUBLIC_CHANNEL, "result: " + (string)result);
 +
 
 +
        if (switch == 1 && result == 1)
 +
        {
 +
            llSay(PUBLIC_CHANNEL, "The parcel environment was removed with success.");
 +
        }
 +
 
 +
        else if (switch == 1 && result == -1)
 +
        {
 +
            llSay(PUBLIC_CHANNEL, "The parcel environment was removed without success.");
 +
        }
 +
 
 +
        else if (switch == 0 && result == 1)
 +
        {
 +
            llSay(PUBLIC_CHANNEL, "The region environment was set to the default with success.");
 +
        }
 +
 
 +
        else if (switch == 0 && result == -1)
 +
        {
 +
            llSay(PUBLIC_CHANNEL, "The region environment was set to the default without success.");
 +
        }
 +
    }
 +
}
 +
</source>
 
|additional_info=Added in 0.9.2
 
|additional_info=Added in 0.9.2
 
}}
 
}}

Revision as of 03:24, 28 November 2020

integer osResetEnvironment(integer ParcelOrRegion, integer transition)
Resets parcel or region environment.
  • 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.

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.");
    }
 
    touch_start(integer number)
    {
        integer result;
 
        if (switch =! switch)
        {
            result = osResetEnvironment(switch, transition);
        }
 
        else
        {
            result = osResetEnvironment(switch, transition);
        }
 
        llSay(PUBLIC_CHANNEL, "transition: " + (string)transition);
        llSay(PUBLIC_CHANNEL, "switch: " + (string)switch);
        llSay(PUBLIC_CHANNEL, "result: " + (string)result);
 
        if (switch == 1 && result == 1)
        {
            llSay(PUBLIC_CHANNEL, "The parcel environment was removed with success.");
        }
 
        else if (switch == 1 && result == -1)
        {
            llSay(PUBLIC_CHANNEL, "The parcel environment was removed without success.");
        }
 
        else if (switch == 0 && result == 1)
        {
            llSay(PUBLIC_CHANNEL, "The region environment was set to the default with success.");
        }
 
        else if (switch == 0 && result == -1)
        {
            llSay(PUBLIC_CHANNEL, "The region environment was set to the default without success.");
        }
    }
}
Notes
Added in 0.9.2


Personal tools
General
About This Wiki