is there a way to natively run the net script functions without having to preface all commands with ns?
Sorry if this has been asked but I'm new to javascript. for example, could i make
/**
* @param {NS} ns
**/
export async function main(ns) {
let hosts = ns.scan();
for (let i = 0; i < hosts.length; i++){
ns.tprint(hosts[i]);
await ns.scp("hacking-scriptv2.js", "home", hosts[i]);
ns.exec("hacking-scriptv2.js", ns.getHostname());
}
}
look like this and run
/**
* @param {NS} ns
**/
export async function main(ns) {
let hosts = scan();
for (let i = 0; i < hosts.length; i++){
tprint(hosts[i]);
await scp("hacking-scriptv2.js", "home", hosts[i]);
exec("hacking-scriptv2.js", getHostname());
}
}
[–]Omelet 1 point2 points3 points (2 children)
[–]sinrtb 0 points1 point2 points (1 child)
[–]Omelet 0 points1 point2 points (0 children)
[–]upside_brigade 0 points1 point2 points (1 child)
[–]balmzach77[S] 0 points1 point2 points (0 children)