Page MenuHomeFeedback Tracker

SWITCH and IF control statements seem completely broken
Closed, ResolvedPublic

Description

If statements and switch statements seem to not work at all, they execute the code in their block even if the condition isn't met.

Details

Legacy ID
1254464786
Severity
Major
Resolution
Not A Bug
Reproducibility
Always
Category
Scripting
Steps To Reproduce
  1. Create init.sqf
  2. Add below code to file:

_which_one = "two"

if (_which_one == "three") then
{
hintSilent "derp";
};

  1. Add unit to map and under initialization add code []exec "init.sqf"
  1. Watch as the hint is displayed on the screen.
Additional Information

This is reproducible with switch statements as well.

Event Timeline

zellyman edited Steps To Reproduce. (Show Details)Mar 14 2013, 1:24 PM
zellyman edited Additional Information. (Show Details)
zellyman set Category to Scripting.
zellyman set Reproducibility to Always.
zellyman set Severity to Major.
zellyman set Resolution to Not A Bug.
zellyman set Legacy ID to 1254464786.May 7 2016, 12:34 PM

"exec" is for sqs scripts. You have to use "execVM" for your sqf script.

Like DarkDruid said, use the execVM command to execute sqf scripts. It works fine, I just tested it.