penumbra 4 Posted December 25, 2017 Share Posted December 25, 2017 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 https://wrobot.eu/forums/topic/8106-totown-state/ Share on other sites More sharing options...
Avvi 98 Posted December 26, 2017 Share Posted December 26, 2017 (edited) 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 December 26, 2017 by Avvi Link to comment https://wrobot.eu/forums/topic/8106-totown-state/#findComment-37066 Share on other sites More sharing options...
Matenia 630 Posted December 26, 2017 Share Posted December 26, 2017 ToTown.ToTownInProgress (although I've noticed that sometimes that boolean is set despite not actually going to town, so try Logging.Status.ToLower().Contains("town")). zatvorgt and Pudge 2 Link to comment https://wrobot.eu/forums/topic/8106-totown-state/#findComment-37073 Share on other sites More sharing options...
Avvi 98 Posted December 26, 2017 Share Posted December 26, 2017 (edited) 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 December 26, 2017 by Avvi Matenia 1 Link to comment https://wrobot.eu/forums/topic/8106-totown-state/#findComment-37079 Share on other sites More sharing options...
penumbra 4 Posted January 1, 2018 Author Share Posted January 1, 2018 Thank you both! Avvi I have purchased your plugin, seems to do the trick Avvi 1 Link to comment https://wrobot.eu/forums/topic/8106-totown-state/#findComment-37277 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now