Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: if statement

  1. #11
    Quote Originally Posted by GunnDawg09 View Post
    so I was gonna write an if statement in a trigger, or maybe a script file and just call it in the trigger but cant seem to get it to work.

    I have a trigger that does "alpha_clear=true" once all of the opfor are dead, but stays "alpha_clear=false" if opfor are still present.

    So the trigger I want to make would do: player sidechat "OPFOR still alive!" if alpha_clear=false and: player sidechat "OPFOR have been eliminated!" if alpha_clear=true.

    I write a lot in C++ so I figured it would be somwhat the same, but doesnt seem to wanna work. This is what I tried.

    if(alpha_clear = false)
    {
    player sidechat "OPFOR still alive"
    }
    else if(alpha_clear = true)
    {
    player sidechat "OPFOR have been eliminated!"
    }
    If you are used to C++, look at that page : http://community.bistudio.com/wiki/Control_Structures

    From what I get, SQS is now deprecated in favor of SQF, which looks a lot more like C++ than the SQS.

    Your script then looks like this.

    Code:
    if(!alpha_clear) then
    {
       player sidechat "OPFOR still alive";
    }
    else
    {
       player sidechat "OPFOR have been eliminated!";
    };
    From what I can see, there is NO if, else if structures. You will have to go with nested if, else statements.
    Last edited by The_Angry_Canadian; Jul 11 2009 at 13:32. Reason: To reflect Xeno precision about == vs =

  2. #12
    I'd suggest Xeno's version with "! boolean", but just for the detail:

    alpha_clear = false, this is assigning false to your variable

    alpha_clear == false, this is checking if variable is false.

  3. #13
    Quote Originally Posted by [ASA]ODEN View Post
    alpha_clear == false, this is checking if variable is false.
    Doesn't work in ArmA.

    Either a boolean variable is true or false, no need to check against false or true
    A boolean variable allready mets a condition.

    !alpha_clear
    or
    alpha_clear

    Xeno

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •