command for pet buff check

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

Moderator: MacroQuest Developers

rheally
decaying skeleton
decaying skeleton
Posts: 7
Joined: Sat May 29, 2004 4:05 am

command for pet buff check

Post by rheally » Sat Jun 05, 2004 6:16 am

right now this code will always be true for some reason i need help

Code: Select all

/declare swif string outer swift like the wind
   /declare che string outer scaled avatar's hauberk
/if (!${Pet.Buff[${swif}].ID}) /call cast "${che}" item


I am trying to check to see if my pet has haste and if he doesnt use the item scaled avatar's hauberk, which casts haste. RIght now it will cast the item over and over on my pet. is this the wrong code? also how do i target my pet? /target npc ${me.pet}

? any help thanks....

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

Post by Falco72 » Sat Jun 05, 2004 6:24 am

I have a similar code and it works:

Code: Select all

   /declare swif string outer
   /declare che string outer
   /varset swif "swift like the wind"
   /varset che "scaled avatar's hauberk"
   /if (!${Pet.Buff[${swif}].ID}) /call cast ${che} item
To target your pet, this is a way (not the only one):

Code: Select all

   /target id {Me.Pet.ID}

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Re: command for pet buff check

Post by wassup » Sat Jun 05, 2004 6:50 am

Along the lines of Falco's code, try the change below:

Code: Select all

/declare swif string outer [color=cyan]"swift like the wind"[/color]
   /declare che string outer [color=cyan]"scaled avatar's hauberk"[/color]
/if (!${Pet.Buff[${swif}].ID}) /call cast "${che}" item

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

Post by Falco72 » Sat Jun 05, 2004 7:58 am

I think if you put in quote a string you should not quote it again when passing it to a sub. I mean, if you use

Code: Select all

/declare che string outer "scaled avatar's hauberk"
you should NOT use the quote around ${che}

Code: Select all

/call cast [color=red]"[/color]${che}[color=red]"[/color] item
else you will pass to the sub: ""scaled avatar's hauberk"" (double quotes) resulting in an error.

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Sat Jun 05, 2004 8:23 am

er...

Actually... I think in the case where ${che} is use, it would need the "" around it.

I have nevcer tested this but with:

Code: Select all

Sub Main
   /declare che string outer scaled avatar's hauberk
   /echo ${che}
/return
I wonder what the echo is...

scaled

or

scaled avatar's hauberk

Drumstix42
a grimling bloodguard
a grimling bloodguard
Posts: 808
Joined: Mon May 03, 2004 4:25 pm

Post by Drumstix42 » Sat Jun 05, 2004 12:07 pm

Besides returned if a pet has a buff.... possible to get a timer on it?

I don't want a slot timer, just a search for a certain buff, and if it's there return a timer on it (If possible)

dman
a hill giant
a hill giant
Posts: 181
Joined: Fri Dec 05, 2003 12:54 pm

Post by dman » Sat Jun 05, 2004 1:10 pm

I wonder what the echo is...

scaled

or

scaled avatar's hauberk
I was playing with this last night with your plugin Wassup and it would echo as: scaled avatar's hauberk. Putting something in quotes on the declare line would add the quotes as part of the string. ie

Code: Select all

/declare che string outer "scaled avatar's hauberk"
/echo "${che}"
would echo: ""Scaled avatar's hauberk""

rheally
decaying skeleton
decaying skeleton
Posts: 7
Joined: Sat May 29, 2004 4:05 am

Post by rheally » Sat Jun 05, 2004 1:59 pm

It will echo the correct item. Everything works except for my if statment. Something is wrong where even after the pet receives the buff swift like the wind I will contue to cast over and over on it

dman
a hill giant
a hill giant
Posts: 181
Joined: Fri Dec 05, 2003 12:54 pm

Post by dman » Sat Jun 05, 2004 6:56 pm

Does it still work if you try hardcoding the buff name into the if statement? It shouldn't change anything with the way the parser works but I've known other wierd things to happen with stuff. ie

Code: Select all

/if (!${Pet.Buff[Swift like the Wind].ID}) /call cast "${che}" item

Drumstix42
a grimling bloodguard
a grimling bloodguard
Posts: 808
Joined: Mon May 03, 2004 4:25 pm

Post by Drumstix42 » Sun Jun 06, 2004 2:28 am

I can't get MQ to return anything on my pet buffs:

/echo ${Pet.Buff.[1]}
/echo ${Pet.Buff.[1].Name}
/echo ${Pet.Buff.[1].Duration.TimeHMS}

these all returned NULL

Strangely enough when I tried

/echo ${Me.Buff.[1].Duration.TimeHMS}

it still returned NULL, but that's the same code I have in my UI file and it works fine. (without the /echo of course)

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

Post by Falco72 » Sun Jun 06, 2004 3:46 am

You are using too many ".":

Code: Select all

/echo ${Pet.Buff[color=cyan].[/color][1]}
/echo ${Pet.Buff[color=cyan].[/color][1].Name}
/echo ${Pet.Buff[color=cyan].[/color][1].Duration.TimeHMS}
it should be

Code: Select all

/echo ${Pet.Buff[1]}
/echo ${Pet.Buff[1].Name}
/echo ${Pet.Buff[1].Duration.TimeHMS}
without the "." between Buff and []

Drumstix42
a grimling bloodguard
a grimling bloodguard
Posts: 808
Joined: Mon May 03, 2004 4:25 pm

Post by Drumstix42 » Sun Jun 06, 2004 12:33 pm

<bangs head on desk>

Drumstix42
a grimling bloodguard
a grimling bloodguard
Posts: 808
Joined: Mon May 03, 2004 4:25 pm

Post by Drumstix42 » Sat Jun 12, 2004 2:48 am

Falco72 wrote:You are using too many ".":

Code: Select all

/echo ${Pet.Buff[color=cyan].[/color][1]}
/echo ${Pet.Buff[color=cyan].[/color][1].Name}
/echo ${Pet.Buff[color=cyan].[/color][1].Duration.TimeHMS}
it should be

Code: Select all

/echo ${Pet.Buff[1]}
/echo ${Pet.Buff[1].Name}
/echo ${Pet.Buff[1].Duration.TimeHMS}
without the "." between Buff and []
Are these all supposed to return NULL?

I'm have trouble still now that I've acctaully tried them. Got the self buff stuff, but nothign with pet buffs....

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

Post by Falco72 » Sat Jun 12, 2004 3:05 am

For sure

Code: Select all

/echo ${Pet.Buff[1].Duration.TimeHMS}
will always return NULL, cause client do not know the duration of pet buffs, it is only server side.
For the other two, I have never tested them, I usually only use:

Code: Select all

/if (${Pet.Buff["Buff Name"].ID}<=0} {
to see if the buff is still on or not.

Drumstix42
a grimling bloodguard
a grimling bloodguard
Posts: 808
Joined: Mon May 03, 2004 4:25 pm

Post by Drumstix42 » Sat Jun 12, 2004 2:20 pm

K, thanx. I wasn't going for the durtion myself. Just checking for 1 or 2 buffs to show in my MQHud :)