executables: dynamically load help messages. lshw.js, main.js: add options to change score correction method and score factor multipliers. README.md: update.
[?]
May 13, 2020, 2:21 PM
FBAPT2WW2IUZTIHZP3BMVWKAIAGICTTH2QRPLDJXWNSYBW5AMO6ACDependencies
- [2]
ZVQK2652executables: fix help message. - [3]
ZNH2OJ3Chacker.js, main.js: added continuous scheduling mode. README.md: update. credits to Mei for helping me figure out how to time the continuous mode and to Kozd for making `sort_by` work with methods. - [4]
2WOLGB42README.md: update. kill.js: fix argument parser. lshw.js: add `-p` option. increase information given. main.js: fix error message. set saner defaults. hacker.js: split some functions into "lib_time.js" and "lib_score.js". ram.js: fix. - [5]
NQ22FUSWadd more options to `main.js`. update `README.md`. - [6]
SXEJJKPIexecutables: add `--help` flag. hacker.js: change scheduling logic. refactor. kill.js: allow handling more than one server or script at a time. cyclic_weaken.js: add. README.md: update. - [7]
3NFCZ6IPfixed the ram utilisation logic. added flags to `main.js` that can prevent the execution of helpers. - [8]
HLC2L3NJadd "tor.js" and "programs.js". use `minimist` for "main.js" argument parsing. - [9]
VMXI7PS4added action cap. improved scoring system. fixed parts of security and cash predictors. made lshw loopable. - [10]
IVSW4A6Plib_score.js: normalised scores against average instead of using arbitrary values. - [11]
HSNSECD5all: refactor. main.js: fix call to `void_kill_script_named_server_named`. - [12]
2BKHJI2Sinit - [13]
Y5OWMCQRall: remove unecessary uses of `exec`. refactor. main.js: add RAM reservation logic. lib_ram.js: renamed to lib_ram_server.js. README.js: update. - [14]
6TF4T3E2lshw.js: fix function call typo. - [15]
G7YVCY6Hlib_score.js: refactor. add two functions for score correction. remove unneeded arbitrary hard-coded multipliers. - [*]
6MBUKAG6remove unneeded functions and comments. update readme. - [*]
DJDWBCCQadd missing "nop.js". killall.js: rename to kill.js. add `--script` and `--server` options.
Change contents
- replacement in lib/lib_score.js at line 100
export const float_get_server_score = function (ns, string_server) {export const float_get_server_score = function (ns,string_server,string_method_score_correction,float_multiplier_factor_skill_argument,float_multiplier_factor_max_cash_argument,float_multiplier_factor_growth_argument) {letfloat_method_score_correction = float_get_standard_score,float_multiplier_factor_skill = 1,float_multiplier_factor_max_cash = 1,float_multiplier_factor_growth = 1;switch (string_method_score_correction) {case "standard":float_method_score_correction = float_get_standard_score;break;case "normal":float_method_score_correction = float_get_mean_normalised_score;break;default:ns.tprint(`WARNING: "${string_method_score_correction}" is not a valid value for the \`string_method_score_correction\` variable. Defaulting to "standard" method.`);}null !== float_multiplier_factor_skill_argument &&(float_multiplier_factor_skill = float_multiplier_factor_skill_argument),null !== float_multiplier_factor_max_cash_argument &&(float_multiplier_factor_max_cash = float_multiplier_factor_max_cash_argument),null !== float_multiplier_factor_growth_argument &&(float_multiplier_factor_growth = float_multiplier_factor_growth_argument); - edit in lib/lib_score.js at line 130
// can change this to try different correction methodsfloat_method_score_correction = float_get_standard_score, - replacement in lib/lib_score.js at line 168[4.3718743]→[4.2403:2464](∅→∅),[4.2464]→[4.3718815:3718843](∅→∅),[4.3718815]→[4.3718815:3718843](∅→∅)
1 * float_factor_skill +1 * float_factor_max_cash +1 * float_factor_growthfloat_multiplier_factor_skill * float_factor_skill +float_multiplier_factor_max_cash * float_factor_max_cash +float_multiplier_factor_growth * float_factor_growth - replacement in lib/lib_no_ns.js at line 10
"'": "&apos","'": "'", - replacement in bin/lshw.js at line 1
// lshw.js - 7.25GB - Display information about one or more servers. TODO:// * add flags that prevent certain information from being displayed./* lshw.js - 7.25GB - Display information about one or more servers. TODO:* prevent parser from altering default values displayed in help message.* add flags that prevent certain information from being displayed.*/ - edit in bin/lshw.js at line 17
const object_get_constants = function () {return {// default valuesobject_defaults: {// decimal places to use for displaying numerical informationinteger_precision: 2,// multiplier for skill factor used in server scoring systemfloat_multiplier_factor_skill: 1,// multiplier for max cash factor used in server scoring systemfloat_multiplier_factor_max_cash: 1,// multiplier for growth factor used in server scoring systemfloat_multiplier_factor_growth: 1,// correction method for factors used in server scoring system. can be "standard" or "normal"string_method_score_correction: "standard",float_sleep_duration: 0,},object_argument_names: {delay: {short: "d",long: "delay",},help: {short: "h",long: "help",},multiplier_skill: {short: "k",long: "multiplier-skill",},multiplier_cash: {short: "l",long: "multiplier-cash",},multiplier_growth: {short: "m",long: "multiplier-growth",},precision: {short: "p",long: "precision",},score_correction: {short: "q",long: "score-correction",},}}}; - edit in bin/lshw.js at line 69
const// defaultsobject_defaults = object_get_constants().object_defaults,// argument namesobject_argument_names = object_get_constants().object_argument_names; - replacement in bin/lshw.js at line 75
float_sleep_duration = 0,integer_precision = 2,// multiplier for skill factor used in server scoring systemfloat_multiplier_factor_skill = object_defaults.float_multiplier_factor_skill,// multiplier for max cash factor used in server scoring systemfloat_multiplier_factor_max_cash = object_defaults.float_multiplier_factor_max_cash,// multiplier for growth factor used in server scoring systemfloat_multiplier_factor_growth = object_defaults.float_multiplier_factor_growth,// correction method for factors used in server scoring system. can be "standard" or "normal"string_method_score_correction = object_defaults.string_method_score_correction,float_sleep_duration = object_defaults.float_sleep_duration,integer_precision = object_defaults.integer_precision, - replacement in bin/lshw.js at line 93
case "d":case object_argument_names.delay.short: - replacement in bin/lshw.js at line 95
case "delay":case object_argument_names.delay.long: - replacement in bin/lshw.js at line 98
case "h":case object_argument_names.help.short: - replacement in bin/lshw.js at line 100
case "help":case object_argument_names.help.long: - replacement in bin/lshw.js at line 103
case "p":case object_argument_names.multiplier_skill.short:// fall-throughcase object_argument_names.multiplier_skill.long:float_multiplier_factor_skill = argument_value;break;case object_argument_names.multiplier_cash.short:// fall-throughcase object_argument_names.multiplier_cash.long:float_multiplier_factor_max_cash = argument_value;break;case object_argument_names.multiplier_growth.short:// fall-throughcase object_argument_names.multiplier_growth.long:float_multiplier_factor_growth = argument_value;break;case object_argument_names.precision.short: - replacement in bin/lshw.js at line 120
case "precision":case object_argument_names.precision.long: - edit in bin/lshw.js at line 123
case object_argument_names.score_correction.short:// fall-throughcase object_argument_names.score_correction.long:string_method_score_correction = argument_value;break; - replacement in bin/lshw.js at line 139
return void_print_help(ns, integer_precision);return void_print_help(ns); - replacement in bin/lshw.js at line 148
void_print_information(ns, string_server, integer_precision);void_print_information(ns,string_server,integer_precision,string_method_score_correction,float_multiplier_factor_skill,float_multiplier_factor_max_cash,float_multiplier_factor_growth); - replacement in bin/lshw.js at line 167
const void_print_help = function (ns,integer_precision) {const void_print_help = function (ns) {const object_argument_names = object_get_constants().object_argument_names;const object_defaults = object_get_constants().object_defaults; - replacement in bin/lshw.js at line 177
run lshw.js [OPTIONS ...] <ARGUMENT [ARGUMENT ...]>run ${ns.getScriptName()} [OPTIONS ...] <ARGUMENT [ARGUMENT ...]> - edit in bin/lshw.js at line 180
FLAGS-${object_argument_names.help.short}, --${object_argument_names.help.long}Displays this message then exits. - replacement in bin/lshw.js at line 186
-d, --delay <SECONDS>-${object_argument_names.delay.short}, --${object_argument_names.delay.long} <SECONDS> - replacement in bin/lshw.js at line 189
-p, --precision <INTEGER>INTEGER = The decimal places to display floating point values with. Should be an integer >= 0. Defaults to ${integer_precision}.-${object_argument_names.multiplier_skill.short}, --${object_argument_names.multiplier_skill.long} <FLOAT>FLOAT = The multiplier used to change the weight of the factor representing your skill against the target server used in the server scoring system. Should a floating point number. 1 = factor has normal importance, > 1 = factor has more importance, < 1 = factor has less importance, 0 = factor is not used, < 0 = factor has negative effect. Defaults to ${object_defaults.float_multiplier_factor_skill}.-${object_argument_names.multiplier_cash.short}, --${object_argument_names.multiplier_cash.long} <FLOAT>FLOAT = The multiplier used to change the weight of the factor representing the target server's maximum cash used in the server scoring system. Should a floating point number. 1 = factor has normal importance, > 1 = factor has more importance, < 1 = factor has less importance, 0 = factor is not used, < 0 = factor has negative effect. Defaults to ${object_defaults.float_multiplier_factor_max_cash}.-${object_argument_names.multiplier_growth.short}, --${object_argument_names.multiplier_growth.long} <FLOAT>FLOAT = The multiplier used to change the weight of the factor representing the target server's growth used in the server scoring system. Should a floating point number. 1 = factor has normal importance, > 1 = factor has more importance, < 1 = factor has less importance, 0 = factor is not used, < 0 = factor has negative effect. Defaults to ${object_defaults.float_multiplier_factor_growth}. - replacement in bin/lshw.js at line 198
FLAGS-h, --helpDisplays this message then exits.`-${object_argument_names.precision.short}, --${object_argument_names.precision.long} <INTEGER>INTEGER = The decimal places to display floating point values with. Should be an integer >= 0. Defaults to ${object_defaults.integer_precision}.-${object_argument_names.score_correction.short}, --${object_argument_names.score_correction.long} <METHOD>METHOD = The method used to correct the factors used in the server scoring system. Can be "standard" (uses standard scoring) or "normal" (uses mean normalised scoring). Defaults to "${object_defaults.string_method_score_correction}".` - replacement in bin/lshw.js at line 210
integer_precisioninteger_precision,string_method_score_correction,float_multiplier_factor_skill,float_multiplier_factor_max_cash,float_multiplier_factor_growth - replacement in bin/lshw.js at line 244
Score: ${float_get_server_score(ns, string_server).toFixed(integer_precision)}Score: ${float_get_server_score(ns,string_server,string_method_score_correction,float_multiplier_factor_skill,float_multiplier_factor_max_cash,float_multiplier_factor_growth).toFixed(integer_precision)} - edit in bin/kill.js at line 12
const object_get_constants = function () {return {object_argument_names: {script: {short: "c",long: "script",},server: {short: "e",long: "server",},help: {short: "h",long: "help",},}}}; - replacement in bin/kill.js at line 39
const object_arguments = object_parse_arguments(ns.args);constobject_argument_names = object_get_constants().object_argument_names,object_arguments = object_parse_arguments(ns.args); - replacement in bin/kill.js at line 46
case "c":case object_argument_names.script.short: - replacement in bin/kill.js at line 48
case "script":case object_argument_names.script.long: - replacement in bin/kill.js at line 53
case "e":case object_argument_names.server.short: - replacement in bin/kill.js at line 55
case "server":case object_argument_names.server.long: - replacement in bin/kill.js at line 60
case "h":case object_argument_names.help.short: - replacement in bin/kill.js at line 62
case "help":case object_argument_names.help.long: - replacement in bin/kill.js at line 64[4.5409]→[4.3799756:3799773](∅→∅),[4.12486]→[4.3799756:3799773](∅→∅),[4.3799756]→[4.3799756:3799773](∅→∅)
break;break;; - edit in bin/kill.js at line 89
const object_argument_names = object_get_constants().object_argument_names; - replacement in bin/kill.js at line 99
run kill.js [FLAGS ...] [OPTIONS ...]run ${ns.getScriptName()} [FLAGS ...] [OPTIONS ...]FLAGS-${object_argument_names.help.short}, --${object_argument_names.help.long}Displays this message then exits. - replacement in bin/kill.js at line 106
-c, --script <SCRIPT>-${object_argument_names.script.short}, --${object_argument_names.script.long} <SCRIPT> - replacement in bin/kill.js at line 109
-e, --server <SERVER>SERVER = The name of a server on which scripts will be killed.FLAGS-h, --helpDisplays this message then exits.`-${object_argument_names.server.short}, --${object_argument_names.server.long} <SERVER>SERVER = The name of a server on which scripts will be killed.` - edit in bin/cp.js at line 8
const object_get_constants = function () {return {object_argument_names: {help: {short: "h",long: "help",},}}}; - replacement in bin/cp.js at line 23
const object_arguments = object_parse_arguments(ns.args);constobject_argument_names = object_get_constants().object_argument_names,object_arguments = object_parse_arguments(ns.args); - replacement in bin/cp.js at line 31
case "h":case object_argument_names.help.short: - replacement in bin/cp.js at line 33
case "help":case object_argument_names.help.long: - edit in bin/cp.js at line 62
const object_argument_names = object_get_constants().object_argument_names; - replacement in bin/cp.js at line 69
run cp.js [FLAGS ...] <ARGUMENT [ARGUMENT ...]>run ${ns.getScriptName()} [FLAGS ...] <ARGUMENT [ARGUMENT ...]> - replacement in bin/cp.js at line 74
-h, --help-${object_argument_names.help.short}, --${object_argument_names.help.long} - edit in README.md at line 44
`-g, --no-programs` - edit in README.md at line 47
* Prevents the "programs.js" script from being started which is responsible for buying programs from the "darkweb" server. - edit in README.md at line 53
`-g, --no-programs`* Prevents the "programs.js" script from being started which is responsible for buying programs from the "darkweb" server. - edit in README.md at line 56
`-u, --no-cyclic-weaken` - edit in README.md at line 59[17.3559][18.9897]
* Prevents the "cyclic_weaken.js" script from being started which is responsible for running `weaken` continuously to gain hacking experience. - edit in README.md at line 93[4.17731]
`-k, --multiplier-skill <FLOAT>`FLOAT = The multiplier used to change the weight of the factor representing your skill against the target server used in the server scoring system. Should a floating point number. 1 = factor has normal importance, > 1 = factor has more importance, < 1 = factor has less importance, 0 = factor is not used, < 0 = factor has negative effect. Defaults to 1.`-l, --multiplier-cash <FLOAT>`FLOAT = The multiplier used to change the weight of the factor representing the target server's maximum cash used in the server scoring system. Should a floating point number. 1 = factor has normal importance, > 1 = factor has more importance, < 1 = factor has less importance, 0 = factor is not used, < 0 = factor has negative effect. Defaults to 1.`-m, --multiplier-growth <FLOAT>`FLOAT = The multiplier used to change the weight of the factor representing the target server's growth used in the server scoring system. Should a floating point number. 1 = factor has normal importance, > 1 = factor has more importance, < 1 = factor has less importance, 0 = factor is not used, < 0 = factor has negative effect. Defaults to 1.`-q, --score-correction <METHOD>`METHOD = The method used to correct the factors used in the server scoring system. Can be "standard" (uses standard scoring) or "normal" (uses mean normalised scoring). Defaults to "standard".`-v, --ram-cyclic-weaken <FLOAT>`FLOAT = The fraction of the botnet's available RAM to be used to run cyclic_weaken.js. Should be a floating point number > 0. Defaults to 0.5.#### EXAMPLES`run main.js`* Runs the script using default values.`run main.js -ao --no-botnet --job-cap 4000 -i "harakiri-sushi" -r 0.7 --steal-cap=0.5 -q normal`* Runs the script with up to 4000 jobs, targetting "harakiri-sushi", only upgrading/replacing servers when at least 0.7 of your network's total RAM is being used, stealing only up to 50% of harakiri-sushi's cash per "hack.js" job that finishes executing, and using the "mean normalised" score correction method, whilst the remaining variables are set to defaults. The "ram.js", "tor.js" and "botnet.js" helper scripts are also prevented from starting.---### "kill.js" (2.55 GB)* Kill all running scripts.* Optionally, kill only named scripts instead.* Optionally, kill only scripts on named servers instead.* Optionally, kill only named scripts on named servers instead.#### USAGE`run kill.js [FLAGS ...] [OPTIONS ...]`#### FLAGS`-h, --help`* Displays a help message then exits.#### OPTIONS`-c, --script <SCRIPT>`* SCRIPT = The name of a script to kill.`-e, --server <SERVER>`* SERVER = The name of a server on which scripts will be killed.#### EXAMPLES`run kill.js`* Kills all running scripts.`run kill.js -c grow.js --script hack.js`* Kills all scripts named "grow.js" and "hack.js" on any servers that they are currently running on.`run kill.js -e home --server harakiri-sushi`* Kills all scripts currently running on the "home" and "harakiri-sushi" servers.`run kill.js -c grow.js --script hack.js -e home --server harakiri-sushi`* Kills all scripts named "grow.js" and "hack.js" currently running on the "home" and "harakiri-sushi" servers.---### "lshw.js" (7.25 GB)* Display information about one or more servers.* Optionally, display the information at regular intervals.#### USAGE`run lshw.js [FLAGS ...] [OPTIONS ...] <ARGUMENT [ARGUMENT ...]>`* ARGUMENT = Server to display the information about.#### FLAGS`-h, --help`* Displays a help message then exits.#### OPTIONS`-d, --delay <SECONDS>`* SECONDS = The duration of delay between update, in seconds. Should be a floating-point number >= 0.001. By default, the script will only display server information once, unless this option is manually set.`-p, --precision <INTEGER>`* INTEGER = The decimal places to display floating point values with. Should be an integer >= 0. Defaults to 2.#### EXAMPLES`run lshw.js -d 1 --precision=4 home foodnstuff`* Causes the terminal to output up-to-date information about the "home" and "foodnstuff" servers every second, using 4 decimal places for the floating point values it displays.---### "cp.js" (2.65 GB)* Copy all files that contain particular substring(s) in their filenames from all servers to the current server.#### USAGE`run cp.js [FLAGS ...] <ARGUMENT [ARGUMENT ...]>`* ARGUMENT = Substring contained in the names of files to be copied to the current server.#### FLAGS`-h, --help`* Displays a help message then exits.#### EXAMPLES`run cp.js .lit .script .txt`* Copies all files that contain the strings ".lit", ".script" or ".txt" in their filename from all servers to the current server.---## InstallationSave all the `.js` files in this repository to the root directory of the "home" server using the same filenames that they currently have in this repository.---## LicenseThis Work is distributed and dual-licensed under the terms of both the [MIT License](https://nest.pijul.com/nicoty/bitburner_scripts:master/4bb17ded7a86f7decd) and the [Apache License 2.0](https://nest.pijul.com/nicoty/bitburner_scripts:master/4bb17ded7a86f7de02).### ContributionUnless You explicitly state otherwise, any Contribution submitted for inclusion in the Work by You, as defined in the Apache License 2.0, shall be dual-licensed as above, without any additional terms or conditions.