TitaniumTrout
Posts: 374
Joined: 10/20/2014 From: Michigan Status: offline
|
Here we go! This cleans out the old triggers at the same time as sending the all clear. local detectingunit = ScenEdit_UnitY()
print(detectingunit.unit.guid)
local currtime = ScenEdit_CurrentTime()
print(currtime)
local futuretime = currtime + 300
print(futuretime)
local convtime = (os.date('%m-%d-%Y %H:%M:%S %p', futuretime))
print(convtime)
local triggerunit = detectingunit.unit.guid .. convtime
local triggergroup = detectingunit.unit.group.name
print(triggergroup)
ScenEdit_SetTrigger({mode='add',type='Time', name='trigger'.. triggerunit, time = convtime})
local SetEMCON = "ScenEdit_SetEMCON('Group', '"..triggergroup.."', 'Inherit;Radar=Active')"
local RemoveT = "ScenEdit_SetTrigger({mode='remove', type = 'Time', name='trigger"..triggerunit.."' })"
local RemoveA = "ScenEdit_SetAction({mode='remove', type = 'Luascript', name= 'triggerunitAction"..triggerunit.."'})"
local RemoveE = "ScenEdit_SetEvent('TimeTest Event"..triggerunit.."', {mode='remove'})"
--Must delete event first, then delete action and trigger.
local ScriptTextComp = SetEMCON.. "\r\n" ..RemoveE.. "\r\n" ..RemoveA.. "\r\n" ..RemoveT.. "\r\n"
print(ScriptTextComp)
ScenEdit_SetAction({mode='add', type='LuaScript', name= 'triggerunitAction'..triggerunit, ScriptText = ScriptTextComp})
ScenEdit_SetEvent('TimeTest Event'..triggerunit, {mode='add', isActive=True})
ScenEdit_SetEventTrigger('TimeTest Event'..triggerunit, {mode='add', name='trigger'.. triggerunit})
ScenEdit_SetEventAction('TimeTest Event'..triggerunit, {mode='add', name='triggerunitAction'..triggerunit}) ..
< Message edited by TitaniumTrout -- 3/13/2020 3:29:05 PM >
_____________________________
|