Frictional Games Forum (read-only)
Boolean Type - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Boolean Type (/thread-11690.html)



Boolean Type - Victor - 12-05-2011

What is "boolean"? Because I'm trying to make an enemy loop between 18 path nodes, but there is a fatal error...


for (int i = 1; i <11; i++)
{
int x = i;
if (i == 1)
{
x = 2;
}
if (i = 18)
{
x = 4;
}
if (i != 1 || i != 18)
{
x = 0;
}
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1"+17, 18, "");
}

It says that there it needs to be something of boolean type, and I don't know what is it... Please, help?!


RE: Boolean Type - nemesis567 - 12-05-2011

Boolean is a variable type whose variables can only assume two values, true or false.

A boolean is declared and assigned as follows:

PHP Code:
bool bRandomVar true//declaration and initialization of bRandomVar
bRandomVar false//Assigning false to the bRandomVar Boolean variable. 





RE: Boolean Type - Your Computer - 12-06-2011

The issue is if (i = 18). Instead of providing a boolean operator, you made a declaration within the if statement.


RE: Boolean Type - nemesis567 - 12-06-2011

Nice perception.



RE: Boolean Type - Victor - 12-07-2011

(12-06-2011, 01:58 AM)Your Computer Wrote: The issue is if (i = 18). Instead of providing a boolean operator, you made a declaration within the if statement.
How can I repair this issue?


RE: Boolean Type - Tanshaydar - 12-07-2011

if( i == 18)

= is an assignment operator and doesn't give a boolean result.
== is a comparison operator and does give a boolean result.


RE: Boolean Type - Victor - 12-07-2011

(12-07-2011, 01:00 AM)Tanshaydar Wrote: if( i == 18)

= is an assignment operator and doesn't give a boolean result.
== is a comparison operator and does give a boolean result.
Thanks a lot!