Difference between revisions of "Bool (2da type)"

From Dragon Age Toolset Wiki
Jump to: navigation, search
m (moved Bool to Bool (2da type))
m (Reformatting, adding links)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== In 2DAs ==
+
The '''bool''' (boolean) data type is supported by 2DAs. In the Excel source file a bool value may be represented by one of:
  
The 'bool' (boolean) data type is supported by 2DAs. In the Excel source file a bool value may be represented by one of:
+
{| class="wikitable"
* a zero or non-zero number
+
|-
* Yes or No (case insensitive)
+
! True!! False
* words beginning with T or F (such as True! and False!)
+
|-
 +
| any non-zero number || zero
 +
|-
 +
| Yes (case insensitive) || No (case insensitive)
 +
|-
 +
| any words beginning with T (such as True!)  || any words beginning with  F (such as False!)
 +
|}
  
NOTE: You cannot use TRUE and FALSE because Excel converts those to a special keyword the binarizer can't parse properly at this time.  
+
NOTE: You cannot use TRUE and FALSE because Excel converts those to a special keyword the [[Compiling_2DAs|ExcelProcessor]] cannot parse properly at this time.  
  
Note: the scripting language doesn't have a function for retrieving boolean values from a 2DA, and the behavior of Get2DAInt when retrieving a boolean is untested. It is probably safer to just use an integer for scripting purposes.
+
NOTE: The scripting language doesn't have a function for retrieving boolean values from a 2DA, and the behavior of [[Get2DAInt]] when retrieving a boolean is untested. It is probably safer to use an [[Int (2da type)|integer]] for scripting purposes.
  
== In scripts ==
+
== See also ==
  
The DA scripting language doesn't have an explicit boolean data type. Instead, it uses integer values. A 0 is used to represent "false", and any non-zero integer represents "true". The following constants are defined:
+
* [[Boolean constant]] for a discussion of how booleans are handled in the scripting language
  
{{Constant table start
+
[[Category: 2da types]]
|sourcefile=script.ldf
+
|sourcemodule=
+
}}
+
{{Constant table row
+
|name=FALSE
+
|type=int
+
|value=0
+
|description=
+
|sourcefile=script.ldf
+
|sourcemodule=
+
}}
+
{{Constant table row
+
|name=TRUE
+
|type=int
+
|value=1
+
|description=
+
|sourcefile=script.ldf
+
|sourcemodule=
+
}}
+
{{Constant table end}}
+
 
+
Note that if you test for a variable's truth value by testing if it's equal to TRUE you may not get the correct result, since TRUE == 1 but not TRUE == 2. You may wish to instead test if your variable is not equal to FALSE.
+
 
+
<!-- == Remarks == -->
+
<!-- This section contains additional comments, observations and known issues. -->
+
 
+
<!-- == Examples == -->
+
<!-- This section contains examples transcluded from the snippet library. -->
+
 
+
<!-- == See also == -->
+
<!-- This section contains links to articles, functions or constant groups. -->
+
 
+
[[Category:Uncategorised constants]]
+
 
+
[[Category:data types]]
+

Latest revision as of 13:22, 10 August 2011

The bool (boolean) data type is supported by 2DAs. In the Excel source file a bool value may be represented by one of:

True False
any non-zero number zero
Yes (case insensitive) No (case insensitive)
any words beginning with T (such as True!) any words beginning with F (such as False!)

NOTE: You cannot use TRUE and FALSE because Excel converts those to a special keyword the ExcelProcessor cannot parse properly at this time.

NOTE: The scripting language doesn't have a function for retrieving boolean values from a 2DA, and the behavior of Get2DAInt when retrieving a boolean is untested. It is probably safer to use an integer for scripting purposes.

See also

  • Boolean constant for a discussion of how booleans are handled in the scripting language