Setting altitude (Full Version)

All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion



Message


Gunner98 -> Setting altitude (3/13/2020 4:20:33 PM)

Using the command:

ScenEdit_SetUnit({side="NATO", unitname="101 Sqn RAF #1", altitude=10972.6, speed=230})

works fine, but note that the command uses meters and you must have the decimal point included. 10972.6 (or 7 or 8 or 9) returns 36,000.7 ft ASL which is fine but -

Is there a way to simply give the command in feet and avoid the '.7'

BTW, the documentation notes the meters but doesn't mention using the decimal point.

Thanks




TitaniumTrout -> RE: Setting altitude (3/13/2020 5:54:31 PM)

So if you give it the command without a decimal value then it just sets it to zero, correct? That's what I see in my testing.

local a = ScenEdit_SetUnit({side="BLUFOR", unitname="Airplane", altitude = 7000, manualaltitude=7010, manualspeed=410})
print(a)


[image]https://i.imgur.com/LSjQ0aj.png[/image]

A few things you can do. One, just add a decimal after the value. Setting the "altitude = 7000." is enough to make it work. Odd that it doesn't also happen with speed, probably something going on with a conversion.

You could also include a conversion so you don't have to think in meters. then you'd do "altitude = (3600/3.281)".

Interestingly enough that works, however I'm running into some oddities setting the math on the manualaltitude side of things. I can divide 3000/3 and it sets it to 3,281 ft. However if I try to divide 3000/3.281 it sets it to 20 ft. Dividing 4000/3 also sets it to 20 ft.

local man = 1000/3
print(man)

local a = ScenEdit_SetUnit({side="BLUFOR", unitname="Airplane", altitude = (3000/3.281), manualaltitude=man, manualspeed=400})
print(a)


Manual override goes to 20 ft.

local man = 333
print(man)

local a = ScenEdit_SetUnit({side="BLUFOR", unitname="Airplane", altitude = (3000/3.281), manualaltitude=man, manualspeed=400})
print(a)


Manual altitude goes to 1093 ft.

333.0 returns 1093 ft.
333.3 returns 20 ft.

I'll cross post this as a bug? Unless I'm missing something.









Gunner98 -> RE: Setting altitude (3/13/2020 7:15:54 PM)

quote:

So if you give it the command without a decimal value then it just sets it to zero, correct? That's what I see in my testing


Yes that is exactly what is happening to me. I do believe there is something to do with rounding as the same result (36000.7 ft ASL) in feet appears with multiple altitude entries (altitude=10972.6 or .7, or .8 or .9)


This is very workable but I do think something may be off.

Thanks for checking into it.

B




michaelm75au -> RE: Setting altitude (3/14/2020 2:27:22 AM)

This may be a side affect of moving to Lua 5.3 as in Lua 5.2 all numbers were treated as decimal/floats that is not the case in L5.3. The suggestion from the L5.3 manual is to force it to a float by adding a decimal point to it. . As TT suggests.

I need to check how the values are being passed to the SE_SetUnit() as funny speed works and altitude doesn't - we came across something like this on a different function when testing the changes.

Verified and fixed for a future build.




michaelm75au -> RE: Setting altitude (3/14/2020 2:30:07 AM)

BTW you should be able to put the value in feet.

{altitude='100 FT'}




Gunner98 -> RE: Setting altitude (3/14/2020 12:34:47 PM)

Cheers, thanks Michael

B




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
4.453125