sleepy time update
This commit is contained in:
27
Mizzajl/home/testgang.js
Normal file
27
Mizzajl/home/testgang.js
Normal file
@@ -0,0 +1,27 @@
|
||||
export async function main(ns) {
|
||||
ns.tail();
|
||||
// Get the list of all task names
|
||||
let aTasks = ns.gang.getTaskNames();
|
||||
// Create an array to store task stats
|
||||
let oTasks = [];
|
||||
|
||||
// Loop through each task and get the stats
|
||||
for (let i = 0; i < aTasks.length; i++) {
|
||||
let taskName = aTasks[i];
|
||||
let taskStats = ns.gang.getTaskStats(taskName);
|
||||
|
||||
// Store task name and stats in an object and push to array
|
||||
oTasks.push({
|
||||
name: taskName,
|
||||
stats: taskStats
|
||||
});
|
||||
}
|
||||
|
||||
// Convert the object to a JSON string for easy storage
|
||||
let taskStatsString = JSON.stringify(oTasks, null, 2);
|
||||
|
||||
// Write the task stats to a file
|
||||
await ns.write("GangTaskStats.txt", taskStatsString, "w");
|
||||
|
||||
ns.tprint("Gang task stats have been written to GangTaskStats.txt.");
|
||||
}
|
||||
Reference in New Issue
Block a user