Merge pull request #3864 from marcowesii/patch-1

DOCUMENTATION: arguments documentation example for ns2 scripts
This commit is contained in:
hydroflame 2022-07-06 14:28:42 -04:00 committed by GitHub
commit 9f6ba6c802
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 42 additions and 24 deletions

@ -56,7 +56,7 @@ Here is everything you will KEEP when you install an Augmentation:
* Every Augmentation you have installed * Every Augmentation you have installed
* Scripts on your home computer * Scripts on your home computer
* RAM Upgrades on your home computer * RAM/Core Upgrades on your home computer
* World Stock Exchange account and TIX API Access * World Stock Exchange account and TIX API Access
.. _gameplay_augmentations_purchasingmultiple: .. _gameplay_augmentations_purchasingmultiple:

@ -26,4 +26,16 @@ Harder crimes are typically more profitable, and also give more EXP.
Crime details Crime details
^^^^^^^^^^^^^ ^^^^^^^^^^^^^
TODO Available crimes, and their descriptions, which all begin with "attempt to..."
Shoplift …shoplift from a low-end retailer
Rob store …commit armed robbery on a high-end store
Mug someone …mug a random person on the street
Larceny …rob property from someone's house
Deal Drugs …deal drugs
Bond Forgery …forge corporate bonds
Traffick illegal Arms …smuggle illegal arms into the city
Homicide …murder a random person on the street
Grand theft Auto …commit grand theft auto
Kidnap and Ransom …kidnap and ransom a high-profile-target
Assassinate …assassinate a high-profile target
Heist …pull off the ultimate heist

@ -2,6 +2,9 @@
Factions Factions
======== ========
.. warning:: This page contains spoilers regarding the game's story/plot-line.
Throughout the game you may receive invitations from factions. There are Throughout the game you may receive invitations from factions. There are
many different factions, and each faction has different criteria for many different factions, and each faction has different criteria for
determining its potential members. Joining a faction and furthering determining its potential members. Joining a faction and furthering

@ -8,15 +8,6 @@ on the navigation menu on the left-hand side of the game (you may need to expand
the 'Hacking' header in order to see the 'Terminal' tab). Alternatively, the :ref:`keyboard the 'Hacking' header in order to see the 'Terminal' tab). Alternatively, the :ref:`keyboard
shortcut <shortcuts>` Alt + t can be used to open the Terminal. shortcut <shortcuts>` Alt + t can be used to open the Terminal.
Configuration
-------------
The terminal has a configuration file called .fconf. To edit this file, go to
the terminal and enter::
nano .fconf
.. _terminal_filesystem: .. _terminal_filesystem:
Filesystem (Directories) Filesystem (Directories)

@ -62,7 +62,7 @@ To briefly summarize the information from the links above: Each server has a
security level that affects how difficult it is to hack. Each server also has a security level that affects how difficult it is to hack. Each server also has a
certain amount of money, as well as a maximum amount of money it can hold. Hacking a certain amount of money, as well as a maximum amount of money it can hold. Hacking a
server steals a percentage of that server's money. The :js:func:`hack` Netscript function server steals a percentage of that server's money. The :js:func:`hack` Netscript function
is used to hack server. The :js:func:`grow` Netscript function is used to increase is used to hack a server. The :js:func:`grow` Netscript function is used to increase
the amount of money available on a server. The :js:func:`weaken` Netscript function is the amount of money available on a server. The :js:func:`weaken` Netscript function is
used to decrease a server's security level. used to decrease a server's security level.

