Addressing feedback.

`flags` example should have the output, instead of the code, in a comment block. `formulas.basic.calculateExp` and `formulas.basic.hackChance` should have explicit `var` declarations.
This commit is contained in:
MageKing17 2021-07-04 08:10:55 -07:00 committed by danielyxie
parent 43b09a2459
commit 04c0c87242
3 changed files with 8 additions and 7 deletions

@ -22,7 +22,7 @@ flags() Netscript Function
.. code-block:: javascript .. code-block:: javascript
/* example.script // example.script
var data = flags([ var data = flags([
['delay', 0], // a default number means this flag is a number ['delay', 0], // a default number means this flag is a number
['server', 'foodnstuff'], // a default string means this flag is a string ['server', 'foodnstuff'], // a default string means this flag is a string
@ -30,7 +30,7 @@ flags() Netscript Function
['help', false], // a default boolean means this flag is a boolean ['help', false], // a default boolean means this flag is a boolean
]); ]);
tprint(data); tprint(data);
*/ /*
[home ~/]> run example.script [home ~/]> run example.script
{"_":[],"delay":0,"server":"foodnstuff","exclude":[],"help":false} {"_":[],"delay":0,"server":"foodnstuff","exclude":[],"help":false}
[home ~/]> run example.script --delay 3000 [home ~/]> run example.script --delay 3000
@ -43,3 +43,4 @@ flags() Netscript Function
{"_":["hello","world"],"help":false,"delay":3000,"server":"harakiri-sushi","exclude":["a","b"]} {"_":["hello","world"],"help":false,"delay":3000,"server":"harakiri-sushi","exclude":["a","b"]}
[home ~/]> run example.script --help [home ~/]> run example.script --help
{"_":[],"delay":0,"server":"foodnstuff","exclude":[],"help":true} {"_":[],"delay":0,"server":"foodnstuff","exclude":[],"help":true}
*/

@ -18,8 +18,8 @@ calculateExp() Netscript Function
.. code-block:: javascript .. code-block:: javascript
player = getPlayer(); var player = getPlayer();
nextHacking = player.hacking_skill+1; var nextHacking = player.hacking_skill+1;
nextExp = formulas.basic.calculateExp(nextHacking); var nextExp = formulas.basic.calculateExp(nextHacking);
missingExp = nextExp - player.hacking_exp; var missingExp = nextExp - player.hacking_exp;
tprint("Missing " + missingExp + " to reach next hacking level"); tprint("Missing " + missingExp + " to reach next hacking level");

@ -20,6 +20,6 @@ hackChance() Netscript Function
.. code-block:: javascript .. code-block:: javascript
server = getServer(); var server = getServer();
server.hackDifficulty = server.minDifficulty; server.hackDifficulty = server.minDifficulty;
tprint(formulas.basic.hackChance(server, getPlayer())); tprint(formulas.basic.hackChance(server, getPlayer()));