kolton / d2bot-with-kolbot

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

Error in act 1 scripts (stuck when tping) #2492

Open julitovidela opened 4 years ago

julitovidela commented 4 years ago

Hello, I dont know if anyone else has this problem but I keep getting the same error over and over. Every 1-4 games the bot cannot execute some of the scripts because the character gets stuck. I have seen the bot working and this is caused because it fails to go to town through the TP. Specifically, when the bot finishes Act 1 Pit, Countess, or Andy runs, it throws a TP, goes to town, immediately goes back to the portal (into Pit, Tower lvl 5 or Cata lvl 4) and then fails of course to use the waypoint when executing the next script because the character is not in town. Is there any way to fix this?

Example of error log: Error in Andariel (pather.js #1020) useWaypoint: Failed to use waypoint (Area: 25, Ping:188, Game: xxxx412) Error in Countess (pather.js #1020) useWaypoint: Failed to use waypoint (Area: 16, Ping:235, Game: xxxx416) Error in Countess (pather.js #1020) useWaypoint: Failed to use waypoint (Area: 16, Ping:203, Game: xxxx417) Error in AncientTunnels (pather.js #1020) useWaypoint: Failed to use waypoint (Area: 37, Ping:172, Game: xxxx420) Error in Andariel (pather.js #1020) useWaypoint: Failed to use waypoint (Area: 25, Ping:219, Game: xxxx421)

DarkHorseDre commented 4 years ago

I don't have this issue, but seems boss scripts don't tp to town when theyre done, but the next script usually does a town.doChores() and then usewaypoint which doesnt seem (havent read all of it yet) to check if youre in town and near a wp..

if I'm right (I can look later-on) then the fix should be easy.

but tell me which exact scripts are running after 1) countess, 2) andy, 3) pit

oh and does the failure to use wp mean the bot quits the current script and move onto the next?

gtoilet commented 4 years ago

or bot could be getting smacked around after it finishes script and fails to town and or use wp

DarkHorseDre commented 4 years ago

or bot could be getting smacked around after it finishes script and fails to town and or use wp

that does happen when trying to town for pots or shop etc, but he said the bot goes to town at end of script then straight back through tp again, then tries wp..

julitovidela commented 4 years ago

Thank for your response! The order of my scripts is: 1) Pit 2) Countess 3) Andy 4) Cows 5) Ancient Tunnels, etc. The odd thing is that 70% of runs the bot works well, but there's this 30% that keeps doing this silly mistake of going to town but returning right back to dungeon and standing there for like 1 min. until it skips the next script (in this case number 2, 3, 4 or 5) So yeah, when the bot recognizes it failed, it just skips the next script and goes to town like nothing happened haha @gtoilet I think thats not the problem, in fact the bot goes to town but idk why it takes the tp immediately back to pit, tower, cata and/or farm

DarkHorseDre commented 4 years ago

yeah I've seen that before but usually with mfhelpers.

before I look in a bit: is your kolbot up to date? have you made any mods? please paste your char script to pastebin and link here

julitovidela commented 4 years ago

Thanks @DarkHorseDre 1) Kolbot it has the latest update installed (19.3.3.100) 2) I once made a little mod into Misc.js but then changed it back 3) This is my pally script but I have the same issue with my sorc

DarkHorseDre commented 4 years ago

ok so the key I think is to understand why the bot goes back through tp - and I have no idea!

Does the bot finish each bot when it has this issue? (it sounds like it does)

The design of the bot seems to be minimalist, in that: 1) the boss scripts (functions) doChores (use tp to town if not in town), usewp. travel to boss, kill that boss, pickit, optional chests, end (no tp). 2) next script does the same - so it is assumed the bot will be in town at the start of the script.

Your bot clicks the tp and ends up back where it came from - This seems to be why your bot sometimes ends up confused.. problem is it's not consistent with same toon and config.

The bot casts a tp at the end of the run (hence my question) or when it has mercwatch, towncheck enabled.. but you don't have them enabled and it seems the script ends (and it doesn't look like it tries to id at Cain - you do have that enabled and I don't use that).

doChores checks if in town and tps if not.. so maybe the tp back is after that, but would need to know why bot is using the TP in the first place!

