kolton / d2bot-with-kolbot

d2bot game manager by D3STROY3R with kolbot libs by kolton for d2bs
346 stars 334 forks source link

Feature: Possibility to specify run order #670

Closed Kongolan closed 6 years ago

Kongolan commented 6 years ago

Currently runs can't be ordered, while this can be useful, if chickens occur more likely in some areas then i want to play the safe runs first and later go to the risky ones, so i ensure it doesn't skip early.

This is limited because in Config.js the scripts are in a set order and the char config only sets the values if it should be run or not, so order there doesn't matter.

It would be really helpful if the loader could somehow check, what scripts to run first just by the order in my char file.

krazy03 commented 6 years ago

Not sure what you mean but you can change order of scripts in Character Config file.

I have cows / chaos at the end because for some reason my sorcs like to chicken at cows and chaos a alot, if i had it is some of my runs would be like 3 mins short.

Kongolan commented 6 years ago

Can you post your Charfile please, for me it's not working somehow... For Example i want ChestMania with Lower Kurast chests first before every run.

krazy03 commented 6 years ago
        // *** sorc ***
    Scripts.Eldritch = true;
        Config.Eldritch.OpenChest = true;
        Config.Eldritch.KillShenk = true;
        Config.Eldritch.KillDacFarren = false;
        Scripts.Countess = true;
        Config.Countess.KillGhosts = false;
    Scripts.Andariel = true                     
        Scripts.Pit = true;
        Config.Pit.ClearPit1 = true
        Scripts.AncientTunnels = true;
        Config.AncientTunnels.OpenChest = false; // Open special chest in Lost City
        Config.AncientTunnels.KillDarkElder = false;
    Scripts.Summoner = true;
        Config.Summoner.FireEye = false;
    Scripts.Travincal = true;
        Config.Travincal.PortalLeech = false; // Set to true to open a portal for leechers.
    Scripts.Mephisto = true;
        Config.Mephisto.MoatTrick = false;
        Config.Mephisto.KillCouncil = true;
        Config.Mephisto.TakeRedPortal = true;
    Scripts.Nihlathak = true;
        Config.Nihlathak.ViperQuit = false; // End script if Tomb Vipers are found.
    Scripts.Cows = true;
    Scripts.Diablo = true;
        Config.Diablo.Entrance = false; // Start from entrance
        Config.Diablo.SealWarning = "Leave the seals alone!";
        Config.Diablo.EntranceTP = "Entrance TP up";
        Config.Diablo.StarTP = "Star TP up";
        Config.Diablo.DiabloMsg = "Diablo";
    Scripts.Baal = true;
        Config.Baal.HotTPMessage = "";
        Config.Baal.SafeTPMessage = "";
        Config.Baal.BaalMessage = "";
        Config.Baal.SoulQuit = false; // End script if Souls (Undead Soul Killers) are found.
        Config.Baal.DollQuit = false; // End script if Dolls (Undead Stigyan Dolls) are found.
        Config.Baal.KillBaal = true; // Kill Baal. Leaves game after wave 5 if false.

    /* ### leeching section ###
    * Unless stated otherwise, leader's character name isn't needed on order to run.
    * Don't use more scripts of the same type! (Run AutoBaal OR BaalHelper, not both)
    */

    Config.Leader = ""; // Leader's ingame character name. Leave blank to try auto-detection (works in AutoBaal, Wakka, MFHelper)
    Config.QuitList = [""]; // List of character names to quit with. Example: Config.QuitList = ["MySorc", "MyDin"];
    Config.QuitListMode = 0; // 0 = use character names; 1 = use profile names (all profiles must run on the same computer).

    Scripts.TristramLeech = false; // Enters Tristram, attempts to stay close to the leader and will try and help kill.
    Scripts.TravincalLeech = false; // Enters portal at back of Travincal.
        Config.TravincalLeech.Helper = true; // If set to true the character will teleport to the stairs and help attack.
    Scripts.MFHelper = false; // Run the same MF run as the MFLeader. Leader must have Config.MFLeader = true
    Scripts.Wakka = false; // Walking chaos leecher with auto leader assignment, stays at safe distance from the leader
    Scripts.SealLeecher = false; // Enter safe portals to Chaos. Leader should run SealLeader.
    Scripts.DiabloHelper = false; // Chaos helper, kills monsters and doesn't open seals on its own.
        Config.DiabloHelper.Wait = 120; // Seconds to wait for a runner to be in Chaos. If Config.Leader is set, it will wait only for the leader.
        Config.DiabloHelper.Entrance = true; // Start from entrance. Set to false to start from star.
        Config.DiabloHelper.SkipTP = false; // Don't wait for town portal and directly head to chaos. It will clear monsters around chaos entrance and wait for the runner.
        Config.DiabloHelper.SkipIfBaal = false; // End script if there are party members in a Baal run.
    Scripts.AutoBaal = false; // Baal leecher with auto leader assignment
        Config.AutoBaal.FindShrine = false; // false = disabled, 1 = search after hot tp message, 2 = search as soon as leader is found
        Config.AutoBaal.LeechSpot = [15115, 5050]; // X, Y coords of Throne Room leech spot
        Config.AutoBaal.LongRangeSupport = false; // Cast long distance skills from a safe spot
    Scripts.BaalHelper = false;
        Config.BaalHelper.Wait = 120; // Seconds to wait for a runner to be in Throne
        Config.BaalHelper.KillNihlathak = false; // Kill Nihlathak before going to Throne
        Config.BaalHelper.FastChaos = false; // Kill Diablo before going to Throne
        Config.BaalHelper.DollQuit = false;  // End script if Dolls (Undead Soul Killers) are found.
        Config.BaalHelper.KillBaal = true; // Kill Baal. If set to false, you must configure Config.QuitList or the bot will wait indefinitely.
        Config.BaalHelper.SkipTP = false; // Don't wait for a TP, go to WSK3 and wait for someone to go to throne. Anti PK measure.
    Scripts.Follower = false; // Script that follows a manually played leader around like a merc. For a list of commands, see Follower.js

