mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-18 07:18:38 +02:00
Add ns.getRecentScripts()
This commit is contained in:
56
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
56
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@@ -99,22 +99,56 @@ interface Player {
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
interface RunningScript {
|
||||
export interface RunningScript {
|
||||
/** Arguments the script was called with */
|
||||
args: string[];
|
||||
/** Filename of the script */
|
||||
filename: string;
|
||||
/**
|
||||
* Script logs as an array. The newest log entries are at the bottom.
|
||||
* Timestamps, if enabled, are placed inside `[brackets]` at the start of each line.
|
||||
**/
|
||||
logs: string[];
|
||||
/** Total amount of hacking experience earned from this script when offline */
|
||||
offlineExpGained: number;
|
||||
/** Total amount of money made by this script when offline */
|
||||
offlineMoneyMade: number;
|
||||
/** Number of seconds that the script has been running offline */
|
||||
offlineRunningTime: number;
|
||||
/** Total amount of hacking experience earned from this script when online */
|
||||
onlineExpGained: number;
|
||||
/** Total amount of money made by this script when online */
|
||||
onlineMoneyMade: number;
|
||||
/** Number of seconds that this script has been running online */
|
||||
onlineRunningTime: number;
|
||||
/** Process ID. Must be an integer */
|
||||
pid: number;
|
||||
/** How much RAM this script uses for ONE thread */
|
||||
ramUsage: number;
|
||||
/** Hostname of the server on which this script runs */
|
||||
server: string;
|
||||
/** Number of threads that this script runs with */
|
||||
threads: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
interface RecentScript {
|
||||
/** Arguments the script was called with */
|
||||
args: string[];
|
||||
/** Filename of the script */
|
||||
filename: string;
|
||||
/** Process ID. Must be an integer */
|
||||
pid: number;
|
||||
/** Timestamp of when the script was killed */
|
||||
timestamp: Date;
|
||||
/** Numeric epoch of timestamp */
|
||||
timestampEpoch: number;
|
||||
/** An inactive copy of the last `RunningScript` associated to the script */
|
||||
runningScript: RunningScript;
|
||||
}
|
||||
|
||||
/**
|
||||
* Data representing the internal values of a crime.
|
||||
* @public
|
||||
@@ -4567,6 +4601,26 @@ export interface NS extends Singularity {
|
||||
*/
|
||||
getScriptLogs(fn?: string, host?: string, ...args: any[]): string[];
|
||||
|
||||
/**
|
||||
* Get an array of recently killed scripts across all servers.
|
||||
* @remarks
|
||||
* RAM cost: 0.2 GB
|
||||
*
|
||||
* The most recently killed script is the first element in the array.
|
||||
* Note that there is a maximum number of recently killed scripts which are tracked.
|
||||
* This is configurable in the game's options as `Recently killed scripts size`.
|
||||
*
|
||||
* @usage below:
|
||||
* ```ts
|
||||
* let recentScripts = ns.getRecentScripts();
|
||||
* let mostRcent = recentScripts.pop()
|
||||
* ns.tprint(mostRecent.logs.join('\n'))
|
||||
* ```
|
||||
*
|
||||
* @returns Array with information about previously killed scripts.
|
||||
*/
|
||||
getRecentScripts(): RecentScript[];
|
||||
|
||||
/**
|
||||
* Open the tail window of a script.
|
||||
* @remarks
|
||||
|
||||
Reference in New Issue
Block a user