Jump to content

Recommended Posts

Posted (edited)

Hi,

I've been pouring over the Mission Builders forum and GUI Manual, but still have some questions on Flags.

 

1. True?: Flags all start as Boolean = False

 

2. True?: Flags all start as value = Null

 

3. True?: Increment a Flag that is False by 1 will set it to Zero

 

4. True?: Increment a Flag that is Null (False) will set it to Boolean = True

 

5. True?: A Flag = Zero is True

 

6. True?: Decrement a Flag that = 1 by 1 will set it to Zero and it will still be Boolean = True

 

7. True?: Decrement a Flag = Zero by 1 will set it to Null & Boolean = False

 

8. True?: Decrement a Flag < n by n will set it to Null & Boolean = False

 

 

 

I realize that I can test all of these conditions, but after five days of logic puzzles I've decided to eat some humble pie and ask...

 

TIA!

 

Wrecking Crew

 

 

:gun_smilie:

Edited by Wrecking Crew
Numbered the questions

Visit the Hollo Pointe DCS World server -- an open server with a variety of COOP & H2H missions including Combined Arms. All released missions are available for free download, modification and public hosting, from my Wrecking Crew Projects site.

Posted (edited)
Hi,

I've been pouring over the Mission Builders forum and GUI Manual, but still have some questions on Flags.

 

True?: Flags all start as Boolean = False

 

True?: Flags all start as value = Null

 

Flags are all either initially false or nil; in the case of Lua, which much of the trigger logic operates in, nil and false both evaluate to false; ANY other value will evaluate to true. However, whether this applies to flags or not, I do not know actually. However, all flags initially evaluate as false. Note that switched->flag is false-> whatever will not evaluate to true at mission start, at least, last I checked. Switched depends on the transition from a previously false state to a previously true state; for flag is false, at mission start, the flag has ALWAYS been false, so "switched" will not trigger.

 

True?: Increment a Flag that is False by 1 will set it to Zero

 

I think so. I am 99% sure that if you increment and uninitialized flag by 1, it sets it to 1, as if the intitial value was 0. A flag you set false though... I donno. Setting a flag false will likely nominally reset it to zero. If you can figure this out, we'd be appreciative.

 

True?: Increment a Flag that is Null (False) will set it to Boolean = True

 

True?: A Flag = Zero is True

 

True?: Decrement a Flag that = 1 by 1 will set it to Zero and it will still be Boolean = True

 

True?: Decrement a Flag = Zero by 1 will set it to Null & Boolean = False

 

True?: Decrement a Flag < n by n will set it to Null & Boolean = False

 

It's best to keep your boolean values and number values separate. I'm pretty sure flag values can go into the negative numbers, so if you decrement a flag that is number value 1 by 1, it should go to zero; if you decrement it again, it should go to -1. I haven't tested it, but assuming that ED made the natural, logical choice, and gave flag values an int value, then they will go negative.

 

Anyway, much of the ME logic works in Lua, and in Lua, like I said, ANY number value evaluates as true. But... who knows, maybe ED is applying a different set of logical assumptions to ME logic. Maybe 0 is false, anything non zero is true. Maybe ANY number value evaluates to false, and only true evaluates to true. Maybe 0 and negative are false, 1 and up are true. Who knows. If you go about comparing a boolean with a number in Lua, it generates an error, so maybe, you'll generate an error when you attempt this operation.

 

Furthermore, you have absolutely no need to try to compare a boolean flag to a number. If you're using a number value, then it must be because you needed a flag with more than two values... wouldn't you want to detect which value it was at exactly? There's a "flag is equal to" trigger condition as of patch 1110, I believe. I suppose you might be interested in which range a flag was in, but that's what the "flag value less/more than" trigger conditions are for.

 

Edit: I have thought of 1 potential use for comparing number flags with booleans- say you want to reset a flag to zero. You could decrement it till it reaches number zero, or you could (potentially) set it to false- IF false really gets cast into a value of 0 when you add or compare flags to values, or set a number value flag to false. Anyway, the only reason we'd have for this is that last I checked (and this may be different now!) there is no set flag number value trigger action. However, if there is, or if the set flag random value trigger action allows you to specify a range of values (you could set the range to 0 to 0, for example), then truly, I can't think of a single reason to ever compare number value flags to booleans, or boolean flags to number values, or increment boolean flag (other than perhaps uninitialized flags).

Edited by Speed

Intelligent discourse can only begin with the honest admission of your own fallibility.

Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/

Lua scripts and mods:

MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616

Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979

Now includes remote server administration tools for kicking, banning, loading missions, etc.

Posted

Lots of interesting stuff there in those questions and you bring out some good ideas, too, Speed. I've gotten good at quick test missions so the answers will come out...

 

v1.1.1.1 BTW.

 

Most wanting would be 'Set Flag To ()', and a Message blahbla & Flag 1, B(oolean)/V(alue) & blahbla. As far as flags go, anyway.

 

I think there is consensus on #1.

 

WC

Visit the Hollo Pointe DCS World server -- an open server with a variety of COOP & H2H missions including Combined Arms. All released missions are available for free download, modification and public hosting, from my Wrecking Crew Projects site.

  • Recently Browsing   0 members

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