diff --git a/Botbases/RSBot.Training/Bundle/Loop/LoopBundle.cs b/Botbases/RSBot.Training/Bundle/Loop/LoopBundle.cs index 8a2041e0..eccfe88b 100644 --- a/Botbases/RSBot.Training/Bundle/Loop/LoopBundle.cs +++ b/Botbases/RSBot.Training/Bundle/Loop/LoopBundle.cs @@ -9,6 +9,8 @@ namespace RSBot.Training.Bundle.Loop; internal class LoopBundle : IBundle { + private System.DateTime _lastAutopathAttempt = System.DateTime.MinValue; + /// /// Gets the configuration. /// @@ -78,6 +80,7 @@ public void Stop() ShoppingManager.Stop(); Running = false; + _lastAutopathAttempt = System.DateTime.MinValue; } /// @@ -165,6 +168,14 @@ public void CheckForWalkbackScript(bool startFromTown = false) if (Config.WalkScript == null || !File.Exists(Config.WalkScript)) { + if (Container.Bot.Area.Position.DistanceToPlayer() <= Container.Bot.Area.Radius + 50) + return; + + if (System.DateTime.UtcNow - _lastAutopathAttempt < System.TimeSpan.FromSeconds(30)) + return; + + _lastAutopathAttempt = System.DateTime.UtcNow; + Log.Notify("No walkback script found. Attempting to generate a dynamic path..."); if (NavigationManager.CalculatePathToTrainingArea()) { diff --git a/Botbases/RSBot.Training/TrainingBase.cs b/Botbases/RSBot.Training/TrainingBase.cs index 2354670d..b6e1aa5b 100644 --- a/Botbases/RSBot.Training/TrainingBase.cs +++ b/Botbases/RSBot.Training/TrainingBase.cs @@ -1,4 +1,4 @@ -using System; +using System; using RSBot.Core; using RSBot.Core.Components; using RSBot.Core.Objects; @@ -34,7 +34,7 @@ public void Tick() return; //Begin the loopback if needed - if (Container.Bot.Area.Position.DistanceToPlayer() > 80) + if (Container.Bot.Area.Position.DistanceToPlayer() > Container.Bot.Area.Radius + 50) Bundles.Loop.Start(); if (Bundles.Loop.Running)