bitburner-src/markdown/bitburner.ns.sleep.md
2023-04-28 14:45:55 -04:00

772 B

Home > bitburner > NS > sleep

NS.sleep() method

Suspends the script for n milliseconds.

Signature:

sleep(millis: number): Promise<true>;

Parameters

Parameter Type Description
millis number Number of milliseconds to sleep.

Returns:

Promise<true>

A promise that resolves to true when the sleep is completed.

Remarks

RAM cost: 0 GB

Example

// This will count from 1 to 10 in your terminal, with one number every 5 seconds
for (var i = 1; i <= 10; i++) {
  ns.tprint(i);
  await ns.sleep(5000);
}