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

Condition check and logging question

highend

Member
Joined
Jan 15, 2010
Messages
422
Reaction score
1
Simple code, just for testing if the class is working at all:

Code:
        #region Combat

        public override void Combat()
        {

            if (Me.CurrentTarget != null && Me.CurrentTarget.IsAlive == true && Me.Mounted == false)
            {
                if ((!Me.Auras.ContainsKey("Arcane Blast") || Me.ActiveAuras["Arcane Blast"].StackCount <= 2) && Me.IsMoving == false)
                {
                    if (CastSpell("Arcane Blast") == true)
                    {
                        Logging.Write(Color.Aqua, ">> Arcane Blast <<");
                    }
                }
                else if ((Me.Auras.ContainsKey("Arcane Blast") && Me.ActiveAuras["Arcane Blast"].StackCount > 2) && Me.IsMoving == false)
                {
                    if (CastSpell("Arcane Barrage") == true)
                    {
                        Logging.Write(Color.Aqua, ">> Arcane Barrage <<");
                    }
                }
            }
        }

        #endregion

In fact the cc uses Arcane Blast up to four times before it uses Arcane Barrage (it should fire it if the stack reaches 3) and the logging is very inconsistent.

Shouldn't it log _every_ spellcast (e.g. Arcane Blast, Arcane Blast, Arcane Blast, Arcane Barrage) and why isn't it using Arcane Barrage after 3 casts instead 4?

Tia,
highend
 
Simple code, just for testing if the class is working at all:

Code:
        #region Combat

        public override void Combat()
        {

            if (Me.CurrentTarget != null && Me.CurrentTarget.IsAlive == true && Me.Mounted == false)
            {
                if ((!Me.Auras.ContainsKey("Arcane Blast") || Me.ActiveAuras["Arcane Blast"].StackCount <= 2) && Me.IsMoving == false)
                {
                    if (CastSpell("Arcane Blast") == true)
                    {
                        Logging.Write(Color.Aqua, ">> Arcane Blast <<");
                    }
                }
                else if ((Me.Auras.ContainsKey("Arcane Blast") && Me.ActiveAuras["Arcane Blast"].StackCount > 2) && Me.IsMoving == false)
                {
                    if (CastSpell("Arcane Barrage") == true)
                    {
                        Logging.Write(Color.Aqua, ">> Arcane Barrage <<");
                    }
                }
            }
        }

        #endregion

In fact the cc uses Arcane Blast up to four times before it uses Arcane Barrage (it should fire it if the stack reaches 3) and the logging is very inconsistent.

Shouldn't it log _every_ spellcast (e.g. Arcane Blast, Arcane Blast, Arcane Blast, Arcane Barrage) and why isn't it using Arcane Barrage after 3 casts instead 4?

Tia,
highend
because on arcane barrage you have > 2. if you want to go on 4, then just change the 2 to a 3. that would make it go on any number over 3

as for the logging, its not going to log the same thing it makes it avoid log spam.
you can always do
Code:
Logging.Write(Color.Aqua, ">> Arcane Blast << Stack Count {0}", Me.ActiveAuras["Arcane Blast"].StackCount.toString());

it makes the string different each time and gets pass the built in rules for log spamming.
</pre>
 
because on arcane barrage you have > 2. if you want to go on 4, then just change the 2 to a 3. that would make it go on any number over 3

Thanks for your fast answer. What I meant is: Although it should only cast Arcane Blast 3 times (the second condition will be true then) it casts it 4 times before it fires Arcane Barrage and I don't understand why it's not doing it after an Arcane Blast stack of 3.

I'll incorporate the logging thing, thanks for pointing out the log spamming :)
 
Thanks for your fast answer. What I meant is: Although it should only cast Arcane Blast 3 times (the second condition will be true then) it casts it 4 times before it fires Arcane Barrage and I don't understand why it's not doing it after an Arcane Blast stack of 3.

I'll incorporate the logging thing, thanks for pointing out the log spamming :)
heres my check for arcane barrage
Code:
SpellManager.CanCast("Arcane Barrage") && Me.HasAura("Arcane Blast") && Me.ActiveAuras["Arcane Blast"].StackCount >= AmplifySettings.Instance.ArcaneBlastStacks
replace the AmplifySettiingsInstance with 3 and see how that works for you.
 
Thanks for your fast answer. What I meant is: Although it should only cast Arcane Blast 3 times (the second condition will be true then) it casts it 4 times before it fires Arcane Barrage and I don't understand why it's not doing it after an Arcane Blast stack of 3.