@ -21,7 +21,7 @@ To automatically enter commands in the terminal (only works if looking at the te
terminalInput[handler].onChange({target:terminalInput}); terminalInput[handler].onChange({target:terminalInput});
// Simulate an enter press // Simulate an enter press
terminalInput[handler].onKeyDown({keyCode:13,preventDefault:()=>null}); terminalInput[handler].onKeyDown({key:'Enter',preventDefault:()=>null});
To add lines to the terminal (only works if looking at the terminal): To add lines to the terminal (only works if looking at the terminal):
@ -32,4 +32,4 @@ To add lines to the terminal (only works if looking at the terminal):
const list = document.getElementById("generic-react-container").querySelector("ul"); const list = document.getElementById("generic-react-container").querySelector("ul");
// Inject some HTML. // Inject some HTML.
list.insertAdjacentHTML('beforeend',`<li><p color=lime>whatever custom html</p></li>`) list.insertAdjacentHTML('beforeend',`<li><p color=lime>whatever custom html</p></li>`)

@ -15,4 +15,4 @@ scriptKill() Netscript Function
.. code-block:: javascript .. code-block:: javascript
scriptKill("demo.script"); // returns: true scriptKill("demo.script", "home"); // returns: true

@ -23,4 +23,4 @@ spawn() Netscript Function
.. code-block:: javascript .. code-block:: javascript
spawn('foo.script', 10, 'foodnstuff', 90); // "run foo.script 10 foodnstuff 90" in 10 seconds. spawn('foo.script', 10, 'foodnstuff', 90); // "run foo.script foodnstuff 90 -t 10" in 10 seconds.

@ -23,3 +23,14 @@ into a script using::
args.length args.length
**WARNING: Do not try to modify the args array. This will break the game.** **WARNING: Do not try to modify the args array. This will break the game.**
example for accessing arguments in ns2 from terminal execution:
terminal command:
run name_of_script.js -t 10 --tail argument1 argument2
ns2 script:
const args_obj = arguments[0]
const argument1 = (args_obj.server.args[0])
const argument2 = (args_obj.server.args[1])

@ -123,7 +123,7 @@ export const BlackOperations: {
desc: ( desc: (
<> <>
CODE RED SITUATION. Our intelligence tells us that VitaLife has discovered a new android cloning technology. CODE RED SITUATION. Our intelligence tells us that VitaLife has discovered a new android cloning technology.
This technology is supposedly capable of cloning Synthoid, not only physically but also their advanced AI This technology is supposedly capable of cloning Synthoids, not only physically but also their advanced AI
modules. We do not believe that VitaLife is trying to use this technology illegally or maliciously, but if any modules. We do not believe that VitaLife is trying to use this technology illegally or maliciously, but if any
Synthoids were able to infiltrate the corporation and take advantage of this technology then the results would Synthoids were able to infiltrate the corporation and take advantage of this technology then the results would
be catastrophic. be catastrophic.

@ -1282,14 +1282,15 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
numTries: 10, numTries: 10,
desc: (n: string): string => { desc: (n: string): string => {
return [ return [
"You are given the following encoded binary String: \n", "You are given the following encoded binary string: \n",
`'${n}' \n`, `'${n}' \n`,
"Treat it as a Hammingcode with 1 'possible' error on an random Index.\n", "The string is a Hamming code with 1 'possible' error on a random index.\n",
"Find the 'possible' wrong bit, fix it and extract the decimal value, which is hidden inside the string.\n\n", "If there is an error, find the bit that is an error and fix it.\n",
"Note: The length of the binary string is dynamic, but it's encoding/decoding is following Hammings 'rule'\n", "Extract the encoded decimal value and return a string with that value.\n\n",
"Note 2: Index 0 is an 'overall' parity bit. Watch the Hammingcode-video from 3Blue1Brown for more information\n", "NOTE: The length of the binary string is dynamic.\n",
"Note 3: There's a ~55% chance for an altered Bit. So... MAYBE there is an altered Bit 😉\n", "NOTE 2: Index 0 is an 'overall' parity bit. Watch the Hamming code video from 3Blue1Brown for more information.\n",
"Extranote for automation: return the decimal value as a string", "NOTE 3: There's approximately a 55% chance for an altered bit. So... MAYBE there is an altered bit 😉\n",
"NOTE 4: Return the decimal value as a string.",
].join(" "); ].join(" ");
}, },
gen: (): string => { gen: (): string => {