Can be used for any scenario where you only want 1 script to be able to perform a given action at a time. ![]() This is used in the ExecutionController to guard against more than one script accesing the shared Netscript Port at the same time. MutexLock.tsĬontains a Mutex class to enable you protect resources across scripts. I would have to click through all those scripts to see which one was spending my money.īy logging all purchases via the RemoteLogger, I can now see all spends from all scripts in a single output window. I was constantly trying to figure out what my money was getting spent on, as I have scripts that automate stuff like purchasing Sleeve augmentations, purchasing and upgrading hacknet servers, upgrading home server, etc. I use this pretty much exclusively to log when one of my scripts purchase something. As a way to see common information without cluttering up the terminal. The intent of this is that you can have multiple scripts running and emitting logs, but have those logs be centralized into the output for a single script (remoteLoggerReceiver script). If you run 'remoteLoggerReceiver.js', it will start up an instance of RemoteLogReader and continually drain the logs and write them to the output window for the remoteLoggerReceiver script. It also includes a class that reads the remote logs. This contains a logger which writes to a common Netscript Port. This way you can implement your own customer loggers and have them used from your scripts without needing to reinstrument all your scripts. I highly recommend that you only pass around the logging library via the ILogger interface. This provides an easy abstraction for logging within scripts with support for changing the logging level to make your script output either more or less verbose. logger.tsĬontains a simple logging library. Enables you to more easily keep track of what ports to use across different scripts without stomping on each other. PortType.tsĬonstants for defining what Netscript Ports are used for scripts. When referencing any other script on an import, do so with the full path from the root.īelow are the list of libraries and what they are used for.When referencing NetScriptDefinitions, do so via the path relative to the script which is importing it '././NetScriptDefinitions.d.ts'.Do not include file extensions on your import lines.To enable imports to work across both Typescript at build time, and execution within BitBurner you need to do the following: You can now run any of the published scripts within the game. The scripts in 'out/' will get pushed to the game.The scripts in the 'src/' folder will be compiled to.NetScriptDefinitions.d.ts will be created in the root of the bitburner-scripts folder.Enter the port from step 2 and hit connect.Īssuming everything above is set up correctly, the following should happen. From within bit-burner, go to Options->Remote API.It should be 12525, unless you've change the prot in filesync.json ![]() From a new command prompt run 'startFileSync.cmd'. ![]() The definitions will be pulled down shortly. This will give errors the first time saying that NetScriptDefinitions could not be found.
0 Comments
Leave a Reply. |