Home   Help Search Login Register  

Author Topic: wtf is boolean!>!!?!?!?  (Read 1317 times)

0 Members and 1 Guest are viewing this topic.

fargo

  • Guest
wtf is boolean!>!!?!?!?
« on: 12 Apr 2004, 03:33:51 »
im trying to make better missions, ive been able to do some simple scripting things and triggers, but what does boolean mean ??? ??? ??? ???

Offline .pablo.

  • Former Staff
  • ****
  • When in doubt, empty the magazine.
Re:wtf is boolean!>!!?!?!?
« Reply #1 on: 12 Apr 2004, 03:53:29 »
boolean is:

"2 Of or relating to a data type or variable in a programming language that can have one of two values, true or false."
http://dictionary.reference.com/search?q=boolean

so for an example, this would be a boolean variable:

youaregay = true

where youaregay is a variable that can be true or false

a non-boolean variable could be something like this:

mygayfriends = 6

where mygayfriends is a variable that can hold any string of numbers or letters

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re:wtf is boolean!>!!?!?!?
« Reply #2 on: 12 Apr 2004, 06:56:56 »
Fargo,

Boolean varibales are variables that are either true or false.  They are not numeric values, or string values (alpha characters).  The are used often with if - then statements.   Here is an axample:

Code: [Select]
If (getDamage _soldier < .4) then {_soldierhealthy = true} else {_soldierhealthy = false}
When you use a boolean on the "if" side of the if - then you do not use any == signs or >=, instead you just state the varialbe for a positive check, or "not" in front of the varible for a negative check like so:

Code: [Select]
If (_soldierheathy) then .......
or

Code: [Select]
If (not _soldierheathy) then .......
For short you can use "!" instead of "not" also you can use "?" instead of "if" and ":" instead of "then".  I hope this helps.  If you want you can examine some of the scripts in the editior depot.  Almost all scripts of any advanced level will make use of boolean variables (true or false conditions).  If you look at these scripts you can see how they are used and some examples of the situations where they are usefull.

fargo

  • Guest
Re:wtf is boolean!>!!?!?!?
« Reply #3 on: 14 Apr 2004, 22:12:31 »
 thanks that cleared it up a little :)