What's new
  • Visit Rebornbuddy
  • Visit Resources
  • Visit API Documentation
  • Visit Downloads
  • Visit Portal
  • Visit Panda Profiles
  • Visit LLamamMagic

How to keep re-evaluating priorities while moving around?

Karls

New Member
Joined
Apr 11, 2014
Messages
324
Reaction score
2
Say I have that line of code:

Code:
ComeTo(doodad, 2);

Is there anyway to continue execution of the plugin while still letting the bot keep moving until it reaches destination or another ComeTo call, so I can keep executing my evaluation code and react to what happens while moving (someone tagging the mob while I run to it, someone getting to the mining node before me, some closer mob/node spawning, ...)

(And damned be the queue, preventing me to test things for a while)
 
Say I have that line of code:

Code:
ComeTo(doodad, 2);

Is there anyway to continue execution of the plugin while still letting the bot keep moving until it reaches destination or another ComeTo call, so I can keep executing my evaluation code and react to what happens while moving (someone tagging the mob while I run to it, someone getting to the mining node before me, some closer mob/node spawning, ...)

(And damned be the queue, preventing me to test things for a while)
I'm not sure if it will work with ComeTo - you may need to do a while look with MoveTo and check distance. I think ComeTo has a loop itself which stops when in range. A new Task() could also be used to do stuff while running.
 
I thought about starting an extra thread, but I'm not sure how I can cancel movement/interact with the main thread and even less how to do that in a clean way!

I'll check MoveTo as well once I get ingame (as well as the 3rd parameter of ComeTo being equal to the total distance, but not sure if that will continue execution as I hope or just not move at all)
 
I thought about starting an extra thread, but I'm not sure how I can cancel movement/interact with the main thread and even less how to do that in a clean way!

I'll check MoveTo as well once I get ingame (as well as the 3rd parameter of ComeTo being equal to the total distance, but not sure if that will continue execution as I hope or just not move at all)

I think i tried the 3rd param already, it just stopped - but I'm not 100% sure. I would go with MoveTo and use your own loop.
You could also put the ComeTo in an extra thread and stop it/dispose it - just let the mainthread handle the conditions when to stop it. You could just recycle the extra thread everytime just for the movement.
 
Tested it and MoveTo seems to just be ComeTo except it can't stop at a certain distance from the target.

But using a different thread for movement is an interesting idea, hadn't thought of doing it that way. I'll give it a try when I have time to see if movement still feels natural that way (but no reason it shouldn't, since a thread would only be killed when I need to change direction)
 
Dunno what u already wrote,but u don't need Threads if Ur writing it bt Style ... Look at Singular,if u do it coroutine style take a Look into com dev sticky Threads,if u do Classic Style (if (){}else{}) then put the movement check below the Me.combat check
 
Back
Top