OsGetPhysicsEngineType

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Change threat level to what the code says it is: "high")
(Replace script)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{osslfunc
 
{{osslfunc
 
|threat_level=High
 
|threat_level=High
 +
|permissions=true
 +
|delay=0
 
|function_syntax=string osGetPhysicsEngineType()
 
|function_syntax=string osGetPhysicsEngineType()
 +
|description=This function returns a string containing the name of the Physics Engine.
 
|ossl_example=<source lang = "lsl">
 
|ossl_example=<source lang = "lsl">
// ----------------------------------------------------------------
 
// Example / Sample Script to show function use.
 
 
//
 
//
// Script Title:    osGetPhysicsEngineType.lsl
+
// osGetPhysicsEngineType Script Example
// Script Author:  
+
// Author: djphil
// Threat Level:    High
+
// Script Source:  http://opensimulator.org/wiki/OsGetPhysicsEngineType
+
//
+
// 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
+
// See http://opensimulator.org/wiki/Threat_level
+
// ================================================================
+
// Inworld Script Line:    string osGetPhysicsEngineType();
+
//
+
// Example of osGetPhysicsEngineType()
+
 
//
 
//
 +
 
default
 
default
 
{
 
{
     state_entry() // display @ start
+
     state_entry()
 
     {
 
     {
         llSay(0, "Touch me to get the physics engine type using osGetPhysicsEngineType");
+
         llSay(PUBLIC_CHANNEL, "Touch to see osGetPhysicsEngineType usage.");
 
     }
 
     }
     touch_end(integer num) // Tell toucher our version
+
 
 +
     touch_start(integer number)
 
     {
 
     {
         llInstantMessage(llDetectedKey(0), "Physics engine type: "+osGetPhysicsEngineType());
+
         string physics_engine_type = osGetPhysicsEngineType();
 +
 
 +
        if (physics_engine_type == "ubODE")
 +
        {
 +
            llSay(PUBLIC_CHANNEL, physics_engine_type + " is detected ...");
 +
        }
 +
       
 +
        else
 +
        {
 +
            llSay(PUBLIC_CHANNEL, physics_engine_type + " is not detected ...");
 +
        }
 
     }
 
     }
 
}
 
}
 
</source>
 
</source>
|description=This function returns a string containing the current simulator version.
+
|additional_info=This function was added in 0.7.6-post-fixes
|
+
This function does not throw an exception if the threat level is not high enough.<br>
 +
If 'os' functions are enabled this function will return an empty string if the threat level is not met.<br>
 +
This allows vehicle scripts to always check this and not worry about exceptions.<br>
 +
The value returned is the name of the physics engine specified in the OpenSim.ini file ("physics = XXX").<br>
 +
It is usually either "OpenDynamicsEngine", "BulletSim" or "ubODE".
 
}}
 
}}
Notes:
 
This function does not throw an exception if the threat level is not high enough. If 'os' functions are enabled, this function will return an empty string if the threat level is not met. This allows vehicle scripts to always check this and not worry about exceptions.
 
 
The value returned is the name of the physics engine specified in the OpenSim.ini file ("physics = XXX"). It is usually either "OpenDynamicsEngine" or "BulletSim".
 

Latest revision as of 08:13, 30 December 2020

string osGetPhysicsEngineType()
This function returns a string containing the name of the Physics Engine.
Threat Level High
Permissions Use of this function is always allowed by default
Extra Delay 0 seconds
Example(s)
//
// osGetPhysicsEngineType Script Example
// Author: djphil
//
 
default
{
    state_entry()
    {
        llSay(PUBLIC_CHANNEL, "Touch to see osGetPhysicsEngineType usage.");
    }
 
    touch_start(integer number)
    {
        string physics_engine_type = osGetPhysicsEngineType();
 
        if (physics_engine_type == "ubODE")
        {
            llSay(PUBLIC_CHANNEL, physics_engine_type + " is detected ...");
        }
 
        else
        {
            llSay(PUBLIC_CHANNEL, physics_engine_type + " is not detected ...");
        }
    }
}
Notes
This function was added in 0.7.6-post-fixes

This function does not throw an exception if the threat level is not high enough.
If 'os' functions are enabled this function will return an empty string if the threat level is not met.
This allows vehicle scripts to always check this and not worry about exceptions.
The value returned is the name of the physics engine specified in the OpenSim.ini file ("physics = XXX").
It is usually either "OpenDynamicsEngine", "BulletSim" or "ubODE".

Personal tools
General
About This Wiki