bitburner-src/markdown/bitburner.singularity.workforcompany.md

64 lines
2.1 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; [Singularity](./bitburner.singularity.md) &gt; [workForCompany](./bitburner.singularity.workforcompany.md)
## Singularity.workForCompany() method
2022-01-16 00:39:37 +01:00
Work for a company.
2021-10-30 18:34:14 +02:00
<b>Signature:</b>
```typescript
2022-01-08 19:25:06 +01:00
workForCompany(companyName?: string, focus?: boolean): boolean;
2021-10-30 18:34:14 +02:00
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
2021-11-03 05:27:21 +01:00
| companyName | string | Name of company to work for. Must be an exact match. Optional. If not specified, this argument defaults to the last job that you worked |
2022-01-08 19:25:06 +01:00
| focus | boolean | Acquire player focus on this work operation. Optional. Defaults to true. |
2021-10-30 18:34:14 +02:00
<b>Returns:</b>
boolean
True if the player starts working, and false otherwise.
## Remarks
2022-01-16 00:39:37 +01:00
RAM cost: 3 GB \* 16/4/1
2021-11-03 05:27:21 +01:00
This function will automatically set you to start working at the company at which you are employed. If you are already in the middle of some “working” action (such as working for a faction, training at a gym, or creating a program), then running this function will automatically cancel that action and give you your earnings.
This function will return true if the player starts working, and false otherwise.
Note that when you are working for a company, you will not actually receive your earnings (reputation, money, experience) until you FINISH the action.
2022-01-08 19:25:06 +01:00
## Example 1
2021-10-30 18:34:14 +02:00
2021-10-30 21:46:34 +02:00
```ts
2022-01-08 19:25:06 +01:00
// NS1:
2021-10-30 18:34:14 +02:00
//If you only want to work until you get 100,000 company reputation. One small hack to get around this is to continuously restart the action to receive your earnings:
while (getCompanyRep(COMPANY HERE) < VALUE) {
workForCompany();
sleep(60000);
}
//This way, your company reputation will be updated every minute.
```
2022-01-08 19:25:06 +01:00
## Example 2
```ts
// NS2:
//If you only want to work until you get 100,000 company reputation. One small hack to get around this is to continuously restart the action to receive your earnings:
while (ns.getCompanyRep(COMPANY HERE) < VALUE) {
ns.workForCompany();
await ns.sleep(60000);
}
//This way, your company reputation will be updated every minute.
```