kolton / d2bot-with-kolbot

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

Switching weapons for current script #3075

Open sasquach15 opened 3 years ago

sasquach15 commented 3 years ago

Hey. This one shouldnt be hard.

I want my bot to switch weapon when he starts another script.

Example: Doing chestmania with 2x Lemed Swords, after that he starts Travincal run and kill Council with 2x grief pb on switch

It probably requires adding line or two to Travincal.js, but sadly im not wise enough. Anyone can help?

gtoilet commented 3 years ago
    Attack.weaponSwitch(swap);

is prolly what you will want to put in the trav script to have him switch over after chestmaina

sasquach15 commented 3 years ago

Attack.weaponSwitch(swap);

Error in Travincal (travincal.js #28) swap is not defined

/edit:

ok figured it out

Attack.weaponSwitch(true); did the job

thank you very much

texxxmex commented 3 years ago

Attack.weaponSwitch(swap);

Error in Travincal (travincal.js #28) swap is not defined

/edit:

ok figured it out

Attack.weaponSwitch(true); did the job

thank you very much

Yea, swap is going to be a variable that stores current state. Would have to define that.

Does it swap back after your trav run? Assume it does but I forget the logic to make sure you’re on the right weapon swap prior to each run.

sasquach15 commented 3 years ago

Attack.weaponSwitch(swap);

Error in Travincal (travincal.js #28) swap is not defined /edit: ok figured it out Attack.weaponSwitch(true); did the job thank you very much

Yea, swap is going to be a variable that stores current state. Would have to define that.

Does it swap back after your trav run? Assume it does but I forget the logic to make sure you’re on the right weapon swap prior to each run.

it doesnt, but its no prob since travi is last script. In next game first thing he does is switching back for main position anyway

AZE-deluxe commented 3 years ago

Where can I define Attack.weapon(swap) ?

If I enter the lines even with true or 1 for 2nd slot, it skips the area with the error message: it is not a defined command.

This is what attack.js say: weaponSwitch: function (slot) { if (me.gametype === 0 || me.weaponswitch === slot) { return true; }

    var i, tick;

    if (slot === undefined) {
        slot = me.weaponswitch ^ 1;
    }

    delay(500);

    for (i = 0; i < 5; i += 1) {
        weaponSwitch();

        tick = getTickCount();

        while (getTickCount() - tick < 2000 + me.ping) {
            if (me.weaponswitch === slot) {
                //delay(me.ping + 1);

                return true;
            }

            delay(10);
        }
    }

    return false;
},

so what command I have to edit to the bot.js where I want to define the weapon to use?

BR