Significant Breakthrough !
This is about editing scripts while a mission is running. It is quite simple, and as simple things go, it took me a long time to figure it out. I had great help from Pikey, and this post of his got me started… after 60 episodes of Game Of Thrones and a few sprinkles of spare time … viola’
I use Notepad++ for editing Lua script files. Set up a Mission Start → Radio Menu Add event for ‘Run Script’, and a Switched Condition event to detect the Radio flag for running the development script. The Switched Condition event detects the flag as True, and for Actions it: Turns the Radio flag Off, Runs a Do Script (defined below), and outputs a Message To All that the script event executed.
In the Do Script Text Window enter like this to point to your debug script (my file is appendClientNames03.lua):
assert(loadfile(“C:\Users\..\Saved Games\DCS Docs & Utils\Mission Dev Library\Mission Template 20N\appendClientNames03.lua”))()
Note the Lua convention of double backslashes in the path.
– EDIT –
– All backslashes must be like ‘\’
– The editor here is stripping out the first '' in the quotes above. The backslashes in the path must be represented like with two backslashes - one \ immediately followed by another , or the ‘assert(loadfile(..’ line will not work. Every "" must be two “\” “\”.
GEEZ WIZ adminds, I just want to enter two of these \ thingies
Please see the attached Mission Template file with these events. This is the original code that was under test:
do
-- aircraftUnitTypes = {'F-15C', 'AJS37', 'M-2000C', 'MiG-21Bis'}
-- aircraftUnitTypes = {'F-15C', 'AJS37'}
-- aircraftUnitTypes = {'[blue][plane]'}
local function contains(tbl, val)
for _,v in ipairs(tbl) do
if v == val then return true end
end
return false
end
for uName, uData in pairs(mist.DBs.humansByName) do
-- if uData.type == 'F-15C' or uData.type == 'AJS37' or uData.type == 'M-2000C' or uData.type == 'MiG-21Bis' then
if(contains(aircraftUnitTypes, uData.type)) then
if(contains(aircraftClientNames, uName)) then
-- do nothing
else
table.insert(aircraftClientNames, uName)
end
end
end
end
I was able to comment lines in and out, change lines, and re-execute the script while the mission was still going. Eventually the code went to this, and for all the changes I did not have to restart the mission each time. That, my peeps, is significant. (We had this in-game editing a few versions ago with Witchcraft).
do
local function contains(tbl, val)
for _,v in ipairs(tbl) do
if v == val then return true end
end
return false
end
for uName, uData in pairs(mist.DBs.humansByName) do
if(contains({'blue'}, uData.coalition)) then
if not(contains(aircraftClientNamesBlue, uName)) then
table.insert(aircraftClientNamesBlue, uName)
end
end
end
for uName, uData in pairs(mist.DBs.humansByName) do
if(contains({'red'}, uData.coalition)) then
if not(contains(aircraftClientNamesRed, uName)) then
table.insert(aircraftClientNamesRed, uName)
end
end
end
end
The key to debugging a script lies in a Switched Condition event that detects the Radio command to Run Script, and it executes an Action of Do Script:
assert(loadfile(“C:\Users\..\Saved Games\DCS Docs & Utils\Mission Dev Library\Mission Template 20N\appendClientNames03.lua”))()
See the attached mission.
Here are a few DCS commands that can help you with your mission development -
Restart - LShft R
Time Accelerate - LCntrl Z
Time Decel - LAlt Z
Time Normal - LShft Z
Commo (Radio) Menu - \
Objects Switch Direction Forward - LCntrl PgDn
Objects Switch Direction Reverse - LCntrl PgUp
This is my Notepad++ window, I can make changes here and then use the Radio F10 Menu to ‘Run Script’ -
All scripts are loaded with Mission Start events in the order that I desire -
This is the Do Script that executes the ‘assert(loadfile..’ -
When the debug is complete then this Switched Condition event gets replaced with a Once event and a Do Script Action to load the finished script.
This mission is a template that will be used to build new Nevada missions. It has the infrastructure in place for mission starting things and ending things, including Timeouts and Blue/Red wins. This will evolve.. 
This is soo cool, I am soo thrilled to get this working. Edits can be made and tested immediately, for tons of time saved.
Enjoy!
This is the Mission Template for Nevada in v2 -
Mission Template 20N1g Mission Start.miz (2.9 MB)