diff --git a/markdown/bitburner.ns.getfunctionramcost.md b/markdown/bitburner.ns.getfunctionramcost.md
index fc0afe171..b1c22cb65 100644
--- a/markdown/bitburner.ns.getfunctionramcost.md
+++ b/markdown/bitburner.ns.getfunctionramcost.md
@@ -4,7 +4,9 @@
## NS.getFunctionRamCost() method
-Get the ram cost of a netscript function.
+Get the RAM cost of a netscript function.
+
+The base RAM cost per script thread can also be retrieved by using `"baseCost"` as argument to this function.
**Signature:**
@@ -42,7 +44,7 @@ string
-The fully-qualified function name, without the leading `ns`. Example inputs: `hack`, `tprint`, `stock.getPosition`.
+The fully-qualified function name, without the leading `ns`.
|
@@ -56,3 +58,13 @@ number
RAM cost: 0 GB
+## Example
+
+
+```js
+const RAM_baseCost = ns.getFunctionRamCost('baseCost');
+const RAM_for_hack = ns.getFunctionRamCost('hack');
+const RAM_for_tprint = ns.getFunctionRamCost('tprint');
+const RAM_for_stock_getPosition = ns.getFunctionRamCost('stock.getPosition');
+```
+
diff --git a/markdown/bitburner.ns.md b/markdown/bitburner.ns.md
index ccd5663f2..b82bc28f2 100644
--- a/markdown/bitburner.ns.md
+++ b/markdown/bitburner.ns.md
@@ -718,7 +718,9 @@ Get the metadata of a file.
-Get the ram cost of a netscript function.
+Get the RAM cost of a netscript function.
+
+The base RAM cost per script thread can also be retrieved by using `"baseCost"` as argument to this function.
|
diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts
index a1e178f38..b9cdb0ae6 100644
--- a/src/NetscriptFunctions.ts
+++ b/src/NetscriptFunctions.ts
@@ -96,7 +96,7 @@ import { hasScriptExtension } from "./Paths/ScriptFilePath";
import { hasTextExtension } from "./Paths/TextFilePath";
import { ContentFilePath } from "./Paths/ContentFile";
import { hasContractExtension } from "./Paths/ContractFilePath";
-import { getRamCost } from "./Netscript/RamCostGenerator";
+import { getRamCost, RamCostConstants } from "./Netscript/RamCostGenerator";
import { getEnumHelper } from "./utils/EnumHelper";
import { ServerConstants } from "./Server/data/Constants";
import { assertFunctionWithNSContext } from "./Netscript/TypeAssertion";
@@ -1500,6 +1500,9 @@ export const ns: InternalAPI = {
}),
getFunctionRamCost: (ctx) => (_name) => {
const name = helpers.string(ctx, "name", _name);
+ if (name === "baseCost") {
+ return RamCostConstants.Base;
+ }
return getRamCost(name.split("."), true);
},
tprintRaw: () => (value) => {
diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts
index 7f448f707..25fc865a1 100644
--- a/src/ScriptEditor/NetscriptDefinitions.d.ts
+++ b/src/ScriptEditor/NetscriptDefinitions.d.ts
@@ -9002,12 +9002,22 @@ export interface NS {
getResetInfo(): ResetInfo;
/**
- * Get the ram cost of a netscript function.
+ * Get the RAM cost of a netscript function.
+ *
+ * The base RAM cost per script thread can also be retrieved by using `"baseCost"` as argument to this function.
*
* @remarks
* RAM cost: 0 GB
*
- * @param name - The fully-qualified function name, without the leading `ns`. Example inputs: `hack`, `tprint`, `stock.getPosition`.
+ * @param name - The fully-qualified function name, without the leading `ns`.
+ *
+ * @example
+ * ```js
+ * const RAM_baseCost = ns.getFunctionRamCost('baseCost');
+ * const RAM_for_hack = ns.getFunctionRamCost('hack');
+ * const RAM_for_tprint = ns.getFunctionRamCost('tprint');
+ * const RAM_for_stock_getPosition = ns.getFunctionRamCost('stock.getPosition');
+ * ```
*/
getFunctionRamCost(name: string): number;