Jump to content

Please NO! Scripts now simply silently fail?


Go to solution Solved by toutenglisse,

Recommended Posts

It seems that since the last release of DCS, it no longer warns if a script cant be loaded or runs into an error; it now fails silently with no outward sign that anything is amiss. This makes it exceedingly difficult for me to develop any meaningful script.

Please consider the following script

blatant = {}
function blatant.error()
	trigger.action.outText("Hi there, next line has an error", 30)
	trigger.action.outText("Hi there, next line has an error") -- delay missed

	trigger.action.outText("never shown, silent fail", 30)
end

function blattant.error2()
    -- even worse, this will prevent anything to run past above 
    -- syntax error, blatant.error will NOT be invoked
    -- loading simply continues, no indication of error AT ALL
end

blatant.error()

Above code has two errors. It misses the delay parameter in the second invocation of trigger.action.outText(), and the second function definition misspells 'blatant'. Usually, the first would generate an error/warning at runtime, the second would create a warning at load time. At least we can spot it when it occurs

Currently, DCS loads the entire script, silently fails while loading, giving no indication that something is amiss - even though the script fails to load and aborts loading while parsing blattant.error2(). Nothing is executed, and you - the developer - is none the wiser, as everything  looks fine.

Can we please. please, please have the old warnings back, or at least make them optional (a debug on option perhaps)? The current "silent treatment" makes it very, very difficult to develop any non-trivial script.

Here's the demo miz

blatantErr.miz

Link to comment
Share on other sites

  • Solution
1 hour ago, cfrag said:

...Here's the demo miz...

When I run the .miz I get :

load-error.jpg

And when I remove the function blattant.error2(), I get :

load-error-2.jpg

And also in DCS.txt logs :

2022-05-01 19:05:53.623 ERROR   SCRIPTING: Mission script error: [string "blatant = {}..."]:4: Parameter #2 (delay) missed
stack traceback:
    [C]: ?
    [C]: in function 'outText'
    [string "blatant = {}..."]:4: in function 'error'
    [string "blatant = {}..."]:8: in main chunk

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...