Reply
Thread Tools Display Modes
Unread 06-13-05, 02:09 PM   #1
Coskesh
A Deviate Faerie Dragon
Join Date: Jun 2005
Posts: 11
What am I doing wrong?

I've modified a modified script/addon (written by Gello, and Daan) for autoinnerfire/druid buffs.

I've modded it for my shaman, and it seems that the weapon buffs for shaman are not considered buffs, so the IsBuffActive command won't handle it. I've tried to use a timer, and here is what I have:

2 global variables:

Code:
WBuffTimer = GetTime();
Rebuff = 1;
Then in the actual function:

Code:
elseif not found1 and AutoAllBuff and not mounted and not shapeshifted and (Rebuff < WBuffTimer) then
				
			WBuffTimer = GetTime();
			Rebuff = (WBuffTimer + 290);
			WBuff_Cast()
It's a 5 min buff, and it works initially on UI load, but after 290 seconds, it will not rebuff/call the WBuff_Cast() function. There something I'm missing?

Thanks!
Coskesh is offline   Reply With Quote
Unread 06-13-05, 02:36 PM   #2
Gello
A Scalebane Royal Guard
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 444
I have never played a shaman, but if it's a true weapon enchant like Feedback or poisons, check out GetWeaponEnchantInfo():

http://www.wowwiki.com/API_GetWeaponEnchantInfo

You may be able to use it in place of checking for normal buffs.

In what you posted above, you have:

WBuffTimer = GetTime();
Rebuff = 1;

So when you initially move, Rebuff < WBuffTimer so it runs:
WBuffTimer = GetTime();
Rebuff = (WBuffTimer + 290);
WBuff_Cast()

But after that, Rebuff will never be less than WBuffTimer again. You'll want to move WBuffTimer to before the "if" statement. so it's like:

WBuffTimer = GetTime();
if something then
-- stuff
elseif not found1 and AutoAllBuff and not mounted and not shapeshifted and (Rebuff < WBuffTimer) then
Rebuff = (WBuffTimer + 290);
WBuff_Cast()
end

But I'd check out GetWeaponEnchantInfo() it may be a better route.
Gello is offline   Reply With Quote
Unread 06-13-05, 05:27 PM   #3
Coskesh
A Deviate Faerie Dragon
Join Date: Jun 2005
Posts: 11
Thanks for the timely reply Gello! I posted asking about the shaman weapon buff over in the macro help section over a week ago, should have posted here instead!

I now understand why my time based function wasnt' being called, and I've fixed it. I tried using the GetWeaponEnchantInfo() command, but I"m not sure if I'm doing it properly.


So outside of my if statement, I'd have,

GetWeaponEnchantInfo();

then inside I'd say...

elseif AutoAllBuff and not mounted and not shapeshifted and (not hasMainHandEnchant == 1) then

? Well, obviously that isnot right, because it does not work.

I'm also trying to encompass group buffing into the script for mages and druids. Is there a way to check for spell range when attempting to buff a party member? As it is right now:

local i=GetNumPartyMembers();

if i > 3 then
ClearTarget();
TargetUnit("party4");
Thorns_Cast_Other()


and...

function Thorns_Cast_Other()
local i,done,name,id=1,false;
if (not IsBuffActive("Thorns","target")) then
while not done do
name = GetSpellName(i,BOOKTYPE_SPELL);
if not name then
done=true;
elseif name=="Thorns" then
id = i;
gid = i;
end
i = i+1;
end
CastSpell(id,BOOKTYPE_SPELL);
SpellTargetUnit("target")
end
end


I'd like to modify it so that it checks if the target is out of range, but I only know how to do that with action buttons with the IsActionInRange command . Any tips?
Coskesh is offline   Reply With Quote
Unread 06-13-05, 07:49 PM   #4
Gello
A Scalebane Royal Guard
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 444
GetWeaponEnchantInfo returns 6 values. To get those six values you would do:

v1, v2, v3, v4, v5, v6 = GetWeaponEnchantInfo()

tho you'll want to use more descriptive variables probably. Per the wiki, it will then fill those values with: hasMainHandEnchant, mainHandExpiration, mainHandCharges, hasOffHandEnchant, offHandExpiration, offHandCharges

In lua you don't need to pull every value. If your weapon enchant only goes to main hand weapon and you only want hasMainHandEnchant, you can just do hasenchant = GetWeaponEnchantInfo()

I would experiment with those. Dunno what shaman buffs can go on weapons (ie, this function alone won't tell if you have a particular buff), how they get on the weapons, etc. Use message() to test values. ie, try the enchant then enter /script v1,v2,v3,etc = GetWeaponEnchantInfo(); message(v1); and you may be able to see if it's workable.
Gello is offline   Reply With Quote
Unread 06-14-05, 02:39 PM   #5
Coskesh
A Deviate Faerie Dragon
Join Date: Jun 2005
Posts: 11
Thanks for the help Gello!

local hasenchant = GetWeaponEnchantInfo();

with

elseif AutoAllBuff and not mounted and not shapeshifted and not hasenchant then
WBuff_Cast()


is working perfectly!

Appreciate it.
Coskesh is offline   Reply With Quote
Reply

Go BackWoWInterface » Developer Discussions » Lua/XML Help » What am I doing wrong?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off