I'm guessing makePortal is called then usePortal is called in town to get back to the wrong area.. and we'd have to work out why/where (and I cannot reproduce yet, and you only can 30% of time)..

julitovidela commented 4 years ago

Yeah generally (sometimes it tries to go to town to make room) the bot fully finishes every run without an issue when this happens, so no mercwatch or any other special script is executed when this occurs. I will try to record the bot when this happens so you can see it and maybe spot something else. One thing I havent mentioned, the game tends to freeze (or slow really down) when this error is happening. I dont know if it stays in an execution loop caused by this error or if the error causes this freezing. In any case, its just weird that this happens only in act 1

DarkHorseDre commented 4 years ago

One thing I havent mentioned, the game tends to freeze (or slow really down) when this error is happening. Yeah, it does this (I should have mentioned that it often happens if you pause the bot, move the toon to a different area, then unpause)

I will try to record the bot when this happens so you can see it and maybe spot something else. yes always a good thing - please ensure the console is visible (press home key) as we need to know what is being executed to cause bot to click that damned portal (we probably wont see anything on console but worth a try)

julitovidela commented 4 years ago

Ok so here is the video. I recorded the whole run (starting from pit lvl 1) so you can see that the rest of the acts the bot executes the scripts without a problem I have 2 errors here: The first one in the pit, where the toon goes to town to heal but takes the portal back. In this case the bot is able to make a tp again (after more than 2 minutes [1:30 - 3:45]) and execute the next script. The second error is at the tower cellar lvl 5, after killing the countess the bot goes to town, this time to id items, but does the same thing of returning to the dungeon [5:00 - 7:30]. Finally it throws an error and skips the next script (in this case andariel)

So its almost 5 minutes of lost time for this run. What could be the cause?

DarkHorseDre commented 4 years ago

Nice work! :)

1:30 looks like massive lag spike - it is possible bot clicked tp but lag caused bot to click same location by accident (retry of clicking tp). bot definitely thought it was in town, and the bot lags the game as it retries the move to coordinates that aren't there anymore. same kinda thing for countess.

one massive thing accounted for in the code is ping lag - much of the time you will see (something + me.ping) which is to allow for extra time dependent upon your ping at that time. when clicking things (like tps) this is most important.

Do you know what your ping was at that time?

you can place ping overhead of bot or in console if that helps. example for overhead - place 1 line in toolsthread.js line 606, from original:

while (true) {
        try {

to:

while (true) {
                me.overhead("ping: " + me.ping); 
        try {

if its not ping then something else is making bot click immediately.. but ping is the most likely culprit (unless there's some known issue I'm unaware of) - I can say this doesn't happen to me but has in the past (on wireless for example)

oh yes - are you on wireless/powerline ethernet?

julitovidela commented 4 years ago

Cool, thank you! Im gonna write down the exact ping whenever I get this error and Ill let you know. Generally my ping is around 150-300 (in fact, you can check that in the first post of this thread where I pasted my error log). Im on wireless internet but I rarely have any noticeable lag issues

DarkHorseDre commented 4 years ago

yes I saw that, but it wasn't necessarily the ping experienced when the event occurred.

it would be easier if the bot tells you - the bot needs to tell you as its the ping from game client (may have inherent lag?) to blizz server game is on. you can type ping to console (`print("ping: " + me.ping);

or as above

OH and wireless is massive red flag! plug into ethernet and see if there's any difference - this is the easiest and quickest test. even my powerline over 8-15 metres adds extra latency..

julitovidela commented 4 years ago

Ok so I did the test with both of my chars, I had this problem once with each one in the first run. The paladin with 500 ping while finishing the countess script and the sorceress with 234 ping finishing andy script. I think the ping might be the issue but the problem is that its not consistent. I mean, the bot could go to town in the same run while having a ping of >300 but then it couldnt with a ping of 234. Do you know where is the line of code that I could edit to put a delay of ~1000 ms before starting town chores in act 1?

DarkHorseDre commented 4 years ago

Ping is probably related to something else like wireless interference, AP fart etc. I'd switch to wired to test.

Do you know where is the line of code that I could edit to put a delay of ~1000 ms before starting town chores in act 1?

delay(1000);

julitovidela commented 4 years ago

Excellent, I will try now the ethernet connection and see what happens