LUA Question.
Posted: Mon Sep 23, 2019 3:42 pm
I am not seeing what I am doing incorrectly. The LUA script does not throw me any diagnostics. But it also does not turn on the radars.
I do see the I have EMCON all caps, but the main LUA page shows that.
Neither works
====
math.random(os.time())
a = 0
b = 3
string.WorkUnit = {'Radar Alfa', 'Radar Bravo', 'Radar Charlie'}
repeat
a = a + 1
r = math.random(1,5)
if r < 3 then
ScenEdit_SetEMCON('Mission', string.WorkUnit[a], 'Radar=Active')
else
ScenEdit_SetEMCON('Mission', string.WorkUnit[a], 'Radar=Passive')
end
until a >= b
====
math.random(os.time())
a = 0
b = 4
string.WorkUnit = {'Vehicles Alfa', 'Vehicles Bravo', 'Vehicles Charlie', 'Radar Surface Alfa'}
repeat
a = a + 1
r = math.random(1,5)
if r < 3 then
ScenEdit_SetEMCON('Unit', string.WorkUnit[a], 'Radar=Active')
else
ScenEdit_SetEMCON('Unit', string.WorkUnit[a], 'Radar=Passive')
end
until a >= b
====
Does the EMCON for the unit and or mission have to be set a certain way for this to work?
Again no diagnostics but does not work. I printed the random number as well as the work unit... it all looks good.
I do see the I have EMCON all caps, but the main LUA page shows that.
Neither works
====
math.random(os.time())
a = 0
b = 3
string.WorkUnit = {'Radar Alfa', 'Radar Bravo', 'Radar Charlie'}
repeat
a = a + 1
r = math.random(1,5)
if r < 3 then
ScenEdit_SetEMCON('Mission', string.WorkUnit[a], 'Radar=Active')
else
ScenEdit_SetEMCON('Mission', string.WorkUnit[a], 'Radar=Passive')
end
until a >= b
====
math.random(os.time())
a = 0
b = 4
string.WorkUnit = {'Vehicles Alfa', 'Vehicles Bravo', 'Vehicles Charlie', 'Radar Surface Alfa'}
repeat
a = a + 1
r = math.random(1,5)
if r < 3 then
ScenEdit_SetEMCON('Unit', string.WorkUnit[a], 'Radar=Active')
else
ScenEdit_SetEMCON('Unit', string.WorkUnit[a], 'Radar=Passive')
end
until a >= b
====
Does the EMCON for the unit and or mission have to be set a certain way for this to work?
Again no diagnostics but does not work. I printed the random number as well as the work unit... it all looks good.