kolton / d2bot-with-kolbot

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

MFHelper #1851

Open Whyy0416 opened 5 years ago

Whyy0416 commented 5 years ago

Probably this is not a issue post. I use bot in local LAN game. But when I use MFLeader and MFHelper, I met same problem as #280 and #1373. Cause my Sorc character mf too fast and left others behind, so that Sorc runs another script , they are still running last MF script. And another issue is if (me.area === player.area) in MFHelper.js , If the leader called doChores() in town, and the others finished script and stay in town. then they will run all over the town. Here is my solution, I made the leader wait for others at the beginning and the end in a script. Attack.js: https://pastebin.com/44FpE240 Pather.js: https://pastebin.com/xvHBxxFj MFHelper.js: https://pastebin.com/dqm5TxSq

And I found another problem. while a character is loading, he can't recive chat message. Maybe it's better to use EventListener?

Sorry for I put my code here. But I don't know how to pull request.

DarkHorseDre commented 5 years ago

Hey bro, Did you comment where you made changes to those files? were you using the latest Kolbot files?

Whyy0416 commented 5 years ago

Yep I using the latest Kolbot files.

I only add TeamCheck Function in Pather.js, and called by Attack.js (kill, clear, clearlevel). Recive command and response in MFHelper.js

This code made MFLeader broadcast his position via chat message, then MFHelpers could use the determinate area instead player.area in MFLeader, that cause too much "Failed to use portal.". Also broadcast at the beginning and the end of a MF script to wait MFHelpers finished their script.

Also I noticed that if (Pather.usePortal(LeaderArea, player.name)) seems won't get result immediately in MFHelper.js, I add a delay after that code.

Here is my update: https://pastebin.com/kNmRytwz Pather.js (only my add part). https://pastebin.com/TbJ8MzWP MFHelper.js (small change).

DarkHorseDre commented 5 years ago

Bro your links dont work.

You need to comment your work as otherwise I'd have to compare the current scripts with yours... no fun!

Try and work out the pull request - reach out to those whom have submitted some for advice. youtube prolly has videos for github pulls too

on that note, can you make a video of the changes you mention to see how it works?

mf022 commented 5 years ago

@Whyy0416 Do you consider to make a pull-request with these changes?

First of all, you should fork the main repository (check top-right line), then you can add your fixes to your forked repo, and the PR can be created-from-a-fork.

atm there is another PR about MFHelper https://github.com/kolton/d2bot-with-kolbot/pull/1188

Whyy0416 commented 5 years ago

So here's the thing. I only tested it in local LAN game, I can't promise this will work in single player mode or official server. However, I'll try to make a PR. @DarkHorseDre , sorry bro, cause I use a vpn, I don't have enough data to upload a video.

DarkHorseDre commented 5 years ago

no worries - a PR would help us see what the changes are - sounds like you'll work out the PR ;)

DarkHorseDre commented 5 years ago

@mf022 aha! I Thought that had already been merged - this is what I'm waiting for!

Whyy0416 commented 5 years ago

I pulled a request. Git Extensions is more complicated than I thought. Hope I didn't mess it up.

DarkHorseDre commented 5 years ago

youve got to be sure the PR mf022 referenced doesnt do what yours is trying to do..

mf022 commented 5 years ago

Git Extensions is more complicated than I thought.

I have used the tortoiseSVN > Commit function to add the changes on the forked repository, obtaining the same results.

Whyy0416 commented 5 years ago

@mf022 Thank you, I've already made a PR by your step.

1860

DrShunk commented 4 years ago

I really like this, but is there anyway I can get my MFHelper to forcefinish if the Leader is done?

My Barb doesn't have teleport & takes forever wandering around Pit to check the map is cleared. I just want him to drop everything and move to the next area if my Leader (Sorc) is done.

Again, this runs wonderful if everyone has Enigma.

DarkHorseDre commented 4 years ago

@DrShunk I dont know what the 2 PR's are doing but if they dont solve this then maybe something simple like having the leader say() a new unique command, like "scriptComplete" and add another check to mfhelper to gototown start the wait cycle for another command for the next script?

DrShunk commented 4 years ago

@DrShunk I dont know what the 2 PR's are doing but if they dont solve this then maybe something simple like having the leader say() a new unique command, like "scriptComplete" and add another check to mfhelper to gototown start the wait cycle for another command for the next script?

Will try this, Im really a novice though but I'll do my best!

Edit: I have no idea what I am doing and everything I do makes me sad

DarkHorseDre commented 4 years ago

No worries, should be easy! I haven't used kolbot in almost a year - If nobody comes up with a better idea/existing code, look at mfhelper:

https://github.com/kolton/d2bot-with-kolbot/blob/master/d2bs/kolbot/libs/bots/MFHelper.js

function ChatEvent(name, msg) {
        if (!player) {
            var i,
                match = ["kill", "clearlevel", "clear", "quit", "cows", "council"];

it matches the commands issued by leader - you could add a command there.

in attack.js is where the leader (or any bot) is told to use those commands. so my theory is that you could add a line to say the new command as it does with

 say("kill " + classId);"

eg: modified mfhelper: match = ["kill", "clearlevel", "clear", "quit", "cows", "council , "Next"];

modified attack.js (at each end of clear, clearlevel, kill etc): say("Next");

and the mfhelper will goto town and start the loop again (wait for a command from leader then look for their tp etc)