Pet_Buff_Duration snippet

A forum for macro code snippets to be used in writing other macros. Post routines or .inc files here only, completed macros go to the Macro Depot. MQ2Data format only!

Moderator: MacroQuest Developers

User avatar
Jon100
a hill giant
a hill giant
Posts: 161
Joined: Mon Sep 22, 2003 6:15 am
Location: UK

Pet_Buff_Duration snippet

Post by Jon100 » Mon Aug 15, 2005 3:00 am

This snippet of code is equivelent to ${Me.PetBuffDuration}. After the call you can get the result from the variable ${Macro.Return}

Hope it helps some.

Jon100

Code: Select all

Sub Pet_Buff_Duration(string buffname)

   /if (${Me.PetBuff[${buffname}]}==0) /return 0

   /declare buffslot int local 0
   /declare tooltip string local
   /declare buff_ticks int local 0

   /varset buffslot ${Math.Calc[${Me.PetBuff[${buffname}]}-1]}
   /varset tooltip ${Window[PetInfoWindow].Child[PIW_PetBuff${buffslot}_Button].Tooltip}
   /varset tooltip ${tooltip.Right[6].Left[5]}
   /varset buff_ticks ${Math.Calc[((${tooltip.Left[2]}*60)+${tooltip.Right[2]})/6]}

/return ${buff_ticks}

KokoNutz
orc pawn
orc pawn
Posts: 20
Joined: Sat Aug 13, 2005 4:59 pm

Post by KokoNutz » Mon Aug 15, 2005 1:43 pm

My bald spot thanks you. :)

User avatar
fearless
Not a Psychic
Posts: 2684
Joined: Wed Mar 10, 2004 3:52 pm

Post by fearless » Mon Aug 15, 2005 1:56 pm

Some slight modifications

Code: Select all

Sub Pet_Buff_Duration(string buffname)

   /if ( !${Me.PetBuff[${buffname}]} ) /return 0

   /declare buffslot int local 0
   /declare tooltip string local
   /declare buff_ticks int local 0

   /varcalc buffslot ${Me.PetBuff[${buffname}]}-1
   /varset tooltip ${Window[PetInfoWindow].Child[PIW_PetBuff${buffslot}_Button].Tooltip}
   /varset tooltip ${tooltip.Right[6].Left[5]}
   /varcalc buff_ticks ( ( ${tooltip.Left[2]}*60 ) + ${tooltip.Right[2]} ) / 6

/return ${buff_ticks} 
Reading . . . it's not just for me.

[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]

User avatar
Night Hawk
a grimling bloodguard
a grimling bloodguard
Posts: 590
Joined: Fri Aug 13, 2004 4:56 pm

Post by Night Hawk » Mon Aug 15, 2005 8:45 pm

Code: Select all

/if ( !${Me.PetBuff[${buffname}]} ) /return 0
Is this tested? I'm just wondering, because I recall that ${Me.PetBuff["buffname"]} doesn't return a BOOL value, therefor messing up the check. /shrug

I just know that my hud has:

Code: Select all

${If[${Me.PetBuff["buffname"]}>0,pet buffed,pet not buffed]}
because I was having trouble just using !${Me.PetBuff}.... but this this was awhile ago.


Also, I'd suggest just using the TLO ${Me.PetBuffTime} posted in the development forum anyhow.

User avatar
fearless
Not a Psychic
Posts: 2684
Joined: Wed Mar 10, 2004 3:52 pm

Post by fearless » Mon Aug 15, 2005 10:16 pm

Code: Select all

/if ( ${Me.Pet.ID} && !${Me.PetBuff[Augmentation of Death]} && ${Me.Pet.Distance}<100 ) {
  /call Cast "Augmentation of Death" gem8 
}
Is known working as I use it on a daily basis in my SK macro.
Reading . . . it's not just for me.

[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]