kolton / d2bot-with-kolbot

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

Stagger time between games for multiple leads #294

Closed Hopes92 closed 7 years ago

Hopes92 commented 7 years ago

Hello,

I wondered if it would be a nice addition to have a variable set time between making games when running more than 1 leader (or solo chars). This feature was added to etal after blizzards "server down" policy changed from games / cd key to games / ip. It is claimed, that it helps to prevent "server down" issues by making sure that there are at least 2 minutes between the creation of a new game. A workaround would obviously be to just have the mingametime exceed the the time the run takes and then time it for running more than 1 lead, but that would make it impossible to have random gametimes which I believe is necessary as well in order to avoid issues.

I sadly lack the skills to do that on my own, but if someone whos capable adding that deems it a good idea, Id be glad to see it added ! (Ive been happy enough to do simple modifications to existing scripts and have them work the way I want them to. In this case however I cant find what I need in the existing entry scripts to achieve that goal).

Link to etal forum post: https://www.projectetal.com/forums/threads/scripting-delays-in-the-create-game-entries-need-testers.34189/

Thanks in advance!

StoneOfJordan commented 7 years ago

rand(x, y); will do more for you than that system. =)

Hopes92 commented 7 years ago

Thanks for the fast answer. Thats one of the commands I was using over and over again in almost all scripts for multiple purposes after I first came across it here. https://github.com/kolton/d2bot-with-kolbot/pull/224/files I liked the changes to the baal scripts a lot and tried to use the stuff there to keep silent leech in other scripts as well - with teleport chars opening portal and having non teleport chars join in for the bosses, basically like the MFHelper script, but without chat ! The one thing I never understood however, was how the heck that "case 6969" is working (as to why it is 6969 and how can I use something similar to basically add in a "safe check" for other scripts). That left me with a non "safe check" method where the chars just idle and take the first tp opened to the area which works perfectly fine for most cases as well :)

But back to rand(x, y) command. Using it on "CreateGameDelay" was kinda obvious, but do you refer to using it for "MinGameTime" as well ? ~~ That would make something like MinGameTime : rand( 520, 700), // think that 3 minutes is enough for 2 leads or rather go for a large random time of "CreateGameDelay" to something like 3 minutes ?

Two more quick questions while Im at it: 1) I somehow didnt manage to have the console show me real time information as to where the bot is headed to at the moment (not current position but the position it is trying to reach!). Id need this to do some improvements for e.g. walking diablo helpers as they usually get stuck for 5-10 seconds on the way from moving from vizier to seis (near the star) ~~! My idea so far was to add print with x, y in the pather.js or diablohelper.js but I didnt get it so give me the information I need I yet! 2) The version hack guide https://github.com/DetectiveSquirrel/Version-Hack-Guide-1.14d/blob/master/README.md is no longer necessary? Out of curiosity I tried to start d2 via kolbot outta a clean bnet install 1.14d and it worked just fine (didnt test with any scripts though), which would make this outdated because of the new d2bot version. Just asking, because it cant hurt to not have unnecessary files in the d2 folder ~~

StoneOfJordan commented 7 years ago

1) Take a look at the sendCopyData function that D2BS provides: http://docs.d2bs.org/group__globalFunctions.html#gad4e03d1abafaa3beab0e1cbb90ca8e37 int sendCopyData ( String windowClassName, String windowName, int32_t nModeId, String data )

6969 is just a random number picked for the mode. It has no meaning beyond that. You'll send the nModeId integer and data string to the specified window. The setup that you're talking about handles that message by checking which nModeId was received since the message wasn't important in that case. The switch is also redundant because of that.

Here's an example of how you could use send/receiveCopyData:

    var inputMode = 1337, // some number of your choice
        inputMsg = "hej"; // some message

    sendCopyData(null, profileName, inputMode, inputMsg);

    addEventListener('copydata', // for recipient
        function receiveCopyData(mode, msg) {
            if (mode === inputMode && msg === inputMsg) { // check input data (msg) & mode
                doSomething();
            }
        } 
    );

