added `killall.js` option to kill only named scripts. fixed `void_server_buy_or_upgrade` regression that prevented it from working when you don't have servers.
[?]
Apr 14, 2020, 7:26 PM
BCM3TZOSIZSGCROXIWDIZBZPMWDAPUVYVFS6LJNMLMEI5AOMHFAQCDependencies
- [2]
VMXI7PS4added action cap. improved scoring system. fixed parts of security and cash predictors. made lshw loopable. - [3]
2BKHJI2Sinit - [4]
3TYF4BJStarget only hackable servers. replace servers continually.
Change contents
- edit in lib/lib.js at line 33
// ns.tprint(JSON.stringify(error)); - edit in lib/lib.js at line 148
// ns.tprint(JSON.stringify(error)); - replacement in lib/lib.js at line 248
// catch (error) {// catch (error) {// ns.tprint(JSON.stringify(error)); - edit in lib/lib.js at line 367
}else {return false; - edit in lib/lib.js at line 373
const float_ram_server_bought_biggest = integer_get_server_ram_total(ns, string_get_server_bought_biggest(ns)); - replacement in lib/lib.js at line 376[3.3789]→[2.2386:2467](∅→∅),[2.2467]→[3.3749897:3750019](∅→∅),[3.3861]→[3.3749897:3750019](∅→∅),[3.3749897]→[3.3749897:3750019](∅→∅),[3.3750019]→[2.2468:2639](∅→∅)
(integer_servers_bought_amount < object_constants.PurchasedServerLimit) &&// you dont own a server with max ram yet, buy a server with ram greater than the ram of your biggest bought server(float_ram_server_bought_biggest != object_constants.PurchasedServerMaxRam) &&(float_ram_server_bought_biggest < integer_get_server_ram_biggest_afforded(ns))(integer_servers_bought_amount < object_constants.PurchasedServerLimit) - replacement in lib/lib.js at line 379
return true;}else {return false;const float_ram_server_bought_biggest = integer_get_server_ram_total(ns, string_get_server_bought_biggest(ns));if (// you dont own a server with max ram yet, buy a server with ram greater than the ram of your biggest bought server(float_ram_server_bought_biggest != object_constants.PurchasedServerMaxRam) &&(float_ram_server_bought_biggest < integer_get_server_ram_biggest_afforded(ns))) {return true;} - replacement in lib/lib.js at line 394[3.4377]→[2.2640:2727](∅→∅),[2.2727]→[3.4555:4636](∅→∅),[3.4555]→[3.4555:4636](∅→∅),[3.4636]→[3.3750307:3750398](∅→∅),[3.3750307]→[3.3750307:3750398](∅→∅),[3.3750398]→[3.4637:4754](∅→∅),[3.4754]→[2.2728:2815](∅→∅)
if (// you currently own less than the maximum amount of purchased servers allowed(integer_servers_bought_amount < object_constants.PurchasedServerLimit) &&// you already bought a server with max ram, buy another server the max possible ram(integer_get_server_ram_total(ns, string_get_server_bought_biggest(ns)) == float_ram_server_bought_maximum) &&(integer_get_server_ram_biggest_afforded(ns) >= float_ram_server_bought_maximum)if (// you have one or more servers already(integer_servers_bought_amount > 0) &&// you currently own less than the maximum amount of purchased servers allowed(integer_servers_bought_amount < object_constants.PurchasedServerLimit) - replacement in lib/lib.js at line 399
return true;if (// you already bought a server with max ram, buy another server the max possible ram(integer_get_server_ram_total(ns, string_get_server_bought_biggest(ns)) == float_ram_server_bought_maximum) &&(integer_get_server_ram_biggest_afforded(ns) >= float_ram_server_bought_maximum)) {return true;} - edit in lib/lib.js at line 406
else {return false;} - replacement in bin/killall.js at line 4
for (let integer_indices_0 = 0; integer_indices_0 < array_servers.length; ++integer_indices_0) {const array_scan_results = ns.scan(array_servers[integer_indices_0]);for (let integer_indices_1 = 0; integer_indices_1 < array_scan_results.length; ++integer_indices_1) {if (array_servers.indexOf(array_scan_results[integer_indices_1]) === -1) {array_servers.push(array_scan_results[integer_indices_1]);for (let integer_integer_indices_0 = 0; integer_integer_indices_0 < array_servers.length; ++integer_integer_indices_0) {const array_scan_results = ns.scan(array_servers[integer_integer_indices_0]);for (let integer_integer_indices_1 = 0; integer_integer_indices_1 < array_scan_results.length; ++integer_integer_indices_1) {if (array_servers.indexOf(array_scan_results[integer_integer_indices_1]) === -1) {array_servers.push(array_scan_results[integer_integer_indices_1]); - replacement in bin/killall.js at line 17
const const_string_host = ns.getHostname();const string_host = ns.getHostname(); - edit in bin/killall.js at line 19
const array_arguments = Array.from(arguments)[1]; - replacement in bin/killall.js at line 24
for (var indices_0 = 0; indices_0 < array_of_servers.length; indices_0++) {const server = array_of_servers[indices_0];const scripts = ns.ps(server);// kill each script in the serverfor (var indices_1 = 0; indices_1 < scripts.length; indices_1++) {ns.scriptKill(scripts[indices_1].filename, server);for (let integer_indices_0 = 0; integer_indices_0 < array_of_servers.length; ++integer_indices_0) {const string_server = array_of_servers[integer_indices_0];// if arguments exist, kill the scripts with the same name in the server, otherwise, kill all scripts in the serverif (array_arguments.length > 0) {for (let integer_indices_4 = 0; integer_indices_4 < array_arguments.length; ++integer_indices_4) {ns.scriptKill(array_arguments[integer_indices_4], string_server);} - edit in bin/killall.js at line 33
else {const array_scripts_in_server = ns.ps(string_server);for (let integer_indices_1 = 0; integer_indices_1 < array_scripts_in_server.length; ++integer_indices_1) {ns.scriptKill(array_scripts_in_server[integer_indices_1].filename, string_server);}} - replacement in bin/killall.js at line 42
let scripts_host = ns.ps(const_string_host);for (var indices_2 = 0; indices_2 < scripts_host.length; indices_2++) {// ensure current this script is killed lastif (scripts_host[indices_2].filename != ns.getScriptName()) {ns.scriptKill(scripts_host[indices_2].filename, const_string_host);if (array_arguments.length > 0) {for (let integer_indices_5 = 0; integer_indices_5 < array_arguments.length; ++integer_indices_5) {if (array_arguments[integer_indices_5] != ns.getScriptName()) {ns.scriptKill(array_arguments[integer_indices_5], string_host);}}}else {const array_scripts_in_host = ns.ps(string_host);for (let integer_indices_2 = 0; integer_indices_2 < array_scripts_in_host.length; ++integer_indices_2) {// ensure current this script is killed lastif (array_scripts_in_host[integer_indices_2].filename != ns.getScriptName()) {ns.scriptKill(array_scripts_in_host[integer_indices_2].filename, string_host);} - replacement in bin/killall.js at line 61
void_kill_all_scripts(ns);const array_arguments = ns.args;void_kill_all_scripts(ns, array_arguments);