diff --git a/src/Constants.ts b/src/Constants.ts index ef2b82333..c16dc5158 100644 --- a/src/Constants.ts +++ b/src/Constants.ts @@ -241,6 +241,7 @@ export let CONSTANTS: IMap = { an augmentation. * getCharacterInformation now additionally returns exp * pid resets back to 1 when installing or destroying a BitNode. + * New '.ns' scripts start with a main function. Misc. * Fixed an issue where SF3 was listed as infinitly repeatable and SF12 as diff --git a/src/Terminal.js b/src/Terminal.js index 2cc2e82d7..1a611086b 100644 --- a/src/Terminal.js +++ b/src/Terminal.js @@ -1760,7 +1760,14 @@ let Terminal = { const filepath = Terminal.getFilepath(filename); const script = Terminal.getScript(filename); if (script == null) { - Engine.loadScriptEditorContent(filepath); + let code = "" + if(filename.endsWith(".ns")) { + code = `export async function main(ns) { + +}`; + } + console.log('default code'); + Engine.loadScriptEditorContent(filepath, code); } else { Engine.loadScriptEditorContent(filepath, script.code); }