mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-21 05:35:45 +01:00
2.1 KiB
2.1 KiB
Home > bitburner > Singularity > workForCompany
Singularity.workForCompany() method
Work for a company.
Signature:
workForCompany(companyName?: string, focus?: boolean): boolean;
Parameters
Parameter | Type | Description |
---|---|---|
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 |
focus | boolean | Acquire player focus on this work operation. Optional. Defaults to true. |
Returns:
boolean
True if the player starts working, and false otherwise.
Remarks
RAM cost: 3 GB * 16/4/1
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.
Example 1
// NS1:
//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.
Example 2
// 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.