From Bohemia Interactive Community
|
|
(12 intermediate revisions by 8 users not shown) |
Line 1: |
Line 1: |
| '''Description:''' | | '''Description:'''<br> |
| Boolean ([[true]] or [[false]]). | | A [[Boolean]] can either be [[true]] or [[false]]. |
| | Note that Booleans are '''real''' types in the scripting language. |
|
| |
|
| Boolean values in OFP are ''identical'' to [[Number|numbers]] except, by convention, the values are 0, or 1
| | In config.cpp (addons), a boolean is simply a poetic licence, a convenience, for a zero/non zero integer. |
|
| |
|
| Thus
| | [[Category: Data Types]] |
| | |
| StartEngine = 0; // would be interpred as off
| |
| IsNightTime = 1; // is not daytime !!!
| |
| | |
| as a covenience. well written mission.sqm's and well written config.cpp's (addons) have the following defines at top of file
| |
| | |
| #define true 1
| |
| #define false 0 // note the lack of a semicolon
| |
| | |
| Thus the script fragment
| |
| | |
| IsNightTime=true;
| |
| | |
| is exceedingly more readable, with the added bonus that not all token-names (IsNightTime) 'look' like boolean names. They could, appear to be, to the human reader, an integer that can take any value.
| |
| | |
| | |
| [[Category: Types]] | |
Latest revision as of 18:02, 10 February 2021
Description:
A Boolean can either be true or false.
Note that Booleans are real types in the scripting language.
In config.cpp (addons), a boolean is simply a poetic licence, a convenience, for a zero/non zero integer.