
I have a script that works well enough on one game, but breaks once imported to another. Here is the snippet in question debugVariable = function(target_var) { sendChat('',JSON.stringify (target_var)); }, ...... nl.get('notes', function(n){ debugVariable('hhh2'); debugVariable(n); if(!_.isNull(n)){ This basically looks up the content of a Journal entry and is nearly copy pasted from another script called JournalLog. The fourth/fifth line sets 'n' to the contents of the log correctly and is outputted into the chat on line sixth/seventh. The final line, for some unknown reason, throws a fit and dies TypeError: Cannot read property '0' of null
TypeError: Cannot read property '0' of null
at incrementDate (apiscript.js:3590:56)
at Timeout._onTimeout (apiscript.js:3514:30)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7) I cannot understand for the life of me why this would fail here when it runs fine everywhere else Any ideas on what mistake I am making? Since the error is referencing incrementDate, even though it doesn't make it that far....here is some more of the code }, incrementDate = function(journal_contents,args) { debugVariable('bla');// Doesn't output ....... }, passTime = function(args) { nl = getNoteLog(); debugVariable('hhh1'); // outputs fine nl.get('notes', function(n){ debugVariable('hhh2'); //outputs fine debugVariable(n); //outputs fine if(!_.isNull(n)){ debugVariable('hhh3'); //Doesn't output setTimeout(function(){ debugVariable('hhh4'); let text=incrementDate(n,args); debugVariable(text); sendChat('',`/desc ${getDate(text,'short')}`); nl.set('notes',text); },0); } }); },