buffs.mac need help to convert please

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

Goby
orc pawn
orc pawn
Posts: 10
Joined: Thu Mar 20, 2003 4:35 pm

buffs.mac need help to convert please

Post by Goby » Fri Oct 31, 2003 8:56 pm

I've been using this buffs macro to keep track of my current buffs but with the recent changes to MQ it no longer works :/
It was posted in the macro depot a long time ago but unfortunately i have no idea how to convert it.
Its quite a short macro so hopefully someone here should find it quite simple to update, thanks for any help :)

Code: Select all


| Buffs.mac 
| Only list the buffs you have and the time left on them 
| this is a edit of a non working Buff counter I found on the formus 
| i have tested it and it even works with Sommon horse 


#Define CTimeTick v12 
#Define CTimeTotSec v13 
#Define CTimeHour v15 
#Define CTimeMin v14 
#Define CTimeSec v16 
#Define Temp v17 
#Turbo 

sub MAIN 

   /for p1 1 to 15 
      /varset CTimeHour 0 
      /varset CTimeMin 0 
      /varset CTimeTotSec 0 
      /varset CTimeSec 0 
      /varset Temp 0 

      /varset CTimeTick $char(buff,$p1,duration) 
      /varcalc CTimeTotSec $int($CTimeTick*6) 
      /varcalc CTimeHour $int($CTimeTotSec/3600) 
      /varcalc Temp $CTimeHour*3600 
      /varsub  CTimeTotSec $Temp 
      /varcalc CTimeMin $int($CTimeTotSec/60) 
      /varcalc Temp $CTimeMin*60 
      /varsub  CTimeTotSec $Temp 
      /varcalc CTimeSec $CTimeTotSec 
      /if n $CTimeTick>=1 /echo Buff $p1 has $CTimeHour h $CTimeMin m $CTimeSec s remaining. 
      /next p1 
/return

koad
Plugins Czar
Posts: 127
Joined: Fri May 16, 2003 8:32 pm

Post by koad » Sat Nov 01, 2003 12:04 am

hrmm try this - cleaner time code, too:

Code: Select all

| bufftime.mac 
| List the buffs you have and the time left on them 
| if you specify a buff name, it only reports that one

Sub Main 
  /declare time_sec local 
  /declare time_min local 
  /declare time_hou local 
  /declare i local 
  /for i 1 to 15 
    /if "$char(buff,@i,spellid)"!="NULL" { 
      /if $defined(Param0)==true /if "$char(buff,@i,spellid)"!~"@Param0" /next i 
      /varcalc time_sec $char(buff,@i,duration)*6 
      /varcalc time_hou @time_sec\3600 
      /varcalc time_min @time_sec%3600\60 
      /varcalc time_sec @time_sec%60 
      /echo $char(buff,@i,spellid) (Level $char(buff,@i,level)) @time_hou hrs @time_min mins @time_sec secs remaining 
    } 
  /next i 
/return 

Goby
orc pawn
orc pawn
Posts: 10
Joined: Thu Mar 20, 2003 4:35 pm

Woot! works like a charm :)

Post by Goby » Sat Nov 01, 2003 2:26 pm

Thanks for the conversion Koad :). Works perfectly, infact better than before, now it at actually tells you the name of the buff,level of the buff as well as the duration.

Great job, thanks again :) :D

Goby