From 35777f3c367b5d200e38695ba5e38aaaaea1427e Mon Sep 17 00:00:00 2001 From: samohtGTO <71775252+samohtGTO@users.noreply.github.com> Date: Fri, 19 May 2023 12:42:11 +0200 Subject: [PATCH 1/2] suggestion: custom scripts helper #292 --- autopilot.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/autopilot.js b/autopilot.js index 89dd1d3e..84aae672 100644 --- a/autopilot.js +++ b/autopilot.js @@ -30,6 +30,7 @@ const argsSchema = [ // The set of all command line arguments ['disable-casino', false], // Set to true to disable running the casino.js script automatically ['on-completion-script', null], // Spawn this script when we defeat the bitnode ['on-completion-script-args', []], // Optional args to pass to the script when we defeat the bitnode + ['run-script', []], // Spawns a script if it isnt running already in the main loop, example [{"name": ,"arg": [arguments] "bitnode": [bitnode] , "ram": }] ]; export function autocomplete(data, args) { data.flags(argsSchema); @@ -423,6 +424,22 @@ async function checkOnRunningScripts(ns, player) { // NOTE: Default work-for-factions behaviour is to spend hashes on coding contracts, which suits us fine launchScriptHelper(ns, 'work-for-factions.js', rushGang ? rushGangsArgs : workForFactionsArgs); } + + // TODO: add that mutiple bitnodes in the requirements work + if (options['run-script']) { + options['run-script'].forEach(script => { + if(!script.ram){ + script.ram =0 + } + if (!findScript(script.name) && script.ram<=homeRam && (script.bitnode in unlockedSFs || script.bitnode==player.bitNodeN)) { + if(script.args) { + launchScriptHelper(ns, script.name, script.args) + } else { + launchScriptHelper(ns, script.name) + } + } + }); + } } /** Logic to steal 10b from the casino From ab71ebe2901d2e932d39e3db9a4f5b24677cb515 Mon Sep 17 00:00:00 2001 From: samohtGTO <71775252+samohtGTO@users.noreply.github.com> Date: Sat, 1 Jul 2023 09:15:42 +0200 Subject: [PATCH 2/2] Ascend Without TIX API liquidate error Fixes #311 --- autopilot.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/autopilot.js b/autopilot.js index d414f8e6..1bfd881e 100644 --- a/autopilot.js +++ b/autopilot.js @@ -491,6 +491,10 @@ async function maybeInstallAugmentations(ns, player) { setStatus(ns, `No singularity access, so you're on your own. You should manually work for factions and install augmentations!`); return false; // Cannot automate augmentations or installs without singularity } + const hasTixApiAccess = await getNsDataThroughFile(ns, 'ns.stock.hasTIXAPIAccess()'); + if(!hasTixApiAccess) { + return false; //We cant liquidate + } // If we previously attempted to reserve money for an augmentation purchase order, do a fresh facman run to ensure it's still available if (reservedPurchase && installCountdown <= Date.now()) { log(ns, "INFO: Manually running faction-manager.js to ensure previously reserved purchase is still obtainable.");