Premature exit on Canny macro, no error msg, no echo

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

Soultrapper
orc pawn
orc pawn
Posts: 28
Joined: Thu Apr 22, 2004 1:30 pm

Premature exit on Canny macro, no error msg, no echo

Post by Soultrapper » Sat May 08, 2004 9:57 pm

Code: Select all

#include spellcast.inc

#event QuiOn "You fall into a state of quiescence."
#event QuiOff "Your state of quiescence ends."

sub Main
	/declare CanniSpell string outer "Cannibalize IV"
	/declare CannAATimer timer outer
	/declare CannTimer timer outer
	/declare QuiState bool outer FALSE
	
	:MainLoop 
	/doevents
		/if (${Me.PctHPs}<=80 && !${QuiState}) {
			/echo "casting Qui"
			/call Cast "Quiescence"
		}
		/if (${Me.PctMana}>97) {
			/echo "mana good, exiting"
			/return
		}
		/call CheckCann
	/goto :MainLoop
	/echo "got thru!!!"
/return

Sub CheckCann 
   /if (!${Me.Moving}) { 
      /if (${Me.PctMana}<80 && ${Me.PctHPs}>=60 && ${Me.CurrentHPs}>2900 && ${CannAATimer}<=0) { 
      	/echo "canny5"
         /call Cast "47" activate
         /varset CannAATimer 3m
         /return
      } 
      /if (${Me.PctMana}<97 && ${Me.PctHPs}>=40 && ${CannTimer}<=0) {
      	/echo "Casting ${CanniSpell}" 
         /call Cast ${CanniSpell}
         /varset CannTimer 4s 
      } 
   } 
/return

| ### EVENTS ### | 

Sub Event_QuiOn
	/varset QuiState TRUE
/end

Sub Event_QuiOff
	/varset QuiState FALSE
/end 
Usually this is the way it goes, if you're low enough on mana, starts off w/ a Canny5, goes onto Quiscence then does one Canny IV and exits wo/ echoing that it's either good on mana or that it got thru somehow.

Any ideas?

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

Why the events?

Post by Chill » Sun May 09, 2004 1:44 am

My guess is that it might not be doing what you want after the events. Im not 100% sure, but honestly I would get rid of the events and timers.

try this:

Code: Select all

#include spellcast.inc 

sub Main 
   /declare CanniSpell string outer "Cannibalize IV" 
    
   :MainLoop 
      /if (${Me.PctHPs}<=80 && !${Me.Buff["Quiescence"].Duration}) { 
         /echo "Casting Quiescence"
         [color=red]/target myself[/color]
         /call Cast "Quiescence" 
      } 
      /if (${Me.PctMana}>97) { 
         /echo "mana good, exiting" 
         /return 
      } 
      /call CheckCann 
   /goto :MainLoop 
/return 

