OsGetTerrainHeight

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m
m (Added permissions and delay information)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
----
+
{{osslfunc
'''NOTE''' : This function replaces the deprecated [[OsTerrainGetHeight]] function.
+
|threat_level=ignored
----
+
|permissions=true
 
+
|delay=0
 
+
|function_syntax=float osGetTerrainHeight(integer x, integer y)
{|  width="100%" style="border: thin solid black"
+
|ossl_example=<source lang = "lsl">
| colspan="2" align="center" style=background:orange | '''{{SUBPAGENAME}}'''
+
// ----------------------------------------------------------------
|- valign="top"
+
// Example / Sample Script to show function use.
|'''Threat Level''' || None
+
//
 
+
// Script Title:    osSetTerrainHeight_osGetTerrainHeight.lsl
|- valign="top"
+
// Script Author:  WhiteStar Magic
|'''Function Syntax''' || <source lang="lsl">
+
// Threat Level:    High
osGetTerrainHeight(integer x, integer y);
+
// Script Source: 
 +
//
 +
// Notes: See Script Source reference for more detailed information
 +
// This sample is full opensource and available to use as you see fit and desire.
 +
// Threat Levels only apply to OSSL & AA Functions
 +
//
 +
// ================================================================
 +
// C# Source Line:     public LSL_Integer    osSetTerrainHeight(int x, int y, double val)
 +
// Inworld Script Line: osSetTerrainHeight(int X, int Y, float value);
 +
//
 +
// C# Source Line:      public LSL_Float    osGetTerrainHeight(int x, int y)
 +
// Inworld Script Line: osGetTerrainHeight(int x, int y);
 +
//
 +
// Example of osSetTerrainHeight & osGetTerrainHeight
 +
//
 +
integer touched = FALSE;
 +
integer iX = 128;
 +
integer iY = 128;
 +
float CurValue;
 +
//
 +
default
 +
{
 +
    state_entry()
 +
    {
 +
        llSay(0,"Touch to see osSetTerrainHeight & osGetTerrainHeight work.");
 +
        CurValue = osGetTerrainHeight(iX, iY);
 +
    }
 +
    touch_end(integer num)
 +
    {
 +
        if(touched)
 +
        {
 +
            touched = FALSE;
 +
            osSetTerrainHeight(iX, iY, CurValue);
 +
            llOwnerSay("osSetTerrainHeight @ coordinates X-["+(string)iX+"] Y-["+(string)iY+"] set to ["+(string)osGetTerrainHeight(iX, iY)+"]");
 +
        }
 +
        else
 +
        {
 +
            touched = TRUE;
 +
            float NewValue = CurValue + 4.5;
 +
            osSetTerrainHeight(iX, iY, NewValue);
 +
            llOwnerSay("osSetTerrainHeight @ coordinates X-["+(string)iX+"] Y-["+(string)iY+"] set to ["+(string)osGetTerrainHeight(iX, iY)+"]\nTouch to restore to Original Height");
 +
        }
 +
    }
 +
}
 
</source>
 
</source>
|- valign="top"
+
|description='''NOTE'''&nbsp;: This function replaces the deprecated [[OsTerrainGetHeight]] function.
|'''Example(s)||
+
|
 
+
}}
|}
+
 
+
[[Category:OSSL Functions]]
+
[[Category:OSSL_functions_without_example]]
+

Latest revision as of 18:03, 25 October 2017

float osGetTerrainHeight(integer x, integer y)
NOTE : This function replaces the deprecated OsTerrainGetHeight function.
Threat Level This function does not do a threat level check
Permissions Use of this function is always allowed by default
Extra Delay 0 seconds
Example(s)
// ----------------------------------------------------------------
// Example / Sample Script to show function use.
//
// Script Title:    osSetTerrainHeight_osGetTerrainHeight.lsl
// Script Author:   WhiteStar Magic
// Threat Level:    High
// Script Source:   
//
// Notes: See Script Source reference for more detailed information
// This sample is full opensource and available to use as you see fit and desire.
// Threat Levels only apply to OSSL & AA Functions
// 
// ================================================================
// C# Source Line:      public LSL_Integer    osSetTerrainHeight(int x, int y, double val)
// Inworld Script Line: osSetTerrainHeight(int X, int Y, float value); 
//
// C# Source Line:      public LSL_Float    osGetTerrainHeight(int x, int y)
// Inworld Script Line: osGetTerrainHeight(int x, int y);
//
// Example of osSetTerrainHeight & osGetTerrainHeight
//
integer touched = FALSE;
integer iX = 128;
integer iY = 128;
float CurValue;
//
default
{
    state_entry()
    {
        llSay(0,"Touch to see osSetTerrainHeight & osGetTerrainHeight work.");
        CurValue = osGetTerrainHeight(iX, iY);
    }
    touch_end(integer num)
    {
        if(touched)
        {
            touched = FALSE;
            osSetTerrainHeight(iX, iY, CurValue);
            llOwnerSay("osSetTerrainHeight @ coordinates X-["+(string)iX+"] Y-["+(string)iY+"] set to ["+(string)osGetTerrainHeight(iX, iY)+"]");
        }
        else
        {
            touched = TRUE;
            float NewValue = CurValue + 4.5;
            osSetTerrainHeight(iX, iY, NewValue);
            llOwnerSay("osSetTerrainHeight @ coordinates X-["+(string)iX+"] Y-["+(string)iY+"] set to ["+(string)osGetTerrainHeight(iX, iY)+"]\nTouch to restore to Original Height");
        }
    }
}


Personal tools
General
About This Wiki