MOOSE - Mission Object Oriented Scripting Framework - Page 3 - ED Forums
 


Notices

Reply
 
Thread Tools Display Modes
Old 01-30-2015, 03:58 PM   #21
Lilkiki
Member
 
Lilkiki's Avatar
 
Join Date: Jun 2013
Location: France
Posts: 607
Default

Many thanks for your help !!

Actually, my "mod" is a fake "unit", it is actually labelled as a "structure" but it can be easily changed to a fake "mechanised unit".

I will look to gory_valley.miz and see if I can manage with it !

Thanks again !
__________________
Lilkiki is offline   Reply With Quote
Old 01-30-2015, 04:23 PM   #22
FlightControl
Senior Member
 
FlightControl's Avatar
 
Join Date: Mar 2012
Location: Antwerp, Belgium
Posts: 2,015
Default

Question to you all and ed dev team. As you can see, the framework moose consists put of several lua source files. The mission editor is pretty bad at importing multiple lua sources into a mission file. It is very labour intensive and every time you update a lua file you need to reimport the file in the mission. That is why I am currently using the installation trick. The framework is installed in the scripts directory and with a hook in missionscripting.lua I managed to make dcs multiplayer to load the framework before missin startup. This is all nice as long as players have the framework installed. Is there any technique that would allow to "publish" the framework into a miz file and post it embedded within the mission without having to manually import every lua script file? Believe me, I've been there... Help or ideas would be appreciated... Sv.
__________________
FlightControl is offline   Reply With Quote
Old 01-30-2015, 06:02 PM   #23
Flagrum
Veteran
 
Flagrum's Avatar
 
Join Date: Feb 2013
Location: 32U MC0539
Posts: 6,016
Default

Quote:
Originally Posted by svenvandevelde View Post
Question to you all and ed dev team. As you can see, the framework moose consists put of several lua source files. The mission editor is pretty bad at importing multiple lua sources into a mission file. It is very labour intensive and every time you update a lua file you need to reimport the file in the mission. That is why I am currently using the installation trick. The framework is installed in the scripts directory and with a hook in missionscripting.lua I managed to make dcs multiplayer to load the framework before missin startup. This is all nice as long as players have the framework installed. Is there any technique that would allow to "publish" the framework into a miz file and post it embedded within the mission without having to manually import every lua script file? Believe me, I've been there... Help or ideas would be appreciated... Sv.
When you use a DO SCRIPT FILE somewhere, the ME copies the .LUA file into the MIZ file. When starting such a mission, it is first unpacked in the %TEMP% folder and then DCS uses these temporary files. I think, this temporary folder is added to the scripts path that DCS uses.

I have not tested this, but this should then work as well:
- DO SCRIPT FILE "A.LUA"
- a.lua requires() an file b.lua
- b.lua is NOT included in the .MIZ automatically as nobody DO SCRIPT FILEed it anywhere
- open .MIZ file, add b.lua manually
- ???
- Profit ...?

Maybe already known by you, but just to make sure: afaik the ME checks only the file name of an DO SCRIPT FILE statement. If that lua alreads was importet into the .MIZ file by DCS, it will not import it again. This is a pita if you change your (external) version of the file and want the updated version to be used by DCS. Removing the DO SCRIPT FILE and re-applying it should work, but you cal also always update the .MIZ manually with your newer version.

(It would be cool if ED would add some "compile mission" function to the ME. This would then import all external ressources (lua scripts, mission briefing pics, etc.) into the .MIZ file, regardless if thy were already imported earlier.)
__________________
DCS - Digital Combat Simulator
"Don't get yourselves too excited" *


Flagrum is offline   Reply With Quote
Old 01-30-2015, 06:33 PM   #24
Shahdoh
Member
 
Shahdoh's Avatar
 
Join Date: Jan 2013
Posts: 942
Default

H'lo,
I am trying to use MOOSE for the cleanup function but seem to be having some problems. Using Gori Valley mission as an example, I took the .lua file and stripped it down to just the cleanup portion:
Spoiler:
Code:
Include.File( "Mission" )
Include.File( "Client" )
Include.File( "DeployTask" )
Include.File( "PickupTask" )
Include.File( "SlingLoadHookTask" )
Include.File( "SlingLoadUnHookTask" )
Include.File( "DestroyGroupsTask" )
Include.File( "DestroyRadarsTask" )
Include.File( "DestroyUnitTypesTask" )
Include.File( "GoHomeTask" )
Include.File( "Spawn" )
Include.File( "Movement" )
Include.File( "Sead" )
Include.File( "CleanUp" )



--- Keep some airports clean
CLEANUP_Airports = CLEANUP:New( { 'Clean Sochi' }, 60 )


-- MISSION SCHEDULER STARTUP
MISSIONSCHEDULER.Start()
MISSIONSCHEDULER.ReportMenu()
MISSIONSCHEDULER.ReportMissionsFlash( 120 )

env.info( "VA Cleanup.lua loaded" )


MOOSE is installed, but had to modify the MissionScripting.lua because I am also using Witchcraft and SLMOD. Below is how I added it:
Spoiler:
Code:
dofile('Scripts/ScriptingSystem.lua')

