コンテンツにスキップ
ライオットビット

ライオットビット

  • 家
  • ニュース
  • ガイド
  • ビデオガイド
  • パッチノート
  • 不正行為を報告する
  • 検索フォームを切り替え
ビットバーナー

ビットバーナー – サーバー購入ボット

ポストする 01/09/2022 に Meng 1 コメント の上 ビットバーナー – サーバー購入ボット
  • タイトル: ビットバーナー
  • 発売日:
  • 開発者:
  • 出版社:
Bitburner に関する情報はまだ不完全です. これを使用してゲームの詳細を記入するのにご協力ください。 お問い合わせフォーム.

This is an automated script for midgame (or SF1+ games) that buys and rebuys servers. It has editable variables for extra customization.

About this Bot

This is a bot that will:

  • Buy servers of RAM you specify (default is half your home RAM, minimum of 32GB)
  • Upload and execute a script of your choosing
  • Template for uploading additional scripts of your choosing (つまり. if your main script calls 3x scripts like mine does)
  • If you have max servers (25) and they are weak (<25% of your home RAM) and have sufficient money to upgrade, it will prompt a yes/no box to upgrade them. This deletes and rebuys.

Due to the logic inside, it is quite hefty at 13.3GB of RAM required, as such it is not really suited for a very early game.

There is some basic technical knowledge required to change a few lines of code to suit your setup. Read the how-to carefully.

You can force a server rebuy by running it with the ‘f’ argument (つまり. “run servers.js f”)

スクリプト

// Server purchasing script for Bitburner - https://danielyxie.github.io/bitburner/ , written by steamid/Meng
// Runs until satisfied, will rebuy servers money is sufficient and server is worse than 25% of ram. Run with 'f' argument to force rebuy

// バージョン 1.22
// Added additional comments and MAIN_SCRIPT variable so that the code will be usable for others

export async function main(ns) {

    // ~~~~~~~~~Editable variables~~~~~~~~~~~
    const SVRNAME = "plex";             // What hostname your purchased servers will have
    const MIN_RAM = 32;                 // Minimum RAM you want to buy for a server
    const SVR_RAM_RATIO = 2;            // Target RAM for server is "家" ラム, divided by SVR_RAM_RATIO, must = power of 2 (0.5, 1, 2, 4...). 例えば. '2' is 50% of home RAM
    const MAIN_SCRIPT = "breaker.js"    // Name of your main script that you want to upload
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    let currentServers = ns.getPurchasedServers();
    let ram = calculateRam();   // Calculates how much RAM to buy for the server
    let i = currentServers.length;
    const serverMax = 25;       // hardcoded max servers as of Bitburner v1.3

    // Check and ensure servers are running scripts (recover after a forced reboot)
    // if server is not running scripts, overwrite existing breaker and run.
    ns.print('Starting scripts on existing servers...')
    ために(let x = 0; × < currentServers.length; x++){
        もし (!ns.isRunning(MAIN_SCRIPT, currentServers[×])){ 
            ns.scpを待ちます(MAIN_SCRIPT, currentServers[×]);
            ns.exec(MAIN_SCRIPT, currentServers[×], 1);
        }
    };

    // Server purchase info
    const serverPriceInfoText = (ns.getPurchasedServerCost(ram) / 1000000).toFixed(2);
    ns.toast(`Server price is ${serverPriceInfoText} M`, "情報");
    ns.print(`about to start buying servers @ ${ram}gb for ${serverPriceInfoText}`);
    await ns.sleep(15000)
    
    // then Continuously try to purchase servers until we've reached the maximum
    while (私 < serverMax) { // Check if we have enough money to purchase a server if (ns.getServerMoneyAvailable("家") > ns.getPurchasedServerCost(ram)) {
            // if sufficient money, buy server, name it, upload scripts and exec MAIN_SCRIPT
            let hostname = ns.purchaseServer(SVRNAME + 私, ram);
            ns.scpを待ちます(MAIN_SCRIPT, hostname);
            // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            // Add any extra scripts you want to upload here, or delete the lines
            // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            await ns.scp("hackscript.js", hostname);
            ns.scpを待ちます("growscript.js", hostname);
            ns.scpを待ちます("weakscript.js", hostname);
            // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            ns.exec(MAIN_SCRIPT, hostname, 1);
            ns.toast(`Server ${hostname} was purchased`, "成功")
            ++私;
        }
        それ以外 {
            ns.print(`cannot buy yet - price is `+ ns.getPurchasedServerCost(ram))
            await ns.sleep(20000)
        }
    } // end of while  (ns.getPurchasedServerCost(ram) * 13) ){ // if money is sufficient for upgrade..
            let areYouSure = await ns.prompt(`do you want to rebuy servers? Est Cost: $ ${((ns.getPurchasedServerCost(ram) * 25)/1000000000).toFixed(2)} B`);
            もし (areYouSure){
                ために (let i = 0; 私 < currentServers.length; i++){ // Delete all existing servers ns.killall(currentServers); ns.deleteServer(currentServers); } ns.spawn("servers.js", 1); // Kills and Restarts this script to start buy process } } await ns.sleep (900000); } function calculateRam() { // Calculate how much RAM to buy for the server (set to SVR_RAM_RATIO) const myRam = ns.getServerMaxRam("家"); const maxPossRam = 1048576; // Hardcoded value for maximum purchasable server ram @ Bitburner v1.3 if (myRam > maxPossRam){return maxPossRam}
        そうでなければ (myRam <= MIN_RAM){return MIN_RAM}
        それ以外 {戻る (myRam / SVR_RAM_RATIO)};
        }
    } // end of script

