Thread Tools Display Modes
07-08-06, 04:32 AM   #1
ProfOak
A Cyclonian
Join Date: Oct 2005
Posts: 47
How to make a button that acts like spell or action buttons ?

Hi!

First, let me thk you for having the time to read my problem.
I developed (still in testing phase :P ) an addon. I made some functions that will make the life easier to the player, but in the end, all cast spell, like remove poison or healing touch.
To use my functions, I created macros that call for the corresponding function. The problem with macros is that they can't show if target's in range neither the spell cooldown.
So, I was hoping to make buttons to replace those macros. And there's the big problem, is it possible to make such kind of buttons ? Buttons that call for an addon function and by any mean display the spell casted cooldown ? And to be able to make it like the normal buttons, that you can add to your actionbar slot ? If this is possible, what type of button do I need to create and (tough question :P ) how to make it display the cooldown.

Thks again :P
  Reply With Quote
07-12-06, 03:49 PM   #2
Esamynn
Featured Artist
Premium Member
Featured
Join Date: Jan 2005
Posts: 395
When you are writing your macros, you can trick the game into linking a particular spell to the macro so that an action button for that macro will mimic the range and cooldown indicators of that spell.

Since you are already using a /script command, tack the following text onto the end of your current /script command:

--CastSpellByName("<spellName>")

Don't forget the --
  Reply With Quote
07-14-06, 02:41 AM   #3
ProfOak
A Cyclonian
Join Date: Oct 2005
Posts: 47
Thanks for your replay :P

I tryed what you told me to but didn't work
This is what I wrote:

/script MyFuncTable.MotW(); -- CastSpellByName('Mark of the Wild');

It crossed my mind that Mark of the Wild have a rank too. Is that why this doesn't work ?

Anyway, this is an overview on how I'm building the addon:

MyFuncTable = {
MyHealingFunc = function()
-- A lot of stuff happen here like which rank to use. so by exemple:
rank = 13; -- i know that doesn't exists ^^ it's jus't an exemple :P

-- It is checked who the target will be, so to the exemple let's say the target is player's target

MyCastFunc("Healing Touch", rank, "target");
end;

-- Some other functions here
}

function MyCastFunc(spell, rank, target)
if(not rank) then
CastSpellByName(spell);
else
CastSpellByName(spell.."(Rank "..rank..")");
end

SpellTargetUnit(target);
end;

Maybe by checking this exemple above, you can tell me what am I doing wrong with your trick :P Or some1 tell me if it is possible to make a button like the one's we drag from spellbook (able to associate to an action bar, show if target's in distance, if there are enough mana to be casted and the cooldown) :P

Thks again
  Reply With Quote
07-18-06, 08:48 PM   #4
Esamynn
Featured Artist
Premium Member
Featured
Join Date: Jan 2005
Posts: 395
You need to use " instead of '

It's interesting though that the macro parser doesn't recognize the single quotation marks in place of the double quotation marks.
  Reply With Quote
07-26-06, 04:27 AM   #5
ProfOak
A Cyclonian
Join Date: Oct 2005
Posts: 47
It worked

Many thanks m8 ^^

Way easier this way than to develope a button, which I had no clue how to do it :P

Thanks again for your help :P

Cheers
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » How to make a button that acts like spell or action buttons ?


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