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.
usingSystem;usingSystem.Threading;usingSystem.Threading.Tasks;usingSystem.ComponentModel;usingSystem.Collections.Generic;using robotManager.Helpful;using wManager.Wow.Helpers;using wManager.Events;using wManager.Wow.ObjectManager;publicclassMain: wManager.Plugin.IPlugin{privateList<string> potions =newList<string>(new string[]{"Superior Healing Potion","Major Healing Potion"});publicvoidInitialize(){Loop();}privatevoidLoop(){
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();}publicvoidDispose(){// Code to run when the bot is stopped}publicvoidSettings(){// Code to run when someone clicks the plugin settings button}privatevoidLog(string text){Logging.WriteDebug("UseHealingPotions: "+ text);}}
usingSystem;usingSystem.ComponentModel;usingSystem.Collections.Generic;usingSystem.Threading;usingSystem.Windows.Forms;usingSystem.IO;usingSystem.Linq;usingSystem.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;publicclassMain: wManager.Plugin.IPlugin{privateint distance =64;publicvoidInitialize(){Loop();}privatevoidLoop(){
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();}elseif(Products.InPause==true&& nearestPlayerDistance > distance){ResumeBot();}}if(!ObjectManager.Me.IsAlive&&Products.InPause==true){ResumeBot();}Thread.Sleep(2500);Loop();}privatevoidPauseBot(){Products.InPause=true;Log("Detected player near by. Pausing bot!");}privatevoidResumeBot(){Products.InPause=false;Log("No players detected near by. Resuming bot!");}privatevoidLog(string text){Logging.WriteDebug("STOP BOT: "+ text);}publicvoidDispose(){}publicvoidSettings(){}}
Silent crash
in General discussion
Posted
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.