Checking Pet Buffs

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

Moderator: MacroQuest Developers

draco
a ghoul
a ghoul
Posts: 145
Joined: Thu Jan 29, 2004 7:06 pm
Contact:

Checking Pet Buffs

Post by draco » Fri May 21, 2004 4:13 pm

According to the FM. PetBuff[name] on the character Object returns the slot number that the buff is in.

If anyone see a problem let me know. I'm going to try it and give the results. It has failed before but since I don't have the outout to post. I can't ask a good question.
Assuming petBuffList in a string array filled out elsewhere. In this case from an ini file.

Code: Select all


Sub BuffPet
 /declare indx int local

 /if (${Me.Pet}) {
     /target id ${Me.Pet.ID}
     /for indx 1 to 8 step 1
     
         /if(!${Me.PetBuff[${petBuffList[indx]}]}) {
              /call Cast "${petBuffList[indx]}"
         }
        
     /next indx
     /target clear
  }
/return 

It seems like a simply concept But, I seem to be doing something wrong because the running code doesn't work.

chawk
orc pawn
orc pawn
Posts: 14
Joined: Sat May 08, 2004 4:08 am

Post by chawk » Fri May 21, 2004 4:29 pm

Seems you're not encapsulating the indx variable with { } so it's not parsing to the numeric value?

Preocts
a snow griffon
a snow griffon
Posts: 312
Joined: Thu Jan 29, 2004 1:02 pm

Post by Preocts » Fri May 21, 2004 4:51 pm

Code: Select all

Sub BuffPet 
/declare indx int local 

/if (${Me.Pet}) { 
     /target id ${Me.Pet.ID} 
     /for indx 1 to 8 step 1 
      
         /[color=red]if(!${Me.PetBuff[${petBuffList[indx]}]}) [/color]{ 
              /call Cast "${petBuffList[indx]}" 
         } 
        
     /next indx 
     /target clear 
  } 
/return 
${Me.PetBuff[n/name]} returns a string. You want ${Me.PetBuff[].ID}

And what was mentioned above. ${indx} not "indx"

draco
a ghoul
a ghoul
Posts: 145
Joined: Thu Jan 29, 2004 7:06 pm
Contact:

Post by draco » Fri May 21, 2004 10:09 pm

Actually, I the code I did have the brackets around the indx.

I finally found the answer. When setting the value into my array. I had to use the following otherwise "" where getting into the array as part of the spell name and "Spirit if Wolf" always coming up NULL.

Code: Select all

/varset petBuffList[${idx}] ${String[${Macro.Return}]}
The String object was nescessary.

Preocts
a snow griffon
a snow griffon
Posts: 312
Joined: Thu Jan 29, 2004 1:02 pm

Post by Preocts » Sat May 22, 2004 10:59 am

Umm... since that little snippet of code had 100% nothing to do with what you posted above... I have to say you fixed the problem before you placed that assinine ${String[]} around ${Macro.Return}. Why?

${Macro.Return} IS a string. You don't need to force it to be a string... it already is one.

draco
a ghoul
a ghoul
Posts: 145
Joined: Thu Jan 29, 2004 7:06 pm
Contact:

Post by draco » Mon May 24, 2004 7:52 am

Now this is what I found strange and I'll have to look more intently at my code to make sure it isn't a coding error in the routine that reads from the ini file and fills the array.

Bu,t to make a long story short. The returned value of the spell name contained explicite "'s around it. So, yes the fix ended up being in the routine that fills in the array of buffs not in the processing of that array.

I doubt there is a bug or any thing as I am very used to having to escape a quote i.e. \" to get it to assign into a variable. So, I do screw that up quite often in MQ2.