I'll incorporate the logging thing, thanks for pointing out the log spamming :)
Has to do with latency, and when the Pulse runs. It looks and sees 2 stacks in the objectmanager, but there are actually 3 shown in wow. Its stupid
 
Has to do with latency, and when the Pulse runs. It looks and sees 2 stacks in the objectmanager, but there are actually 3 shown in wow. Its stupid
actually i was thinking theres so much stuff being checked, maybe the while If statement isnt turning true till it reaches 4 stacks. that its not just waiting on the stack count but something else as well.
 
Code:
SpellManager.CanCast("Arcane Barrage") && Me.HasAura("Arcane Blast") && Me.ActiveAuras["Arcane Blast"].StackCount >= 3

It still casts Arcane Blast 4 times. Latency = 60 ms, not too much to call it a lag.

Will be online again in about 8 hours, time to get some sleep now.

Regards,
highend
 
try this
Code:
                if (Me.CurrentTarget != null && Me.CurrentTarget.IsAlive == true && Me.Mounted == false)
                {
                    if (SpellManager.CanCast("Arcane Blast") && (!Me.Auras.ContainsKey("Arcane Blast") || Me.ActiveAuras["Arcane Blast"].StackCount <= 2) && Me.IsMoving == false)
                    {
                        CastSpell("Arcane Blast");
                        Logging.Write(Color.Aqua, ">> Arcane Blast <<");
                    }
                    if (SpellManager.CanCast("Arcane Barrage") && Me.Auras.ContainsKey("Arcane Blast") && Me.ActiveAuras["Arcane Blast"].StackCount > 2 && Me.IsMoving == false)
                    {
                        CastSpell("Arcane Barrage");
                        Logging.Write(Color.Aqua, ">> Arcane Barrage <<");
                    }
                }
 
Last edited:
It's still casting Arcane Blast 4 times...

44ms latency atm.

Can't be too hard to let a cc cast a spell when an exact condition is met, right? ;)
 
It's still casting Arcane Blast 4 times...

44ms latency atm.

Can't be too hard to let a cc cast a spell when an exact condition is met, right? ;)
do this, if this wont do it i dont know what else will
Code:
 try this 
[code]
                if (Me.CurrentTarget != null && Me.CurrentTarget.IsAlive == true && Me.Mounted == false)
                {
if (SpellManager.CanCast("Arcane Barrage")  && Me.Auras.ContainsKey("Arcane Blast") &&  Me.ActiveAuras["Arcane Blast"].StackCount > 2 && Me.IsMoving  == false)
                     {
                         CastSpell("Arcane Barrage");
                         Logging.Write(Color.Aqua, ">> Arcane Barrage <<");
                     }
                    if (SpellManager.CanCast("Arcane Blast") &&  (!Me.Auras.ContainsKey("Arcane Blast") || Me.ActiveAuras["Arcane  Blast"].StackCount < 2) && Me.IsMoving == false)
                    {
                        CastSpell("Arcane Blast");
                        Logging.Write(Color.Aqua, ">> Arcane Blast <<");
                    }
                    
                }
basicly just changed it from checking arcane blast 1st to arcane barrage first.
let me know if that works.
 
Unfortunately no, isn't working, still casting A Blast 4 times *sigh*

Thanks for your time, CodenameG.
 
Unfortunately no, isn't working, still casting A Blast 4 times *sigh*

Thanks for your time, CodenameG.
can you post the entire project so i can see if there is anything going on in your spellcasting method and how the entire thing fits together.]
 
It's just the Blank.cs from your tutorial thread with the few checks in the combat method (+ a few "using" lines). I just wanted to see how easy it is to build a basic cc that is fast and does exactly what I want it to do (follow my (elitistjerks) combat logic without any movement, any targeting or other "fancy" stuff).

I have to do the molten front dailies with 10 chars each day and I don't want to do the tedious fighting part (takes long enough to do all the quests). 90% of the current ccs include logic to retarget things, even if you clear your current target intentionally, do some weird movement things while still in combat (target is dead already) and other stuff that I don't like. Instead of trying to edit all these ccs I'll want to create simple ones with simple rest, pre combat buff and combat logic that just --- work ---.

Here is the current MyMage file if you still want to see it:
 

Attachments

When HB starts up and tries to compile your edited cc file it complains with:

