Checking Buffs

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

MrOuija_AK
orc pawn
orc pawn
Posts: 23
Joined: Mon Sep 13, 2004 9:16 pm

Checking Buffs

Post by MrOuija_AK » Tue Oct 12, 2004 12:01 pm

I'm trying to figure out how to check if a character has specific buffs up. Example having a wizard check to see if Barrier of Force is up. The closest I could come up with was to look at each slot individually and if it finds the buff change a variable to false. Then doing an IF statement and if the variable is still true rebuff. Unfortunately all it does is chain rebuff. So I think I've messed up somewhere. I can't seem to figure out what I did wrong in here.

I'm pretty new at this so I'd like to know what I did wrong with this, but I'd also like to know if there's a better way to do it. This just seems like I made it way over complicated.

Code: Select all

:loop
/varset force ${Bool[TRUE]}
/varset i 1
/for i 1 to 15 step 1
/if (${Me.Buff[${i}]Name.Find[Barrier of Force]}) {
     /varset force ${Bool[FALSE]}
     /varset i 15
}
/next i
/if (${force}) {
     /call Cast "Staff of the Four" item
     /delay 2s
     /sit
} else {
     /varset force ${Bool[TRUE]}
}
/goto :loop

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

Post by fearless » Tue Oct 12, 2004 12:11 pm

Code: Select all

#include spellcast.inc

Sub Main
  :loop
    /if (!${Me.Buff["Barrier of Force"].ID}) /call Cast "Staff of the Four" item
  /goto :loop
/endmacro
Should work.
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]

A_Druid_00
Macro Maker Extraordinaire
Posts: 2378
Joined: Tue Jul 13, 2004 12:45 pm
Location: Rolling on the Lawn Farting

Post by A_Druid_00 » Tue Oct 12, 2004 12:13 pm

I know genbot has a routine for keeping self buffs up, you may want to take a look there. It's a little more robust than what you're looking for probably (Keeping up clickies, etc.), but it will at least give you an idea how to start.
[quote]<DigitalMocking> man, A_Druid_00 really does love those long ass if statements
<dont_know_at_all> i don't use his macro because i'm frightened of it[/quote]
[quote][12:45] <dont_know_at_all> never use a macro when you can really fuck up things with a plugin[/quote]

MrOuija_AK
orc pawn
orc pawn
Posts: 23
Joined: Mon Sep 13, 2004 9:16 pm

Post by MrOuija_AK » Tue Oct 12, 2004 2:21 pm

Thanks that worked well.

I still wonder what was wrong with my logic on my overly complicated way of doing it though.

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Tue Oct 12, 2004 3:29 pm

MrOuija_AK wrote:I still wonder what was wrong with my logic on my overly complicated way of doing it though.
${Me.Buff[${i}]Name.Find[Barrier of Force]} should be ${Me.Buff[${i}].Name.Find[Barrier of Force]} (notice the dot between ] and Name) ..

anon_coward
a lesser mummy
a lesser mummy
Posts: 40
Joined: Wed Mar 24, 2004 11:11 pm

Post by anon_coward » Tue Oct 12, 2004 3:31 pm

Might need to change:

Code: Select all

/if (${Me.Buff[${i}]Name.Find[Barrier of Force]}) { 
To:

Code: Select all

/if (${Me.Buff[${i}].Name.Find[Barrier of Force]}) { 
Notice the '.' between the square bracket and 'Name'. I dunno if this was your original problem, and I can't test it right now to see if that really works. Just thought I'd try to help.

Edit: He really is a ninja :lol:

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Tue Oct 12, 2004 3:34 pm

anon_coward wrote:Edit: He really is a ninja :lol:
lol...