Jump to content

Pause/Unpause when an error is encountered in the "Waypoint timed out" log


Recommended Posts

hi, I'm trying to make a plugin to fix a nasty bug I've encountered on a warmane (3.3.5a) server. it happens that the character periodically freezes and if he continues to move, then he is constantly teleported back until he stops for a few seconds. I face this problem without using a bot and on this server.

I found a plugin on the forum (https://wrobot.eu/forums/topic/12149-how-to-disable-anti-stuck/?do=findComment&comment=58260&_rid=97009). another error is processed there and the bot stops, how can I change "stop" to "pause" and add a timer of 5-10 seconds, after which the bot will unpause and continue working? I will be grateful if you help me with advice

 

attaching the plugin code from the topic on the forum:

using System.ComponentModel;
using wManager.Plugin;

public class Main : IPlugin
{
    private bool _isLaunched;

    public void Initialize()
    {
robotManager.Events.LoggingEvents.OnAddLog += delegate(robotManager.Helpful.Logging.Log log)
        {
            if (log != null)
            {
                if (log.Text.Contains("[MovementManager] Think we are stuck"))
                    robotManager.Products.Products.ProductStop();
            }
        }; 
    }

    public void Dispose()
    {
        _isLaunched = false;
    }

    public void Settings()
    {
    }
}

 

Hello, you can should look like that :

using System.Threading;
using wManager.Plugin;

public class Main : IPlugin
{
    private bool _isLaunched;

    public void Initialize()
    {
        _isLaunched = true;
        robotManager.Events.LoggingEvents.OnAddLog += delegate(robotManager.Helpful.Logging.Log log)
        {
            if (log != null)
            {
                if (log.Text.Contains("[MovementManager] Think we are stuck"))
                {
                    robotManager.Products.Products.InPause = true;
                    
                    // new thread to unpause after 5 seconds
                    new Thread(t =>
                    {
                        Thread.Sleep(5000);
                        if (_isLaunched)
                            robotManager.Products.Products.InPause = false;
                    }).Start();
                }
            }
        }; 
    }

    public void Dispose()
    {
        _isLaunched = false;
    }

    public void Settings()
    {
    }
}

 

thanks a lot, it worked

 

using System.Threading;
using wManager.Plugin;

public class Main : IPlugin
{
    private bool _isLaunched;

    public void Initialize()
    {
        _isLaunched = true;
        robotManager.Events.LoggingEvents.OnAddLog += delegate(robotManager.Helpful.Logging.Log log)
        {
            if (log != null)
            {
                if (log.Text.Contains("[MovementManager] Waypoint timed out"))
                {
                    robotManager.Products.Products.InPause = true;
                    
                    // new thread to unpause after 5 seconds
                    new Thread(t =>
                    {
                        Thread.Sleep(5000);
                        if (_isLaunched)
                            robotManager.Products.Products.InPause = false;
                    }).Start();
                }
            }
        }; 
    }

    public void Dispose()
    {
        _isLaunched = false;
    }

    public void Settings()
    {
    }
}

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...