help with my first macro

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

Ogre_Luvr
a lesser mummy
a lesser mummy
Posts: 52
Joined: Thu Dec 18, 2003 10:11 pm
Location: DC

help with my first macro

Post by Ogre_Luvr » Fri Dec 26, 2003 12:06 am

ok, im trying to make this macro pause the buff cycle and canni when oom

I would like it to check if it can cast the spell after every successful canni

...been beating my head against the wall for a bit now... tried a few things but no real progress for a bit .. if someone else could give it a once over and clue me in I would be very greatfull.

I know this probably already exists, maybe in a better form even but i would like to finnish this to learn the macro language a bit .

**Note SpellCast is edited with

Code: Select all

Sub Event_OutOfMana 

	/if n $char(hp,pct)>50 /if n $char(mana,pct)<90 {
		/call Cast "Cannibalize III"
		/return CAST_RESTART
	} else {
		/if $char(state)!="SIT" /sit 
		/delay 10s 
		/return CAST_RESTART |CAST_OUTOFMANA
	}

Code: Select all

#event SpellFizzle "Your spell fizzles"
#turbo 90
#include Buffspellcast.inc

Sub Main
/clear
/declare BuffCount local
/declare i local
/declare g local
/declare BuffSpell   array
/declare SingleBuffSpell array
/declare SingleBuffCount local

	/if $ucase("@Param0")=="GROUP" {	
	
		/if n $target(level)<=46 {
			/echo Low Group
			
			/varset BuffCount 1
			/varset BuffSpell(1) "Spirit of Bih`Li"
			
			/varset SingleBuffCount 9
			/varset SingleBuffSpell(1) "Infusion of Spirit"
			/varset SingleBuffSpell(2) "Guardian"
			/varset SingleBuffSpell(3) "Agility"
			/varset SingleBuffSpell(4) "Dexterity" 
			/varset SingleBuffSpell(5) "Strength"
			/varset SingleBuffSpell(6) "Stamina"
			/varset SingleBuffSpell(7) "Talisman of Altuna"
			/varset SingleBuffSpell(8) "Chloroplast"
			/varset SingleBuffSpell(9) "Alacrity"
		}
		/if n $target(level)>=45 {
			/echo high Group
			/varset BuffCount 6
			/varset BuffSpell(1) "Talisman of the Cat"
			/varset BuffSpell(2) "Talisman of the Brute"
			/varset BuffSpell(3) "Talisman of Shadoo"
			/varset BuffSpell(4) "talisman of Jasinth" 
			/varset BuffSpell(5) "Regrowth of Dar Khura" 
			/varset BuffSpell(6) "Spirit of Bih`Li"

			/varset SingleBuffCount 2
			/varset SingleBuffSpell(1) "Harnessing of Spirit"
			/varset SingleBuffSpell(2) "Celerity"
		}
		
| Cast Procedures for group buff go here

/declare TargetedPC local | this is here so if your grouped with a person below level 45 and want to high buff group, you will re target the high member you started with
/varset TargetedPC $target(id)

			/for i 1 to @SingleBuffCount
				/for g 0 to $group(count)
					/if n $group(@g)!=-1 {
						/target id $group(@g)
						/echo Casting "@SingleBuffSpell(@i)" on $target(name)
						/call Cast "@SingleBuffSpell(@i)" 
					}
				/next g
			/next i
			/target id @TargetedPC
			/for i 1 to @BuffCount
				/echo Casting "@BuffSpell(@i)" on Group
				/call Cast "@BuffSpell(@i)"
			/next i
| End cast procedures for group buff
		
	} else {
		/if n $target(id)!=0 {
			/if n $target(level)<=46 {
				/echo Low
				/varset BuffCount 10
				/varset BuffSpell(1) "Infusion of Spirit"
				/varset BuffSpell(2) "Guardian"
				/varset BuffSpell(3) "Agility"
				/varset BuffSpell(4) "Dexterity" 
				/varset BuffSpell(5) "Strength"
				/varset BuffSpell(6) "Stamina"
				/varset BuffSpell(7) "Talisman of Altuna"
				/varset BuffSpell(8) "Chloroplast"
				/varset BuffSpell(9) "Alacrity"
				/varset BuffSpell(10) "Spirit of Bih`Li"	
			} else {
				/echo high
				/varset BuffCount 10
				/varset BuffSpell(1) "Infusion of Spirit"
				/varset BuffSpell(2) "Shroud of the Spirits"
				/varset BuffSpell(3) "Deliriously Nimble"
				/varset BuffSpell(4) "Dexterity" 
				/varset BuffSpell(5) "Maniacal Strength"
				/varset BuffSpell(6) "Riotous Health"
				/varset BuffSpell(7) "Talisman of Kragg"
				/varset BuffSpell(8) "Regrowth"
				/varset BuffSpell(9) "Celerity"
				/varset BuffSpell(10) "Spirit of Bih`Li"
			}
| Cast Procedures for single buff  go here
			/for i 1 to @BuffCount
				/echo Casting "@BuffSpell(@i)" on $target(name)
				/call Cast "@BuffSpell(@i)"
			/next i
| End Procedures for single buff
		}
	}
	/call main
