bitburner-src/markdown/bitburner.ns.hackanalyzethreads.md

45 lines
1.3 KiB
Markdown
Raw Normal View History

2021-10-30 18:34:14 +02:00
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [NS](./bitburner.ns.md) &gt; [hackAnalyzeThreads](./bitburner.ns.hackanalyzethreads.md)
## NS.hackAnalyzeThreads() method
2021-11-03 05:27:21 +01:00
Predict the effect of hack.
2021-10-30 18:34:14 +02:00
<b>Signature:</b>
```typescript
2021-10-30 21:46:34 +02:00
hackAnalyzeThreads(host: string, hackAmount: number): number;
2021-10-30 18:34:14 +02:00
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
2021-10-30 21:46:34 +02:00
| host | string | Hostname of the target server to analyze. |
2021-10-30 18:34:14 +02:00
| hackAmount | number | Amount of money you want to hack from the server. |
<b>Returns:</b>
number
The number of threads needed to hack the server for hackAmount money.
## Remarks
RAM cost: 1 GB
This function returns the number of script threads you need when running the hack command to steal the specified amount of money from the target server. If hackAmount is less than zero or greater than the amount of money available on the server, then this function returns -1.
2021-11-03 05:27:21 +01:00
Warning: The value returned by this function isnt necessarily a whole number.
2021-10-30 18:34:14 +02:00
## Example
2021-10-30 21:46:34 +02:00
```ts
2021-10-30 18:34:14 +02:00
//For example, lets say the foodnstuff server has $10m and you run:
hackAnalyzeThreads("foodnstuff", 1e6);
//If this function returns 50, this means that if your next hack call is run on a script with 50 threads, it will steal $1m from the foodnstuff server.
```