diff --git a/doc/build/doctrees/environment.pickle b/doc/build/doctrees/environment.pickle index 670baa660..2c43bbd6c 100644 Binary files a/doc/build/doctrees/environment.pickle and b/doc/build/doctrees/environment.pickle differ diff --git a/doc/build/doctrees/netscriptjs.doctree b/doc/build/doctrees/netscriptjs.doctree index 6a673cc6e..b91eb9924 100644 Binary files a/doc/build/doctrees/netscriptjs.doctree and b/doc/build/doctrees/netscriptjs.doctree differ diff --git a/doc/build/html/_sources/netscriptjs.rst.txt b/doc/build/html/_sources/netscriptjs.rst.txt index 954291a8b..73d5e6dd4 100644 --- a/doc/build/html/_sources/netscriptjs.rst.txt +++ b/doc/build/html/_sources/netscriptjs.rst.txt @@ -41,8 +41,8 @@ Therefore, the signature of the :code:`main()` function must be:: export async function main(ns) { ns.print("Starting script here"); - ns.hack("foodnstuff"); //Use Netscript hack function - ns.print(ns.args); //The script arguments must be prefaced with ns as well + await ns.hack("foodnstuff"); //Use Netscript hack function + ns.print(ns.args); //The script arguments must be prefaced with ns as well } Here is a summary of all rules you need to follow when writing Netscript JS code: @@ -63,7 +63,7 @@ Here is a summary of all rules you need to follow when writing Netscript JS code * Any functions that you want to be visible from other scripts must be marked with :code:`export`. -* **Do not write any infinite loops** without using a :code:`sleep` or one of the timed Netscript functions like :code:`hack`. Doing so will crash your game. +* **Do not write any infinite loops without using a** :code:`sleep` **or one of the timed Netscript functions like** :code:`hack`. Doing so will crash your game. * Any global variable declared in a NetscriptJS script is shared between all instances of that script. For example, assume you write a script *foo.ns* and declared a global variable like so:: @@ -74,8 +74,8 @@ Here is a summary of all rules you need to follow when writing Netscript JS code export async function main(ns) { globalVariable = ns.args.length; while(true) { - tprint(globalVariable); - await sleep(3000); + ns.tprint(globalVariable); + await ns.sleep(3000); } } diff --git a/doc/build/html/netscriptjs.html b/doc/build/html/netscriptjs.html index 6257beadb..eb08d5fdf 100644 --- a/doc/build/html/netscriptjs.html +++ b/doc/build/html/netscriptjs.html @@ -86,8 +86,8 @@ the main function. This environment includes all of the pre-defined Netscript fu

Therefore, the signature of the main() function must be:

export async function main(ns) {
     ns.print("Starting script here");
-    ns.hack("foodnstuff");  //Use Netscript hack function
-    ns.print(ns.args);      //The script arguments must be prefaced with ns as well
+    await ns.hack("foodnstuff"); //Use Netscript hack function
+    ns.print(ns.args);           //The script arguments must be prefaced with ns as well
 }
 
@@ -112,7 +112,7 @@ the main function. This environment includes all of the pre-defined Netscript fu
  • Any functions that you want to be visible from other scripts must be marked with export.

  • -
  • Do not write any infinite loops without using a sleep or one of the timed Netscript functions like hack. Doing so will crash your game.

    +
  • Do not write any infinite loops without using a sleep or one of the timed Netscript functions like hack. Doing so will crash your game.

  • Any global variable declared in a NetscriptJS script is shared between all instances of that script. For example, assume you write a script foo.ns and declared a global variable like so:

    @@ -122,8 +122,8 @@ script. For example, assume you write a script foo.ns and declared a gl export async function main(ns) { globalVariable = ns.args.length; while(true) { - tprint(globalVariable); - await sleep(3000); + ns.tprint(globalVariable); + await ns.sleep(3000); } } diff --git a/doc/source/netscriptjs.rst b/doc/source/netscriptjs.rst index 954291a8b..73d5e6dd4 100644 --- a/doc/source/netscriptjs.rst +++ b/doc/source/netscriptjs.rst @@ -41,8 +41,8 @@ Therefore, the signature of the :code:`main()` function must be:: export async function main(ns) { ns.print("Starting script here"); - ns.hack("foodnstuff"); //Use Netscript hack function - ns.print(ns.args); //The script arguments must be prefaced with ns as well + await ns.hack("foodnstuff"); //Use Netscript hack function + ns.print(ns.args); //The script arguments must be prefaced with ns as well } Here is a summary of all rules you need to follow when writing Netscript JS code: @@ -63,7 +63,7 @@ Here is a summary of all rules you need to follow when writing Netscript JS code * Any functions that you want to be visible from other scripts must be marked with :code:`export`. -* **Do not write any infinite loops** without using a :code:`sleep` or one of the timed Netscript functions like :code:`hack`. Doing so will crash your game. +* **Do not write any infinite loops without using a** :code:`sleep` **or one of the timed Netscript functions like** :code:`hack`. Doing so will crash your game. * Any global variable declared in a NetscriptJS script is shared between all instances of that script. For example, assume you write a script *foo.ns* and declared a global variable like so:: @@ -74,8 +74,8 @@ Here is a summary of all rules you need to follow when writing Netscript JS code export async function main(ns) { globalVariable = ns.args.length; while(true) { - tprint(globalVariable); - await sleep(3000); + ns.tprint(globalVariable); + await ns.sleep(3000); } }