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

Question regarding Coroutines.FinishCurrentAction

Fujiyama

Member
Joined
Mar 27, 2014
Messages
485
Reaction score
4
I'm using this code for SRS, and it's great that he is casting non-stop. But he keeps casting after the mobs are dead, all the way until I'm out of mana. How can I set a condition for the bot to "finish current action"? Just want him to stop it when there are no mobs.

Thank you!

Code:
if (_summonRagingSpiritSlot != -1 &&
                _summonRagingSpiritStopwatch.ElapsedMilliseconds > OldRoutineSettings.Instance.SummonRagingSpiritDelayMs)
                {
                    var skill = LokiPoe.InGameState.SkillBarPanel.Slot(_summonRagingSpiritSlot);
                    var max = skill.GetStat(StatTypeGGG.NumberOfRagingSpiritsAllowed);
                    if (skill.NumberDeployed < max && skill.CanUse())
                    {
                        ++_summonRagingSpiritCount;


                        LokiPoe.ProcessHookManager.ClearAllKeyStates();
                        var err1 = LokiPoe.InGameState.SkillBarPanel.UseAt(_summonRagingSpiritSlot, false, targetPosition);


                        if (_summonRagingSpiritCount >=
                            OldRoutineSettings.Instance.SummonRagingSpiritCountPerDelay)
                        {
                            _summonRagingSpiritCount = 0;
                            _summonRagingSpiritStopwatch.Restart();
                        }


                        if (err1 == LokiPoe.InGameState.UseError.None)
                        {
                            await Coroutine.Sleep(Utility.LatencySafeValue(77));


                            await Coroutines.FinishCurrentAction(false);


                            Log.ErrorFormat("Casting SRS");
                            
                            return true;
                        }
 
You'd need to post your full modified routine to give that code context.

If you're setting key states, then you must clear them when the routine returns, so avoid it from keep casting into other logic. In OldRoutine, similar logic is only executed after there's a BestTarget, so it won't cast if there are no targets.
 
You'd need to post your full modified routine to give that code context.

If you're setting key states, then you must clear them when the routine returns, so avoid it from keep casting into other logic. In OldRoutine, similar logic is only executed after there's a BestTarget, so it won't cast if there are no targets.

Im just posting this here in case you or anyone else care to take a look. I'm not at all familiar with this code so a couple of pointers would be appreciated.

We could either have him stop when there's no mobs or stop every 10 seconds or so, so I won't have to gimp my mana regen to keep him from casting for all eternity.
 

Attachments

Im just posting this here in case you or anyone else care to take a look. I'm not at all familiar with this code so a couple of pointers would be appreciated.

We could either have him stop when there's no mobs or stop every 10 seconds or so, so I won't have to gimp my mana regen to keep him from casting for all eternity.

With SRS besttarget is not really "useful" imho, you should cache surrounding hostile alive mobs and check if there's still some, then keep casting by returning true, else just let the routine return false.

it's pretty specific spell, since it's not really targeted.
 
With SRS besttarget is not really "useful" imho, you should cache surrounding hostile alive mobs and check if there's still some, then keep casting by returning true, else just let the routine return false.

it's pretty specific spell, since it's not really targeted.

Yeah I'm with you on the logic, let us see if I can execute it :)
 
Back
Top