Condition Radar(s) on/off

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
Parel803
Posts: 608
Joined: Thu Oct 10, 2019 3:39 pm
Location: Netherlands

Condition Radar(s) on/off

Post by Parel803 »

Good morning,

I'm trying to give a message in an event when a radar is still strangled. Tried to have a condition if that message is to be send to the operator. Not getting it to work, stays at false.
The Event:NATO Message, EmconU/Radar cehck
The Condition:
local u = ScenEdit_GetUnit({name='F 827 Karel Doorman', guid='50PVO4-0HMC8KQOB26K8'})
if (u.sensor_dbid==2179 and u.sensor_isactive==true) then
print ('KH1007 is Shining')
return true
else
print ('KH1007 is Strangled')
return false
end

Hope someone can and will help me
regards GJ
Attachments
2ASWASuW.zip
(420.11 KiB) Downloaded 3 times
User avatar
TitaniumTrout
Posts: 400
Joined: Mon Oct 20, 2014 9:06 am
Location: Michigan
Contact:

RE: Condition Radar(s) on/off

Post by TitaniumTrout »

You need to dig into the table of sensor data. As below you can print the contents of u.sensors which gives you a ton of data.

print(u.sensors)
{ [1] = { sensor_isactive = 'No', sensor_name = 'KH 1007 [Type 1007]', sensor_maxrange = 96, sensor_status = 'Operational', sensor_role = 2028, sensor_guid = 'T5Z37W-0HMCI67HH16DU', sensor_dbid = 2179, sensor_type = 2001 }, [2] = { sensor_isactive = 'No', sensor_name = 'LW.08', sensor_maxrange = 180, sensor_status = 'Operational', sensor_role = 2001, sensor_guid = 'T5Z37W-0HMCI67HH16DV', sensor_dbid = 1191, sensor_type = 2001 }, [3] = { sensor_isactive = 'No', sensor_name = 'SMART-S', sensor_maxrange = 80, sensor_status = 'Operational', sensor_role = 2014, sensor_guid = 'T5Z37W-0HMCI67HH16E0', sensor_dbid = 655, sensor_type = 2001 }, [4] = { sensor_isactive = 'No', sensor_name = 'Scout Mk.2', sensor_maxrange = 24, sensor_status = 'Operational', sensor_role = 2028, sensor_guid = 'T5Z37W-0HMCI67HH16E1', sensor_dbid = 2637, sensor_type = 2001 }, [5] = { sensor_isactive = 'No', sensor_name = 'Sea Watcher 100 [Seastar]', sensor_maxrange = 40, sensor_status = 'Operational', sensor_role = 2028, sensor_guid = 'T5Z37W-0HMCI67HH16E2', sensor_dbid = 5140, sensor_type = 2001 }, [6] = { sensor_isactive = 'No', sensor_name = 'IRSCAN', sensor_maxrange = 0, sensor_status = 'Operational', sensor_role = 2879, sensor_guid = 'T5Z37W-0HMCI67HH16E3', sensor_dbid = 331, sensor_type = 2004 }, [7] = { sensor_isactive = 'No', sensor_name = 'AR-700A(V)1', sensor_maxrange = 500, sensor_status = 'Operational', sensor_role = 3011, sensor_guid = 'T5Z37W-0HMCI67HH16E4', sensor_dbid = 1792, sensor_type = 3001 }, [8] = { sensor_isactive = 'No', sensor_name = 'Telegon 4', sensor_maxrange = 500, sensor_status = 'Operational', sensor_role = 3101, sensor_guid = 'T5Z37W-0HMCI67HH16E5', sensor_dbid = 165, sensor_type = 3001 }, [9] = { sensor_isactive = 'No', sensor_name = 'AR-700A(V)1 APECS II', sensor_maxrange = 0, sensor_status = 'Operational', sensor_role = 4021, sensor_guid = 'T5Z37W-0HMCI67HH16E6', sensor_dbid = 676, sensor_type = 3002 }, [10] = { sensor_isactive = 'No', sensor_name = 'AR-700A(V)1 APECS II', sensor_maxrange = 0, sensor_status = 'Operational', sensor_role = 4021, sensor_guid = 'T5Z37W-0HMCI67HH16E7', sensor_dbid = 676, sensor_type = 3002 }, [11] = { sensor_isactive = 'No', sensor_name = 'PHS-36', sensor_maxrange = 4, sensor_status = 'Operational', sensor_role = 5032, sensor_guid = 'T5Z37W-0HMCI67HH16E8', sensor_dbid = 1271, sensor_type = 5002 }, [12] = { sensor_isactive = 'No', sensor_name = 'DSBV 62C', sensor_maxrange = 40, sensor_status = 'Operational', sensor_role = 5101, sensor_guid = 'T5Z37W-0HMCI67HH16E9', sensor_dbid = 1900, sensor_type = 5011 }, [13] = { sensor_isactive = 'No', sensor_name = 'Gatekeeper [CCD]', sensor_maxrange = 25, sensor_status = 'Operational', sensor_role = 2701, sensor_guid = 'T5Z37W-0HMCI67HH16EB', sensor_dbid = 5144, sensor_type = 2003 }, [14] = { sensor_isactive = 'No', sensor_name = 'Gatekeeper [FLIR]', sensor_maxrange = 25, sensor_status = 'Operational', sensor_role = 2801, sensor_guid = 'T5Z37W-0HMCI67HH16EC', sensor_dbid = 5143, sensor_type = 2004 }, [15] = { sensor_isactive = 'No', sensor_name = 'STIR 180 [Radar]', sensor_maxrange = 32, sensor_status = 'Operational', sensor_role = 2143, sensor_guid = 'T5Z37W-0HMCI67HH16EE', sensor_dbid = 3146, sensor_type = 2001 }, [16] = { sensor_isactive = 'No', sensor_name = 'STIR 180 [IR Camera]', sensor_maxrange = 100, sensor_status = 'Operational', sensor_role = 2871, sensor_guid = 'T5Z37W-0HMCI67HH16EF', sensor_dbid = 3695, sensor_type = 2004 }, [17] = { sensor_isactive = 'No', sensor_name = 'STIR 180 [TV Camera]', sensor_maxrange = 100, sensor_status = 'Operational', sensor_role = 2671, sensor_guid = 'T5Z37W-0HMCI67HH16EG', sensor_dbid = 3696, sensor_type = 2003 }, [18] = { sensor_isactive = 'No', sensor_name = 'STIR 180 [Radar]', sensor_maxrange = 32, sensor_status = 'Operational', sensor_role = 2143, sensor_guid = 'T5Z37W-0HMCI67HH16EI', sensor_dbid = 3146, sensor_type = 2001 }, [19] = { sensor_isactive = 'No', sensor_name = 'STIR 180 [IR Camera]', sensor_maxrange = 100, sensor_status = 'Operational', sensor_role = 2871, sensor_guid = 'T5Z37W-0HMCI67HH16EJ', sensor_dbid = 3695, sensor_type = 2004 }, [20] = { sensor_isactive = 'No', sensor_name = 'STIR 180 [TV Camera]', sensor_maxrange = 100, sensor_status = 'Operational', sensor_role = 2671, sensor_guid = 'T5Z37W-0HMCI67HH16EK', sensor_dbid = 3696, sensor_type = 2003 }, [21] = { sensor_isactive = 'No', sensor_name = 'Mk1 Eyeball', sensor_maxrange = 50, sensor_status = 'Operational', sensor_role = 2016, sensor_guid = 'T5Z37W-0HMCI67HH16EL', sensor_dbid = 0, sensor_type = 2003 }, [22] = { sensor_isactive = 'No', sensor_name = 'Goalkeeper Tracker [Radar]', sensor_maxrange = 6, sensor_status = 'Operational', sensor_role = 2191, sensor_guid = 'T5Z37W-0HMCI67HH16F7', sensor_dbid = 1153, sensor_type = 2001 }, [23] = { sensor_isactive = 'No', sensor_name = 'Goalkeeper Acquisition [Radar]', sensor_maxrange = 12, sensor_status = 'Operational', sensor_role = 2103, sensor_guid = 'T5Z37W-0HMCI67HH16F8', sensor_dbid = 4252, sensor_type = 2001 }, [24] = { sensor_isactive = 'No', sensor_name = 'Generic Gun Director [TV Camera]', sensor_maxrange = 80, sensor_status = 'Operational', sensor_role = 2681, sensor_guid = 'T5Z37W-0HMCI67HH16F9', sensor_dbid = 4230, sensor_type = 2003 } }
>> local u = ScenEdit_GetUnit({name='boat',side='player'})

