Page MenuHomeFeedback Tracker

Boolean equaling is not working
Closed, ResolvedPublic

Description

In SQF scripts, if you have boolean variable and you need to check if it's true or false

if(Variable == true) then {}

is not working, and will not even manage else block.

Details

Legacy ID
4023760796
Severity
Major
Resolution
Fixed
Reproducibility
Always
Operating System
Windows 7
Category
Scripting
Steps To Reproduce

Example code (similar to one which i used):

Spawned = false;

if(Spawned == true) then
{

//Something
//Will not run

}
else
{

//Something else
//Will not run either

};

Event Timeline

ffredyk edited Steps To Reproduce. (Show Details)Apr 1 2013, 12:17 PM
ffredyk edited Additional Information. (Show Details)
ffredyk set Category to Scripting.
ffredyk set Reproducibility to Always.
ffredyk set Severity to Major.
ffredyk set Resolution to Not A Bug.
ffredyk set Legacy ID to 4023760796.May 7 2016, 1:21 PM

Spawned = false;

if(Spawned) then
{

//Something
//Will not run

}
else
{

//Something else
//Will run

};

ffredyk added a subscriber: ffredyk.May 7 2016, 1:21 PM

Yeah, thanks, I realized that after some time.. But still, is it intentional to == not work like this?

But still, is it intentional to == not work like this

It is, Deadfast's example is the only way how to ask for boolean state.

Mass close.

BIS_fnc_KK reopened this task as Assigned.
BIS_fnc_KK updated the task description. (Show Details)
BIS_fnc_KK changed Resolution from Not A Bug to Reopened.
BIS_fnc_KK edited Steps To Reproduce. (Show Details)
BIS_fnc_KK edited Additional Information. (Show Details)
BIS_fnc_KK set Operating System to Windows 7.
BIS_fnc_KK added a subscriber: Moricky.
BIS_fnc_KK closed this task as Resolved.Jul 19 2020, 6:20 PM
BIS_fnc_KK changed Resolution from Reopened to Fixed.