Thread Tools Display Modes
12-27-10, 05:27 AM   #1
clerkenwell
A Defias Bandit
Join Date: Aug 2009
Posts: 2
using CastSpellByName to open tradeskill windows

I'm trying to create a set of buttons that can be used to open tradeskill windows, and from what I can tell the CastSpellByName function is not protected when used for this purpose, but it's still not working. If I type (or click a macro that says) /script CastSpellByName "Engineering" it correctly opens the Engineering panel. But I can't get my buttons to do the same. I'm using:

Code:
SetScript("OnMouseDown", function() CastSpellByName("Jewelcrafting") end)
Clicking the button only returns the system message in chat "Interface action failed because of an AddOn." Any ideas?

Thanks.
  Reply With Quote
12-27-10, 08:35 AM   #2
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 318
Haven't fiddled with CastSpellByName so I have no idea why it isn't working.

You can however set a buttons attribute to use a macro-snippet as its action. The button has to inherit from SecureActionButtonTemplate for it to work though, IIRC.

Code:
button:SetAttribute("type", "macro")
button:SetAttribute("macrotext", "/cast Jewelcrafting")
__________________
Oh, the simulated horror!
  Reply With Quote
12-27-10, 08:36 PM   #3
clerkenwell
A Defias Bandit
Join Date: Aug 2009
Posts: 2
That worked perfectly! Thank you so much.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » using CastSpellByName to open tradeskill windows


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