By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
Fadgames.net
  • Apps
  • Tools
  • Software
  • Photoshop
  • Download
  • Guides
  • Cheats
Notification
Fadgames.netFadgames.net
Aa
Search

Top Post

The Texas Chain Saw Massacre Beginners Guide

The Texas Chain Saw Massacre My character not leveling up anymore

Photo Generic Guide

Bomb Rush Cyberfunk Photo Generic Guide (Polo Locations)

Stay Connected

Find us on socials
248.1k Followers Like
61.1k Followers Follow
165k Subscribers Subscribe
Made by ThemeRuby using the Foxiz theme. Powered by WordPress
Home » Blog » Bitburner: Time Calculation Script (How to Get the Time)
Guides

Bitburner: Time Calculation Script (How to Get the Time)

Jaeden Feil
Last updated: 2023/07/17 at 7:40 AM
By Jaeden Feil
Share
SHARE
a script to using the formulas API to calculate how long we need to wait for a certain hacking level based only on the exp for our hacking scripts (if we have formulas API then our scripts are usually getting more exp than any other method can compare to by that point)
how to use

paste the code into a .js or .ns file

for example timetohack.js

then to use it go to your terminal and run it with your target level as an argument

for example

run timetohack.js 2500

it will print how long you will need to wait to the terminal

the code
function timeformat(input) {
	var sec_num = parseInt(input, 10); // don't forget the second param
	var hours = Math.floor(sec_num / 3600);
	var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
	var seconds = sec_num - (hours * 3600) - (minutes * 60);

	if (hours > 24) { return Math.floor(hours / 24) + " days" }
	if (hours < 0) { hours = 0; }
	if (hours < 10) { hours = "0" + hours; }
	if (minutes < 10) { minutes = "0" + minutes; }
	if (seconds < 10) { seconds = "0" + seconds; }
	return hours + ':' + minutes + ':' + seconds;
}
/** @param {NS} ns **/
export async function main(ns) {
	var skill = ns.args[0];
	var player = ns.getPlayer();
	var mult = player.hacking_mult;
	var sk = ns.formulas.skills;
	var target = sk.calculateExp(skill, mult);
	var left = target - player.hacking_exp;
	var time = left / ns.getScriptExpGain();
	ns.tprint(timeformat(time))
}
follow up

this version of the script is kinda basic because i’m lazy but it’s useful enough on it’s own.

because it’s basic you can use it as an example to make something more useful, some of the more advanced players could probably add a countdown clock to the user interface or something cool like that.

By tokumeiko
TAGGED: BITBURNER
Jaeden Feil July 17, 2023 July 17, 2023
Share This Article
Facebook Twitter Copy Link Print

Related

Guides

The Texas Chain Saw Massacre Beginners Guide

Guides

The Texas Chain Saw Massacre My character not leveling up anymore

Photo Generic Guide
Guides

Bomb Rush Cyberfunk Photo Generic Guide (Polo Locations)

Guides

Character Guide | Touhou Juuouen Unfinished Dream of All Living Ghost

Guides

Book of Hours How to get unstuck

Guides

Princess & Conquest The Acquisition of Capital

Guides

Book of Hours Assistance Guide

Guides

VPet-Simulator AHK script to remove the window from the ALT-Tab list

Show More
Fadgames.net

All Guides, Walkthrough, Tips, Cheats for You

  • About Us
  • Privacy Policy
  • Terms and Conditions
  • Contact Us
Made by ThemeRuby using the Foxiz theme. Powered by WordPress
Welcome Back!

Sign in to your account

Register Lost your password?