duthibaut 0 Posted May 17, 2019 Share Posted May 17, 2019 Hello @Droidz I have do some C# code in a pluggin for check distance farming and stop go to the node by his ground Vector3 but. But when i use my plugin i have a problem : The bot try to go the node AND to follow the path with gathering in the same time. You know how i can stop the following path, clean the node and restart the following path by the pluggin ? Thx ? Link to comment https://wrobot.eu/forums/topic/11244-c-stopfollowing-path-gathering/ Share on other sites More sharing options...
TheSmokie 242 Posted May 17, 2019 Share Posted May 17, 2019 I was wondering this also. Link to comment https://wrobot.eu/forums/topic/11244-c-stopfollowing-path-gathering/#findComment-53721 Share on other sites More sharing options...
duthibaut 0 Posted May 17, 2019 Author Share Posted May 17, 2019 Well in fact with juste a while it's done .. ^^" Edit : Well in fact no ... xD @Droidz Link to comment https://wrobot.eu/forums/topic/11244-c-stopfollowing-path-gathering/#findComment-53725 Share on other sites More sharing options...
duthibaut 0 Posted May 18, 2019 Author Share Posted May 18, 2019 Seems to be sleep.thread who make go out of the thread ang go gathering Link to comment https://wrobot.eu/forums/topic/11244-c-stopfollowing-path-gathering/#findComment-53749 Share on other sites More sharing options...
TheSmokie 242 Posted May 18, 2019 Share Posted May 18, 2019 Can you provide you’re plugin so I can have a lookie? I might be able to help Link to comment https://wrobot.eu/forums/topic/11244-c-stopfollowing-path-gathering/#findComment-53750 Share on other sites More sharing options...
duthibaut 0 Posted May 18, 2019 Author Share Posted May 18, 2019 Sure, I use Gathering profile "Néantine.xml" with. The bot go to the node, but when he start to gather, he start to follow path at the same time... Maybie do some event in a while for stay in .. But i don"t know how to do that ? GatheringHelp.cs Néantine.xml Link to comment https://wrobot.eu/forums/topic/11244-c-stopfollowing-path-gathering/#findComment-53752 Share on other sites More sharing options...
Droidz 2738 Posted May 18, 2019 Share Posted May 18, 2019 It is same problem like here: https://wrobot.eu/bugtracker/battleground-debuff-r1251/?do=findComment&comment=5834 Your plugin run code not on the same thread that your current product thread, in your code at the same time you do 2 tasks duthibaut 1 Link to comment https://wrobot.eu/forums/topic/11244-c-stopfollowing-path-gathering/#findComment-53753 Share on other sites More sharing options...
duthibaut 0 Posted May 18, 2019 Author Share Posted May 18, 2019 Thanks ? I take a look ! Link to comment https://wrobot.eu/forums/topic/11244-c-stopfollowing-path-gathering/#findComment-53755 Share on other sites More sharing options...
duthibaut 0 Posted May 18, 2019 Author Share Posted May 18, 2019 Working like a charm, just need to see how go out the thread ? Thanks a lot ! Link to comment https://wrobot.eu/forums/topic/11244-c-stopfollowing-path-gathering/#findComment-53756 Share on other sites More sharing options...
Inaru 6 Posted May 18, 2019 Share Posted May 18, 2019 (edited) I think its : Thread.Abort() Buut.... Read this just in case: https://stackoverflow.com/questions/14131608/how-to-terminate-a-thread-in-c Good luck. Edited May 18, 2019 by Inaru Link to comment https://wrobot.eu/forums/topic/11244-c-stopfollowing-path-gathering/#findComment-53757 Share on other sites More sharing options...
duthibaut 0 Posted May 18, 2019 Author Share Posted May 18, 2019 Thanks for this reply, but ... Thread is an object ? this line don"t compile, i need to create a object thread and .abort after ? public void GoToFarm() { _isLaunched = true; wManager.Wow.Helpers.Chat.SendChatMessage("Initialize", wManager.Wow.Enums.ChatTypeId.SAY); glaurierId = 181279; var glaurierObject = ObjectManager.GetNearestWoWGameObject(ObjectManager.GetWoWGameObjectByEntry(glaurierId)) ; while (_isLaunched) { try { var distance = ObjectManager.GetNearestWoWGameObject(ObjectManager.GetWoWGameObjectByEntry(glaurierId)).GetDistance; if (ObjectManager.GetNearestWoWGameObject(ObjectManager.GetWoWGameObjectByEntry(glaurierId)).GetDistance < 200) { robotManager.Events.FiniteStateMachineEvents.OnBeforeCheckIfNeedToRunState += (engine, state, cancelable) => { if (state is wManager.Wow.Bot.States.Farming && !state.NeedToRun) { wManager.Wow.Bot.Tasks.GoToTask.ToPositionAndIntecractWithGameObject(ObjectManager.GetNearestWoWGameObject(ObjectManager.GetWoWGameObjectByEntry(glaurierId)).Position, ObjectManager.GetNearestWoWGameObject(ObjectManager.GetWoWGameObjectByEntry(glaurierId)).Entry); Thread.Sleep(5000); wManager.Wow.Helpers.Chat.SendChatMessage("In the new thread", wManager.Wow.Enums.ChatTypeId.SAY); } }; } //wManager.Wow.Helpers.Chat.SendChatMessage("Je suis sorti", wManager.Wow.Enums.ChatTypeId.SAY); } //wManager.Wow.Bot.Tasks.GoToTask.ToPositionAndIntecractWithGameObject(ObjectManager.GetNearestWoWGameObject(ObjectManager.GetWoWGameObjectByEntry(glaurierId)).Position, ObjectManager.GetNearestWoWGameObject(ObjectManager.GetWoWGameObjectByEntry(glaurierId)).Entry); catch (Exception e) { Logging.WriteError("[GatheringHelp]: " + e); } } } public void Initialize() { Thread newThread = new Thread(new ThreadStart(GoToFarm)); } Link to comment https://wrobot.eu/forums/topic/11244-c-stopfollowing-path-gathering/#findComment-53760 Share on other sites More sharing options...
Inaru 6 Posted May 18, 2019 Share Posted May 18, 2019 What is the error in the compiler? Link to comment https://wrobot.eu/forums/topic/11244-c-stopfollowing-path-gathering/#findComment-53761 Share on other sites More sharing options...
Droidz 2738 Posted May 18, 2019 Share Posted May 18, 2019 don't put code in loop, you need to call this code only one time Link to comment https://wrobot.eu/forums/topic/11244-c-stopfollowing-path-gathering/#findComment-53762 Share on other sites More sharing options...
duthibaut 0 Posted May 18, 2019 Author Share Posted May 18, 2019 @Inaru Only an assignation, a call or an increment in wait and expressions of object "new" can be use like an instruction @Droidz nothing change well i delete the while(_islaunched) {} , he skipp all the node ? Link to comment https://wrobot.eu/forums/topic/11244-c-stopfollowing-path-gathering/#findComment-53763 Share on other sites More sharing options...
Droidz 2738 Posted May 18, 2019 Share Posted May 18, 2019 I think it is problem with "new ThreadStart" but you don't need to create new thread you can call "GoToFarm()" directly Link to comment https://wrobot.eu/forums/topic/11244-c-stopfollowing-path-gathering/#findComment-53764 Share on other sites More sharing options...
Inaru 6 Posted May 18, 2019 Share Posted May 18, 2019 (edited) Try with..... GoToFarm(){ new Thread(() => // Your code here }).Start(); } And in initialize just do GoToFarm() Edited May 18, 2019 by Inaru Link to comment https://wrobot.eu/forums/topic/11244-c-stopfollowing-path-gathering/#findComment-53765 Share on other sites More sharing options...
duthibaut 0 Posted May 18, 2019 Author Share Posted May 18, 2019 I do like this : @Droidz public void Initialize() { _isLaunched = true; wManager.Wow.Helpers.Chat.SendChatMessage("Initialize", wManager.Wow.Enums.ChatTypeId.SAY); glaurierId = 181279; var glaurierObject = ObjectManager.GetNearestWoWGameObject(ObjectManager.GetWoWGameObjectByEntry(glaurierId)) ; GoToFarm(glaurierId); } public void GoToFarm(int glaurierId) { try { var distance = ObjectManager.GetNearestWoWGameObject(ObjectManager.GetWoWGameObjectByEntry(glaurierId)).GetDistance; if (ObjectManager.GetNearestWoWGameObject(ObjectManager.GetWoWGameObjectByEntry(glaurierId)).GetDistance < 200) { robotManager.Events.FiniteStateMachineEvents.OnBeforeCheckIfNeedToRunState += (engine, state, cancelable) => { if (state is wManager.Wow.Bot.States.Farming && !state.NeedToRun) { wManager.Wow.Bot.Tasks.GoToTask.ToPositionAndIntecractWithGameObject(ObjectManager.GetNearestWoWGameObject(ObjectManager.GetWoWGameObjectByEntry(glaurierId)).Position, ObjectManager.GetNearestWoWGameObject(ObjectManager.GetWoWGameObjectByEntry(glaurierId)).Entry); Thread.Sleep(5000); wManager.Wow.Helpers.Chat.SendChatMessage("In the new thread", wManager.Wow.Enums.ChatTypeId.SAY); } }; } } catch (Exception e) { Logging.WriteError("[GatheringHelp]: " + e); } } He do as well but stay in "In the new thread" (say in chat). I try this now @Inaru !! Link to comment https://wrobot.eu/forums/topic/11244-c-stopfollowing-path-gathering/#findComment-53766 Share on other sites More sharing options...
duthibaut 0 Posted May 19, 2019 Author Share Posted May 19, 2019 Thx @Inaru and @Droidz I set some recusivity in my thread and it's working just fine as well ? public void Initialize() { _isLaunched = true; wManager.Wow.Helpers.Chat.SendChatMessage("Initialize", wManager.Wow.Enums.ChatTypeId.SAY); glaurierId = 181279; var glaurierObject = ObjectManager.GetNearestWoWGameObject(ObjectManager.GetWoWGameObjectByEntry(glaurierId)) ; GoToFarm(glaurierId); } public void GoToFarm(int glaurierId) { robotManager.Events.FiniteStateMachineEvents.OnBeforeCheckIfNeedToRunState += (engine, state, cancelable) => { try { var distance = ObjectManager.GetNearestWoWGameObject(ObjectManager.GetWoWGameObjectByEntry(glaurierId)).GetDistance; if (ObjectManager.GetNearestWoWGameObject(ObjectManager.GetWoWGameObjectByEntry(glaurierId)).GetDistance < 200) if (state is wManager.Wow.Bot.States.Farming && !state.NeedToRun) { glaurierId = 181279; wManager.Wow.Bot.Tasks.GoToTask.ToPositionAndIntecractWithGameObject(ObjectManager.GetNearestWoWGameObject(ObjectManager.GetWoWGameObjectByEntry(glaurierId)).Position, ObjectManager.GetNearestWoWGameObject(ObjectManager.GetWoWGameObjectByEntry(glaurierId)).Entry); Thread.Sleep(5000); wManager.Wow.Helpers.Chat.SendChatMessage("In the new thread", wManager.Wow.Enums.ChatTypeId.SAY); GoToFarm(glaurierId); } } catch (Exception e) { Logging.WriteError("[GatheringHelp]: " + e); } }; Link to comment https://wrobot.eu/forums/topic/11244-c-stopfollowing-path-gathering/#findComment-53776 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