Updated tracing with loading static and improved SCHEDULER

- Tracing is by default switched off when using Moose in static mode.
- SCHEDULER is now correctly rescheduling when repeating the loop.
- Modified the loaders, adding the default trace on in case of dynamic
and off in case of static loading.
This commit is contained in:
FlightControl 2016-06-15 05:54:21 +02:00
parent 37510ab647
commit 5bd0595b35
28 changed files with 470 additions and 331 deletions

View File

@ -37,12 +37,6 @@
-- @module Client
-- @author FlightControl
--- The CLIENT class
-- @type CLIENT
-- @extends Unit#UNIT
@ -131,7 +125,7 @@ function CLIENT:Register( ClientName )
self.ClientAlive2 = false
--self.AliveCheckScheduler = routines.scheduleFunction( self._AliveCheckScheduler, { self }, timer.getTime() + 1, 5 )
self.AliveCheckScheduler = SCHEDULER:New( self, self._AliveCheckScheduler, {}, 1, 5 )
self.AliveCheckScheduler = SCHEDULER:New( self, self._AliveCheckScheduler, { "Client Alive " .. ClientName }, 1, 5 )
self:E( self )
return self
@ -241,10 +235,11 @@ function CLIENT:Alive( CallBackFunction, ... )
end
--- @param #CLIENT self
function CLIENT:_AliveCheckScheduler()
self:F( { self.ClientName, self.ClientAlive2, self.ClientBriefingShown, self.ClientCallBack } )
function CLIENT:_AliveCheckScheduler( SchedulerName )
self:E( SchedulerName )
self:F( { SchedulerName, self.ClientName, self.ClientAlive2, self.ClientBriefingShown, self.ClientCallBack } )
if self:IsAlive() then -- Polymorphic call of UNIT
if self:IsAlive() then
if self.ClientAlive2 == false then
self:ShowBriefing()
if self.ClientCallBack then

View File

