Script problem

Hey, there is a problem i have faced with walking scripts, when the bot gets freeze from npc thieves, the bot goes to the next coordinate instead of completing the current one which causes me to get stuck sometimes. I know i can use go back a coordinate if stuck but after x seconds, but no matter the time i put there the bot goes back a coordinate everytime they freeze me(even if im not stuck) and with 10 npc thieves i end up dying after a couple of freezes.
I hope you can help me solve this issue.

Where + when does this happen? Probably the easiest and only solution to this will be creating a costum script that you execute.

What do you mean by a custom script?