Difference between revisions of "FALSE"
Jump to navigation
Jump to search
Kireji Haiku (talk | contribs) m (added second example) |
Kireji Haiku (talk | contribs) m (some readability improvements) |
||
Line 32: | Line 32: | ||
</lsl> | </lsl> | ||
<lsl> | <lsl> | ||
say_whether_true_or_false(integer inputInteger) | |||
{ | |||
string outputString = "FALSE"; | |||
if (inputInteger) | |||
// { | |||
outputString = "TRUE"; | |||
// } | |||
// else | |||
// { | |||
// we don't need to change the output string anymore | |||
// because the default was "FALSE" | |||
// } | |||
// PUBLIC_CHANNEL has the integer value 0 | |||
llSay(PUBLIC_CHANNEL, "/me [" + llGetScriptName() | |||
+ "]: Boolean has the value '" + outputString + "'."); | |||
} | |||
default | default | ||
{ | { | ||
state_entry() | state_entry() | ||
{ | { | ||
integer | integer boolean = TRUE; | ||
if( | if(boolean) | ||
{ | { | ||
say_whether_true_or_false(boolean); | |||
boolean = FALSE; | |||
if(!boolean)// if FALSE (not TRUE) | |||
if(! | |||
{ | { | ||
say_whether_true_or_false(boolean); | |||
boolean = TRUE; | |||
if(!boolean)// if FALSE (not TRUE) | |||
// { | |||
say_whether_true_or_false(boolean); | |||
// } | |||
else | else | ||
{ | { | ||
say_whether_true_or_false(boolean); | |||
boolean = FALSE; | |||
if(boolean) | |||
// { | |||
say_whether_true_or_false(boolean); | |||
// } | |||
else | else | ||
// { | |||
say_whether_true_or_false(boolean); | |||
// } | |||
} | } | ||
} | } | ||
else | else | ||
// { | |||
say_whether_true_or_false(boolean); | |||
// } | |||
} | } | ||
else | else | ||
// { | |||
say_whether_true_or_false(boolean); | |||
// } | |||
} | } | ||
} | } |
Revision as of 07:51, 27 October 2012
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Caveats
Examples
<lsl> integer is_owner(key inputKey) {
key owner = llGetOwner();
if (inputKey == owner) return TRUE;
// else
return FALSE;
}
default {
touch_start(integer num_detected) { key id = llDetectedKey(0);
// PUBLIC_CHANNEL has the integer value 0
if ( is_owner(id) ) llSay(PUBLIC_CHANNEL, "Hello, you're my owner!"); else llSay(PUBLIC_CHANNEL, "Hello, you're not my owner!"); }
} </lsl> <lsl> say_whether_true_or_false(integer inputInteger) {
string outputString = "FALSE";
if (inputInteger)
// {
outputString = "TRUE";
// } // else // { // we don't need to change the output string anymore // because the default was "FALSE" // }
// PUBLIC_CHANNEL has the integer value 0
llSay(PUBLIC_CHANNEL, "/me [" + llGetScriptName() + "]: Boolean has the value '" + outputString + "'.");
}
default {
state_entry() { integer boolean = TRUE;
if(boolean) { say_whether_true_or_false(boolean); boolean = FALSE;
if(!boolean)// if FALSE (not TRUE) { say_whether_true_or_false(boolean); boolean = TRUE;
if(!boolean)// if FALSE (not TRUE)
// {
say_whether_true_or_false(boolean);
// }
else { say_whether_true_or_false(boolean); boolean = FALSE;
if(boolean)
// {
say_whether_true_or_false(boolean);
// }
else
// {
say_whether_true_or_false(boolean);
// }
} } else
// {
say_whether_true_or_false(boolean);
// }
} else
// {
say_whether_true_or_false(boolean);
// }
}
} </lsl>