I'm not sure about ChestMania it should work as well though I would think

DarkHorseDre commented 6 years ago

I found this issue when I started - the problem is the scripts do not execute in order written in the config. You can re-order boss scripts but you cant override the order of other scripts (like chestmania). they are hard coded to run before/after other scripts.

A good example is clearanyarea: the bot will run act 1-5 then go back to catacombs to clear.. which is a waste as the bot was in the area before!

I realise I would have to hard code the scripts to execute what I want or add some logic to do some checks, but that's a lot of work, especially for chestmania (e.g. compare chestmania areas with bot areas and execute in order. even then it wouldn't be seamless unless you edited furter to make the bot do chestmania whilst in the area, instead of tele to town, do chores, then wp-->tele to chestmania area...)

krazy03 commented 6 years ago

I just test it, it works no problem

        // *** sorc ***
    Scripts.ChestMania = true; // Open chests in configured areas. See sdk/areas.txt
        Config.ChestMania.Act3 = [79]; // List of act 3 areas to open chests in
    Scripts.Eldritch = true;
        Config.Eldritch.OpenChest = true;
        Config.Eldritch.KillShenk = true;
        Config.Eldritch.KillDacFarren = false;
        Scripts.Countess = true;
        Config.Countess.KillGhosts = false;
    Scripts.Andariel = true                     
        Scripts.Pit = true;
        Config.Pit.ClearPit1 = true
        Scripts.AncientTunnels = true;
        Config.AncientTunnels.OpenChest = false; // Open special chest in Lost City
        Config.AncientTunnels.KillDarkElder = false;
    Scripts.Summoner = true;
        Config.Summoner.FireEye = false;
    Scripts.Travincal = true;
        Config.Travincal.PortalLeech = false; // Set to true to open a portal for leechers.
    Scripts.Mephisto = true;
        Config.Mephisto.MoatTrick = false;
        Config.Mephisto.KillCouncil = true;
        Config.Mephisto.TakeRedPortal = true;
    Scripts.Nihlathak = true;
        Config.Nihlathak.ViperQuit = false; // End script if Tomb Vipers are found.
    Scripts.Cows = true;
    Scripts.Diablo = true;
        Config.Diablo.Entrance = false; // Start from entrance
        Config.Diablo.SealWarning = "Leave the seals alone!";
        Config.Diablo.EntranceTP = "Entrance TP up";
        Config.Diablo.StarTP = "Star TP up";
        Config.Diablo.DiabloMsg = "Diablo";
    Scripts.Baal = true;
        Config.Baal.HotTPMessage = "";
        Config.Baal.SafeTPMessage = "";
        Config.Baal.BaalMessage = "";
        Config.Baal.SoulQuit = false; // End script if Souls (Undead Soul Killers) are found.
        Config.Baal.DollQuit = false; // End script if Dolls (Undead Stigyan Dolls) are found.
        Config.Baal.KillBaal = true; // Kill Baal. Leaves game after wave 5 if false.

There you go, just tested it and it works. Make sure TO NOT HAVE ANY DUPLICATES!!!!! Meaning the original Lines

    Scripts.ChestMania = false; // Open chests in configured areas. See sdk/areas.txt
        Config.ChestMania.Act1 = [13, 14, 15, 16, 18, 19]; // List of act 1 areas to open chests in
        Config.ChestMania.Act2 = [55, 59, 65, 66, 67, 68, 69, 70, 71, 72]; // List of act 2 areas to open chests in
        Config.ChestMania.Act3 = [79, 80, 81, 92, 93, 84, 85, 90]; // List of act 3 areas to open chests in
        Config.ChestMania.Act4 = []; // List of act 4 areas to open chests in
        Config.ChestMania.Act5 = [115, 116, 119, 125, 126, 127]; // List of act 5 areas to open chests in

Remove them otherwise IT WILL NOT do ChestMania first, it'll just skip it. Why? I don't know`even though its set to false it will skip the first one, and just not do it at all.

Kongolan commented 6 years ago

True it works, when you comment lines out, still not good that all lines are generally uncommented, so it's harder to sort them 🙈 I'm closing this post.

iamhaymc commented 4 years ago

I think the config files are adding key-value pairs to an initially empty object "Scripts", then we iterate over the keys in the object to determine the sequence of script execution. I think it just so happens to work out that the order of the scripts in the config correlates with the sequence of execution, but if true, that is not a very robust solution.

I think to change that, you can do a one of a handful of small tweaks in Loader.loadScripts() to sort the script list before they are executed.

DarkHorseDre commented 4 years ago

@krazy03 you confirmed one aspect (boss scripts) but not ALL scripts (rusher, rushee, chestmania etc) - the TYPE of script seems to be iterated through in a specific order then the scripts within that type; so yes, boss scripts can be rotated, but you will still run other scripts type in an order you cant control from the character config

@lrgstu very likely - I stopped short of this as it wasnt that important, but overriding the default sequence at that level is what would be needed.