mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-24 10:12:53 +02:00
v1.0.2 part 1
This commit is contained in:
@@ -670,10 +670,45 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
||||
if (args.length === 0) {
|
||||
throw makeRuntimeErrorMsg("tprint", "Takes at least 1 argument.");
|
||||
}
|
||||
Terminal.print(`${workerScript.scriptRef.filename}: ${argsToString(args)}`);
|
||||
const str = argsToString(args);
|
||||
if (str.startsWith("ERROR") || str.startsWith("FAIL")) {
|
||||
Terminal.error(`${workerScript.scriptRef.filename}: ${str}`);
|
||||
return;
|
||||
}
|
||||
if (str.startsWith("SUCCESS")) {
|
||||
Terminal.success(`${workerScript.scriptRef.filename}: ${str}`);
|
||||
return;
|
||||
}
|
||||
if (str.startsWith("WARN")) {
|
||||
Terminal.warn(`${workerScript.scriptRef.filename}: ${str}`);
|
||||
return;
|
||||
}
|
||||
if (str.startsWith("INFO")) {
|
||||
Terminal.info(`${workerScript.scriptRef.filename}: ${str}`);
|
||||
return;
|
||||
}
|
||||
Terminal.print(`${workerScript.scriptRef.filename}: ${str}`);
|
||||
},
|
||||
tprintf: function (format: any, ...args: any): any {
|
||||
Terminal.print(vsprintf(format, args));
|
||||
const str = vsprintf(format, args);
|
||||
|
||||
if (str.startsWith("ERROR") || str.startsWith("FAIL")) {
|
||||
Terminal.error(`${workerScript.scriptRef.filename}: ${str}`);
|
||||
return;
|
||||
}
|
||||
if (str.startsWith("SUCCESS")) {
|
||||
Terminal.success(`${workerScript.scriptRef.filename}: ${str}`);
|
||||
return;
|
||||
}
|
||||
if (str.startsWith("WARN")) {
|
||||
Terminal.warn(`${workerScript.scriptRef.filename}: ${str}`);
|
||||
return;
|
||||
}
|
||||
if (str.startsWith("INFO")) {
|
||||
Terminal.info(`${workerScript.scriptRef.filename}: ${str}`);
|
||||
return;
|
||||
}
|
||||
Terminal.print(`${workerScript.scriptRef.filename}: ${str}`);
|
||||
},
|
||||
clearLog: function (): any {
|
||||
workerScript.scriptRef.clearLog();
|
||||
|
||||
Reference in New Issue
Block a user