Checking or Timing Buff duration on single target

Macro requests from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

Sikk
decaying skeleton
decaying skeleton
Posts: 1
Joined: Wed Oct 02, 2002 2:27 am

Checking or Timing Buff duration on single target

Post by Sikk » Wed Oct 02, 2002 2:31 am

Hiyas,

I have had a pretyy good look about at the samples I have seen here, I'm comfortable with the majority of the macro language (so far). But I have yet to see an example of a way to check if a buff is up on a toon (lets say the toon the macro is running on)

I have an application that would be much more effective if my little shaman would resow himself at a regular period.

Any suggestions?

Feel free to flame me if I missed the code sample =D

Sikk

User avatar
DeathSpiral
a ghoul
a ghoul
Posts: 95
Joined: Thu Aug 22, 2002 6:31 pm

Re: Checking or Timing Buff duration on single target

Post by DeathSpiral » Wed Oct 02, 2002 3:32 am

Sikk wrote:I have had a pretyy good look about at the samples I have seen here, I'm comfortable with the majority of the macro language (so far). But I have yet to see an example of a way to check if a buff is up on a toon (lets say the toon the macro is running on)
This is in the todo file: '$char(buff,x,name|duration|type) -- Still looking for buff slots...' We still need a memloc on the buffs, but they'll be there sometime.
Sikk wrote:I have an application that would be much more effective if my little shaman would resow himself at a regular period.

Any suggestions?
Yeah. Time how long SoW lasts. Subtract 1-2 minutes. Set up a timer.

Code: Select all

sub Main
   ...
   /varset t14 27m
   ...
/return

sub Event_Timer
   /if n $p0==14 {
      /target myself
      /cast "Spirit of Wolf"
   }
/return
... obviously enough replacing 27m with the time you figured out.
I am orc pawn, hear me yell for centurians...

User avatar
Fippy
a snow griffon
a snow griffon
Posts: 499
Joined: Tue Jul 16, 2002 10:42 am

Post by Fippy » Wed Oct 02, 2002 4:42 am

YPu could also use an event liek this

Code: Select all


#event_SOW "The spirit of Wolf leaves you"


<
.
.
Script
.
.
.>


sub event_SOW
 /target myself
 /cast <gem with sow in it>
/return

Fill in the blanks and check the Event text cause if it aint the same it wont work.

Fippy

Lane
a hill giant
a hill giant
Posts: 201
Joined: Fri Dec 06, 2002 11:57 am

Post by Lane » Fri Dec 06, 2002 12:03 pm

There are also new UI (I know you can't /click) based timers that you can get. I can't find the link right now but they are fully customizable. Just click options on a web page and it builds the xml for you and replaces any window you want.

I found it:
http://www.horizonsoutpost.com/eq/timer.asp

-Lane

macrolover
a ghoul
a ghoul
Posts: 107
Joined: Sun Jul 14, 2002 9:19 am

something new

Post by macrolover » Mon Dec 09, 2002 6:36 pm

i looked through the readme and char buff is in it now as a command is this just a mistake or has noone else noticed it? it's also in the newest release's changes text

User avatar
Fippy
a snow griffon
a snow griffon
Posts: 499
Joined: Tue Jul 16, 2002 10:42 am

Post by Fippy » Tue Dec 10, 2002 9:04 am

The $char buffs feature appears to work. I had a quick look and it seems to report thr correct names and durations remaining. Not come up with i need to use it myself so I havent used it in anger.
Fippy

This is my girl. But Rizwank had her first :-)
[img]http://www.btinternet.com/~artanor/images/fairy_bounce09.gif[/img]

User avatar
ap50
a snow griffon
a snow griffon
Posts: 425
Joined: Sun Aug 18, 2002 2:29 pm

Buffs List attempt... Work in Progress

Post by ap50 » Wed Dec 11, 2002 9:02 am

This is what I've been working on all morning..

Code: Select all

| Buffslist.mac
| Created to list all your buffs and tell you how long is remaining on them.
|

#define DurationTick v12
#define DurationTotSec v13
#Define DurationHour v15
#Define DurationMin v14
#Define DurationSec v16

