MISC: Remove support for running NS1 scripts (#2083)

This commit is contained in:
catloversg
2025-04-12 03:41:48 +07:00
committed by GitHub
parent 571cc8f886
commit a9900072da
24 changed files with 86 additions and 347 deletions
+1 -1
View File
@@ -114,7 +114,7 @@ Check how much [RAM](ram.md) a script requires to run with "n" threads
**nano [script]**
Create/Edit a script.
The name of a script must end with a script extension (.js, .jsx, .ts, .tsx, .script). You can also create a text file with a text extension (.txt, .json).
The name of a script must end with a script extension (.js, .jsx, .ts, .tsx). You can also create a text file with a text extension (.txt, .json).
**ps**
+4 -4
View File
@@ -1,12 +1,12 @@
# "Netscript 2" Migration Guide
The game allows two script formats:
In previous versions, the game supported two script formats:
- `.script` (also sometimes called "Netscript 1" or "NS1") files are ran through an interpreter that is based on a version of Javascript from 2009 (ES5). These files are no longer actively supported and should be converted to the newer `.js` format.
- `.script` (also sometimes called "Netscript 1" or "NS1") files are ran through an interpreter that is based on a version of Javascript from 2009 (ES5).
- `.js` (also sometimes called "Netscript 2" or "NS2") files are native javascript that is ran directly by the web browser. Modern features of javascript that are supported by your web browser are supported in `.js` files, because they are run as native js.
Support for `.script` files will be completely removed in future version 3.0. Some basic autoconversion will be attempted at that time, but it is highly recommended to convert your remaining `.script` files to the `.js` format before that, to ensure correctness and, if needed, to familiarize yourself with the `.js` format requirements.
Support for running `.script` files was removed in version 3.0.
## Why do I have to change anything?
@@ -75,4 +75,4 @@ export async function main(ns) {
## Additional problems or edge cases
To get additional help with the migration join the [official Discord server](https://discord.gg/TFc3hKD).
To get additional help with the migration, please join the [official Discord server](https://discord.gg/TFc3hKD).
@@ -39,8 +39,8 @@ Common infinite loop when translating the server purchasing script in starting g
while (i < ns.getPurchasedServerLimit()) {
if (ns.getServerMoneyAvailable("home") > ns.getPurchasedServerCost(ram)) {
var hostname = ns.purchaseServer("pserv-" + i, ram);
ns.scp("early-hack-template.script", hostname);
ns.exec("early-hack-template.script", hostname, 3);
ns.scp("early-hack-template.js", hostname);
ns.exec("early-hack-template.js", hostname, 3);
++i;
}
}