使用方法

Here’s how you can use this script

  • terminal > nano “servers.js”
  • paste the below code in
  • EDIT THE CODE – ライン 13 + Lines 45-50
    • ライン 13: 変化 “breaker.js” to whatever your main script filename is that you would like to execute on the remote server.
    • Lines 45-50: If you want to upload more scripts, then amend these lines as well, if you do not need them, then delete them between the lines. Note that these will not auto-execute, they assume that your main script calls them. If you need to execute them as well, then add extra lines of
      ns.exec("yourScriptNameHere.js", hostname, 1);
  • 保存
  • terminal > run servers.js

ノート: If you do not name the file servers.js, then you amend line 70 to whatever you name the file, or the rebuy function will not work.

これが今日私たちがこの目的で共有するすべてです ビットバーナー ガイド. このガイドは元々、次の者によって作成および執筆されました。 Meng. このガイドを更新できなかった場合, これに従って最新のアップデートを見つけることができます リンク.

このサイトのコンテンツがあなたの権利を侵害していると思われる場合, あなたの知的財産権を含む, お問い合わせフォームを使用してすぐにご連絡ください.
ガイド タグ:ビットバーナー

ポストナビゲーション

前の投稿: アイドル超大国初心者ガイド, ヒント, とトリック
次の投稿: 繁栄する – 長期細胞段階のサバイバルガイド

コメント (1) 「ビットバーナー」で – サーバー購入ボット”

  1. soyaro 言う:
    01/31/2022 で 4:05 午前

    I just spent multiple minutes to fix the syntax errors before I was able to understand at least parts of it. I don’t know if the website messed it up or it was user error but like this nobody can execute it. almost all ifs are commented out, 例えば. the linebreaks are a mess, if there are any. 複数 ; are missing. At first I thought you tried to write while else (turned out to be another commented if). Why don’t you just use let scriptArray = [“script1.js”, “script2.js”,…,”scriptn.js”]; to be used in ns.scp(scriptArray, hostname);? Does need one scp instead of 3 while uploading every amount of scripts at once. And what the heck are you trying to do in the final loop? the condition (one value multiplied by 13) would always be true if it weren’t commented out. This script would constantly spam “do you want to rebuy servers?”, probably instant-spending all the players money. Maybe you should stick to reddit with your scripts, there you’ll get instant feedback and enhancement suggestions…

    返事

返信を残す 返信をキャンセル

あなたのメールアドレスは公開されません. 必須フィールドにマークが付いています *

  • タイトル: ビットバーナー
  • 発売日:
  • 開発者:
  • 出版社:
Bitburner に関する情報はまだ不完全です. これを使用してゲームの詳細を記入するのにご協力ください。 お問い合わせフォーム.

免責事項

引用されたすべてのコンテンツはそれぞれの情報源から得られています. 当社があなたのコンテンツを許可なく使用したと思われる場合, 必ずご連絡ください。真剣に対応させていただきます.
  • 私たちに関しては
  • お問い合わせ
  • プライバシーポリシー
  • 利用規約

著作権 © 2025 ライオットビット.

搭載 プレスブックニュース ワードプレスのテーマ