Difference between revisions of "FALSE"
Jump to navigation
Jump to search
Kireji Haiku (talk | contribs) m (added second example) |
m (<lsl> tag to <source>) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 2: | Line 2: | ||
|name=FALSE | |name=FALSE | ||
|type=integer | |type=integer | ||
|subtype=boolean | |||
|value=0 | |value=0 | ||
|desc=Constant used to define the FALSE value in conditional structures or variables/constants in general. Usually it's used because it is more readable, indicating a [[Boolean|boolean]] value instead a [[Integer|integer]] value (0). | |desc=Constant used to define the FALSE value in conditional structures or variables/constants in general. Usually it's used because it is more readable, indicating a [[Boolean|boolean]] value instead a [[Integer|integer]] value (0). | ||
|examples= | |examples= | ||
< | <source lang="lsl2"> | ||
integer is_owner(key inputKey) | integer is_owner(key inputKey) | ||
{ | { | ||
if (inputKey == llGetOwner() ) | |||
if (inputKey == | |||
return TRUE; | return TRUE; | ||
// else | // else | ||
Line 21: | Line 20: | ||
{ | { | ||
key id = llDetectedKey(0); | key id = llDetectedKey(0); | ||
if ( is_owner(id) ) | if ( is_owner(id) ) | ||
llSay( | llSay(0, "Hello, you're my owner!"); | ||
else | else | ||
llSay( | llSay(0, "Hello, you're not my owner!"); | ||
} | } | ||
} | } | ||
</ | </source> | ||
< | <source lang="lsl2"> | ||
default | default | ||
{ | { | ||
Line 37: | Line 34: | ||
{ | { | ||
integer q = TRUE; | integer q = TRUE; | ||
if(q) | if(q) | ||
{ | { | ||
llSay(0, "TRUE"); | |||
llSay( | |||
q = FALSE; | q = FALSE; | ||
if(!q) | if(!q) | ||
{ | { | ||
llSay( | llSay(0, "FALSE"); | ||
q = TRUE; | q = TRUE; | ||
if(!q) | if(!q) | ||
llSay( | llSay(0, "Won't say this."); | ||
else | else | ||
{ | { | ||
llSay( | llSay(0, "TRUE"); | ||
q = FALSE; | q = FALSE; | ||
if(q) | if(q) | ||
llSay( | llSay(0, "Won't say this."); | ||
else | else | ||
llSay( | llSay(0, "FALSE"); | ||
} | } | ||
} | } | ||
else | else | ||
llSay( | llSay(0, "Won't say this."); | ||
} | } | ||
else | else | ||
llSay( | llSay(0, "Won't say this."); | ||
} | } | ||
} | } | ||
</ | </source> | ||
|constants={{LSL ConstRow|TRUE}} | |constants={{LSL ConstRow|TRUE}} | ||
|functions= | |functions= |
Latest revision as of 15:36, 23 January 2015
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Caveats
Examples
integer is_owner(key inputKey)
{
if (inputKey == llGetOwner() )
return TRUE;
// else
return FALSE;
}
default
{
touch_start(integer num_detected)
{
key id = llDetectedKey(0);
if ( is_owner(id) )
llSay(0, "Hello, you're my owner!");
else
llSay(0, "Hello, you're not my owner!");
}
}
default
{
state_entry()
{
integer q = TRUE;
if(q)
{
llSay(0, "TRUE");
q = FALSE;
if(!q)
{
llSay(0, "FALSE");
q = TRUE;
if(!q)
llSay(0, "Won't say this.");
else
{
llSay(0, "TRUE");
q = FALSE;
if(q)
llSay(0, "Won't say this.");
else
llSay(0, "FALSE");
}
}
else
llSay(0, "Won't say this.");
}
else
llSay(0, "Won't say this.");
}
}