Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: Add ns.renderTail #1815

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions markdown/bitburner.ns.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export async function main(ns) {
| [readPort(portNumber)](./bitburner.ns.readport.md) | Read data from a port. |
| [relaysmtp(host)](./bitburner.ns.relaysmtp.md) | Runs relaySMTP.exe on a server. |
| [renamePurchasedServer(hostname, newName)](./bitburner.ns.renamepurchasedserver.md) | Rename a purchased server. |
| [renderTail(pid)](./bitburner.ns.rendertail.md) | Render a tail window. |
| [resizeTail(width, height, pid)](./bitburner.ns.resizetail.md) | Resize a tail window. |
| [rm(name, host)](./bitburner.ns.rm.md) | Delete a file. |
| [run(script, threadOrOptions, args)](./bitburner.ns.run.md) | Start another script on the current server. |
Expand Down
30 changes: 30 additions & 0 deletions markdown/bitburner.ns.rendertail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [NS](./bitburner.ns.md) &gt; [renderTail](./bitburner.ns.rendertail.md)

## NS.renderTail() method

Render a tail window.

**Signature:**

```typescript
renderTail(pid?: number): void;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| pid | number | _(Optional)_ Optional. PID of the script having its tail rendered. If omitted, the current script is used. |

**Returns:**

void

## Remarks

RAM cost: 0 GB

Tail windows are rendered at an interval defined in game settings. This function renders the tail window of the specified script immediately.

1 change: 1 addition & 0 deletions src/Netscript/RamCostGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ export const RamCosts: RamCostTree<NSFull> = {
tail: 0,
toast: 0,
moveTail: 0,
renderTail: 0,
resizeTail: 0,
closeTail: 0,
setTitle: 0,
Expand Down
11 changes: 11 additions & 0 deletions src/NetscriptFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,17 @@ export const ns: InternalAPI<NSFull> = {

LogBoxEvents.emit(runningScriptObj);
},
renderTail:
(ctx) =>
(_pid = ctx.workerScript.scriptRef.pid) => {
const pid = helpers.number(ctx, "pid", _pid);
const runningScriptObj = helpers.getRunningScript(ctx, pid);
if (runningScriptObj == null) {
helpers.log(ctx, () => helpers.getCannotFindRunningScriptErrorMessage(pid));
return;
}
runningScriptObj.tailProps?.rerender();
},
moveTail:
(ctx) =>
(_x, _y, _pid = ctx.workerScript.scriptRef.pid) => {
Expand Down
13 changes: 13 additions & 0 deletions src/ScriptEditor/NetscriptDefinitions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6374,6 +6374,19 @@ export interface NS {
*/
tail(fn?: FilenameOrPID, host?: string, ...args: ScriptArg[]): void;

/**
* Render a tail window.
*
* @remarks
* RAM cost: 0 GB
*
* Tail windows are rendered at an interval defined in game settings. This function renders the tail window of the
* specified script immediately.
*
* @param pid - Optional. PID of the script having its tail rendered. If omitted, the current script is used.
*/
renderTail(pid?: number): void;

/**
* Move a tail window.
* @remarks
Expand Down