/return

Code: Select all

| SpellCast.inc 
| This will cast a spell reliably for you... 
| Usage: 
| /call Cast "spellname" [item] 
| It will return the following values: 
| CAST_SUCCESS 
| CAST_UNKNOWNSPELL 
| CAST_OUTOFMANA 
| CAST_OUTOFRANGE 
| CAST_CANNOTSEE 
| CAST_STUNNED 
| CAST_RESISTED 
|  
| New Vars Modification 
| Plazmic's no globals needed version 
|  

| Oct 9, 2003 - Updated to work with new vars and $char(casting) - gf 
| Oct 11, 2003 - switched some logic, removed defines - gf 
| Oct 15, 2003 - Item support added by EqMule 
|  Modified to add automeming of spells. Goofmester1 

#event Fizzle "Your spell fizzles" 
#event Interrupt "Your casting has been interrupted" 
#event Interrupt "Your spell is interrupted." 
#event Recover "You haven't recovered yet..." 
#event Recover "Spell recovery time not yet met." 
#event Resisted "You target resisted the " 
#event OutOfMana "Insufficient Mana to cast this spell!" 
#event OutOfRange "Your target is out of range, get closer!" 
#event NoLOS "You cannot see your target." 
#event Stunned "You cannot cast while stunned" 
#event Standing "You must be standing to cast a spell" 
#event Collapse "Your gate is too unstable, and collapses." 
#event BookOpen "You are too distracted to cast a spell now!"
Sub Cast(SpellName,Item) 
/if n $char(gem,"@SpellName")==0 { 
  /memspell 8 "@SpellName" 
  /delay 5s 
} 
:StartCast 
  /if "@Item"=="Item" { 
  /call ClearReturnValue 
  /cast item "@SpellName" 
} else { 
  /if n $char(gem,"@SpellName")==0 /return CAST_UNKNOWNSPELL 
  /call ClearReturnValue 
  /if n $char(gem,"@SpellName")<0 { 
     /delay 0 
     /goto :StartCast 
  } 
  /stand
  /cast "@SpellName" 
} 
  
  :WaitCast 
     /if "$char(casting)"=="TRUE" { 
       /delay 1 
       /goto :WaitCast 
     } 
     /doevents Fizzle
     /doevents BookOpen 
     /doevents Interrupt 
     /doevents Recover 
     /doevents Standing 
     /doevents OutOfRange 
     /doevents OutOfMana 
     /doevents NoLOS 
     /doevents Resisted 
     /if "$return"=="CAST_RESTART" /goto :StartCast 
     /if "$return"!="CAST_SUCCESS" /return "$return" 
     /if "$return"=="CAST_OUTOFMANA" /goto :StartCast 
/return CAST_SUCCESS 

Sub ClearReturnValue 
/return CAST_SUCCESS 

Sub Event_BookOpen
/book
/return CAST_RESTART

Sub Event_Fizzle 
/return CAST_RESTART 

Sub Event_Interrupt 
/return CAST_RESTART 

Sub Event_Recover 
   /delay 5 
/return CAST_RESTART 

Sub Event_Standing 
   /stand 