Then you can query from there.

local u = ScenEdit_GetUnit({name='boat',side='player'})
print(u.sensors[1].sensor_isactive)
'No'
Parel803
Posts: 608
Joined: Thu Oct 10, 2019 3:39 pm
Location: Netherlands

RE: Condition Radar(s) on/off

Post by Parel803 »

TitaniumTrout, thank you for your help, appriciated
regards GJ
User avatar
michaelm75au
Posts: 11899
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Condition Radar(s) on/off

Post by michaelm75au »

There is another way to see sensors.
local u = ScenEdit_GetUnit({name='DD 101 Murasame', guid='a1a52edf-3541-4b55-bea4-58d4e1ab11dc'})
print(u.components)
print(u:filterOnComponent('sensor')

I am going to add a second optional parameter to the filter - the DBID to look for
print(u:filterOnComponent('sensor',1650))
This will return a table of just the sensors for DBID (1650).

Michael
Parel803
Posts: 608
Joined: Thu Oct 10, 2019 3:39 pm
Location: Netherlands

RE: Condition Radar(s) on/off

Post by Parel803 »

michaelm75au,

thank you, appriciated

regards GJ
KnightHawk75
Posts: 1590
Joined: Thu Nov 15, 2018 7:24 pm

RE: Condition Radar(s) on/off

Post by KnightHawk75 »

ORIGINAL: michaelm75au

There is another way to see sensors.
local u = ScenEdit_GetUnit({name='DD 101 Murasame', guid='a1a52edf-3541-4b55-bea4-58d4e1ab11dc'})
print(u.components)
print(u:filterOnComponent('sensor')

I am going to add a second optional parameter to the filter - the DBID to look for
print(u:filterOnComponent('sensor',1650))
This will return a table of just the sensors for DBID (1650).


Dope.
Post Reply

Return to “Lua Legion”