Difference between condition/condition_v

All discussions & material related to Command's Lua interface

Moderators: angster, RoryAndersonCDT, michaelm75au, MOD_Command

Post Reply
User avatar
vettim89
Posts: 3668
Joined: Fri Jul 13, 2007 11:38 pm
Location: Toledo, Ohio

Difference between condition/condition_v

Post by vettim89 »

Topic says it all - what is the difference between condition and condition-v in the unit wrapper? Also, what are the values that can be assigned to each?
"We have met the enemy and they are ours" - Commodore O.H. Perry
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

Re: Difference between condition/condition_v

Post by KnightHawk75 »

vettim89 wrote: Sat Mar 26, 2022 9:05 pm Topic says it all - what is the difference between condition and condition-v in the unit wrapper? Also, what are the values that can be assigned to each?
Just as the documents state - but doesn't necessarily go on to explain.

.condition is a string description (can vary depending on context/unit type), generally* it's not what you want to do 'compares' against and is more for display imho.
.condition_v is a string representation of the enum code value (ie a number) that represent the basic condition, this generally is what you want to do compares against and generally* more for logic imho.

I've posed the list a few times if you search for my name and condition_v using the new forum search feature (I suggest advanced view and topic-lists vs post listings).
See here for a list, it's from 2020, I think it still the same, shows you the .condition and related .condition_v values.
https://www.matrixgames.com/forums/view ... 4#p4634064

In short if your trying to check if say an aircraft is in parked condition you would use if wrapper.condition_v == "Parked" then.. whatever. But if you wanted to specifically know if it was in a hanger or flightdeck you could check .condition and see if it contained the strings "hanger" or "flightdeck".
User avatar
vettim89
Posts: 3668
Joined: Fri Jul 13, 2007 11:38 pm
Location: Toledo, Ohio

Re: Difference between condition/condition_v

Post by vettim89 »

Thanks as always Mr.. Knighthawk, sir
"We have met the enemy and they are ours" - Commodore O.H. Perry
Post Reply

Return to “Lua Legion”