mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-20 21:25:47 +01:00
06a985bdf8
This reverts commit bbb6e3f309935aebac74ddb1fbeec12dfb7540b1.
53 lines
1.0 KiB
Markdown
53 lines
1.0 KiB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
|
|
[Home](./index.md) > [bitburner](./bitburner.md) > [NS](./bitburner.ns.md) > [getPurchasedServerCost](./bitburner.ns.getpurchasedservercost.md)
|
|
|
|
## NS.getPurchasedServerCost() method
|
|
|
|
Get cost of purchasing a server.
|
|
|
|
<b>Signature:</b>
|
|
|
|
```typescript
|
|
getPurchasedServerCost(ram: number): number;
|
|
```
|
|
|
|
## Parameters
|
|
|
|
| Parameter | Type | Description |
|
|
| --- | --- | --- |
|
|
| ram | number | Amount of RAM of a potential purchased server, in GB. Must be a power of 2 (2, 4, 8, 16, etc.). Maximum value of 1048576 (2^20). |
|
|
|
|
<b>Returns:</b>
|
|
|
|
number
|
|
|
|
The cost to purchase a server with the specified amount of ram.
|
|
|
|
## Remarks
|
|
|
|
RAM cost: 0.25 GB
|
|
|
|
Returns the cost to purchase a server with the specified amount of ram.
|
|
|
|
## Example 1
|
|
|
|
|
|
```ts
|
|
// NS1:
|
|
for (i = 1; i <= 20; i++) {
|
|
tprint(i + " -- " + getPurchasedServerCost(Math.pow(2, i)));
|
|
}
|
|
```
|
|
|
|
## Example 2
|
|
|
|
|
|
```ts
|
|
// NS2:
|
|
for (i = 1; i <= 20; i++) {
|
|
ns.tprint(i + " -- " + ns.getPurchasedServerCost(Math.pow(2, i)));
|
|
}
|
|
```
|
|
|