FlightControl-Master / MOOSE

Mission Object Oriented Scripting Environment (MOOSE) for lua mission scripting design in DCS World
http://flightcontrol-master.github.io/MOOSE/
GNU General Public License v3.0
290 stars 94 forks source link

Add dynamic mission script approach to documentation and demo mission #2083

Open kaltokri opened 8 months ago

kaltokri commented 8 months ago

With the lua code below it is possible to to create a hybrid betwenn dynamic and static mission script Integration. This allows a fast development of mission scripts without reintegration after every change. But as soon as a good level is reached the script can be reintegrated and shared with others or uploaded to a server easily. So we should add it to documentation under Advanced and add one demo mission as show case.

MissionScript = lfs.writedir() .. '/Missions/hello-world-dyn.lua'

-- Use script file from hard disk instead of the one included in the .miz file
if string.find( debug.getinfo(1).source, lfs.tempdir() ) then
  local f=io.open(MissionScript,"r")
  if f~=nil then
    io.close(f)

    env.info( '*** LOAD MOOSE MISSION SCRIPT FROM HARD DISK *** ' )
    dofile(MissionScript)
    do return end
  end
end

--
-- Simple example mission to show the very basics of MOOSE
--
MESSAGE:New( "Hello World! This messages is printed by MOOSE", 35, "INFO" ):ToAll():ToLog()