alainbryden / bitburner-scripts Goto Github PK
View Code? Open in Web Editor NEWMy own scripts for playing bitburner
License: MIT License
My own scripts for playing bitburner
License: MIT License
More of a question than a real issue.
Why is the other sleeves except 0 set to only do crime?
I read the bug mention on the PR but that would only happen if the sleeves are doing multi work.
Is there also a problem if the sleeves do the same activity the sleeve 0 is doing?
If the value passed to formatDuration is Infinity it returns Infinityh, i think Infinity or ∞ would be a better value
I realized that hacknet-upgrade-manager.js isn't being executed as intended by daemon.js
In daemon.js we have this configuration, but in the logs it just calling the 8h one as show in the picture.
// Buy every hacknet upgrade with up to 4h payoff if it is less than 10% of our current money or 8h if it is less than 1% of our current money
{ interval: 32000, name: "hacknet-upgrade-manager.js", shouldRun: shouldUpgradeHacknet, args: () => ["-c", "--max-payoff-time", "4h", "--max-spend", ns.getServerMoneyAvailable("home") * 0.1] },
{ interval: 33000, name: "hacknet-upgrade-manager.js", shouldRun: shouldUpgradeHacknet, args: () => ["-c", "--max-payoff-time", "8h", "--max-spend", ns.getServerMoneyAvailable("home") * 0.01] },
Also, how can I set it to be very agressive regarding hacknet upgrades?
I tried to set it to 30m and 0.5 of my money but still not buying upgrades
As the script remove-worst-server.js attempts to remove the worst server but is never able to due to scripts still running on it, how is it ever meant to become free and upgrade?
Version: 1.6.4
Git Pull: fbb99c17
Platform: Steam
[home ~/]> run daemon.js
Running script with 1 thread(s), pid 2 and args: [].
/Tasks/contractor.js.solver.js: WARNING: No solver available for contract type "Array Jumping Game II"
Full info: {"contract":"contract-261858.cct","hostname":"nwo","type":"Array Jumping Game II","data":[1,2,0,1,5,2,4,2,3,2,4]})
[home ~/]>
Should probably add a blacklist of augments that should not be purchased for sleeves, such as "CashRoot Starter Kit"
Hi there,
in Faction-manager.js, line 241 there´s an error when the Bladeburner Bitnode is not achieved.
factionData["Bladeburners"].joined
fails because it is undefined.
Kind regards
Still very new to javascript
When I try to run Gangs.js I get
ns.read('/Temp/gang-augs.txt') somehow returned undefined or an empty string
I've looked all through gangs.js and into the temp file created there are no issues that i can figure out i don't know if its me or just an actual error just wanted to give a heads up
Lines such as (maxRamPossibleToBuy < ns.getServerMaxRam("home") * homeThreshold)
compare returns in GB for ns.purchaseServer()
vs return in MB from e.g. ns.getServerMaxRam("home")
.
This means the server you want to purchase is being compared to 1024x higher thresholds etc.
e.g.
I have 32GB ram on home and I can buy 4TB servers.
ns.print(maxRamPossibleToBuy)
ns.print(ns.getServerMaxRam("home"))
logs:
4096
32768
This is likely an issue with the game, still as of 1.6.0 (getServerMaxRam() is supposed to return GB according to the manual), but host manager doesn't work correctly as it is right now. A simple temp fix is multiplying buy values during comparison by 1024 or dividing thresholds by the same.
I had stopped sleeve.js and moved my sleeve manually to Volhaven to study at ZB to boost my main study rate and then didn't move it back before resuming sleeve.js and letting the game idle for a bit while it helped out with faction work. Came back to find that the sleeve had installed some augments and was trying to do initial physical training, but was throwing errors that it couldn't start physical training.
My guess is that it was falling because it was looking for Powerhouse Gym in the wrong city. Probably needs to check if it should travel first.
Lines 153 to 163 in f507018
Hello again,
The recent issue of focus switching can be fixed by an additional parameter that wasn't documented correctly.
workForFaction: function (name: any, type: any, focus: boolean = true): any {
workForCompany: function (companyName: any, focus: boolean = true): any {
This means on work-for-factions.js lines 486, 521, and 649, if you pass ${shouldFocusAtWork} to those commands as a 2nd/3rd argument, it won't swap focus away from what you're already doing as appropriate to the setting. I'd PR this but I figure it's a small change, just say if you'd prefer I do that.
Thanks!
Non Functioning Version: 1.6.0
Snippet Causing Issue
await runCommand(ns,
ns.disableLog('sleep'); ns.tail(); let lastRead = '';
while (true) {
let read = ns.read('${summaryFile}');
if (lastRead != read) ns.print(lastRead = read);
await ns.sleep(1000);
}, summaryTailScript); }
See lines 382 - 396 of stockmaster.js. May be occurring elsewhere also.
Version 1.6.0 on Steam caught in infinite wait/restart loop. Game reports "Did you forget a Sleep(x)?" and wants to restart
Very nice work in this repo! Even works for a beginner if you disable several scripts (maybe make a -newbie flag? :D) Here is another warning related to server upgrades that happens often after deletion until all process are actually killed. Maybe actively kill them from the daemon?:
remove-worst-server.js: Deleted pserv which had only 16384 GB of RAM. 24 servers remain.
daemon.js: WARNING: Caught an error in the targeting loop: |DELIMITER|home|DELIMITER|daemon.js|DELIMITER|fileExists: Invalid hostname or IP: pserv
Stack:
daemon.js:L105@doesFileExist
daemon.js:L1433@isFlaggedForDeletion
daemon.js:L-1@unknown
daemon.js:L1438@buildServerList
daemon.js:L363@doTargetingLoop
Originally posted by @BasTijs in #14 (comment)
As I get into new mechanics and find more and more value from the hash options, I'm starting to see a few avenues for better automation.
Cannot purchase any NeuroFlux Governor because the next level requires 1.426k reputation, but the best faction (Bladeburners) has insufficient rep (485.476).
SUGGESTION: Do some work for faction Church of the Machine God to qickly earn rep for NeuroFlux Governor since it has the most favor (324.0366).
do ns.getFactionRep("Church of the Machine God")
/Temp/terminal-command.js: 5227971.642437208
I have over 5 million rep with the Church, but faction-manager.js won't use the available augmentation that's waiting right there, waiting instead for any other faction to become available, even choosing to donate rather than taking the free route.
Also I'm now noticing that there's a typo above, and the U is missing from qUickly earn rep.
When using subfolders, I'm unable to start daemon
RUNTIME ERROR
/alain/daemon.js@homeFailed to resolve module specifier "./helpers.js". Invalid relative url or base scheme isn't hierarchical.
stack:
TypeError: Failed to resolve module specifier "./helpers.js". Invalid relative url or base scheme isn't hierarchical.
Looks like relative url is valid, I coudn't find any more information how to fix this
['subfolder', '/alain']
run /alain/daemon.js
Scripts downloaded to correct directory, and they are there
I've also tried to run it by
cd alain
run daemon.js
alas to no avail
I have set the number formatting in bitburner to "DE". This results in numbers like '75.000' instead of '75 000'. As some of the numbers seem to be printed in your scripts with the standard methods, and some of them not, I see lines like this:
Doing 'hacking' work for "Tian Di Hui" until 75.000 rep. Currently at 37.394, earning 1.506 rep/sec. (ETA: 6h 56m 13s)
I would expect something like
Doing 'hacking' work for "Tian Di Hui" until 75.000k rep. Currently at 37.394k, earning 1.506 rep/sec. (ETA: 6h 56m 13s)
^ ^
as this is how bitburner is formatting numbers.
run daemon.js -x
ERROR: Ran out of RAM to run /Remote/grow-target.js - 2 of 243 threads were spawned.
Hi, is this error critical?
Even after purchasing Neuroreceptor Management Implant the work-for-factions scripts keeps focusing on the faction reputation work that is being worked on.
I tried to uncomment the lines:
487 -> //if (await getNsDataThroughFile(ns, ns.workForFaction('${factionName}', '${factionWork}') === true); ns.setFocus(${shouldFocusAtWork}
, '/Temp/work-for-faction.txt'))
522 - > //if (!await getNsDataThroughFile(ns, ns.workForFaction('${factionName}', '${work}') === true); ns.setFocus(${shouldFocusAtWork}
, '/Temp/work-for-faction.txt'))
650 -> //if (await getNsDataThroughFile(ns, ns.workForCompany('${companyName}')); ns.setFocus(${shouldFocusAtWork}
, '/Temp/work-for-company.txt')) {
It doesn't focus on the task but it keeps refreshing and sending me to terminal screen.
Am I missing something to make this work?
Periodically, as well as several times on daemon first startup, the following message (or similar) will appear
RUNTIME ERROR
/Remote/weak-target.js@daemon-8
Args: ["syscore", 1640036309008, 1640036865632, 556624, "Batch 20-weak1", 0, 0]
/Remote/weak-target.js cannot be run because it does not have a main function.
Hello - relatively newbie here, recently downloaded the full repository on a clean install and am giving it a shot in BN8.1 (Ghost of Wall Street).
After launching daemon.js either with or without arguments, I shortly get the warning:
"daemon.js: WARNING: Caught an error in the targeting loop: TypeError: Cannot read properties of undefined (reading 'name')"
This error pops continuously every 20 seconds or so, and it's not clear to me if it's a serious issue or even what it's trying to tell me. Since 8.1 restricts all profit except from stock trading, I'm wondering if it's an issue with not buying or using player servers or hacknet nodes?
stockmanager.js appears to be functioning normally - no issues there
Any idea what I might be doing wrong to cause this error? I have not purchase or delete any servers on this bitnode - certainly not while the script was running.
Thanks!
git-pull with --subfolder fails to download contents in any folders. So /remote /temp etc.
This is similar to #23 but slightly different
TODO: Install Augmentations when the situation is suitable.
While running on bn2 to get the 25t to get the last augment, I notice that around 3t of stock it doesn't seem to keep up with the available cash IE at the moment it looks like:
Money | $23.582t |
Stock | $3.418t
With the latest version of the script I keep getting the following error:
The script in question really does not have the mentioned flag, only the budget
and reserve
.
I have tried a reload, but the problem persists between runs, is there any quick fix I can apply? I noticed the call to this script has changed on the last commit.
Hey,
I'm currently in BN6 and found out that work-for-factions.js has a problem with Bladeburners:
The last "Bladeburners" aug is only 62.500 rep, not worth grinding 459.796 rep to unlock donations.
Faction "Bladeburners" Highest Aug Req: 62.500, Current Favor (5.1686/150) Req: 459.796
Doing 'undefined' work for "Bladeburners" until 62.500 rep. Currently at 0, earning 0.000 rep/sec. (ETA: Infinityh)
I'm keeping this here as a placeholder for any who come here intending to report it.
This is a bug with the game (bitburner) itself. There's an open issue in the bitburner backlog: danielyxie/bitburner#1714
It happens because there is a race condition in the game code that will cause calls to ns.scp (or write) to not leave the file in a ready state for a short while after it's first copied / written. As such, when we first copy a script to a new remote server and try to run it, the run might fail that first time, but then work a subsequent time.
Great work here, I appreciate you making your work public because although I could probably write (some of) the scripts myself, I'm in a place in life where I don't want to invest that kind of time in a programming game anymore but still tremendously enjoy watching Bitburner do it's thing and tinkering with your scripts ;)
Having said that, one thing that bugs me is the display of the reputation per second in the work-for-faction.js logs. For me, the number is way off most of the time and on occasional updates jumps back to the real value that Bitburner shows in the actual work window. Obviously the calculation of the remaining time is off as well.
In the screenshot you can see that the value changes and is off from the Bitburner value. If you calculate the diff between the actual reputation and divide it by the seconds that have passed according to the log timestamp, you can see that the valus is off as well.
Now the funny thing is that I cannot figure out where the wrong value comes from. I don't think there's a mistake in your code and I've even traced back the factor "5" to the Bitburner source representing "CYCLES_PER_SEC = 1000 / CONSTANTS.MilliPerCycle". But for some reason the Player object seems to return a wrong value from within the game as opposed to from within Bitburner. This does never happen however when I use a standalone script to peridically print out the workRepGainRate.
Can this be some sort or race condition between you starting the job, Bitburner updating its values and you printing them out too fast? Just for fun I just inserted an "await ns.asleep(1000)" before the message is printed and it indeed seems to fix the issue for me.
Or maybe you have a better idea to fix this?
Hi again,
So I see these 2 errors only once when I run the daemon script, probably nothing big but I just wanted to let you know
1.) RUNTIME ERROR
/Remote/weak-target.js@max-hardware
Args: ["n00dles", 1640755371142, 1640755422787, 51645, "Batch 1-weak2", 0, 0]
/Remote/weak-target.js cannot be run because it does not have a main function.
This appears randomly in the middle of the script run, doesn't stop anything but just pops up for some reason
2.) The file "/Temp/stock-probabilities.txt" is missing or empty. (Is stockmaster.js running?)
Just a warning from the stock script again, only shows up once when I start the script
Hi, I just tried to start using your scripts after pulling from github but when I put "run daemon.js" in my terminal I get this:
RUNTIME ERROR
daemon.js@home
ps(...).some is not a function
stack:
TypeError: ps(...).some is not a function
at whichServerIsRunning (daemon.js:289:46)
at tryRunTool (daemon.js:330:27)
at runStartupScripts (daemon.js:299:39)
at Module.main (daemon.js:272:49)
I'm not sure if there's something wrong in daemon.js or if I'm doing something wrong but it seems like it doesn't like the ps() function for whatever reason.
In the most recent Steam update Source File 4 behavior has changed from giving access to more Singularity functions per level to reducing RAM cost of Singularity functions per level. Trying to find what impact this has on the scripts, but I'm currently in SF4 where I would have access to all Singularity functions anyway. Will update if I find more.
Edit:
I've just realized this is being discussed in another issue, so feel free to close this, but I'm still looking into what this impacts.
Hi. I started running this collection of scripts a few days ago. After a while (not sure how long, haven't timed), the Overview display gets messed up with extra spacing around Money and Stocks and a random extra underlined area next to Agi.
Killing daemon.js and running it again temporarily fixes the overview but the formatting problems come back after a while.
I'm very new to JS and not sure how to help track down and fix this.
Example: bitburner-scripts/helpers.js
export function formatMoney(num, maxSignificantFigures = 6, maxDecimalPlaces = 3) {
let numberShort = formatNumberShort(num, maxSignificantFigures, maxDecimalPlaces);
return num >= 0 ? "$" + numberShort : numberShort.replace("-", "-$");
}
We may use jest
to test functions to increase the stability of the system.
It's probably not been a requirement here, but I would like to run the script with a brand new save. I can probably run some sub-scripts until i get enough to upgrade ram, but for OCD reasons I would like it to run from the start, on it's own.
Below is the output...
[home ~/]> free
Total: 8.00GB
Used: 0.00GB (0.00%)
Available: 8.00GB
[home ~/]> run daemon.js
Running script with 1 thread(s), pid 3 and args: [].
daemon.js: FAIL: (0 retries remaining): Run command returned no pid. Destination: /Temp/owned-source-files.txt.js Command: let result = ""; try { result = JSON.stringify(Object.fromEntries(ns.getOwnedSourceFiles().map(sf => [sf.n, sf.lvl]))); } catch { }
if (ns.read("/Temp/owned-source-files.txt") != result) await ns.write("/Temp/owned-source-files.txt", result, 'w')
Ensure you have sufficient free RAM to run this temporary script.
I'm trying to understand what's happening to take the RAM.
I can see the file...
nano /Temp/owned-source-files.txt.js
import { formatMoney, formatNumberShort, formatDuration, parseShortNumber, scanAllServers } from "helpers.js"
export async function main(ns) { try { let result = ""; try { result = JSON.stringify(Object.fromEntries(ns.getOwnedSourceFiles().map(sf => [sf.n, sf.lvl]))); } catch { }
if (ns.read("/Temp/owned-source-files.txt") != result) await ns.write("/Temp/owned-source-files.txt", result, 'w'); } catch(err) { ns.tprint(String(err)); throw(err); } }
From this I understand that ns.getOwnedSourceFiles() has a 5GB RAM cost.
I can see that daemon.js
has a 5.5GB RAM cost, by doing this:
[home ~/]> run daemon.js --tail
Running script with 1 thread(s), pid 5 and args: [].
[home ~/]> free
Total: 8.00GB
Used: 5.50GB (68.75%)
Available: 2.50GB
-- Random Question -- Is there a better way to see the RAM cost of a script?
This means daemon.js
would have to cost 3GB RAM or less in order to execute on the starter 8GB machine.
Has this been tried already? Do you have any thoughts/advice?
When running several scripts such as work-for-factions (via daemon), they crash with an error like
FAIL: (0 retries remaining): ns.read('/Temp/-462713546-data.txt') somehow returned undefined or an empty string
I'm doing BN8.1, I'm finding that each run when I get to where via your script the ability to purchase SQLInject.exe is doable, it purchases that leaving me without enough money to continue buy stocks, thus leaving me at a stalling point. For now I have disabled the programManager.js and just create them myself (why not farm a small bit of Int exp). Wonder about creating an additional "check" for buying programs to have it wait longer than normal so we don't run out of money to play the market. It's basically leaving me with around 10-20m and doesn't buy any more stocks.
Also noticed the Stock amount on the char overview, stays showing an amount even after all are sold, not sure if that's intended.
welp here we go.
most of the scripts either run out of order or dont do their jobs.
multiple script are pulling ".txt" files that either dont exist or are always empty
if there is someone i missing here any help would be appreciated
ns.read('/Temp/======.txt') somehow returned undefined or an empty string
is a prime example of the .txt files that im having issues with.
The only use of subfolder in git-pull.js is line 29:
const remoteFilePath = baseUrl + localFilePath.substr(options.subfolder.length);
This simply strips part of the file to get causing all files to fail to download IE:
WARNING: "analyze-hack.js" was not updated. (Currently running or not located at https://raw.githubusercontent.com/alainbryden/bitburner-scripts/main/yze-hack.js )
when options.subfolder = "test";
Hi,
just a couple of warnings that keep popping up, I just wanted to let you know
1.)
daemon.js: WARNING: Caught an error in the targeting loop: TypeError: Cannot read properties of null (reading 'ramAvailable')
2.)
Warning, hack stole 0 money. Might be a misfire. ["omega-net",1640838358728,1640838423852,65124,"Batch 12-hack",0,0,0]
faction-manager.js should go for all stats not only if in BN 6 or BN 7. Instead it should go for all stats, if the player chose to join Bladburner faction.
Makes some challenges more convenient.
bitburner-scripts/faction-manager.js
Line 233 in fddb59d
The script is useful for BN-8
run blackjack.js
to README.mdthis happens no matter how much I retry, and I can't figure out how getdatathroughfile failed
Error message is
/Tasks/run-with-delay.js: Failed to spawn "/Tasks/contractor.js.solver.js" with args: [{[List of available contracts as arguments]}] (bad file name or insufficient RAM?)
Seems as though daemon is sending the wrong arguments to run-with-delay.js and it's trying to run contractor.js.solver.js instead of just contractor.js
Is possible to run you script and make it ignore the fact that I dont have bitnodes and source files?
When I run daemon.js I get a lot of errors popping.
I made the files list to download on the first time git-pull.js is called to download all the files from the repo
Tried to get the file automatically inside the game but I dont think is possible right now.
"/Flags/deleting.txt",
"/Remote/grow-target.js",
"/Remote/hack-target.js",
"/Remote/manualhack-target.js",
"/Remote/weak-target.js",
"/Tasks/backdoor-all-servers.js",
"/Tasks/backdoor-all-servers.js.backdoor-one.js",
"/Tasks/contractor.js",
"/Tasks/contractor.js.solver.js",
"/Tasks/program-manager.js",
"/Tasks/ram-manager.js",
"/Tasks/run-with-delay.js",
"/Tasks/tor-manager.js",
"/Tasks/write-file.js",
"analyze-hack.js",
"cascade-kill.js",
"cleanup.js",
"crime.js",
"daemon.js",
"faction-manager.js",
"farm-intelligence.js",
"gangs.js",
"get-list.js",
"git-pull.js",
"hacknet-upgrade-manager.js",
"helpers.js",
"host-manager.js",
"remove-worst-server.js",
"reserve.js",
"reserve.txt",
"run-command.js",
"scan.js",
"sleeve.js",
"spend-hacknet-hashes.js",
"stats.js",
"stockmaster.js",
"work-for-factions.js"
Hi,
I just downloaded the latest version of your scripts and they work really well, but I keep on getting an error whenever I start daemon.js that says:
stats.js: FAIL: (0 retries remaining): ns.read('/Temp/stock-symbols.txt') somehow returned undefined or an empty string
which I think is also how I get a warning stating that stockmaster.js needs to be running for the stock probabilities file to be working.
I was just wondering if I may need to unlock something involving the stock in order for it to work or if it's something wrong with the coding itself.
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.