Jump to content

FLAGS and VALUES


Go to solution Solved by rob10,

Recommended Posts

Posted

I'm wanting to create more scripted missions, and this will obviously require me to do more with flags.  I think I've got the fundamentals, but it would be great if some one could correct me if any of the following is wrong.  I've tried to keep this simple:

Flags act like switches: they can be ON or OFF.  Each FLAG has a name, which can be a number or text or both.

Flags can also have VALUES e.g FLAG 1 has a value of 10.

These VALUES can be increased or decreased using trigger action ACTION:FLAG INCREASE/DECREASE.  This does not change the flag name.

Thanks in advance.

  • Solution
Posted
2 hours ago, BossBearFace said:

I'm wanting to create more scripted missions, and this will obviously require me to do more with flags.  I think I've got the fundamentals, but it would be great if some one could correct me if any of the following is wrong.  I've tried to keep this simple:

Flags act like switches: they can be ON or OFF.  Each FLAG has a name, which can be a number or text or both.

Flags can also have VALUES e.g FLAG 1 has a value of 10.

These VALUES can be increased or decreased using trigger action ACTION:FLAG INCREASE/DECREASE.  This does not change the flag name.

Thanks in advance.

Yep.  You can also use SET FLAG VALUE to set a flag to a specific value.  One other thing to remember is that flags are CASE SENSITIVE, so "Flag 1" is different to "flag 1".

Also with FLAG ON/OFF – on and off DO NOT use integer 1/0 when evaluated (i.e. if you set flag ON, it won't evaluate to 1 in "if flag=1“)

  • Like 1
  • Thanks 1
Posted (edited)
On 9/14/2024 at 9:43 PM, rob10 said:

Also with FLAG ON/OFF – on and off DO NOT use integer 1/0 when evaluated (i.e. if you set flag ON, it won't evaluate to 1 in "if flag=1“)

While I agree that using ON/OFF is something better not used and it would be much better to set a flag to a specific value, I feel somewhat compelled to comment:

  1. Flags in DCS now ARE implemented internally as integers. OFF is logically defined as "flag == 0", and therefore ON is "flag ~= 0", which is decidedly different from "flag == 1"
  2. There is no action named FLAG SET VALUE [EDIT: SIlly me. There is an action called SET FLAG VULE. It's just not grouped with the other FLAG actions. Yeah, DCS...]. Use FLAG SET RANDOM VALUE instead and set min and max to the same value (silly, yes. But this pretty much encapsulates the entire DCS ME experience: annoying, user-hostile quirks abound)
  3. FLAG SET ON will set a flag to the value of "1". Flag SET OFF will set a flag to the value of "0". Still, testing for ON must be done via "If flag ~= 0 then .. end"
  4. Never try and interpret flag values as bools in your script as that will always fail.

Here's a small miz to illustrate above. Note that due to my laziness and the silly way radio menus work in DCS (see "annoying, user-hostile quirks", above) you can only use each menu command once.

 

 

flaggerbasted.miz

Edited by cfrag
  • Like 1
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...