Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCRIPTS: FIX #4081 Rerunning a script from tail window recalculates ram usage #4082

Merged
merged 2 commits into from
Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/NetscriptWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 launch a script from a tail window with insufficient RAM. `,
);
return false;
}
Expand Down
1 change: 1 addition & 0 deletions src/ui/React/LogBoxManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down