安装 Steam						
					
				
				
									登录
											 | 
						语言
						
																																															繁體中文(繁体中文)
																													日本語(日语)
																													한국어(韩语)
																													ไทย(泰语)
																													български(保加利亚语)
																													Čeština(捷克语)
																													Dansk(丹麦语)
																													Deutsch(德语)
																													English(英语)
																													Español-España(西班牙语 - 西班牙)
																													Español - Latinoamérica(西班牙语 - 拉丁美洲)
																													Ελληνικά(希腊语)
																													Français(法语)
																													Italiano(意大利语)
																													Bahasa Indonesia(印度尼西亚语)
																													Magyar(匈牙利语)
																													Nederlands(荷兰语)
																													Norsk(挪威语)
																													Polski(波兰语)
																													Português(葡萄牙语 - 葡萄牙)
																													Português-Brasil(葡萄牙语 - 巴西)
																													Română(罗马尼亚语)
																													Русский(俄语)
																													Suomi(芬兰语)
																													Svenska(瑞典语)
																													Türkçe(土耳其语)
																													Tiếng Việt(越南语)
																													Українська(乌克兰语)
																									报告翻译问题
							
						
 
											 
													

 
						 
						 
						 
						 
						 
						 
						 
						

 
			 
						





since it doesn't take current values into account, if you 'prep' a server (get it to maxMoney and minSecurity), it won't care, and might choose a server that hasn't been prepped. This makes the function non-universal, as early-game doesn't have the time (nor ram) to properly prep most/all servers with money. You can just hard-code it so that, if your hacking level is below, like, 750, then it returns n00dles (a decent server), as beyond 750 you either have a solution or the resources. part 2
i found a formula that agrees with conventional logic, but it's up to you if you want to use it.
maxMoney / (minSecurity * Math.log2(Math.abs(hackingReq + 2 - playerHacking)))
explanation is:
you start off the difference in hacking levels - hackingReq + 2 - playerHacking. You take the absolute value, and then take the log2 of that - this makes the level difference worth less the further away it is. The log2 is why you add 2. Then, you multiply that value (at most like 17 or smthn) by the server's minSecurity. This number is the divisor for maxMoney, because high level difference || high minSecurity is bad, but high maxMoney is good. Then, finally, that is the server's value. Add it to an array, Math.max(...arr), and you have the best server to hack. part 1
alternatively, use math and function calls. It straight up tells you how long a grow will last, but the problem is planning. Therefore, spend five billion on Formulas.exe, and use ns.formulas.hacking.growTime(), and simulate the changes done to the server by using a variable instead of ns.getServer().
Definitely go to the games documentation and look through its API. There's a lot there.
The other things, like the port openers such as BrutesSSH.exe, and the ServerProfiler.exe can be used with the "run" command the same as running a script or coding contract. For example: "run ServerProfiler.exe n00dles". The same as using the Nuke.exe. To make it easier you can start typing their names in all lowercase and press Tab for it to auto-complete the names.
"Then, find a way to wait until it finishes. Repeat this process for grow() and hack()."
I can't find a way to 'wait'. I thought the await or ns.sleep commands were it, but they just crash the game for me.
Any advice?