/return CAST_RESTART 

Sub Event_Collapse 
/return CAST_RESTART 

Sub Event_OutOfMana 

	/if n $char(hp,pct)>50 /if n $char(mana,pct)<90 {
		/call Cast "Cannibalize III"
		/return CAST_RESTART
	} else {
		/if $char(state)!="SIT" /sit 
		/delay 10s 
		/return CAST_RESTART |CAST_OUTOFMANA
	}
	


Sub Event_OutOfRange 
/return CAST_OUTOFRANGE 

Sub Event_NoLOS 
/return CAST_CANNOTSEE 

Sub Event_Stunned 
/return CAST_STUNNED 

Sub Event_Resisted 
/return CAST_RESISTED

Last edited by Ogre_Luvr on Fri Dec 26, 2003 1:59 am, edited 1 time in total.

battaile
Contributing Member
Contributing Member
Posts: 40
Joined: Tue Dec 09, 2003 10:55 am

Post by battaile » Fri Dec 26, 2003 12:22 am

Very impressive, I'm also new to this so take this for what its worth. :)

Could you do a lookup on the buff-type to get the mana cost(dont know how to do this without hardcoding mana costs into your mac or loading from ini but there may be a way) and then compare to your current mana. Pseudo-code example of what I mean below:

Code: Select all

| lookup code to get buffManaCost
if n $char(mana,cur)>=@buffManaCost{
    CastBuff}
else {
    CanniAgain}

Ogre_Luvr
a lesser mummy
a lesser mummy
Posts: 52
Joined: Thu Dec 18, 2003 10:11 pm
Location: DC

the real problem

Post by Ogre_Luvr » Fri Dec 26, 2003 12:46 am

that sounds like a great idea, the problem i am having is.. when i /cast "Cannibalize III" it casts cannibalize 3 .. then before it finnishes casting it continues buffing ..... WAIT i think i figured out my problem .. if so i'm gonna feel stupid ... perhaps i need to /call cast "cannibalize III" .. thats what i meant to do in the first place .. i think the /cast "cannibalize III" is just casting the spell with no fizzle check or anything...trying it now

Ogre_Luvr
a lesser mummy
a lesser mummy
Posts: 52
Joined: Thu Dec 18, 2003 10:11 pm
Location: DC

edited

Post by Ogre_Luvr » Fri Dec 26, 2003 2:05 am

changed the first post to reflect the current copy i am working on..
now it will buff till oom
canni once check for cast(does mana permit) if no mana repeat
untill hp < 50
then sit for 10s
then its SHOULD check if it can cast the buff it stoped on.
Instead it goes on to the next spell

Ogre_Luvr
a lesser mummy
a lesser mummy
Posts: 52
Joined: Thu Dec 18, 2003 10:11 pm
Location: DC

Post by Ogre_Luvr » Fri Dec 26, 2003 2:30 am

Sorry its not commented yet .. ill edit asap but this works as i wanted it to

Code: Select all

#event SpellFizzle "Your spell fizzles"
#turbo 90
#include Buffspellcast.inc