--MOOSE
Include = {}

Include.LoadPath = 'Scripts/MOOSE'
Include.Files = {}

Include.File = function( IncludeFile )
	if not Include.Files[ IncludeFile ] then
		Include.Files[IncludeFile] = IncludeFile
		dofile( Include.LoadPath .. "/" .. IncludeFile .. ".lua" )
		env.info( "Include:" .. IncludeFile .. " loaded." )
	end
end

Include.File( "Trace" )
Include.File( "Routines" )
Include.File( "Database" )
Include.File( "StatHandler" )

--Witchcraft
witchcraft = {}
witchcraft.host = "localhost"
witchcraft.port = 3001
dofile(lfs.writedir()..[[Scripts\witchcraft.lua]])


local function sanitizeModule(name)
	_G[name] = nil
	package.loaded[name] = nil
end
-------------------------------------------------------------------------------------------------------
-- Slmod begins here.


I edited the mission to Do Script File on the cleanup.lua and also added the trigger area in the mission.

It does not appear to be cleaning the wrecks (client spawned aircraft, crashed on purpose) off the trigger areas in either the Gori Valley mission or my edited mission. I did notice that I am getting these errors repeatedly in the DCS.log file

Spoiler:
Code:
00080.980 ERROR   DCS: Mission script error: : error in error handling
00081.036 INFO    SCRIPTING: Error in scheduled function:[string "Scripts/MOOSE/Trace.lua"]:99: attempt to index global 'debug' (a nil value)
00081.036 INFO    SCRIPTING: Error in scheduled function:[string "Scripts/MOOSE/Routines.lua"]:476: attempt to index global 'debug' (a nil value)
00081.036 WARNING LOG: 195 duplicate message(s) skipped.
00081.036 INFO    SCRIPTING: Error in scheduled function:[string "Scripts/MOOSE/Routines.lua"]:476: C stack overflow
00081.036 INFO    SCRIPTING: Error in scheduled function:[string "Scripts/MOOSE/Routines.lua"]:476: attempt to index global 'debug' (a nil value)
00081.782 WARNING LOG: 22 duplicate message(s) skipped.


Have been looking forward to a cleanup of wreckage script for a long while and look forward to getting this working.

Thank you for any help you can provide.
Shahdoh

Last edited by Shahdoh; 01-30-2015 at 07:00 PM.
Shahdoh is online now   Reply With Quote
Old 01-30-2015, 06:40 PM   #25
Lilkiki
Member
 
Lilkiki's Avatar
 
Join Date: Jun 2013
Location: France
Posts: 607
Default

Hi Shahdoh, same for me , I can't maneged to make the CLEANUP function working, even with "Gory valley" sample miz
__________________
Lilkiki is offline   Reply With Quote
Old 02-03-2015, 01:12 AM   #26
Shahdoh
Member
 
Shahdoh's Avatar
 
Join Date: Jan 2013
Posts: 942
Default

Any thoughts on why the cleanup isnt working?
Shahdoh is online now   Reply With Quote
Old 02-03-2015, 06:06 AM   #27
FlightControl
Senior Member
 
FlightControl's Avatar
 
Join Date: Mar 2012
Location: Antwerp, Belgium
Posts: 2,015
Default

Yes. I have. I spent yesterday 5 hours trying to find the reason. It is simple. Ground units cannot be cleaned when they burn... It is the sim. Airplanes are okay, ground units is a problem. Found many topics on the forum about this. That being said, it might be possible to have a workaround like xcom mentions on one of his posts. Capture the hit event I guess, destroy the unit yourself so it disappears and generate an explosion. This could be implemented for units within the zones. It is not ideal. Disappointed.
__________________
FlightControl is offline   Reply With Quote
Old 02-03-2015, 07:57 AM   #28
xcom
Senior Member
 
xcom's Avatar
 
Join Date: Jun 2012
Posts: 1,368
Default

Sven, I still haven't tested everything, but with the destroygroupstask, should the task % raise according to the group being dead or units in the group being dead? do I need to set the % manually or is it automatically updating?

unfortunately it does not work for any of the tasks I set in the last mission I uploaded here.

Secondly, a nice to have - make the mission/task/goal messages look better, right now they are kind of hard to read and not sorted, it would be nice to see them in a table for example.

I still think this framework is amazing, and eventually after I get how this works, I'll most definitely use it in most of my missions!
xcom is offline   Reply With Quote
Old 02-03-2015, 11:10 AM   #29
Shahdoh
Member
 
Shahdoh's Avatar
 
Join Date: Jan 2013
Posts: 942
Default

Ok, but it is the aircraft wrecks (client created), that are not getting cleaned up on my server, using either the demo mission or my own.
Shahdoh is online now   Reply With Quote
Old 02-03-2015, 02:58 PM   #30
Lilkiki
Member
 
Lilkiki's Avatar
 
Join Date: Jun 2013
Location: France
Posts: 607
Default

Quote:
Originally Posted by svenvandevelde View Post
Yes. I have. I spent yesterday 5 hours trying to find the reason. It is simple. Ground units cannot be cleaned when they burn...
Thanks Sven for your effort !
__________________
Lilkiki is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 10:51 PM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.