Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MFHelper #1851

Open
Whyy0416 opened this issue Aug 3, 2019 · 15 comments
Open

MFHelper #1851

Whyy0416 opened this issue Aug 3, 2019 · 15 comments

Comments

@Whyy0416
Copy link

Whyy0416 commented Aug 3, 2019

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
Copy link

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

@Whyy0416
Copy link
Author

Whyy0416 commented Aug 5, 2019

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
Copy link

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
Copy link
Contributor

mf022 commented Aug 6, 2019

@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 #1188

@Whyy0416
Copy link
Author

Whyy0416 commented Aug 6, 2019

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
Copy link

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

@DarkHorseDre
Copy link

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

@Whyy0416
Copy link
Author

Whyy0416 commented Aug 6, 2019

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

@DarkHorseDre
Copy link

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

@mf022
Copy link
Contributor

mf022 commented Aug 6, 2019

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
Copy link
Author

Whyy0416 commented Aug 7, 2019

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

@DrShunk
Copy link

DrShunk commented Jan 25, 2020

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
Copy link

@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
Copy link

DrShunk commented Jan 25, 2020

@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
Copy link

DarkHorseDre commented Jan 26, 2020

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants