mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-21 23:23:51 +01:00
fix previous commit, improve argument page on docs
This commit is contained in:
parent
6369ab434b
commit
23199ee705
@ -16,9 +16,16 @@ This includes information such as function signatures, what they do, and their r
|
||||
sleep() <basicfunctions/sleep>
|
||||
print() <basicfunctions/print>
|
||||
tprint() <basicfunctions/tprint>
|
||||
tFormat() <basicfunctions/tFormat>
|
||||
nFormat() <basicfunctions/nFormat>
|
||||
disableLog() <basicfunctions/disableLog>
|
||||
enableLog() <basicfunctions/enableLog>
|
||||
isLogEnabled() <basicfunctions/isLogEnabled>
|
||||
clearLog() <basicfunctions/clearLog>
|
||||
tail() <basicfunctions/tail>
|
||||
closeTail() <basicfunctions/closeTail>
|
||||
moveTail() <basicfunctions/moveTail>
|
||||
resizeTail() <basicfunctions/resizeTail>
|
||||
scan() <basicfunctions/scan>
|
||||
nuke() <basicfunctions/nuke>
|
||||
brutessh() <basicfunctions/brutessh>
|
||||
@ -31,10 +38,14 @@ This includes information such as function signatures, what they do, and their r
|
||||
spawn() <basicfunctions/spawn>
|
||||
kill() <basicfunctions/kill>
|
||||
killall() <basicfunctions/killall>
|
||||
scriptKill() <basicfunctions/scriptKill>
|
||||
scriptRunning() <basicfunctions/scriptRunning>
|
||||
scp() <basicfunctions/scp>
|
||||
ls() <basicfunctions/ls>
|
||||
ps() <basicfunctions/ps>
|
||||
mv() <basicfunctions/mv>
|
||||
hasRootAccess() <basicfunctions/hasRootAccess>
|
||||
getHostname() <basicfunctions/getHostname>
|
||||
getHackingLevel() <basicfunctions/getHackingLevel>
|
||||
getHackingMultipliers() <basicfunctions/getHackingMultipliers>
|
||||
getHacknetMultipliers() <basicfunctions/getHacknetMultipliers>
|
||||
@ -49,14 +60,14 @@ This includes information such as function signatures, what they do, and their r
|
||||
serverExists() <basicfunctions/serverExists>
|
||||
fileExists() <basicfunctions/fileExists>
|
||||
isRunning() <basicfunctions/isRunning>
|
||||
getPurchasedServerCost() <basicfunctions/getPurchasedServerCost>
|
||||
purchaseServer() <basicfunctions/purchaseServer>
|
||||
deleteServer() <basicfunctions/deleteServer>
|
||||
upgradePurchasedServer() <basicfunctions/upgradePurchasedServer>
|
||||
getPurchasedServers() <basicfunctions/getPurchasedServers>
|
||||
getPurchasedServerLimit() <basicfunctions/getPurchasedServerLimit>
|
||||
getPurchasedServerMaxRam() <basicfunctions/getPurchasedServerMaxRam>
|
||||
getPurchasedServerCost() <basicfunctions/getPurchasedServerCost>
|
||||
getPurchasedServerUpgradeCost() <basicfunctions/getPurchasedServerUpgradeCost>
|
||||
scriptRunning() <basicfunctions/scriptRunning>
|
||||
scriptKill() <basicfunctions/scriptKill>
|
||||
getScriptRam() <basicfunctions/getScriptRam>
|
||||
share() <basicfunctions/share>
|
||||
getSharePower() <basicfunctions/getSharePower>
|
@ -17,7 +17,9 @@ specified in the second argument. The code would look like:
|
||||
|
||||
.. code:: javascript
|
||||
|
||||
run(args[0], args[1]);
|
||||
var fileName = args[0];
|
||||
var threads = args[1];
|
||||
run(fileName, threads);
|
||||
|
||||
And it could be ran from the terminal like:
|
||||
|
||||
@ -28,8 +30,29 @@ In .js / ns2, the above script would look like:
|
||||
.. code:: javascript
|
||||
|
||||
export async function main(ns) {
|
||||
ns.run(ns.args[0], ns.args[1]);
|
||||
let fileName = ns.args[0];
|
||||
let threads = ns.args[1];
|
||||
ns.run(fileName, threads);
|
||||
}
|
||||
|
||||
It is also possible to get the number of arguments that were passed
|
||||
into a script using ``args.length``.
|
||||
|
||||
If we want to make a script like ``foo.js`` that gets 2 arguments: a string to print
|
||||
and a number of time to print that string, the code could look like:
|
||||
|
||||
.. code:: javascript
|
||||
|
||||
export async function main(ns) {
|
||||
for (let i=0; i<ns.args[1];i++){
|
||||
ns.tprint(ns.args[0])
|
||||
}
|
||||
}
|
||||
|
||||
Then we can have another script launch ``foo.js`` with the 2 arguments like:
|
||||
|
||||
.. code:: javascript
|
||||
|
||||
export async function main(ns) {
|
||||
ns.exec("foo.js","n00dles",1,"this will be printed twice", 2)
|
||||
}
|
||||
|
@ -88,9 +88,7 @@ const Exclusive = (props: IExclusiveProps): React.ReactElement => {
|
||||
Certain <b>gangs</b>
|
||||
</li>
|
||||
)}
|
||||
{Player.canAccessGrafting() &&
|
||||
!props.aug.isSpecial &&
|
||||
props.aug.name !== AugmentationNames.TheRedPill && (
|
||||
{Player.canAccessGrafting() && !props.aug.isSpecial && props.aug.name !== AugmentationNames.TheRedPill && (
|
||||
<li>
|
||||
<b>Grafting</b>
|
||||
</li>
|
||||
|
@ -229,7 +229,8 @@ export class OfficeSpace {
|
||||
}
|
||||
const diff = target - this.employeeNextJobs[job];
|
||||
|
||||
if (diff === 0) return true; // We are already at the desired number
|
||||
if (diff === 0) return true;
|
||||
// We are already at the desired number
|
||||
else if (diff <= this.employeeNextJobs[EmployeePositions.Unassigned]) {
|
||||
// This covers both a negative diff (reducing the amount of employees in position) and a positive (increasing and using up unassigned employees)
|
||||
this.employeeNextJobs[EmployeePositions.Unassigned] -= diff;
|
||||
|
Loading…
Reference in New Issue
Block a user