Checking for *pet* buffs

Got a cool macro idea? Wanna request a macro? Here is the place for you!

Moderator: MacroQuest Developers

Troy_swe
orc pawn
orc pawn
Posts: 12
Joined: Fri Apr 09, 2004 11:36 am

Checking for *pet* buffs

Post by Troy_swe » Sun Apr 18, 2004 1:44 pm

Seen some macros that I "think" check for buffs and if the pet already have them it will ignore it otherwise buff it.

Now ive been trying to take that code into a new *.mac but it will just go on buffing it even that the pet is already buffed..

How does a macro look like with only this check part and possible buff part? Want to have it check for 2 buffs, please someone clear it up for me.

Thanks in advance

/troy

edit by lax: I changed the title to be more specific

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

Post by Falco72 » Sun Apr 18, 2004 5:34 pm

Code: Select all

/if n $char(pet)>0 {
   /if n $pet(buff,"Spirit of Rellic")<=0 /call CastSpell "Spirit of Rellic" "$char(pet)" 
   /if n $pet(buff,"Arag`s Celerity")<=0 /call CastSpell "Arag`s Celerity" "$char(pet)"
}

Troy_swe
orc pawn
orc pawn
Posts: 12
Joined: Fri Apr 09, 2004 11:36 am

Post by Troy_swe » Sun Apr 18, 2004 6:38 pm

Code: Select all

Sub CastBuffs
/if "$char(state)"=="SIT" /stand
/if n $char(pet)>0 { 
   /if n $pet(buff,"Alacrity")<=0 /call CastSpell "Alacrity" "$char(pet)" 
   /if n $pet(buff,"Harnessing of spirit")<=0 /call CastSpell "Harnessing of spirit" "$char(pet)" 
}
/call MainLoop
/return
Many thanks Falco for that, I edited it for those spells I want.

However, do I need an *.ini file with this to work ? Tryde it but said some error with /call castspell, tryde #define alacrity "alacrity" but then it crashed.

Looking forward to see what Im doing wrong, =)

/troy

Troy_swe
orc pawn
orc pawn
Posts: 12
Joined: Fri Apr 09, 2004 11:36 am

Post by Troy_swe » Mon Apr 19, 2004 12:33 am

Subroutine castspell wasnt found it says,

edit:
no wonder when I dont have sub castspell.. nm that :oops:

Now this would check if im buffed proper but after much reading and trying im still in need of help. So if anyone wanna give me a few points into the right direction I would be very happy.

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

Post by Falco72 » Mon Apr 19, 2004 1:10 am

/castspell it's mine sub, you need to create yours. To make it simpler you can use Bed karma Cast spell code (http://macroquest2.com/phpBB2/viewtopic.php?t=5373), put your code in Main and change your sub CastBuff like this:

Code: Select all

Sub CastBuffs(SpellName,TargetID)
/if "$char(state)"=="SIT" /stand
/if n @TargetID!=0 {
   /target id @TargetID
   /delay 3
   /call Cast "@SpellName"
}
/return
Your Main should look something like this:

Code: Select all

Sub Main
What ever you like it does
.
.
   :mainloop
.
.
   /if n $char(pet)>0 {
      /if n $pet(buff,"Alacrity")<=0 /call CastBuffs "Alacrity" "$char(pet)"
      /if n $pet(buff,"Harnessing of spirit")<=0 /call CastBuffs "Harnessing of spirit" "$char(pet)"
   }
   /delay 5
   /goto :mainloop
/endmacro

Troy_swe
orc pawn
orc pawn
Posts: 12
Joined: Fri Apr 09, 2004 11:36 am

Post by Troy_swe » Mon Apr 19, 2004 1:45 pm

Works alot better now Falco, checking for buffs on pet and if he has them loop just goes on but if not he buffs it saying something " casting alacrity" so all in all it works great =)

However its still one error, its when he casted the spell it gets an /var error then quits macro. Been trying to read up about it but havent got it to work anyway sadly... imput much appreciated.

One other thing while writing,

Code: Select all

/if n $spawn($char(pet),hp,pct)<90 { 
/target id $char(pet) 
   /cast "Superior Healing" 
   /delay 5s 
   } 
This code works great for me but I would like same code to work when he needs to heal himself. ( thanks to whoever wrote that part I found )

Thanks in advance for any input
/troy