Thread Tools Display Modes
Prev Previous Post   Next Post Next
01-07-12, 08:59 AM   #1
Angrysteel
A Murloc Raider
Join Date: Jan 2008
Posts: 6
Prospecting Lua Script Help

Trying to learn Lua, and starting really simple.

I have made a button that appears in the middle of my screen. I can make the button do many things, such as leave groups, dance, random rolls, summon creatures, etc etc.

When i try to cast a spell via this same button, i get the protected blah blah message. What i am trying to do is prospect some ore, when i push the button.

A simple macro of /cast Prospecting, /cast Obsidium Ore works just fine, but since i am trying to do this via an addon, i cant figure it out.

I know things like: CastSpellByName("Prospecting") no longer work (protected), but other addons are able to prospect ore, by clicking a button. Even reading through the code of those addons, i cant seem to piece it together

Beginner Code i am working with

local Button = CreateFrame("Button", "MyButton", UIParent, "UIPanelButtonTemplate")
Button:SetWidth(150)
Button:SetHeight(25)
Button:SetPoint("TOP")
Button:SetText("Prospect")
Button:RegisterForClicks("AnyUp")
Button:SetScript("OnClick", function()
CastSpellByName("Prospecting")
end )

Any simple solutions?
  Reply With Quote
 

WoWInterface » Developer Discussions » General Authoring Discussion » Prospecting Lua Script Help


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