File: MyMage.cs Line: 63 Error: Da "MyMage.Classname.CastSpell(string)" "void" zur?ckgibt, darf auf ein R?ckgabeschl?sselwort kein Objektausdruck folgen.
File: MyMage.cs Line: 66 Error: Da "MyMage.Classname.CastSpell(string)" "void" zur?ckgibt, darf auf ein R?ckgabeschl?sselwort kein Objektausdruck folgen.
 
Change it to this:
public void CastSpell(string spellName)
{
if (SpellManager.CanCast(spellName))
{
SpellManager.Cast(spellName);
// We managed to cast the spell, so return true, saying we were able to cast it.
return;
}
// Can't cast the spell right now, so return false.
return;
}

Or this if for some reason you wanted to check if it casted it or not:
public bool CastSpell(string spellName)
{
if (SpellManager.CanCast(spellName))
{
SpellManager.Cast(spellName);
// We managed to cast the spell, so return true, saying we were able to cast it.
return true;
}
// Can't cast the spell right now, so return false.
return false;
}
 
With:

Code:
        #region CastSpell Method
        // Credit to Apoc for the below CastSpell code
        // Used for calling CastSpell in the Combat Rotation
        public void CastSpell(string spellName)
        {
            if (SpellManager.CanCast(spellName))
            {
                SpellManager.Cast(spellName);
                // We managed to cast the spell, so return true, saying we were able to cast it.
                return;
            }
            // Can't cast the spell right now, so return false.
            return;
        }
        #endregion

and

Code:
        #region Combat

        public override void Combat()
        {

            if (Me.CurrentTarget != null && Me.CurrentTarget.IsAlive == true && Me.Mounted == false)
            {
                if (Me.ActiveAuras["Arcane Blast"].StackCount > 2)
                {
                    CastSpell("Arcane Barrage");
                    Logging.Write(Color.Aqua, ">> Arcane Barrage <<");
                }
                if ((!Me.Auras.ContainsKey("Arcane Blast") || Me.ActiveAuras["Arcane Blast"].StackCount <= 2))
                {
                    CastSpell("Arcane Blast");
                    Logging.Write(Color.Aqua, ">> Arcane Blast << Stack Count {0}", Me.ActiveAuras["Arcane Blast"].StackCount);
                }
            }
        }
        #endregion

it doesn't even cast Arcane Blast (after entering combat) unless I applied the first stack myself...
 
That coding looks just fine.
Is it throwing any errors? (Debug tab)
 
Yes it does:

Code:
[15:33:12:300] Cleared POI - Reason Exception in Root.Tick()
[15:33:12:300] Cleared POI
[15:33:12:390] System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at MyMage.Classname.Combat() in e:\Games\hbTeam_2.0.0.5387\CustomClasses\MyMage.cs:line 154
   at Styx.Combat.CombatRoutine.CombatRoutine.#MAd(Object action)
   at TreeSharp.Action.RunAction(Object context)
   at TreeSharp.Action.#h.#nF.MoveNext()
   at (Object )
   at TreeSharp.Composite.Tick(Object context)
   at TreeSharp.PrioritySelector.#h.#nF.MoveNext()
   at (Object )
   at TreeSharp.Composite.Tick(Object context)
   at TreeSharp.Decorator.#h.#nF.MoveNext()
   at (Object )
   at TreeSharp.Composite.Tick(Object context)
   at TreeSharp.PrioritySelector.#h.#nF.MoveNext()
   at (Object )
   at TreeSharp.Composite.Tick(Object context)
   at TreeSharp.PrioritySelector.#h.#nF.MoveNext()
   at (Object )
   at TreeSharp.Composite.Tick(Object context)
   at TreeSharp.Decorator.#h.#nF.MoveNext()
   at (Object )
   at TreeSharp.Composite.Tick(Object context)
   at TreeSharp.PrioritySelector.#h.#nF.MoveNext()
   at (Object )
   at TreeSharp.Composite.Tick(Object context)
   at TreeSharp.Decorator.#h.#nF.MoveNext()
   at (Object )
   at TreeSharp.Composite.Tick(Object context)
   at TreeSharp.PrioritySelector.#h.#nF.MoveNext()
   at (Object )
   at TreeSharp.Composite.Tick(Object context)
   at Styx.Logic.BehaviorTree.TreeRoot.Tick()
[15:33:12:390] Cleared POI - Reason Exception in Root.Tick()
[15:33:12:390] Cleared POI
 
Back
Top