From 51d019c16cc4bcb0c9a0b3034e175fb69e5ec35a Mon Sep 17 00:00:00 2001 From: Snarling <84951833+Snarling@users.noreply.github.com> Date: Mon, 5 Sep 2022 08:19:24 -0400 Subject: [PATCH] Decache Ram on Tail Run --- src/NetscriptWorker.ts | 7 +++---- src/ui/React/LogBoxManager.tsx | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/NetscriptWorker.ts b/src/NetscriptWorker.ts index 6dc79dd0c..f9daec12b 100644 --- a/src/NetscriptWorker.ts +++ b/src/NetscriptWorker.ts @@ -393,10 +393,9 @@ function createAndAddWorkerScript(runningScriptObj: RunningScript, server: BaseS const ramAvailable = server.maxRam - server.ramUsed; if (ramUsage > ramAvailable + 0.001) { dialogBoxCreate( - `Not enough RAM to run script ${runningScriptObj.filename} with args ` + - `${arrayToString(runningScriptObj.args)}. This likely occurred because you re-loaded ` + - `the game and the script's RAM usage increased (either because of an update to the game or ` + - `your changes to the script.)`, + `Not enough RAM to run script ${runningScriptObj.filename} with args ${arrayToString(runningScriptObj.args)}.\n` + + `This can occur when you reload the game and the script's RAM usage has increased (either because of an update to the game or ` + + `your changes to the script).\nThis can also occur if you have attempted to launched a script from a tail window with insufficient RAM. `, ); return false; } diff --git a/src/ui/React/LogBoxManager.tsx b/src/ui/React/LogBoxManager.tsx index c63c57157..21cdae3dc 100644 --- a/src/ui/React/LogBoxManager.tsx +++ b/src/ui/React/LogBoxManager.tsx @@ -213,6 +213,7 @@ function LogWindow(props: IProps): React.ReactElement { if (server === null) return; const s = findRunningScript(script.filename, script.args, server); if (s === null) { + script.ramUsage = 0; startWorkerScript(script, server); } else { setScript(s);