PDA

View Full Version : Begginer Scripter's code


Ladikn
29-11-2006, 07:27 AM
Okay, I'm trying to learn how to script to make my grinding go by a little faster, and am working on a macro that detects if the target is rended, if not it uses rend, if so it uses hamstring (may switch around, but that should be easy). Its my first step to trying to work out a macro that searches through debuffs and puts on the next one in a string from most to least important (if thats possible, trying to work it out). Heres what I've pieced together by tearing apart, looking at, and working with other macros I've found.

/script local z=0 for i=1,8 do t=UnitBuff("target", i) if (t and string.find(t,"Rend")) then z=1 break end end if z==1 then CaseSpellByName("Hamstrin()") else CastSpellByName("Rend()") end

but all it does is constantly rend. Where is it wrong?

Jazradel
29-11-2006, 08:21 AM
Should UnitBuff be UnitDebuff?

/script local z=0 for i=1,8 do t=UnitDeBuff("target", i) if (t and string.find(t,"Rend")) then CastSpellByName("Hamstring"); else CastSpellByName("Rend"); break end end

It is possible the buff name for Rend, isn't actually "Rend". Some of them are pretty wierd.

Ladikn
29-11-2006, 08:53 AM
its not UnitDebuff, because Buffs can be helpful, neutral, or harmful. I tryed anyway, but UnitDebuff isnt recognised.

It could be the rend thing, I'll see if i can find it online

EDIT: the actual effect is "Apply Aura: Periodic Damage", but i tryed that in place of "Rend" for effect and it still wont recognise it...

Jazradel
29-11-2006, 08:57 AM
I just found http://www.wowwiki.com/Queriable_Buff_effects
Rend is listed as Ability_Gouge

Ladikn
29-11-2006, 09:07 AM
tryed

/script local z=0 for i=1,8 do t=UnitBuff("target", i) if (t and string.find(t,"Ability_Gouge")) then CastSpellByName("Hamstring"); else CastSpellByName("Rend"); break end end

still wont work, also tryed "Ability Gouge" and "AbilityGouge", it just wont work! is the problem the "UnitBuff("target", i)"? I tryed "%t" in place of "target", but it generated an error

EDIT: ARGH, if this can be made to work, it may be worked out to set up varying sets of variables so that I can attach all my debuffs in approx order of importance to one quickbar slot!

Jazradel
29-11-2006, 09:26 AM
There is a nice wing clip macro here:
http://ui.worldofwar.net/macros.php?id=333
It looks fairly easy to modify, maybe try again with that.

Ladikn
29-11-2006, 09:43 PM
Thanks, that got it to work. The problem was the "UnitDebuff" is cap sesitive

now to try to string a few marcos together to make a one button debuffer.

btw, here is the final code

/script local z=0 for i=1,16 do if UnitDebuff("target", i) and strfind(UnitDebuff("target",i),"Ability_Gouge") then CastSpellByName("Hamstring"); else CastSpellByName("Rend"); break end end

MartijnGP
29-11-2006, 09:50 PM
All LUA functions and variables are case sensitive. Just so you know, might be useful when you continue programming in LUA.

Ladikn
30-11-2006, 01:28 AM
ty for the info, I'll be sure to remember that.

Now for another question. How does one make a macro to activate another macro? CastSpellByName("Macro name") doesnt work. Right now I'm trying to get it by actionbar, but if someone has another idea (or how to do this one), help would be much apreciated.

Jazradel
30-11-2006, 08:37 AM
I know SuperMacro(http://ui.worldofwar.net/ui.php?id=1325&page=2) let you do it. No idea how to do it manually.