@ -1,34 +1,34 @@
--- Models time events calling event handing functions.
--
--
-- @{SCHEDULER} class
-- ===================
-- The @{SCHEDULER} class models time events calling given event handling functions.
--
--
-- SCHEDULER constructor
-- =====================
-- The SCHEDULER class is quite easy to use:
--
--
-- * @{#SCHEDULER.New}: Setup a new scheduler and start it with the specified parameters.
--
--
-- SCHEDULER timer methods
-- =======================
-- The SCHEDULER can be stopped and restarted with the following methods:
--
--
-- * @{#SCHEDULER.Start}: (Re-)Start the scheduler.
-- * @{#SCHEDULER.Start}: Stop the scheduler.
--
--
-- @module Scheduler
-- @author FlightControl
--- The SCHEDULER class
-- @type SCHEDULER
-- @field #number ScheduleID the ID of the scheduler.
-- @extends Base#BASE
SCHEDULER = {
ClassName = "SCHEDULER",
}
--- Constructor.
--- SCHEDULER constructor.
-- @param #SCHEDULER self
-- @param #table TimeEventObject Specified for which Moose object the timer is setup. If a value of nil is provided, a scheduler will be setup without an object reference.
-- @param #function TimeEventFunction The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in TimeEventFunctionArguments.
@ -63,10 +63,10 @@ function SCHEDULER:New( TimeEventObject, TimeEventFunction, TimeEventFunctionArg
if StopSeconds then
self.StopSeconds = StopSeconds
end
self.StartTime = timer.getTime()
self:Start()
return self
@ -77,12 +77,12 @@ end
-- @return #SCHEDULER self
function SCHEDULER:Start()
self:F2( self.TimeEventObject )
if self.RepeatSecondsInterval ~= 0 then
self.Repeat = true
end
timer.scheduleFunction( self._Scheduler, self, timer.getTime() + self.StartSeconds + .01 )
if self.RepeatSecondsInterval ~= 0 then
self.Repeat = true
end
self.ScheduleID = timer.scheduleFunction( self._Scheduler, self, timer.getTime() + self.StartSeconds + .01 )
return self
end
@ -91,17 +91,20 @@ end
-- @return #SCHEDULER self
function SCHEDULER:Stop()
self:F2( self.TimeEventObject )
self.Repeat = false
timer.removeFunction( self.ScheduleID )
self.ScheduleID = nil
return self
end
-- Private Functions
--- @param #SCHEDULER self
function SCHEDULER:_Scheduler()
self:F2( self.TimeEventFunctionArguments )
local ErrorHandler = function( errmsg )
env.info( "Error in SCHEDULER function:" .. errmsg )
@ -110,27 +113,37 @@ function SCHEDULER:_Scheduler()
return errmsg
end
local Status, Result
local Status, Result
if self.TimeEventObject then
Status, Result = xpcall( function() return self.TimeEventFunction( self.TimeEventObject, unpack( self.TimeEventFunctionArguments ) ) end, ErrorHandler )
else
Status, Result = xpcall( function() return self.TimeEventFunction( unpack( self.TimeEventFunctionArguments ) ) end, ErrorHandler )
end
self:T( { Status, Result, self.StartTime, self.RepeatSecondsInterval, self.RandomizationFactor, self.StopSeconds } )
self:T( { self.TimeEventFunctionArguments, Status, Result, self.StartTime, self.RepeatSecondsInterval, self.RandomizationFactor, self.StopSeconds } )
if Status and ( ( Result == nil ) or ( Result and Result ~= false ) ) then
if self.Repeat and ( not self.StopSeconds or ( self.StopSeconds and timer.getTime() <= self.StartTime + self.StopSeconds ) ) then
local ScheduleTime = timer.getTime() + self.RepeatSecondsInterval + math.random( - ( self.RandomizationFactor * self.RepeatSecondsInterval / 2 ), ( self.RandomizationFactor * self.RepeatSecondsInterval / 2 ) ) + 0.01
self:T( { timer.getTime(), ScheduleTime } )
timer.scheduleFunction(
self._Scheduler,
self,
ScheduleTime
)
local ScheduleTime =
timer.getTime() +
self.RepeatSecondsInterval +
math.random(
- ( self.RandomizationFactor * self.RepeatSecondsInterval / 2 ),
( self.RandomizationFactor * self.RepeatSecondsInterval / 2 )
) +
0.01
self:T( { self.TimeEventFunctionArguments, "Repeat:", timer.getTime(), ScheduleTime } )
return ScheduleTime -- returns the next time the function needs to be called.
else
timer.removeFunction( self.ScheduleID )
self.ScheduleID = nil
end
else
timer.removeFunction( self.ScheduleID )
self.ScheduleID = nil
end
return nil
end
@ -140,3 +153,11 @@ end

View File

@ -155,13 +155,13 @@ function UNIT:FindByName( UnitName )
end
function UNIT:GetDCSUnit()
local DCSUnit = Unit.getByName( self.UnitName )
if DCSUnit then
return DCSUnit
end
self:E( "Unit " .. self.UnitName .. " not found!" )
return nil
end

View File

@ -0,0 +1,2 @@
BASE:TraceOnOff( true )

View File

@ -1,13 +1,7 @@
local base = _G
Include = {}
Include.Path = function()
local str = debug.getinfo(2, "S").source
return str:match("(.*/)"):sub(1,-2):gsub("\\","/")
end
Include.Files = {}
Include.File = function( IncludeFile )
end
Include.Files = {}

View File

@ -0,0 +1,2 @@
BASE:TraceOnOff( false )

View File

@ -1,18 +1,12 @@
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20160614_1531' )
env.info( 'Moose Generation Timestamp: 20160615_0552' )
local base = _G
Include = {}
Include.Path = function()
local str = debug.getinfo(2, "S").source
return str:match("(.*/)"):sub(1,-2):gsub("\\","/")
end
Include.Files = {}
Include.File = function( IncludeFile )
end
Include.Files = {}
--- Various routines
-- @module routines
-- @author Flightcontrol
@ -2533,35 +2527,40 @@ end
env.info(( 'Init: Scripts Loaded v1.1' ))
--- BASE classes.
--- This module contains the BASE class.
--
-- @{#BASE} class
-- ==============
-- The @{#BASE} class is the super class for most of the classes defined within MOOSE.
-- 1) @{#BASE} class
-- =================
-- The @{#BASE} class is the super class for all the classes defined within MOOSE.
--
-- It handles:
--
-- * The construction and inheritance of child classes.
-- * The tracing of objects during mission execution within the DCS.log file (under saved games folder).
-- * The tracing of objects during mission execution within the **DCS.log** file, under the **"Saved Games\DCS\Logs"** folder.
--
-- Note: Normally you would not use the BASE class unless you are extending the MOOSE framework with new classes.
--
-- BASE Trace functionality
-- ========================
-- 1.1) BASE constructor
-- ---------------------
-- Any class derived from BASE, must use the @{Base#BASE.New) constructor within the @{Base#BASE.Inherit) method.
-- See an example at the @{Base#BASE.New} method how this is done.
--
-- 1.2) BASE Trace functionality
-- -----------------------------
-- The BASE class contains trace methods to trace progress within a mission execution of a certain object.
-- Note that these trace methods are inherited by each MOOSE class interiting BASE.
-- As such, each object created from derived class from BASE can use the tracing functions to trace its execution.
--
-- Trace a function call
-- ---------------------
-- 1.2.1) Tracing functions
-- ------------------------
-- There are basically 3 types of tracing methods available within BASE:
--
-- * @{#BASE.F}: Trace the beginning of a function and its given parameters.
-- * @{#BASE.T}: Trace further logic within a function giving optional variables or parameters.
-- * @{#BASE.E}: Trace an execption within a function giving optional variables or parameters. An exception will always be traced.
-- * @{#BASE.F}: Trace the beginning of a function and its given parameters. An F is indicated at column 44 in the DCS.log file.
-- * @{#BASE.T}: Trace further logic within a function giving optional variables or parameters. A T is indicated at column 44 in the DCS.log file.
-- * @{#BASE.E}: Trace an exception within a function giving optional variables or parameters. An E is indicated at column 44 in the DCS.log file. An exception will always be traced.
--
-- Tracing levels
-- --------------
-- 1.2.2) Tracing levels
-- ---------------------
-- There are 3 tracing levels within MOOSE.
-- These tracing levels were defined to avoid bulks of tracing to be generated by lots of objects.
--
@ -2572,8 +2571,8 @@ env.info(( 'Init: Scripts Loaded v1.1' ))
-- * @{#BASE.T2}: Trace further logic within a function giving optional variables or parameters with tracing level 2.
-- * @{#BASE.T3}: Trace further logic within a function giving optional variables or parameters with tracing level 3.
--
-- BASE Inheritance support
-- ========================
-- 1.3) BASE Inheritance support
-- ===========================
-- The following methods are available to support inheritance:
--
-- * @{#BASE.Inherit}: Inherits from a class.
@ -2590,16 +2589,19 @@ env.info(( 'Init: Scripts Loaded v1.1' ))
local _TraceOn = true
local _TraceOnOff = true
local _TraceLevel = 1
local _TraceAll = false
local _TraceClass = {}
local _TraceClassMethod = {}
local _ClassID = 0
--- The BASE Class
-- @type BASE
-- @field ClassName The name of the class.
-- @field ClassID The ID number of the class.
-- @field ClassNameAndID The name of the class concatenated with the ID number of the class.
BASE = {
ClassName = "BASE",
ClassID = 0,
@ -2621,27 +2623,29 @@ FORMATION = {
-- @param #BASE self
-- @return #BASE The new instance of the BASE class.
-- @usage
-- function TASK:New()
-- -- This declares the constructor of the class TASK, inheriting from BASE.
-- --- TASK constructor
-- -- @param #TASK self
-- -- @param Parameter The parameter of the New constructor.
-- -- @return #TASK self
-- function TASK:New( Parameter )
--
-- local self = BASE:Inherit( self, BASE:New() )
--
-- -- assign Task default values during construction
-- self.TaskBriefing = "Task: No Task."
-- self.Time = timer.getTime()
-- self.ExecuteStage = _TransportExecuteStage.NONE
--
-- self.Variable = Parameter
--
-- return self
-- end
-- @todo need to investigate if the deepCopy is really needed... Don't think so.
function BASE:New()
local Child = routines.utils.deepCopy( self )
local Parent = {}
setmetatable( Child, Parent )
Child.__index = Child
self.ClassID = self.ClassID + 1
Child.ClassID = self.ClassID
--Child.AddEvent( Child, S_EVENT_BIRTH, Child.EventBirth )
return Child
local self = routines.utils.deepCopy( self ) -- Create a new self instance
local MetaTable = {}
setmetatable( self, MetaTable )
self.__index = self
_ClassID = _ClassID + 1
self.ClassID = _ClassID
self.ClassNameAndID = string.format( '%s#%09d', self.ClassName, self.ClassID )
return self
end
--- This is the worker method to inherit from a parent class.
@ -2677,7 +2681,7 @@ end
-- @param #BASE self
-- @return #string The ClassName + ClassID of the class instance.
function BASE:GetClassNameAndID()
return string.format( '%s#%09d', self:GetClassName(), self:GetClassID() )
return self.ClassNameAndID
end
--- Get the ClassName of the class instance.
@ -2863,11 +2867,12 @@ end
function BASE:SetState( Object, StateName, State )
local ClassNameAndID = Object:GetClassNameAndID()
if not self.States[ClassNameAndID] then
self.States[ClassNameAndID] = {}
end
self.States[ClassNameAndID][StateName] = State
self:E( { ClassNameAndID, StateName, State } )
self:F2( { ClassNameAndID, StateName, State } )
return self.States[ClassNameAndID][StateName]
end
@ -2875,10 +2880,10 @@ end
function BASE:GetState( Object, StateName )
local ClassNameAndID = Object:GetClassNameAndID()
self:E( { ClassNameAndID } )
if self.States[ClassNameAndID] then
local State = self.States[ClassNameAndID][StateName]
self:E( { ClassNameAndID, StateName, State } )
self:F2( { ClassNameAndID, StateName, State } )
return State
end
@ -2898,6 +2903,23 @@ end
-- Log a trace (only shown when trace is on)
-- TODO: Make trace function using variable parameters.
--- Set trace on or off
-- Note that when trace is off, no debug statement is performed, increasing performance!
-- When Moose is loaded statically, (as one file), tracing is switched off by default.
-- So tracing must be switched on manually in your mission if you are using Moose statically.
-- When moose is loading dynamically (for moose class development), tracing is switched on by default.
-- @param BASE self
-- @param #boolean TraceOnOff Switch the tracing on or off.
-- @usage
-- -- Switch the tracing On
-- BASE:TraceOn( true )
--
-- -- Switch the tracing Off
-- BASE:TraceOn( false )
function BASE:TraceOnOff( TraceOnOff )
_TraceOnOff = TraceOnOff
end
--- Set trace level
-- @param #BASE self
-- @param #number Level
@ -2942,12 +2964,12 @@ function BASE:TraceClassMethod( Class, Method )
self:E( "Tracing method " .. Method .. " of class " .. Class )
end
--- Trace a function call. Must be at the beginning of the function logic.
--- Trace a function call. This function is private.
-- @param #BASE self
-- @param Arguments A #table or any field.
function BASE:F( Arguments, DebugInfoCurrentParam, DebugInfoFromParam )
function BASE:_F( Arguments, DebugInfoCurrentParam, DebugInfoFromParam )
if _TraceOn and ( ( _TraceAll == true ) or ( _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName] ) ) then
if ( _TraceAll == true ) or ( _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName] ) then
local DebugInfoCurrent = DebugInfoCurrentParam and DebugInfoCurrentParam or debug.getinfo( 2, "nl" )
local DebugInfoFrom = DebugInfoFromParam and DebugInfoFromParam or debug.getinfo( 3, "l" )
@ -2971,18 +2993,35 @@ function BASE:F( Arguments, DebugInfoCurrentParam, DebugInfoFromParam )
end
end
--- Trace a function call. Must be at the beginning of the function logic.
-- @param #BASE self
-- @param Arguments A #table or any field.
function BASE:F( Arguments )
if _TraceOnOff then
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
local DebugInfoFrom = debug.getinfo( 3, "l" )
if _TraceLevel >= 1 then
self:_F( Arguments, DebugInfoCurrent, DebugInfoFrom )
end
end
end
--- Trace a function call level 2. Must be at the beginning of the function logic.
-- @param #BASE self
-- @param Arguments A #table or any field.
function BASE:F2( Arguments )
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
local DebugInfoFrom = debug.getinfo( 3, "l" )
if _TraceLevel >= 2 then
self:F( Arguments, DebugInfoCurrent, DebugInfoFrom )
end
if _TraceOnOff then
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
local DebugInfoFrom = debug.getinfo( 3, "l" )
if _TraceLevel >= 2 then
self:_F( Arguments, DebugInfoCurrent, DebugInfoFrom )
end
end
end
--- Trace a function call level 3. Must be at the beginning of the function logic.
@ -2990,13 +3029,14 @@ end
-- @param Arguments A #table or any field.
function BASE:F3( Arguments )
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
local DebugInfoFrom = debug.getinfo( 3, "l" )
if _TraceLevel >= 3 then
self:F( Arguments, DebugInfoCurrent, DebugInfoFrom )
end
if _TraceOnOff then
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
local DebugInfoFrom = debug.getinfo( 3, "l" )
if _TraceLevel >= 3 then
self:_F( Arguments, DebugInfoCurrent, DebugInfoFrom )
end
end
end
--- Trace a function logic.
@ -3004,7 +3044,7 @@ end
-- @param Arguments A #table or any field.
function BASE:_T( Arguments, DebugInfoCurrentParam, DebugInfoFromParam )
if _TraceOn and ( ( _TraceAll == true ) or ( _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName] ) ) then
if ( _TraceAll == true ) or ( _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName] ) then
local DebugInfoCurrent = DebugInfoCurrentParam and DebugInfoCurrentParam or debug.getinfo( 2, "nl" )
local DebugInfoFrom = DebugInfoFromParam and DebugInfoFromParam or debug.getinfo( 3, "l" )
@ -3033,13 +3073,14 @@ end
-- @param Arguments A #table or any field.
function BASE:T( Arguments )
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
local DebugInfoFrom = debug.getinfo( 3, "l" )
if _TraceLevel >= 1 then
self:_T( Arguments, DebugInfoCurrent, DebugInfoFrom )
end
if _TraceOnOff then
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
local DebugInfoFrom = debug.getinfo( 3, "l" )
if _TraceLevel >= 1 then
self:_T( Arguments, DebugInfoCurrent, DebugInfoFrom )
end
end
end
@ -3048,13 +3089,14 @@ end
-- @param Arguments A #table or any field.
function BASE:T2( Arguments )
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
local DebugInfoFrom = debug.getinfo( 3, "l" )
if _TraceLevel >= 2 then
self:_T( Arguments, DebugInfoCurrent, DebugInfoFrom )
end
if _TraceOnOff then
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
local DebugInfoFrom = debug.getinfo( 3, "l" )
if _TraceLevel >= 2 then
self:_T( Arguments, DebugInfoCurrent, DebugInfoFrom )
end
end
end
--- Trace a function logic level 3. Can be anywhere within the function logic.
@ -3062,13 +3104,14 @@ end
-- @param Arguments A #table or any field.
function BASE:T3( Arguments )
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
local DebugInfoFrom = debug.getinfo( 3, "l" )
if _TraceLevel >= 3 then
self:_T( Arguments, DebugInfoCurrent, DebugInfoFrom )
end
if _TraceOnOff then
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
local DebugInfoFrom = debug.getinfo( 3, "l" )
if _TraceLevel >= 3 then
self:_T( Arguments, DebugInfoCurrent, DebugInfoFrom )
end
end
end
--- Log an exception which will be traced always. Can be anywhere within the function logic.
@ -3096,36 +3139,36 @@ end
--- Models time events calling event handing functions.
--
--
-- @{SCHEDULER} class
-- ===================
-- The @{SCHEDULER} class models time events calling given event handling functions.
--
--
-- SCHEDULER constructor
-- =====================
-- The SCHEDULER class is quite easy to use:
--
--
-- * @{#SCHEDULER.New}: Setup a new scheduler and start it with the specified parameters.
--
--
-- SCHEDULER timer methods
-- =======================
-- The SCHEDULER can be stopped and restarted with the following methods:
--
--
-- * @{#SCHEDULER.Start}: (Re-)Start the scheduler.
-- * @{#SCHEDULER.Start}: Stop the scheduler.
--
--
-- @module Scheduler
-- @author FlightControl
--- The SCHEDULER class
-- @type SCHEDULER
-- @field #number ScheduleID the ID of the scheduler.
-- @extends Base#BASE
SCHEDULER = {
ClassName = "SCHEDULER",
}
--- Constructor.
--- SCHEDULER constructor.
-- @param #SCHEDULER self
-- @param #table TimeEventObject Specified for which Moose object the timer is setup. If a value of nil is provided, a scheduler will be setup without an object reference.
-- @param #function TimeEventFunction The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in TimeEventFunctionArguments.
@ -3160,10 +3203,10 @@ function SCHEDULER:New( TimeEventObject, TimeEventFunction, TimeEventFunctionArg
if StopSeconds then
self.StopSeconds = StopSeconds
end
self.StartTime = timer.getTime()
self:Start()
return self
@ -3174,12 +3217,12 @@ end
-- @return #SCHEDULER self
function SCHEDULER:Start()
self:F2( self.TimeEventObject )
if self.RepeatSecondsInterval ~= 0 then
self.Repeat = true
end
timer.scheduleFunction( self._Scheduler, self, timer.getTime() + self.StartSeconds + .01 )
if self.RepeatSecondsInterval ~= 0 then
self.Repeat = true
end
self.ScheduleID = timer.scheduleFunction( self._Scheduler, self, timer.getTime() + self.StartSeconds + .01 )
return self
end
@ -3188,17 +3231,20 @@ end
-- @return #SCHEDULER self
function SCHEDULER:Stop()
self:F2( self.TimeEventObject )
self.Repeat = false
timer.removeFunction( self.ScheduleID )
self.ScheduleID = nil
return self
end
-- Private Functions
--- @param #SCHEDULER self
function SCHEDULER:_Scheduler()
self:F2( self.TimeEventFunctionArguments )
local ErrorHandler = function( errmsg )
env.info( "Error in SCHEDULER function:" .. errmsg )
@ -3207,27 +3253,37 @@ function SCHEDULER:_Scheduler()
return errmsg
end
local Status, Result
local Status, Result
if self.TimeEventObject then
Status, Result = xpcall( function() return self.TimeEventFunction( self.TimeEventObject, unpack( self.TimeEventFunctionArguments ) ) end, ErrorHandler )
else
Status, Result = xpcall( function() return self.TimeEventFunction( unpack( self.TimeEventFunctionArguments ) ) end, ErrorHandler )
end
self:T( { Status, Result, self.StartTime, self.RepeatSecondsInterval, self.RandomizationFactor, self.StopSeconds } )
self:T( { self.TimeEventFunctionArguments, Status, Result, self.StartTime, self.RepeatSecondsInterval, self.RandomizationFactor, self.StopSeconds } )
if Status and ( ( Result == nil ) or ( Result and Result ~= false ) ) then
if self.Repeat and ( not self.StopSeconds or ( self.StopSeconds and timer.getTime() <= self.StartTime + self.StopSeconds ) ) then
local ScheduleTime = timer.getTime() + self.RepeatSecondsInterval + math.random( - ( self.RandomizationFactor * self.RepeatSecondsInterval / 2 ), ( self.RandomizationFactor * self.RepeatSecondsInterval / 2 ) ) + 0.01
self:T( { timer.getTime(), ScheduleTime } )
timer.scheduleFunction(
self._Scheduler,
self,
ScheduleTime
)
local ScheduleTime =
timer.getTime() +
self.RepeatSecondsInterval +
math.random(
- ( self.RandomizationFactor * self.RepeatSecondsInterval / 2 ),
( self.RandomizationFactor * self.RepeatSecondsInterval / 2 )
) +
0.01
self:T( { self.TimeEventFunctionArguments, "Repeat:", timer.getTime(), ScheduleTime } )
return ScheduleTime -- returns the next time the function needs to be called.
else
timer.removeFunction( self.ScheduleID )
self.ScheduleID = nil
end
else
timer.removeFunction( self.ScheduleID )
self.ScheduleID = nil
end
return nil
end
@ -3237,6 +3293,14 @@ end
--- The EVENT class models an efficient event handling process between other classes and its units, weapons.
-- @module Event
-- @author FlightControl
@ -7011,13 +7075,13 @@ function UNIT:FindByName( UnitName )
end
function UNIT:GetDCSUnit()
local DCSUnit = Unit.getByName( self.UnitName )
if DCSUnit then
return DCSUnit
end
self:E( "Unit " .. self.UnitName .. " not found!" )
return nil
end
@ -8173,12 +8237,6 @@ end
-- @module Client
-- @author FlightControl
--- The CLIENT class
-- @type CLIENT
-- @extends Unit#UNIT
@ -8267,7 +8325,7 @@ function CLIENT:Register( ClientName )
self.ClientAlive2 = false
--self.AliveCheckScheduler = routines.scheduleFunction( self._AliveCheckScheduler, { self }, timer.getTime() + 1, 5 )
self.AliveCheckScheduler = SCHEDULER:New( self, self._AliveCheckScheduler, {}, 1, 5 )
self.AliveCheckScheduler = SCHEDULER:New( self, self._AliveCheckScheduler, { "Client Alive " .. ClientName }, 1, 5 )
self:E( self )
return self
@ -8377,10 +8435,11 @@ function CLIENT:Alive( CallBackFunction, ... )
end
--- @param #CLIENT self
function CLIENT:_AliveCheckScheduler()
self:F( { self.ClientName, self.ClientAlive2, self.ClientBriefingShown, self.ClientCallBack } )
function CLIENT:_AliveCheckScheduler( SchedulerName )
self:E( SchedulerName )
self:F( { SchedulerName, self.ClientName, self.ClientAlive2, self.ClientBriefingShown, self.ClientCallBack } )
if self:IsAlive() then -- Polymorphic call of UNIT
if self:IsAlive() then
if self.ClientAlive2 == false then
self:ShowBriefing()
if self.ClientCallBack then
@ -20064,4 +20123,6 @@ end
BASE:TraceOnOff( false )
env.info( '*** MOOSE INCLUDE END *** ' )

View File

@ -1,18 +1,12 @@
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20160614_1531' )
env.info( 'Moose Generation Timestamp: 20160615_0552' )
local base = _G
Include = {}
Include.Path = function()
local str = debug.getinfo(2, "S").source
return str:match("(.*/)"):sub(1,-2):gsub("\\","/")
end
Include.Files = {}
Include.File = function( IncludeFile )
end
Include.Files = {}
--- Various routines
-- @module routines
-- @author Flightcontrol
@ -2533,35 +2527,40 @@ end
env.info(( 'Init: Scripts Loaded v1.1' ))
--- BASE classes.
--- This module contains the BASE class.
--
-- @{#BASE} class
-- ==============
-- The @{#BASE} class is the super class for most of the classes defined within MOOSE.
-- 1) @{#BASE} class
-- =================
-- The @{#BASE} class is the super class for all the classes defined within MOOSE.
--
-- It handles:
--
-- * The construction and inheritance of child classes.
-- * The tracing of objects during mission execution within the DCS.log file (under saved games folder).
-- * The tracing of objects during mission execution within the **DCS.log** file, under the **"Saved Games\DCS\Logs"** folder.
--
-- Note: Normally you would not use the BASE class unless you are extending the MOOSE framework with new classes.
--
-- BASE Trace functionality
-- ========================
-- 1.1) BASE constructor
-- ---------------------
-- Any class derived from BASE, must use the @{Base#BASE.New) constructor within the @{Base#BASE.Inherit) method.
-- See an example at the @{Base#BASE.New} method how this is done.
--
-- 1.2) BASE Trace functionality
-- -----------------------------
-- The BASE class contains trace methods to trace progress within a mission execution of a certain object.
-- Note that these trace methods are inherited by each MOOSE class interiting BASE.
-- As such, each object created from derived class from BASE can use the tracing functions to trace its execution.
--
-- Trace a function call
-- ---------------------
-- 1.2.1) Tracing functions
-- ------------------------
-- There are basically 3 types of tracing methods available within BASE:
--
-- * @{#BASE.F}: Trace the beginning of a function and its given parameters.
-- * @{#BASE.T}: Trace further logic within a function giving optional variables or parameters.
-- * @{#BASE.E}: Trace an execption within a function giving optional variables or parameters. An exception will always be traced.
-- * @{#BASE.F}: Trace the beginning of a function and its given parameters. An F is indicated at column 44 in the DCS.log file.
-- * @{#BASE.T}: Trace further logic within a function giving optional variables or parameters. A T is indicated at column 44 in the DCS.log file.
-- * @{#BASE.E}: Trace an exception within a function giving optional variables or parameters. An E is indicated at column 44 in the DCS.log file. An exception will always be traced.
--
-- Tracing levels
-- --------------
-- 1.2.2) Tracing levels
-- ---------------------
-- There are 3 tracing levels within MOOSE.
-- These tracing levels were defined to avoid bulks of tracing to be generated by lots of objects.
--
@ -2572,8 +2571,8 @@ env.info(( 'Init: Scripts Loaded v1.1' ))
-- * @{#BASE.T2}: Trace further logic within a function giving optional variables or parameters with tracing level 2.
-- * @{#BASE.T3}: Trace further logic within a function giving optional variables or parameters with tracing level 3.
--
-- BASE Inheritance support
-- ========================
-- 1.3) BASE Inheritance support
-- ===========================
-- The following methods are available to support inheritance:
--
-- * @{#BASE.Inherit}: Inherits from a class.
@ -2590,16 +2589,19 @@ env.info(( 'Init: Scripts Loaded v1.1' ))
local _TraceOn = true
local _TraceOnOff = true
local _TraceLevel = 1
local _TraceAll = false
local _TraceClass = {}
local _TraceClassMethod = {}
local _ClassID = 0
--- The BASE Class
-- @type BASE
-- @field ClassName The name of the class.
-- @field ClassID The ID number of the class.
-- @field ClassNameAndID The name of the class concatenated with the ID number of the class.
BASE = {
ClassName = "BASE",
ClassID = 0,
@ -2621,27 +2623,29 @@ FORMATION = {
-- @param #BASE self
-- @return #BASE The new instance of the BASE class.
-- @usage
-- function TASK:New()
-- -- This declares the constructor of the class TASK, inheriting from BASE.
-- --- TASK constructor
-- -- @param #TASK self
-- -- @param Parameter The parameter of the New constructor.
-- -- @return #TASK self
-- function TASK:New( Parameter )
--
-- local self = BASE:Inherit( self, BASE:New() )
--
-- -- assign Task default values during construction
-- self.TaskBriefing = "Task: No Task."
-- self.Time = timer.getTime()
-- self.ExecuteStage = _TransportExecuteStage.NONE
--
-- self.Variable = Parameter
--
-- return self
-- end
-- @todo need to investigate if the deepCopy is really needed... Don't think so.
function BASE:New()
local Child = routines.utils.deepCopy( self )
local Parent = {}
setmetatable( Child, Parent )
Child.__index = Child
self.ClassID = self.ClassID + 1
Child.ClassID = self.ClassID
--Child.AddEvent( Child, S_EVENT_BIRTH, Child.EventBirth )
return Child
local self = routines.utils.deepCopy( self ) -- Create a new self instance
local MetaTable = {}
setmetatable( self, MetaTable )
self.__index = self
_ClassID = _ClassID + 1
self.ClassID = _ClassID
self.ClassNameAndID = string.format( '%s#%09d', self.ClassName, self.ClassID )
return self
end
--- This is the worker method to inherit from a parent class.
@ -2677,7 +2681,7 @@ end
-- @param #BASE self
-- @return #string The ClassName + ClassID of the class instance.
function BASE:GetClassNameAndID()
return string.format( '%s#%09d', self:GetClassName(), self:GetClassID() )
return self.ClassNameAndID
end
--- Get the ClassName of the class instance.
@ -2863,11 +2867,12 @@ end
function BASE:SetState( Object, StateName, State )
local ClassNameAndID = Object:GetClassNameAndID()
if not self.States[ClassNameAndID] then
self.States[ClassNameAndID] = {}
end
self.States[ClassNameAndID][StateName] = State
self:E( { ClassNameAndID, StateName, State } )
self:F2( { ClassNameAndID, StateName, State } )
return self.States[ClassNameAndID][StateName]
end
@ -2875,10 +2880,10 @@ end
function BASE:GetState( Object, StateName )
local ClassNameAndID = Object:GetClassNameAndID()
self:E( { ClassNameAndID } )
if self.States[ClassNameAndID] then
local State = self.States[ClassNameAndID][StateName]
self:E( { ClassNameAndID, StateName, State } )
self:F2( { ClassNameAndID, StateName, State } )
return State
end
@ -2898,6 +2903,23 @@ end
-- Log a trace (only shown when trace is on)
-- TODO: Make trace function using variable parameters.
--- Set trace on or off
-- Note that when trace is off, no debug statement is performed, increasing performance!
-- When Moose is loaded statically, (as one file), tracing is switched off by default.
-- So tracing must be switched on manually in your mission if you are using Moose statically.
-- When moose is loading dynamically (for moose class development), tracing is switched on by default.
-- @param BASE self
-- @param #boolean TraceOnOff Switch the tracing on or off.
-- @usage
-- -- Switch the tracing On
-- BASE:TraceOn( true )
--
-- -- Switch the tracing Off
-- BASE:TraceOn( false )
function BASE:TraceOnOff( TraceOnOff )
_TraceOnOff = TraceOnOff
end
--- Set trace level
-- @param #BASE self
-- @param #number Level
@ -2942,12 +2964,12 @@ function BASE:TraceClassMethod( Class, Method )
self:E( "Tracing method " .. Method .. " of class " .. Class )
end
--- Trace a function call. Must be at the beginning of the function logic.
--- Trace a function call. This function is private.
-- @param #BASE self
-- @param Arguments A #table or any field.
function BASE:F( Arguments, DebugInfoCurrentParam, DebugInfoFromParam )
function BASE:_F( Arguments, DebugInfoCurrentParam, DebugInfoFromParam )
if _TraceOn and ( ( _TraceAll == true ) or ( _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName] ) ) then
if ( _TraceAll == true ) or ( _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName] ) then
local DebugInfoCurrent = DebugInfoCurrentParam and DebugInfoCurrentParam or debug.getinfo( 2, "nl" )
local DebugInfoFrom = DebugInfoFromParam and DebugInfoFromParam or debug.getinfo( 3, "l" )
@ -2971,18 +2993,35 @@ function BASE:F( Arguments, DebugInfoCurrentParam, DebugInfoFromParam )
end
end
--- Trace a function call. Must be at the beginning of the function logic.
-- @param #BASE self
-- @param Arguments A #table or any field.
function BASE:F( Arguments )
if _TraceOnOff then
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
local DebugInfoFrom = debug.getinfo( 3, "l" )
if _TraceLevel >= 1 then
self:_F( Arguments, DebugInfoCurrent, DebugInfoFrom )
end
end
end
--- Trace a function call level 2. Must be at the beginning of the function logic.
-- @param #BASE self
-- @param Arguments A #table or any field.
function BASE:F2( Arguments )
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
local DebugInfoFrom = debug.getinfo( 3, "l" )
if _TraceLevel >= 2 then
self:F( Arguments, DebugInfoCurrent, DebugInfoFrom )
end
if _TraceOnOff then
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
local DebugInfoFrom = debug.getinfo( 3, "l" )
if _TraceLevel >= 2 then
self:_F( Arguments, DebugInfoCurrent, DebugInfoFrom )
end
end
end
--- Trace a function call level 3. Must be at the beginning of the function logic.
@ -2990,13 +3029,14 @@ end
-- @param Arguments A #table or any field.
function BASE:F3( Arguments )
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
local DebugInfoFrom = debug.getinfo( 3, "l" )
if _TraceLevel >= 3 then
self:F( Arguments, DebugInfoCurrent, DebugInfoFrom )
end
if _TraceOnOff then
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
local DebugInfoFrom = debug.getinfo( 3, "l" )
if _TraceLevel >= 3 then
self:_F( Arguments, DebugInfoCurrent, DebugInfoFrom )
end
end
end
--- Trace a function logic.
@ -3004,7 +3044,7 @@ end
-- @param Arguments A #table or any field.
function BASE:_T( Arguments, DebugInfoCurrentParam, DebugInfoFromParam )
if _TraceOn and ( ( _TraceAll == true ) or ( _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName] ) ) then
if ( _TraceAll == true ) or ( _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName] ) then
local DebugInfoCurrent = DebugInfoCurrentParam and DebugInfoCurrentParam or debug.getinfo( 2, "nl" )
local DebugInfoFrom = DebugInfoFromParam and DebugInfoFromParam or debug.getinfo( 3, "l" )
@ -3033,13 +3073,14 @@ end
-- @param Arguments A #table or any field.
function BASE:T( Arguments )
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
local DebugInfoFrom = debug.getinfo( 3, "l" )
if _TraceLevel >= 1 then
self:_T( Arguments, DebugInfoCurrent, DebugInfoFrom )
end
if _TraceOnOff then
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
local DebugInfoFrom = debug.getinfo( 3, "l" )
if _TraceLevel >= 1 then
self:_T( Arguments, DebugInfoCurrent, DebugInfoFrom )
end
end
end
@ -3048,13 +3089,14 @@ end
-- @param Arguments A #table or any field.
function BASE:T2( Arguments )
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
local DebugInfoFrom = debug.getinfo( 3, "l" )
if _TraceLevel >= 2 then
self:_T( Arguments, DebugInfoCurrent, DebugInfoFrom )
end
if _TraceOnOff then
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
local DebugInfoFrom = debug.getinfo( 3, "l" )
if _TraceLevel >= 2 then
self:_T( Arguments, DebugInfoCurrent, DebugInfoFrom )
end
end
end
--- Trace a function logic level 3. Can be anywhere within the function logic.
@ -3062,13 +3104,14 @@ end
-- @param Arguments A #table or any field.
function BASE:T3( Arguments )
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
local DebugInfoFrom = debug.getinfo( 3, "l" )
if _TraceLevel >= 3 then
self:_T( Arguments, DebugInfoCurrent, DebugInfoFrom )
end
if _TraceOnOff then
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
local DebugInfoFrom = debug.getinfo( 3, "l" )
if _TraceLevel >= 3 then
self:_T( Arguments, DebugInfoCurrent, DebugInfoFrom )
end
end
end
--- Log an exception which will be traced always. Can be anywhere within the function logic.
@ -3096,36 +3139,36 @@ end
--- Models time events calling event handing functions.
--
--
-- @{SCHEDULER} class
-- ===================
-- The @{SCHEDULER} class models time events calling given event handling functions.
--
--
-- SCHEDULER constructor
-- =====================
-- The SCHEDULER class is quite easy to use:
--
--
-- * @{#SCHEDULER.New}: Setup a new scheduler and start it with the specified parameters.
--
--
-- SCHEDULER timer methods
-- =======================
-- The SCHEDULER can be stopped and restarted with the following methods:
--
--
-- * @{#SCHEDULER.Start}: (Re-)Start the scheduler.
-- * @{#SCHEDULER.Start}: Stop the scheduler.
--
--
-- @module Scheduler
-- @author FlightControl
--- The SCHEDULER class
-- @type SCHEDULER
-- @field #number ScheduleID the ID of the scheduler.
-- @extends Base#BASE
SCHEDULER = {
ClassName = "SCHEDULER",
}
--- Constructor.
--- SCHEDULER constructor.
-- @param #SCHEDULER self
-- @param #table TimeEventObject Specified for which Moose object the timer is setup. If a value of nil is provided, a scheduler will be setup without an object reference.
-- @param #function TimeEventFunction The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in TimeEventFunctionArguments.
@ -3160,10 +3203,10 @@ function SCHEDULER:New( TimeEventObject, TimeEventFunction, TimeEventFunctionArg
if StopSeconds then
self.StopSeconds = StopSeconds
end
self.StartTime = timer.getTime()
self:Start()
return self
@ -3174,12 +3217,12 @@ end
-- @return #SCHEDULER self
function SCHEDULER:Start()
self:F2( self.TimeEventObject )
if self.RepeatSecondsInterval ~= 0 then
self.Repeat = true
end
timer.scheduleFunction( self._Scheduler, self, timer.getTime() + self.StartSeconds + .01 )
if self.RepeatSecondsInterval ~= 0 then
self.Repeat = true
end
self.ScheduleID = timer.scheduleFunction( self._Scheduler, self, timer.getTime() + self.StartSeconds + .01 )
return self
end
@ -3188,17 +3231,20 @@ end
-- @return #SCHEDULER self
function SCHEDULER:Stop()
self:F2( self.TimeEventObject )
self.Repeat = false
timer.removeFunction( self.ScheduleID )
self.ScheduleID = nil
return self
end
-- Private Functions
--- @param #SCHEDULER self
function SCHEDULER:_Scheduler()
self:F2( self.TimeEventFunctionArguments )
local ErrorHandler = function( errmsg )
env.info( "Error in SCHEDULER function:" .. errmsg )
@ -3207,27 +3253,37 @@ function SCHEDULER:_Scheduler()
return errmsg
end
local Status, Result
local Status, Result
if self.TimeEventObject then
Status, Result = xpcall( function() return self.TimeEventFunction( self.TimeEventObject, unpack( self.TimeEventFunctionArguments ) ) end, ErrorHandler )
else
Status, Result = xpcall( function() return self.TimeEventFunction( unpack( self.TimeEventFunctionArguments ) ) end, ErrorHandler )
end
self:T( { Status, Result, self.StartTime, self.RepeatSecondsInterval, self.RandomizationFactor, self.StopSeconds } )
self:T( { self.TimeEventFunctionArguments, Status, Result, self.StartTime, self.RepeatSecondsInterval, self.RandomizationFactor, self.StopSeconds } )
if Status and ( ( Result == nil ) or ( Result and Result ~= false ) ) then
if self.Repeat and ( not self.StopSeconds or ( self.StopSeconds and timer.getTime() <= self.StartTime + self.StopSeconds ) ) then
local ScheduleTime = timer.getTime() + self.RepeatSecondsInterval + math.random( - ( self.RandomizationFactor * self.RepeatSecondsInterval / 2 ), ( self.RandomizationFactor * self.RepeatSecondsInterval / 2 ) ) + 0.01
self:T( { timer.getTime(), ScheduleTime } )
timer.scheduleFunction(
self._Scheduler,
self,
ScheduleTime
)
local ScheduleTime =
timer.getTime() +
self.RepeatSecondsInterval +
math.random(
- ( self.RandomizationFactor * self.RepeatSecondsInterval / 2 ),
( self.RandomizationFactor * self.RepeatSecondsInterval / 2 )
) +
0.01
self:T( { self.TimeEventFunctionArguments, "Repeat:", timer.getTime(), ScheduleTime } )
return ScheduleTime -- returns the next time the function needs to be called.
else
timer.removeFunction( self.ScheduleID )
self.ScheduleID = nil
end
else
timer.removeFunction( self.ScheduleID )
self.ScheduleID = nil
end
return nil
end
@ -3237,6 +3293,14 @@ end
--- The EVENT class models an efficient event handling process between other classes and its units, weapons.
-- @module Event
-- @author FlightControl
@ -7011,13 +7075,13 @@ function UNIT:FindByName( UnitName )
end
function UNIT:GetDCSUnit()
local DCSUnit = Unit.getByName( self.UnitName )
if DCSUnit then
return DCSUnit
end
self:E( "Unit " .. self.UnitName .. " not found!" )
return nil
end
@ -8173,12 +8237,6 @@ end
-- @module Client
-- @author FlightControl
--- The CLIENT class
-- @type CLIENT
-- @extends Unit#UNIT
@ -8267,7 +8325,7 @@ function CLIENT:Register( ClientName )
self.ClientAlive2 = false
--self.AliveCheckScheduler = routines.scheduleFunction( self._AliveCheckScheduler, { self }, timer.getTime() + 1, 5 )
self.AliveCheckScheduler = SCHEDULER:New( self, self._AliveCheckScheduler, {}, 1, 5 )
self.AliveCheckScheduler = SCHEDULER:New( self, self._AliveCheckScheduler, { "Client Alive " .. ClientName }, 1, 5 )
self:E( self )
return self
@ -8377,10 +8435,11 @@ function CLIENT:Alive( CallBackFunction, ... )
end
--- @param #CLIENT self
function CLIENT:_AliveCheckScheduler()
self:F( { self.ClientName, self.ClientAlive2, self.ClientBriefingShown, self.ClientCallBack } )
function CLIENT:_AliveCheckScheduler( SchedulerName )
self:E( SchedulerName )
self:F( { SchedulerName, self.ClientName, self.ClientAlive2, self.ClientBriefingShown, self.ClientCallBack } )
if self:IsAlive() then -- Polymorphic call of UNIT
if self:IsAlive() then
if self.ClientAlive2 == false then
self:ShowBriefing()
if self.ClientCallBack then
@ -20064,4 +20123,6 @@ end
BASE:TraceOnOff( false )
env.info( '*** MOOSE INCLUDE END *** ' )

View File

@ -19,10 +19,11 @@ GOTO End
ECHO Dynamic Moose.lua
REM Create a timestamp with is logged in the DCS.log file.
ECHO env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' ) > Moose.lua
ECHO env.info( 'Moose Generation Timestamp: %2' ) >> Moose.lua
ECHO env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' ) > Moose.lua
ECHO env.info( 'Moose Generation Timestamp: %2' ) >> Moose.lua
COPY /b Moose.lua + "Moose Create Dynamic\Moose_Dynamic_Loader.lua" Moose.lua
COPY /b Moose.lua + "Moose Create Dynamic\Moose_Dynamic_Loader.lua" Moose.lua
COPY /b Moose.lua + "Moose Create Dynamic\Moose_Trace_On.lua" Moose.lua
GOTO End
@ -34,49 +35,51 @@ REM Create a timestamp with is logged in the DCS.log file.
ECHO env.info( '*** MOOSE STATIC INCLUDE START *** ' ) > Moose.lua
ECHO env.info( 'Moose Generation Timestamp: %2' ) >> Moose.lua
COPY /b Moose.lua + "Moose Create Static\Moose_Static_Loader.lua" Moose.lua
COPY /b Moose.lua + "Moose Create Static\Moose_Static_Loader.lua" Moose.lua
COPY /b Moose.lua + %1\Routines.lua Moose.lua
COPY /b Moose.lua + %1\Base.lua Moose.lua
COPY /b Moose.lua + %1\Scheduler.lua Moose.lua
COPY /b Moose.lua + %1\Event.lua Moose.lua
COPY /b Moose.lua + %1\Menu.lua Moose.lua
COPY /b Moose.lua + %1\Group.lua Moose.lua
COPY /b Moose.lua + %1\Unit.lua Moose.lua
COPY /b Moose.lua + %1\Zone.lua Moose.lua
COPY /b Moose.lua + %1\Client.lua Moose.lua
COPY /b Moose.lua + %1\Static.lua Moose.lua
COPY /b Moose.lua + %1\Database.lua Moose.lua
COPY /b Moose.lua + %1\Set.lua Moose.lua
COPY /b Moose.lua + %1\Point.lua Moose.lua
COPY /b Moose.lua + %1\Moose.lua Moose.lua
COPY /b Moose.lua + %1\Scoring.lua Moose.lua
COPY /b Moose.lua + %1\Cargo.lua Moose.lua
COPY /b Moose.lua + %1\Message.lua Moose.lua
COPY /b Moose.lua + %1\Stage.lua Moose.lua
COPY /b Moose.lua + %1\Task.lua Moose.lua
COPY /b Moose.lua + %1\GoHomeTask.lua Moose.lua
COPY /b Moose.lua + %1\DestroyBaseTask.lua Moose.lua
COPY /b Moose.lua + %1\DestroyGroupsTask.lua Moose.lua
COPY /b Moose.lua + %1\DestroyRadarsTask.lua Moose.lua
COPY /b Moose.lua + %1\DestroyUnitTypesTask.lua Moose.lua
COPY /b Moose.lua + %1\PickupTask.lua Moose.lua
COPY /b Moose.lua + %1\DeployTask.lua Moose.lua
COPY /b Moose.lua + %1\NoTask.lua Moose.lua
COPY /b Moose.lua + %1\RouteTask.lua Moose.lua
COPY /b Moose.lua + %1\Mission.lua Moose.lua
COPY /b Moose.lua + %1\CleanUp.lua Moose.lua
COPY /b Moose.lua + %1\Spawn.lua Moose.lua
COPY /b Moose.lua + %1\Movement.lua Moose.lua
COPY /b Moose.lua + %1\Sead.lua Moose.lua
COPY /b Moose.lua + %1\Escort.lua Moose.lua
COPY /b Moose.lua + %1\MissileTrainer.lua Moose.lua
COPY /b Moose.lua + %1\AIBalancer.lua Moose.lua
COPY /b Moose.lua + %1\Routines.lua Moose.lua
COPY /b Moose.lua + %1\Base.lua Moose.lua
COPY /b Moose.lua + %1\Scheduler.lua Moose.lua
COPY /b Moose.lua + %1\Event.lua Moose.lua
COPY /b Moose.lua + %1\Menu.lua Moose.lua
COPY /b Moose.lua + %1\Group.lua Moose.lua
COPY /b Moose.lua + %1\Unit.lua Moose.lua
COPY /b Moose.lua + %1\Zone.lua Moose.lua
COPY /b Moose.lua + %1\Client.lua Moose.lua
COPY /b Moose.lua + %1\Static.lua Moose.lua
COPY /b Moose.lua + %1\Database.lua Moose.lua
COPY /b Moose.lua + %1\Set.lua Moose.lua
COPY /b Moose.lua + %1\Point.lua Moose.lua
COPY /b Moose.lua + %1\Moose.lua Moose.lua
COPY /b Moose.lua + %1\Scoring.lua Moose.lua
COPY /b Moose.lua + %1\Cargo.lua Moose.lua
COPY /b Moose.lua + %1\Message.lua Moose.lua
COPY /b Moose.lua + %1\Stage.lua Moose.lua
COPY /b Moose.lua + %1\Task.lua Moose.lua
COPY /b Moose.lua + %1\GoHomeTask.lua Moose.lua
COPY /b Moose.lua + %1\DestroyBaseTask.lua Moose.lua
COPY /b Moose.lua + %1\DestroyGroupsTask.lua Moose.lua
COPY /b Moose.lua + %1\DestroyRadarsTask.lua Moose.lua
COPY /b Moose.lua + %1\DestroyUnitTypesTask.lua Moose.lua
COPY /b Moose.lua + %1\PickupTask.lua Moose.lua
COPY /b Moose.lua + %1\DeployTask.lua Moose.lua
COPY /b Moose.lua + %1\NoTask.lua Moose.lua
COPY /b Moose.lua + %1\RouteTask.lua Moose.lua
COPY /b Moose.lua + %1\Mission.lua Moose.lua
COPY /b Moose.lua + %1\CleanUp.lua Moose.lua
COPY /b Moose.lua + %1\Spawn.lua Moose.lua
COPY /b Moose.lua + %1\Movement.lua Moose.lua
COPY /b Moose.lua + %1\Sead.lua Moose.lua
COPY /b Moose.lua + %1\Escort.lua Moose.lua
COPY /b Moose.lua + %1\MissileTrainer.lua Moose.lua
COPY /b Moose.lua + %1\AIBalancer.lua Moose.lua
COPY /b Moose.lua + "Moose Create Static\Moose_Trace_Off.lua" Moose.lua
GOTO End
:End
ECHO env.info( '*** MOOSE INCLUDE END *** ' ) >> Moose.lua
ECHO env.info( '*** MOOSE INCLUDE END *** ' ) >> Moose.lua
COPY Moose.lua %3