Problem with varcalc

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

|| Napolion ||
a ghoul
a ghoul
Posts: 96
Joined: Sat Dec 28, 2002 7:45 am

Problem with varcalc

Post by || Napolion || » Tue Jul 29, 2003 5:32 am

After I updatet to the latest vertion of MQ I counter some problems with varcalc.
When ever I run the script below I got a error, can some one please help me figur this out.

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 
|| Napolion ||

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Tue Jul 29, 2003 8:50 am

yeah... move your calcs out of the $int's... e.g.

Code: Select all

      /varcalc CTimeHour $int($CTimeTotSec/3600) 
becomes

Code: Select all

      /varcalc CTimeHour $int($CTimeTotSec)/3600

|| Napolion ||
a ghoul
a ghoul
Posts: 96
Joined: Sat Dec 28, 2002 7:45 am

Post by || Napolion || » Wed Jul 30, 2003 3:29 am

Still not working.

It looks like it only comes up with the error when I have a empty buff spot.

|| Napolion ||

User avatar
Stargazer
a lesser mummy
a lesser mummy
Posts: 32
Joined: Mon Sep 30, 2002 3:30 pm

Post by Stargazer » Wed Jul 30, 2003 8:45 am

Here is my version of this macro. It should work fine for you.

Code: Select all

| buffs.mac - check your buffs
Sub Main 
   /for l0 1 to 15
      /if "$char(buff,$l0,spellid)"!="NULL" {
         /varset v83 $char(buff,$l0,duration)
         /varcalc v83 $v83*6
         /varcalc v84 $int($v83/60)
         /varsub v83 $calc($v84*60)
         /varcalc v85 $int($v84/60)
         /varsub v84 $calc($v85*60)
         /varset v83 $int($v83)
         /varset v84 $int($v84)
         /varset v85 $int($v85)
         /echo $char(buff,$l0,spellid) (Level $char(buff,$l0,level)) $v85 hrs $v84 mins $v83 secs remaining
      }
   /next l0
/return
Cromwell Stargazer

|| Napolion ||
a ghoul
a ghoul
Posts: 96
Joined: Sat Dec 28, 2002 7:45 am

Post by || Napolion || » Sun Aug 03, 2003 5:30 pm

WOW thank you it works great.

|| Napolion ||