Thread Tools Display Modes
12-02-10, 10:29 PM   #1
maltese
A Wyrmkin Dreamwalker
 
maltese's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 54
Using SetAttribute to bind tradeskill to button

Is it possible to bind a tradeskill to a button using SetAttribute?

I've tried everything I know (which isn't much) to bind a tradeskill to a button in an addon. I can get any spell to work, but tradeskills are not working for some reason.

Code:
cdbutton:SetAttribute("type", "spell")
cdbutton:SetAttribute("spell", "Northrend Alchemy Research")
Using the spell ID of Northrend Alchemy Research doesn't work either.
So far what I've come up with is that tradeskills are not considered spells anymore, so I'm curious what I need to do to make the button work. Any ideas?

Last edited by maltese : 12-02-10 at 10:41 PM.
  Reply With Quote
12-03-10, 12:46 AM   #2
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Make it a macro rather than a spell, with a text of "/cast Northrend Alchemy Research".
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
12-03-10, 06:30 AM   #3
maltese
A Wyrmkin Dreamwalker
 
maltese's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 54
That unfortunately does not work. With or without the alchemy window open.

I did however find a way to do it, but it requires knowing the index of the tradeskill you are trying to cast by using DoTradeSkill(). The issue is then all the sections have to be open to set an accurate index and I'm not sure it works with your second trade skill.

Last edited by maltese : 12-03-10 at 06:35 AM.
  Reply With Quote
12-03-10, 07:58 AM   #4
Xubera
A Cobalt Mageweaver
 
Xubera's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 207
just to make sure, the macro :setattribute is tricky.

its
:SetAttribute("type","macro")
:SetAttribute("macrotext", "/cast ...")

took me forever to figure that one out ><
__________________
Chat Consolidate is the solution to any out of control trade chat. Ignore lines, throttle chat, consolidate posts!Follow the link to find out how!

▲ ▲ WoWInterface wont let me triforce >.>
  Reply With Quote
12-03-10, 08:17 AM   #5
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 154
It's possible to cast tradeskill recipe spells from an action bar without the window open, and you could rig a button up for this, but unless you're willing to take over an action slot permanently, this trick won't work in combat. Here's a non-combat-only version that swaps actions around just long enough to cast your tradeskill:

Code:
cdbutton:SetAttribute("type", "action")
cdbutton:SetAttribute("action", 1)

cdbutton:SetScript("PreClick", function ()
  PickupSpell(60893) -- Northrend Alchemy Research
  PlaceAction(1)
end)
cdbutton:SetScript("PostClick", function ()
  PickupAction(1) -- Put previous action back
  ClearCursor()
end)
Make sure to disable that button in combat too or else the Pre/PostClicks will throw an action blocked error if clicked.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Using SetAttribute to bind tradeskill to button


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