Sub Main
/clear
/declare BuffCount local
/declare i local
/declare g local
/declare BuffSpell   array
/declare SingleBuffSpell array
/declare SingleBuffCount local

	/if $ucase("@Param0")=="GROUP" {	
	
		/if n $target(level)<=46 {
			/echo Low Group
			
			/varset BuffCount 1
			/varset BuffSpell(1) "Spirit of Bih`Li"
			
			/varset SingleBuffCount 9
			/varset SingleBuffSpell(1) "Infusion of Spirit"
			/varset SingleBuffSpell(2) "Guardian"
			/varset SingleBuffSpell(3) "Agility"
			/varset SingleBuffSpell(4) "Dexterity" 
			/varset SingleBuffSpell(5) "Strength"
			/varset SingleBuffSpell(6) "Stamina"
			/varset SingleBuffSpell(7) "Talisman of Altuna"
			/varset SingleBuffSpell(8) "Chloroplast"
			/varset SingleBuffSpell(9) "Alacrity"
		}
		/if n $target(level)>=45 {
			/echo high Group
			/varset BuffCount 6
			/varset BuffSpell(1) "Talisman of the Cat"
			/varset BuffSpell(2) "Talisman of the Brute"
			/varset BuffSpell(3) "Talisman of Shadoo"
			/varset BuffSpell(4) "talisman of Jasinth" 
			/varset BuffSpell(5) "Regrowth of Dar Khura" 
			/varset BuffSpell(6) "Spirit of Bih`Li"

			/varset SingleBuffCount 2
			/varset SingleBuffSpell(1) "Harnessing of Spirit"
			/varset SingleBuffSpell(2) "Celerity"
		}
		
| Cast Procedures for group buff go here

/declare TargetedPC local | this is here so if your grouped with a person below level 45 and want to high buff group, you will re target the high member you started with
/varset TargetedPC $target(id)

			/for i 1 to @SingleBuffCount
				/for g 0 to $group(count)
					/if n $group(@g)!=-1 {
						/target id $group(@g)
						/echo Casting "@SingleBuffSpell(@i)" on $target(name)
						/call Cast "@SingleBuffSpell(@i)" 
					}
				/next g
			/next i
			/target id @TargetedPC
			/for i 1 to @BuffCount
				/echo Casting "@BuffSpell(@i)" on Group
				/call Cast "@BuffSpell(@i)"
			/next i
| End cast procedures for group buff
		
	} else {
		/if n $target(id)!=0 {
			/if n $target(level)<=46 {
				/echo Low
				/varset BuffCount 10
				/varset BuffSpell(1) "Infusion of Spirit"
				/varset BuffSpell(2) "Guardian"
				/varset BuffSpell(3) "Agility"
				/varset BuffSpell(4) "Dexterity" 
				/varset BuffSpell(5) "Strength"
				/varset BuffSpell(6) "Stamina"
				/varset BuffSpell(7) "Talisman of Altuna"
				/varset BuffSpell(8) "Chloroplast"
				/varset BuffSpell(9) "Alacrity"
				/varset BuffSpell(10) "Spirit of Bih`Li"	
			} else {
				/echo high
				/varset BuffCount 10
				/varset BuffSpell(1) "Infusion of Spirit"
				/varset BuffSpell(2) "Shroud of the Spirits"
				/varset BuffSpell(3) "Deliriously Nimble"
				/varset BuffSpell(4) "Dexterity" 
				/varset BuffSpell(5) "Maniacal Strength"
				/varset BuffSpell(6) "Riotous Health"
				/varset BuffSpell(7) "Talisman of Kragg"
				/varset BuffSpell(8) "Regrowth"
				/varset BuffSpell(9) "Celerity"
				/varset BuffSpell(10) "Spirit of Bih`Li"
			}
| Cast Procedures for single buff  go here
			/for i 1 to @BuffCount
				/echo Casting "@BuffSpell(@i)" on $target(name)
				/call Cast "@BuffSpell(@i)"
			/next i
| End Procedures for single buff
		}
	}

/return

Code: Select all

| SpellCast.inc 
| This will cast a spell reliably for you... 
| Usage: 
| /call Cast "spellname" [item] 
| It will return the following values: 
| CAST_SUCCESS 
| CAST_UNKNOWNSPELL 
| CAST_OUTOFMANA 
| CAST_OUTOFRANGE 
| CAST_CANNOTSEE 
| CAST_STUNNED 
| CAST_RESISTED 
|  
| New Vars Modification 
| Plazmic's no globals needed version 
|  

| Oct 9, 2003 - Updated to work with new vars and $char(casting) - gf 
| Oct 11, 2003 - switched some logic, removed defines - gf 
| Oct 15, 2003 - Item support added by EqMule 
|  Modified to add automeming of spells. Goofmester1 