Sub CheckCann 
   /if (!${Me.Moving}) { 
      /if (${Me.PctMana}<80 && ${Me.PctHPs}>=60 && ${Me.CurrentHPs}>2900 && ${Me.AbilityReady["[color=darkred]Cannibalize V[/color]"]) { 
         /echo "canny5" 
         /call Cast "47" activate 
         /return 
      } 
      /if (${Me.PctMana}<97 && ${Me.PctHPs}>=40 && !${Me.AbilityReady["[color=darkred]Cannibalize V[/color]"]) { 
         /echo "Casting ${CanniSpell}" 
         /call Cast ${CanniSpell} 
      } 
   } 
/return
I added /target myself before Quiescence for obvious reasons since it is a targetable spell. Also, Im not sure if "Cannibalize V" is the exact name of your AA ability, but use the name whatever that is.

Other than that I think this should do exactly what you were trying to do before, just without the extra timers, events, and variables.

Good luck and let me know how it works.
Last edited by Chill on Sun May 09, 2004 2:10 am, edited 1 time in total.

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

Post by Chill » Sun May 09, 2004 2:09 am

A thought on efficiency: MQ2 runs fast enough that this prolly isnt necessary, BUT if you wanted to make your code a bit more efficient...

You could use an else statement for when Cani 5 is not ready, and some nested if statements for the other conditions to avoid making the program check all conditions every time.

Code: Select all

Sub CheckCann 
   /if (!${Me.Moving}) { 
      /if (${Me.PctMana}<80 && ${Me.PctHPs}>=60 && ${Me.CurrentHPs}>2900 && ${Me.AbilityReady["Cannibalize V"]) { 
         /echo "canny5" 
         /call Cast "47" activate 
         /return 
      } 
      /if (${Me.PctMana}<97 && ${Me.PctHPs}>=40 && !${Me.AbilityReady["Cannibalize V"]) { 
         /echo "Casting ${CanniSpell}" 
         /call Cast ${CanniSpell} 
         /varset CannTimer 4s 
      } 
   }
/return
would become:

Code: Select all

Sub CheckCann 
   /if (!${Me.Moving}) { 
      /if (${Me.AbilityReady["Cannibalize V"]) {
         /if (${Me.PctMana}<80) {
            /if (${Me.CurrentHPs}>2900)) {
               :cani5
               /echo "Cani 5"
               /call cast "47" activate
               /return 5
            }
         }
      }

      /else {
         /if (${Me.PctMana}<97) {
            /if (${Me.PctHPs}>=40) {
               :cani4
               /echo "Casting " & ${CanniSpell}
               /call Cast ${CanniSpell}
               /return 4
            }
         }

      }
   }
I thought it was redundant to check both percent and actual hps. I liked actual better so I took the percent check out of the Cani 5 statement. You could change the Cani 4 check to actual instead of percent as well, or add back in the extra line if you really want to check both.

Soultrapper
orc pawn
orc pawn
Posts: 28
Joined: Thu Apr 22, 2004 1:30 pm

Post by Soultrapper » Sun May 09, 2004 3:52 pm

Glad Lax didn't see this before I found the mistake, lol, or I'd have some pretty names flyin at me.

Code: Select all

Sub Event_QuiOn 
   /varset QuiState TRUE 
/end 

Sub Event_QuiOff 
   /varset QuiState FALSE 
/end 
These end the macro, replacing the /end w/ /return solves the exit problem. :oops: As for the doin the ${Me.AbilityReady["Cannibalize V"]}, don't think that's doable, at least not for AA abilities, or at least I couldn't get it working, so stuck with the timer.

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

Post by Chill » Mon May 10, 2004 6:26 am

dude look at the readme file at the members of Character:

bool AbilityReady[name] Ability with this name ready?

If it isnt working, then the exact name prolly isn't "Cannibalize V". Course thats prolly why I coded it in red and said Im not sure if "Cannibalize V" is the exact name of your AA ability, but use the name whatever that is.

try "Cannabalization", "Cannibalize", or do a search for the exact name of your skill and the ${Me.AbilityReady["WhateverTheFuckYourCannibalizeSkillIsCalled"]} code should work like a dream.

Course if you really think its called "Cannibalize V" you could just try adding the ending "}" I just noticed I forgot in my suggested code above.

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

Post by Chill » Mon May 10, 2004 6:35 am

Here try this first:

Code: Select all

#include spellcast.inc 

sub Main 
   /declare CanniSpell string outer "Cannibalize IV" 
    
   :MainLoop 
      /if (${Me.PctHPs}<=80 && !${Me.Buff["Quiescence"].Duration}) { 
         /echo "Casting Quiescence" 
         /target myself 
         /call Cast "Quiescence" 
      } 
      /if (${Me.PctMana}>97) { 
         /echo "mana good, exiting" 
         /return 
      } 
      /call CheckCann 
   /goto :MainLoop 
/return 

Sub CheckCann 
   /if (!${Me.Moving}) { 
      /if (${Me.AbilityReady["[b]Cannabalization[/b]"]}) { 
         /if (${Me.PctMana}<80) { 
            /if (${Me.CurrentHPs}>2900)) { 
               :cani5 
               /echo "AA Cani 5" 
               /call cast "47" activate 
               /return 5 
            } 
         } 
      } 

      /else { 
         /if (${Me.PctMana}<97) { 
            /if (${Me.PctHPs}>=40) { 
               :cani4 
               /echo "Casting " & ${CanniSpell} 
               /call Cast ${CanniSpell} 
               /return 4 
            } 
         } 

      } 
   }
I dont have a high-level shaman to test this on myself, but it should work. If it doesnt, I would first try playing with the exact sony name of your AA Cani 5 skill before adding back in events and variables and timers to reinvent something that MQ will do for you with 1 simple statement.

Falco72
a hill giant
a hill giant
Posts: 215
Joined: Fri Sep 26, 2003 3:24 am

Post by Falco72 » Mon May 10, 2004 9:15 am

Follow the link http://lucy.allakhazam.com/spell.html?i ... ource=Live and you will see the right name is "Cannibalization".