From 804fbfa90aa02e3d92a1f3d1ffdb10f604ba95a3 Mon Sep 17 00:00:00 2001 From: Heikki Aitakangas Date: Thu, 6 Jan 2022 19:06:44 +0200 Subject: [PATCH 1/3] Make corporation delayed functions check if script has been stopped during delay --- src/NetscriptFunctions/Corporation.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/NetscriptFunctions/Corporation.ts b/src/NetscriptFunctions/Corporation.ts index 67bb16e76..98037706c 100644 --- a/src/NetscriptFunctions/Corporation.ts +++ b/src/NetscriptFunctions/Corporation.ts @@ -311,6 +311,9 @@ export function NetscriptCorporation( const job = helper.string("assignJob", "job", ajob); const employee = getEmployee(divisionName, cityName, employeeName); return netscriptDelay(1000, workerScript).then(function () { + if (workerScript.env.stopFlag) { + return Promise.reject(workerScript); + } return Promise.resolve(AssignJob(employee, job)); }); }, @@ -341,6 +344,9 @@ export function NetscriptCorporation( (60 * 1000) / (player.hacking_speed_mult * calculateIntelligenceBonus(player.intelligence, 1)), workerScript, ).then(function () { + if (workerScript.env.stopFlag) { + return Promise.reject(workerScript); + } return Promise.resolve(ThrowParty(corporation, office, costPerEmployee)); }); }, @@ -353,6 +359,9 @@ export function NetscriptCorporation( (60 * 1000) / (player.hacking_speed_mult * calculateIntelligenceBonus(player.intelligence, 1)), workerScript, ).then(function () { + if (workerScript.env.stopFlag) { + return Promise.reject(workerScript); + } return Promise.resolve(BuyCoffee(corporation, getDivision(divisionName), getOffice(divisionName, cityName))); }); }, From 3769081e4e013ca27d21059c912ae45c3cfac912 Mon Sep 17 00:00:00 2001 From: Cyn Date: Thu, 6 Jan 2022 19:51:11 -0500 Subject: [PATCH 2/3] Remove Incorrect Line --- doc/source/advancedgameplay/hackingalgorithms.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/source/advancedgameplay/hackingalgorithms.rst b/doc/source/advancedgameplay/hackingalgorithms.rst index fdd3b1962..0a3190421 100644 --- a/doc/source/advancedgameplay/hackingalgorithms.rst +++ b/doc/source/advancedgameplay/hackingalgorithms.rst @@ -74,8 +74,6 @@ Meaning if we have space for 100 threads across the entire network 7 threads wil When utilizing this strategy, monitor the amount of money and security on the target server, if the money is not hovering around maximum and the security around the minimum, the ratios should be tweaked until that is the case. -Growth can be made more efficient by dividing it into many processes, instead of one script with a high thread count. Four grow scripts with 20 threads will outperform one grow script with 80 threads. - Utilizing `sleep()` or `asleep()` to ensure that your scripts do not all start at the same time can decrease the chance of issues associated with overhacking occurring. Both functions have a ram cost of zero. Batch algorithms (HGW, HWGW, or Cycles) From 8b2ad883e4ff4b86b158636c17a5188449646709 Mon Sep 17 00:00:00 2001 From: Martin Fournier Date: Thu, 6 Jan 2022 21:13:38 -0500 Subject: [PATCH 3/3] Add save file warning for detailed ram usage --- src/Terminal/commands/mem.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Terminal/commands/mem.ts b/src/Terminal/commands/mem.ts index 0a12230a9..3d60772c0 100644 --- a/src/Terminal/commands/mem.ts +++ b/src/Terminal/commands/mem.ts @@ -43,6 +43,11 @@ export function mem( for (const entry of verboseEntries) { terminal.print(`${numeralWrapper.formatRAM(entry.cost * numThreads).padStart(8)} | ${entry.name} (${entry.type})`); } + + if (ramUsage > 0 && verboseEntries.length === 0) { + // Let's warn the user that he might need to save his script again to generate the detailed entries + terminal.warn('You might have to open & save this script to see the detailed RAM usage information.'); + } } catch (e) { terminal.error(e + ""); }