Jump to content

Totown state?


penumbra
 Share

Recommended Posts

Hello,

Is there a way that I can add a check to see if the bot is in the "ToTown" state?

 

I am tinkering with a bot pausing that I like as I find the functionality in advanced settings to be unreliable, which is a different issue. Even with 500 yards and 0 seconds run time it does not pause

I would like to create a stopbot function that respects players vicinity and pauses straight away, however does not break the "totown" functionality

I am using the below (from the StopBot.cs) to identify when a player is near, and adding a check for an extended pause duration

The problem is that once the bot is on the way to town and encounters its first player, it goes into pause. Which would be fine since it will suppress after a duration. However, the bot upon supressing the pause has forgotten it was on the way to town and goes back to the grinding spot

Is there a way that I can add a check to see if the bot was in the "ToTown" state, so that it does not force the bot to pause, but allows it to run

 

Thanks!


               foreach (var wowPlayer in ObjectManager.GetObjectWoWPlayer() )
               {
                  if (wowPlayer.Name != null && wowPlayer.GetDistance<60 && !ObjectManager.Target.IsAlive)
                  {
                        playerPresent = 1;
                        Logging.Write("Other Player in range detected: "+wowPlayer.Name+" "+wowPlayer.GetDistance.ToString());
                        //Lua.LuaDoString("Dismount();");
                        //Thread.Sleep(10);
                        //Products.InPause = true;
                        
                    }
               }
               if (playerPresent == 0)
                {
                    
                    Products.InPause = false;
                    Thread.Sleep(10);
                } else {
		    Logging.Write("Currently been waiting for: "+timeinpause);
		    timeinpause = timeinpause +1;
			Thread.Sleep(1000);
		}

	     if (timeinpause > 10) {
		    Products.InPause = false;
		    Logging.Write("I probably got stuck on my way to town, surpressing for 40 sec");
		    timeinpause = 0;
                    Thread.Sleep(40000);

	     } 

 

Link to comment
Share on other sites

Hey Penumbra. I offer this functionality in my RoboAlert plugin. (pause when player nearby) and (ignore when going/leaving to town). 

 

https://wrobot.eu/files/file/1332-paidsale-roboalert-game-alerts-sound-email-phone-notification-on-whisper-rare-mob-teleport-logout-death-pause-etc/

 

 

Edited by Avvi
Link to comment
Share on other sites


bool goToTown = false;


public void Initialize(){ 
  initializeToTownWatcher();
}

private void initializeToTownWatcher() {
        robotManager.Events.FiniteStateMachineEvents.OnRunState += (engine, state, cancelable) =>
        {
            if (state != null && state.DisplayName == "To Town")
            {
             
                    goToTown = true;
                    Logging.Write("Going to Town State has been initiated.");
            }
        };

        robotManager.Events.FiniteStateMachineEvents.OnAfterRunState += (engine, state) =>
        {
            if (state != null && state.DisplayName == "To Town")
            {
                goToTown = false;
                Logging.Write("We have completed going To Town State.");
                

            }
        };

    }

I recommend doing it by watching for state change. I've not used Matenia's version, but if that doesn't work you can use my code and use the goToTown boolean. 

 

 

Edited by Avvi
Link to comment
Share on other sites

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
 Share

×
×
  • Create New...