2) You can get Nihlathak's coordinates using the getPresetUnit function, Nihlthak's id is 462 I believe. Pather.moveToPreset(me.area, 2, 462, 0, 0, false, true); this Pather function will also do the job if you're in Nihlathak's area.

3) Just randomize as many things as you can, game time will obviously improve your experience as well.

4) Pather.js is the right place to look for. Just add a print function to whatever function you'd like to look at.

5) The current core in this repository runs on 1.14d, no version hack required.

Hopes92 commented 7 years ago

Awesome! Big thanks again.

1)

Ill definately be playing around with that :)

2)

Pather.moveToPreset(me.area, 2, 462, 0, 0, false, true); I havent found moveToPreset or Pather in that list of functions. Unclear to me after the first look at it is: me.area -> okay 2 -> meaning ? 462 -> nihlathak okay 0, 0, -> always 0 as decribed in Preset functions ? false -> refering to ? true -> refering to ?

3)

yeah prolly doing some testruns till I find a sweet spot for me! - can force a new ip from provider via a very old router with a software coded mac address in case of s/d <3

4)

gonna work my way through the lines till I find what im looking for!

5)

Aint 100% sure if it is for better or worse using a clean install as Ive had no issues or whatsoever for now, but if ill go with a clean one, Ill prolly delete blizzarderror and systemsurvey in the folder just because ^^

Sadly I wont be at home at all tomorrow, but Ill take my time with the info on friday / saturday!

StoneOfJordan commented 7 years ago

It's not a core function, you'll find it in the kolton lib.

    /*
        Pather.moveToPreset(area, unitType, unitId, offX, offY, clearPath, pop);
        area - area of the preset unit
        unitType - type of the preset unit
        unitId - preset unit id
        offX - offset from unit's x coord
        offY - offset from unit's x coord
        clearPath - kill monsters while moving
        pop - remove last node
    */
Hopes92 commented 7 years ago

Just took a look after coming home. I feel kinda stupid now... its indeed explained from line 121 to 126 in pather.js ~~ I guess the "pather" in front shouldve given me already the answer as to where to search, but Ive learned again :)

Thanks, Ill try play with it tomorrow!

For the diablohelper script: ` this.starToSeisA -> first two entries from 7781, 5259 changed to 7773, 5274

this.starToSeisB -> same ` Solves my problem for walking chars when starting De Seis path! I didnt might do some detailed walk path optimization as with the standard path they tend do quite a lot of unnecessary movements.

Hopes92 commented 7 years ago

For Nihlathaks coordinates I am a little confused... Thats the function that the standard Nihlathak script uses Pather.moveToPreset(me.area, 2, 462, 0, 0, false, true); but putting a Pather.makePortal(); in the next line opens a portal at a rather big distance from nihlathak which makes this impossible for walking chars.

Strange to my mind, as the offset for x and y should be 0 and thus the tp should be opened almost on top of him! And being honest, I dont really know what "removes the last node" means or does here ~~

EDIT Setting "remove last node" to "false" and giving x and y an offset of 1 somehow works. Now Im even more interested in what exactly the difference is... 🗡

EDIT2 I just transformed the Pindleskin script into a a basically leechable nihlathak script ~~ Pather.moveToPreset(me.area, 2, 462, 1, 1); Pather.makePortal(); seems to be enough to have the char jump on to nihlathak and create the portal right on him. Still no idea, why Pather.moveToPreset(me.area, 2, 462, 0, 0, false, true); Pather.makePortal(); does not do the job though

EDIT3 Sendcopydata is cool to replace all chat commands, but I guess the cases commands are needed are rarer than I thought :) - still a cool option !

D2Patch09 commented 6 years ago

Hopes if you can, I'm needing help with the sendcopydata function to replace chat commands.

https://github.com/kolton/d2bot-with-kolbot/issues/319