Converted bufftime macro..

Post your completed (working) macros here. Only for macros using MQ2Data syntax!

Moderator: MacroQuest Developers

Azum
a hill giant
a hill giant
Posts: 229
Joined: Wed Jun 04, 2003 5:04 am

Converted bufftime macro..

Post by Azum » Sun May 02, 2004 4:48 pm

Edit: Cant pass it a parameter yet, but /mac bufftime works fine.

Code: Select all

| Buffs.mac 
| List the buffs you have and the time left on them 

#Turbo 

Sub Main 
   /declare time_sec local 
   /declare time_min local 
   /declare time_hou local  
   /declare i int local
   /for i 1 to 15 
   
      /if (${Me.Buff[${i}].ID}) { 
      
         /if (${Defined[Param0]}) /if (!${Me.Buff[${i}].Name.Equal[${Param0}]}) /next i

         /varset time_sec ${Math.Calc[${Me.Buff[${i}].Duration}*6]} 

         /varset time_hou ${Math.Calc[${time_sec}\3600]} 
         /varset time_min ${Math.Calc[${time_sec}%3600\60]} 
         /varset time_sec ${Math.Calc[${time_sec}%60]} 

         /echo ${Me.Buff[${i}].Name} (Level ${Me.Buff[${i}].Level} ${time_hou} hrs ${time_min} mins ${time_sec} secs remaining 
      } 
   /next i
/return 

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Sun May 02, 2004 8:16 pm

Try this:

Code: Select all

| Buffs.mac 
| List the buffs you have and the time left on them 
| 
|  Note if you aren't typing the full name of the buff you need to change this line: 
|      /if (!${Me.Buff[${i}].Name.Equal[${Param0}]}) /goto :Skip
|        To:
|      /if (!${Me.Buff[${i}].Name.Find[${Param0}]}) /goto :Skip
|

Sub Main 
   /declare TimeSec int local 
   /declare TimeMin int local 
   /declare TimeHour int local  
   /declare i int local 
   /for i 1 to 15 
      /if (${Me.Buff[${i}].ID}) { 
      
         /if (${Defined[Param0]}) {
             /if (!${Me.Buff[${i}].Name.Equal[${Param0}]}) /goto :Skip
         }

         /varset TimeSec ${Math.Calc[${Me.Buff[${i}].Duration}*6]} 
         /varset TimeHour ${Math.Calc[${TimeSec}\3600]} 
         /varset TimeMin ${Math.Calc[${TimeSec}%3600\60]} 
         /varset TimeSec ${Math.Calc[${TimeSec}%60]} 

         /echo ${Me.Buff[${i}].Name} (Level ${Me.Buff[${i}].Level} ${TimeHour} hrs ${TimeMin} mins ${TimeSec} secs remaining 
      }
   :Skip 
   /next i 
/return 

dok
a ghoul
a ghoul
Posts: 127
Joined: Mon Mar 15, 2004 3:38 pm

Post by dok » Sun May 02, 2004 9:52 pm

why not do something like:
${If[${Me.Buff[1].Duration.Hours}>0,${Me.Buff[1].Duration.Hours}:,]}${If[${Me.Buff[1].Duration.Minutes}<=9,0,]}${Me.Buff[1].Duration.Minutes}:${If[${Me.Buff[1].Duration.Seconds}<=9,0,]}${Me.Buff[1].Duration.Seconds}

instead of calcilating the hours/minutes/seconds manually?

para
orc pawn
orc pawn
Posts: 11
Joined: Sat Dec 20, 2003 10:08 am

Post by para » Sun May 02, 2004 10:29 pm

Even easier™

Code: Select all

| Buffs.mac
| List the buffs you have and the time left on them

Sub Main
	/declare i int local
	/for i 1 to 15 step 1
		/if (${Me.Buff[${i}].ID}>0) {
			/echo Slot ${i}: ${Me.Buff[${i}].Name} (${Me.Buff[${i}].Level}) - ${Me.Buff[${i}].Duration.Time}
		}
	/next i
/return
Provides output like:

[MQ2] Slot 3: Blessing of the Nine (65) - 32:42
 

homburg
orc pawn
orc pawn
Posts: 20
Joined: Wed Apr 07, 2004 9:52 am

Post by homburg » Mon May 03, 2004 9:31 am

There's some excellent info in the UI forum with bits you can drop into your existing UI that will show a timer on all buffs.

Azum
a hill giant
a hill giant
Posts: 229
Joined: Wed Jun 04, 2003 5:04 am

Post by Azum » Mon May 03, 2004 1:47 pm

Indeed. I have a buff window which lists the time remaining. Converting this macro was mainly a learning experience.