BossBearFace Posted September 14, 2024 Posted September 14, 2024 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.
Cyking Posted September 14, 2024 Posted September 14, 2024 You are right, you can also create random flags values. 1 DISCORD - YOUTUBE - INSTAGRAM
Solution rob10 Posted September 14, 2024 Solution Posted September 14, 2024 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“) 1 1
BossBearFace Posted September 15, 2024 Author Posted September 15, 2024 Thanks guys. Appreciate it. Especially learning that FLAG ON/OFF isn’t an integer.
cfrag Posted September 16, 2024 Posted September 16, 2024 (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: 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" 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) 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" 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 September 16, 2024 by cfrag 1
Recommended Posts