Nireves 0 Posted January 6, 2019 Share Posted January 6, 2019 Hi. I have been using this bot for a few weeks now and have made a few fight classes and plugins, but I have noticed that sometimes the bot will just silently crash with no error or anything in the logs to indicate what happened. This seems to happen when I iterate over things like ObjectManager.GetObjectWoWPlayer(). Has anyone else had issues like this? I have had the bot crash when using the included examples below. Not sure which actually causes the crash, as the log doesn't output any errors. I don't know if it makes a difference, but I do not compile these myself. I just add the .cs files to the plugin folder. using System; using System.Threading; using System.Threading.Tasks; using System.ComponentModel; using System.Collections.Generic; using robotManager.Helpful; using wManager.Wow.Helpers; using wManager.Events; using wManager.Wow.ObjectManager; public class Main : wManager.Plugin.IPlugin { private List<string> potions = new List<string>( new string[] { "Superior Healing Potion", "Major Healing Potion" } ); public void Initialize() { Loop(); } private void Loop() { var hostileUnits = ObjectManager.GetUnitAttackPlayer().Count; if ((ObjectManager.Me.HealthPercent < 10) || (hostileUnits == 1 && ObjectManager.Me.HealthPercent < 20 && ObjectManager.Target.HealthPercent >= 50) || (hostileUnits > 1 && ObjectManager.Me.HealthPercent <= 35)) { foreach(var potionName in potions) { if (wManager.Wow.Helpers.Bag.GetItemContainerBagIdAndSlot(potionName)[0] > -1) { wManager.Wow.Helpers.ItemsManager.UseItem(potionName); Log("PANIC! Using " + potionName + "!"); break; } else { Log("PANIC! Dying, but out of potions!"); } } } else { Log("No need to panic."); } Thread.Sleep(2500); Loop(); } public void Dispose() { // Code to run when the bot is stopped } public void Settings() { // Code to run when someone clicks the plugin settings button } private void Log(string text) { Logging.WriteDebug("UseHealingPotions: " + text); } } using System; using System.ComponentModel; using System.Collections.Generic; using System.Threading; using System.Windows.Forms; using System.IO; using System.Linq; using System.Drawing; using robotManager; using robotManager.Helpful; using wManager.Wow.Class; using wManager.Wow.Enums; using wManager.Wow.Helpers; using wManager.Wow.Helpers.PathFinderClass; using wManager.Wow.ObjectManager; using robotManager.Products; public class Main : wManager.Plugin.IPlugin { private int distance = 64; public void Initialize() { Loop(); } private void Loop() { var nearestPlayer = ObjectManager.GetNearestWoWPlayer(ObjectManager.GetObjectWoWPlayer()); if (nearestPlayer != null) { var nearestPlayerDistance = nearestPlayer.GetDistance; if (Products.InPause == false && Fight.InFight == false && nearestPlayerDistance <= distance && nearestPlayer.IsOnTaxi == false) { PauseBot(); } else if (Products.InPause == true && nearestPlayerDistance > distance) { ResumeBot(); } } if (!ObjectManager.Me.IsAlive && Products.InPause == true) { ResumeBot(); } Thread.Sleep(2500); Loop(); } private void PauseBot() { Products.InPause = true; Log("Detected player near by. Pausing bot!"); } private void ResumeBot() { Products.InPause = false; Log("No players detected near by. Resuming bot!"); } private void Log(string text) { Logging.WriteDebug("STOP BOT: " + text); } public void Dispose() { } public void Settings() { } } Link to comment https://wrobot.eu/forums/topic/10591-silent-crash/ 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