#event Fizzle "Your spell fizzles" 
#event Interrupt "Your casting has been interrupted" 
#event Interrupt "Your spell is interrupted." 
#event Recover "You haven't recovered yet..." 
#event Recover "Spell recovery time not yet met." 
#event Resisted "You target resisted the " 
#event OutOfMana "Insufficient Mana to cast this spell!" 
#event OutOfRange "Your target is out of range, get closer!" 
#event NoLOS "You cannot see your target." 
#event Stunned "You cannot cast while stunned" 
#event Standing "You must be standing to cast a spell" 
#event Collapse "Your gate is too unstable, and collapses." 
#event BookOpen "You are too distracted to cast a spell now!"
Sub Cast(SpellName,Item) 
/if n $char(gem,"@SpellName")==0 { 
  /memspell 8 "@SpellName" 
  /delay 5s 
} 
:StartCast 
  /if "@Item"=="Item" { 
  /call ClearReturnValue 
  /cast item "@SpellName" 
} else { 
  /if n $char(gem,"@SpellName")==0 /return CAST_UNKNOWNSPELL 
  /call ClearReturnValue 
  /if n $char(gem,"@SpellName")<0 { 
     /delay 0 
     /goto :StartCast 
  } 
  /stand
  /cast "@SpellName" 
} 
  
  :WaitCast 
     /if "$char(casting)"=="TRUE" { 
       /delay 1 
       /goto :WaitCast 
     } 
     /doevents Fizzle
     /doevents BookOpen 
     /doevents Interrupt 
     /doevents Recover 
     /doevents Standing 
     /doevents OutOfRange 
     /doevents OutOfMana 
     /doevents NoLOS 
     /doevents Resisted 
     /if "$return"=="CAST_RESTART" /goto :StartCast 
     /if "$return"!="CAST_SUCCESS" /return "$return" 
     /if "$return"=="CAST_OUTOFMANA" /goto :StartCast 
/return CAST_SUCCESS 

Sub ClearReturnValue 
/return CAST_SUCCESS 

Sub Event_BookOpen
/book
/return CAST_RESTART

Sub Event_Fizzle 
/return CAST_RESTART 

Sub Event_Interrupt 
/return CAST_RESTART 

Sub Event_Recover 
   /delay 5 
/return CAST_RESTART 

Sub Event_Standing 
   /stand 
/return CAST_RESTART 

Sub Event_Collapse 
/return CAST_RESTART 

Sub Event_OutOfMana 
	/if n $char(hp,pct)>50 /if n $char(mana,pct)<90 {
		/call Cast "Cannibalize III"
	} else {
		/if $char(state)!="SIT" /sit 
	:WaitLonger
		/delay 10s 
		/if n $char(hp,pct)<75 /goto :WaitLonger
	}
/return CAST_RESTART


Sub Event_OutOfRange 
/return CAST_OUTOFRANGE 

Sub Event_NoLOS 
/return CAST_CANNOTSEE 

Sub Event_Stunned 
/return CAST_STUNNED 

Sub Event_Resisted 
/return CAST_RESISTED


User avatar
wilso132
Contributing Member
Contributing Member
Posts: 106
Joined: Thu Oct 17, 2002 11:53 am

Post by wilso132 » Fri Dec 26, 2003 2:44 am

I'm quickly leveing up my 39 shammy, so this code is a blessing. If I get some free time I may try to add in some general "what to cast on what class" definitions (just because I'm stingy with my mana), but this looks awesome... can't wait to try it out.

Ogre_Luvr
a lesser mummy
a lesser mummy
Posts: 52
Joined: Thu Dec 18, 2003 10:11 pm
Location: DC

Post by Ogre_Luvr » Fri Dec 26, 2003 10:14 am

thats a great idea .. i can work on it as well tonight, also want to make the spell list an INI. just wanted to get that out quick last night.

as it is now i cast all these buffs on all group members anyway, in fact i use the high group buff almost exclusivly. but i will look at adding class detect and select a buff list based on class. ... will have to add a way to select which set you waant to cast (for all those clerics who like to melee)

any other suggestions would be great

User avatar
wilso132
Contributing Member
Contributing Member
Posts: 106
Joined: Thu Oct 17, 2002 11:53 am

Post by wilso132 » Fri Dec 26, 2003 12:57 pm

What if you had it set up to enter in Paramaters for what group members get what?

Would make it easier for you to choose.

like /macro Buffer [melee group members] [non-melee group members]
e.g. /macro Buffer 12 456

Then set it up where melee get all buffs, and non-melee get hp buffs and chloro, but no strength or haste buffs. Would be a pretty sweet setup.