WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Help with a simple (not to me) ingame /script command (https://www.wowinterface.com/forums/showthread.php?t=3349)

Garavix 01-12-06 11:06 AM

Help with a simple (not to me) ingame /script command
 
Okie, first off thanks for looking at the thread. Basically i wanna make a button that casts shadowform, and if shadowform is already up i want it to cast Power Word: Fort. SO heres waht i tried
/script if (not string.find(UnitBuff("player", 1), "Shadowform")) then CastSpellByName("Shadowform"); else CastSpellByName("Power Word: Fortitude");end

What is the index in the unitbuff command supposed to be?

thanks in advance

-Cenarus
:p

Jacend 01-12-06 04:06 PM

First off, I belive you can only cast shadow spells while in Shadoform.. so that might be your problem :) Second off, about UnitBuff:

http://www.wowwiki.com/API_UnitBuff

Hope that helps! :)

Gello 01-12-06 04:17 PM

Quote:

/script if (not string.find(UnitBuff("player", 1), "Shadowform")) then CastSpellByName("Shadowform"); else CastSpellByName("Power Word: Fortitude");end
The macro is the right idea but it will only work if Shadowform is in the first buff slot. The index (1 in that macro) is the buff slot.

To check if Shadowform is up you need to check all buff slots.

/script local i,found,buff for i=1,24 do buff=UnitBuff("player",i) if buff and string.find(UnitBuff("player",i),"Shadowform") then found=1 end end; if not found then CastSpellByName("Shadowform") else CastSpellByName("Power Word: Fortitude") end


All times are GMT -6. The time now is 12:15 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI