Don't click here unless you want to be banned.

LSL Wiki : Constants

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are ec2-204-236-235-245.compute-1.amazonaws.com

Constants


Constants are pre-defined values that do not change--they're constant: TRUE will always equal 1. However, this does not mean that values should be used instead; while there's no technical reason not to, constants exist to simplify your code and make it easier to understand. It's good coding practice to use them.

This page is for general constants; function-specific ones should be documented on the functions page.
You can find an almost complete list of constants & values on LexFile.


float

PI 3.1415926535897932384626433832795 (pi)
TWO_PI 6.283185307179586476925286766559 (pi * 2)
PI_BY_TWO 1.5707963267948966192313216916398 (pi / 2)
DEG_TO_RAD To convert from degrees to radians (multiply, example: radian = 90 * DEG_TO_RAD;)
RAD_TO_DEG To convert to radians from degrees (multiply, example: degree = PI_BY_TWO * RAD_TO_DEG;)
SQRT2 1.4142135623730950488016887242097 (square root of 2)


integer

TRUE 1, an integer constant for boolean operations.
FALSE 0, an integer constant for boolean operations.
DEBUG_CHANNEL 2147483647, a special chat channel used to print to the Script Error Window.
PUBLIC_CHANNEL 0, chat channel that broadcasts to all nearby users.
OBJECT_UNKNOWN_DETAIL -1, an integer returned when an invalid object parameter type is passed to llGetObjectDetails.
INVENTORY_NONE -1, an integer returned by llGetInventoryType when no item is found.


string

NULL_KEY Indicates an empty key: "00000000-0000-0000-0000-000000000000". This constant is typed as a string not as a key.


EOF, "\n\n\n", Indicates the last line (or a line past this) of a notecard was read (returned in the dataserver event), or that the notecard contained embedded objects.

SubstringReplaced With
\tfour spaces
\nnew line
\"double quote
\\backslash

rotation

ZERO_ROTATION <0.0, 0.0, 0.0, 1.0> (Note that ZERO_ROTATION is not <0.0, 0.0, 0.0, 0.0>! This is important.)


vector

ZERO_VECTOR <0.0, 0.0, 0.0>


object type
AGENT 1
ACTIVE 2
PASSIVE 4
SCRIPTED 8

For more info see object types

Also, see annoyances for a partial reason for explicitly specifying floating-point constants in the vector and rotation definitions. Using integers can cause logical-looking calculations in assignments to fail in ways that can be difficult to notice at first due to the way LSL parses numbers and handles inline math operations using the fastest data type.


Functions | Events | Types
There are 15 comments on this page. [Display comments/form]