sub main

	/for p1 1 to 15
		/varset DurationHour 0
		/varset DurationMin 0
		/varset DurationTotSec 0
		/varset DurationSec 0

		/if "$char(buff,$p1)"=="NULL" /next p1
		/varset DurationTick $char(buff,$p1,duration)
		/echo For debug purposes, $char(buff,$p1) has $DurationTick ticks remaining.
		/varcalc DurationTotSec $int($DurationTick*6)

		/if n $DurationTotSec>=3600 {
			/varcalc DurationHour $int($DurationTotSec/3600)
			/varcalc DurationMin $int($DurationTotSec-($DurationHours*3600)/60
			/varcalc DurationSec $DurationTotSec-(($DurationHour*3600)+($DurationMin*60)
		} else
		/if n $DurationTotSec>=60 {
			/varcalc DurationMin $int($DurationTotSec/60)
			/varcalc DurationSec $DurationTotSec-(DurationMin*60)
		} else
		/if n $DurationTotSec<60 {
			/varset DurationSec $DurationTotSec
		}

		/echo $char(buff,$p1) in buff slot $p1 has $DurationHour hours, $DurationMin minutes, $DurationSec seconds remaining.
		/mqlog $char(buff,$p1) in buff slot $p1 has $DurationHour hours, $DurationMin minutes, $DurationSec seconds remaining.
	/next p1
What it tries to do is get the number of ticks (successful) multiply that by 6 to get the total number of seconds remaining on the buff (successful), then break that figure down into hours, minutes and seconds, by calculating integer hours, then calculating the remaining minutes then calculate the remaining seconds (unsuccessful).

Here is a log of what is reported.

Code: Select all

[Wed Dec 11 xx:53:32 2002] [MacroQuest] For debug purposes, Spirit of Eagle has 696 ticks remaining.
[Wed Dec 11 xx:53:33 2002] Calculate encountered a '
[Wed Dec 11 xx:53:33 2002] Calculate encountered a '
[Wed Dec 11 xx:53:33 2002] Calculate encountered a '
[Wed Dec 11 xx:53:33 2002] [MacroQuest] Spirit of Eagle in buff slot 1 has 1.00 hours, 69.00 minutes, -1.00 seconds remaining.
[Wed Dec 11 xx:53:33 2002] Calculate encountered a '
[Wed Dec 11 xx:53:33 2002] [MacroQuest] For debug purposes, Nature's Might has 835 ticks remaining.
[Wed Dec 11 xx:53:33 2002] Calculate encountered a '
[Wed Dec 11 xx:53:33 2002] Calculate encountered a '
[Wed Dec 11 xx:53:33 2002] Calculate encountered a '
[Wed Dec 11 xx:53:33 2002] [MacroQuest] Nature's Might in buff slot 2 has 1.00 hours, 83.00 minutes, -1.00 seconds remaining.
[Wed Dec 11 xx:53:33 2002] Calculate encountered a '
[Wed Dec 11 xx:53:33 2002] [MacroQuest] For debug purposes, Protection of the Nine has 1178 ticks remaining.
[Wed Dec 11 xx:53:33 2002] Calculate encountered a '
[Wed Dec 11 xx:53:33 2002] Calculate encountered a '
[Wed Dec 11 xx:53:34 2002] Calculate encountered a '
[Wed Dec 11 xx:53:34 2002] [MacroQuest] Protection of the Nine in buff slot 3 has 1.00 hours, 117.00 minutes, -1.00 seconds remaining.
[Wed Dec 11 xx:53:34 2002] Calculate encountered a '
[Wed Dec 11 xx:53:34 2002] [MacroQuest] For debug purposes, Camouflage has 218 ticks remaining.
[Wed Dec 11 xx:53:34 2002] Calculate encountered a '
[Wed Dec 11 xx:53:34 2002] [MacroQuest] Camouflage in buff slot 4 has 0 hours, 21.00 minutes, -1.00 seconds remaining.
[Wed Dec 11 xx:53:34 2002] Calculate encountered a '
[Wed Dec 11 xx:53:34 2002] [MacroQuest] For debug purposes, Mask of the Hunter has 1056 ticks remaining.
[Wed Dec 11 xx:53:34 2002] Calculate encountered a '
[Wed Dec 11 xx:53:34 2002] Calculate encountered a '
[Wed Dec 11 xx:53:34 2002] Calculate encountered a '
[Wed Dec 11 xx:53:34 2002] [MacroQuest] Mask of the Hunter in buff slot 5 has 1.00 hours, 105.00 minutes, -1.00 seconds remaining.
[Wed Dec 11 xx:53:34 2002] Calculate encountered a '
[Wed Dec 11 xx:53:36 2002] [MacroQuest] For debug purposes, NULL has null ticks remaining.
[Wed Dec 11 xx:53:36 2002] Calculate encountered a '
[Wed Dec 11 xx:53:36 2002] [MacroQuest] NULL in buff slot 16 has 0 hours, 0 minutes, -1.00 seconds remaining.
[Wed Dec 11 xx:53:36 2002] Calculate encountered a '
[Wed Dec 11 xx:53:36 2002] Calculate encountered a '
[Wed Dec 11 xx:53:36 2002] Cleared the following: Timers Vars Arrays
[Wed Dec 11 xx:53:36 2002] The current macro has ended.
For reference, I'm running December 1st, 2002 version of MQ, obviously with correct offsets or I wouldn't be getting this far...

Any clues why the math calculations are going awry?
[color=yellow][size=92][b]Just because you're paranoid, it doesn't mean everyone isn't out to get you![/b][/size][/color]

User avatar
Fippy
a snow griffon
a snow griffon
Posts: 499
Joined: Tue Jul 16, 2002 10:42 am

Post by Fippy » Wed Dec 11, 2002 9:19 am

I though that calcs would be done like this.

Code: Select all

      /varset DurationTick $char(buff,$p1,duration) 
      /echo For debug purposes, $char(buff,$p1) has $DurationTick ticks remaining. 
      /varset DurationTotSec $int($calc($DurationTick*6))
Fippy

This is my girl. But Rizwank had her first :-)
[img]http://www.btinternet.com/~artanor/images/fairy_bounce09.gif[/img]

Vendor001
Cheezily Banned
Cheezily Banned
Posts: 78
Joined: Wed Nov 13, 2002 1:37 pm

Post by Vendor001 » Wed Dec 11, 2002 10:39 am

Code: Select all

         /varcalc DurationHour $int($DurationTotSec/3600) 
         /varcalc DurationMin $int(($DurationTotSec-($DurationHour*3600))/60)
         /varcalc DurationSec $DurationTotSec-($DurationHour*3600)+($DurationMin*60) 
You were also missing some parenthesis and a misspelled variable

User avatar
ap50
a snow griffon
a snow griffon
Posts: 425
Joined: Sun Aug 18, 2002 2:29 pm

Post by ap50 » Wed Dec 11, 2002 3:01 pm

Ok, I've changed it slightly, and it works for the most part.

Code: Select all

| Buffslist.mac
| Created to list all your buffs and tell you how long is remaining on them.
|

#define DurationTick v12
#define DurationTotSec v13
#Define DurationHour v15
#Define DurationMin v14
#Define DurationSec v16
#Define Temp v17

sub MAIN
	/for p1 1 to 15
      /varset DurationHour 0
      /varset DurationMin 0
      /varset DurationTotSec 0
      /varset DurationSec 0
      /varset Temp 0

      /if "$char(buff,$p1)"=="NULL" /next p1
      /varset DurationTick $char(buff,$p1,duration)
      /varcalc DurationTotSec $int($DurationTick*6)

      /if n $DurationTotSec>=3600 {
			/varcalc DurationHour $int($DurationTotSec/3600)
			/varcalc Temp $DurationHour*3600
			/varsub  DurationTotSec $Temp
			/varcalc DurationMin $int($DurationTotSec/60)
			/varcalc Temp $DurationMin*60
			/varsub  DurationTotSec $Temp
			/varcalc DurationSec $DurationTotSec
			/echo $char(buff,$p1) in buff slot $p1 has $DurationHour hour(s), $DurationMin minute(s), $DurationSec second(s) remaining.
	/next p1
      } else
      /if n $DurationTotSec>=60 {
			/varcalc DurationMin $int($DurationTotSec/60)
			/varcalc Temp $DurationMin*60
			/varsub  DurationTotSec $Temp
			/varcalc DurationSec $DurationTotSec
			/echo $char(buff,$p1) in buff slot $p1 has $DurationMin minute(s), $DurationSec second(s) remaining.
	/next p1
      } else
      /if n $DurationTotSec<60 {
			/varcalc DurationSec $DurationTotSec
			/echo $char(buff,$p1) in buff slot $p1 has $DurationSec second(s) remaining.
	/next p1
      }
/return
and gives the following results

Code: Select all

[Wed Dec 11 xx:56:13 2002] [MacroQuest] Resist Cold in buff slot 1 has 35.00 minute(s), 36.00 second(s) remaining.
[Wed Dec 11 xx:56:13 2002] [MacroQuest] Nature's Might in buff slot 2 has 30.00 minute(s), 6.00 second(s) remaining.
[Wed Dec 11 xx:56:14 2002] [MacroQuest] Protection of the Nine in buff slot 3 has 1.00 hour(s), 4.00 minute(s), 24.00 second(s) remaining.
[Wed Dec 11 xx:56:14 2002] [MacroQuest] Replenishment in buff slot 4 has 19.00 minute(s), 12.00 second(s) remaining.
[Wed Dec 11 xx:56:14 2002] [MacroQuest] Mask of the Hunter in buff slot 5 has 52.00 minute(s), 18.00 second(s) remaining.
[Wed Dec 11 xx:56:15 2002] [MacroQuest] Brackencoat in buff slot 6 has 3.00 hour(s), 46.00 minute(s), 6.00 second(s) remaining.
[Wed Dec 11 xx:56:15 2002] [MacroQuest] Resist Fire in buff slot 7 has 35.00 minute(s), 48.00 second(s) remaining.
[Wed Dec 11 xx:56:16 2002] [MacroQuest] Spirit of Wolf in buff slot 8 has 38.00 minute(s), 54.00 second(s) remaining.
[Wed Dec 11 xx:56:16 2002] [MacroQuest] Levitation in buff slot 9 has 18.00 minute(s), 0.00 second(s) remaining.
[Wed Dec 11 xx:56:16 2002] [MacroQuest] Resist Poison in buff slot 10 has 37.00 minute(s), 0.00 second(s) remaining.
[Wed Dec 11 xx:56:17 2002] [MacroQuest] Shield of Bracken in buff slot 11 has 1.00 minute(s), 48.00 second(s) remaining.
[Wed Dec 11 xx:56:17 2002] [MacroQuest] Resist Disease in buff slot 12 has 39.00 minute(s), 24.00 second(s) remaining.
[Wed Dec 11 xx:56:17 2002] [MacroQuest] Harmony of Nature in buff slot 13 has 1.00 minute(s), 36.00 second(s) remaining.
[Wed Dec 11 xx:56:18 2002] [MacroQuest] Illusion: Fier`dal in buff slot 14 has 35.00 minute(s), 36.00 second(s) remaining.
[Wed Dec 11 xx:56:18 2002] [MacroQuest] Camouflage in buff slot 15 has 23.00 minute(s), 48.00 second(s) remaining.
[Wed Dec 11 xx:56:18 2002] [MacroQuest] NULL in buff slot 16 has 48.00 second(s) remaining.
[Wed Dec 11 xx:56:18 2002] Cleared the following: Timers Vars Arrays
[Wed Dec 11 xx:56:18 2002] The current macro has ended.
But as you can see from the bottom, it is STILL creating a 16th buff slot entry, how can I get rid ?
[color=yellow][size=92][b]Just because you're paranoid, it doesn't mean everyone isn't out to get you![/b][/size][/color]

Vendor001
Cheezily Banned
Cheezily Banned
Posts: 78
Joined: Wed Nov 13, 2002 1:37 pm

Post by Vendor001 » Wed Dec 11, 2002 5:14 pm

Seems MQ is quite forgiving on the close braces. I moved/aligned them and found out you were missing one. I also modified the logic on the first IF statement; there should be no text output if the buff slot is empty. I also removed some duplicate /next p1, since only 1 was necessary.

Code: Select all

| Buffslist.mac 
| Created to list all your buffs and tell you how long is remaining on them. 
| 

#define DurationTick v12 
#define DurationTotSec v13 
#Define DurationHour v15 
#Define DurationMin v14 
#Define DurationSec v16 
#Define Temp v17 

sub MAIN 
   /for p1 1 to 15 
      /varset DurationHour 0 
      /varset DurationMin 0 
      /varset DurationTotSec 0 
      /varset DurationSec 0 
      /varset Temp 0 

      /if "$char(buff,$p1)"!="NULL" 
      { 
        /varset DurationTick $char(buff,$p1,duration) 
        /varcalc DurationTotSec $int($DurationTick*6) 

        /if n $DurationTotSec>=3600 
        { 
           /varcalc DurationHour $int($DurationTotSec/3600) 
           /varcalc Temp $DurationHour*3600 
           /varsub  DurationTotSec $Temp 
           /varcalc DurationMin $int($DurationTotSec/60) 
           /varcalc Temp $DurationMin*60 
           /varsub  DurationTotSec $Temp 
           /varcalc DurationSec $DurationTotSec 
           /echo $char(buff,$p1) in buff slot $p1 has $DurationHour hour(s), $DurationMin minute(s), $DurationSec second(s) remaining. 
        } else /if n $DurationTotSec>=60 
           { 
              /varcalc DurationMin $int($DurationTotSec/60) 
              /varcalc Temp $DurationMin*60 
              /varsub  DurationTotSec $Temp 
              /varcalc DurationSec $DurationTotSec 
              /echo $char(buff,$p1) in buff slot $p1 has $DurationMin minute(s), $DurationSec second(s) remaining. 
           } else 
              { 
                 /varcalc DurationSec $DurationTotSec 
                 /echo $char(buff,$p1) in buff slot $p1 has $DurationSec second(s) remaining. 
              } 
      }
      /next p1
/return

User avatar
ap50
a snow griffon
a snow griffon
Posts: 425
Joined: Sun Aug 18, 2002 2:29 pm

Post by ap50 » Wed Dec 11, 2002 7:59 pm

I was trying all sorts at that point to try and get round the 16th buff..
[color=yellow][size=92][b]Just because you're paranoid, it doesn't mean everyone isn't out to get you![/b][/size][/color]

User avatar
ap50
a snow griffon
a snow griffon
Posts: 425
Joined: Sun Aug 18, 2002 2:29 pm

Post by ap50 » Sat Dec 14, 2002 3:03 pm

I actually have less problems with my version, than I do your re-write, so I'll stick with mine :)

ps Don't use this macro when you're on a horse, for some reason you'll get kicked to desktop.
[color=yellow][size=92][b]Just because you're paranoid, it doesn't mean everyone isn't out to get you![/b][/size][/color]

lifewolf
a ghoul
a ghoul
Posts: 143
Joined: Fri Oct 18, 2002 6:29 pm

Post by lifewolf » Wed Dec 18, 2002 11:02 am

ap50 wrote:I actually have less problems with my version, than I do your re-write, so I'll stick with mine :)

ps Don't use this macro when you're on a horse, for some reason you'll get kicked to desktop.
This is in the readme (FYI) .. "Checking buffs while on horseback = desktop"

Mabey the todo or bug list or something however i remember reading it in one document... Guess i know what it means now ...


Anyway isnt a tick in EQ 5 seconds, not 6? Eveyone i talk to is inconsistant on that point..

Vendor001
Cheezily Banned
Cheezily Banned
Posts: 78
Joined: Wed Nov 13, 2002 1:37 pm

Post by Vendor001 » Wed Dec 18, 2002 2:52 pm

What problems are you having?