Thread Tools Display Modes
Prev Previous Post   Next Post Next
08-29-20, 11:14 AM   #1
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Block Function CastSpellByName

I have a professions button that i use to open prof1 and prof2 when ever i leftclick for prof1 i get this:
Code:
9x [ADDON_ACTION_FORBIDDEN] AddOn 'BasicUI' tried to call the protected function 'CastSpellByName()'.
[string "@!BugGrabber\BugGrabber.lua"]:519: in function <!BugGrabber\BugGrabber.lua:519>
[string "=[C]"]: in function `CastSpellByName'
[string "@BasicUI\Modules\Datapanel.lua"]:1763: in function <BasicUI\Modules\Datapanel.lua:1752>
Yet if i right click the same button it opens prof2 like it is suppose to.

Here is the code im using:
Code:
		proPlugin:SetScript("OnMouseDown",function(self, button)
			local prof1, prof2, _, _, _ = GetProfessions()
			if button == "LeftButton" then
				if prof1 then	
					CastSpellByName((GetProfessionInfo(prof1)))
				else
					print('|cff33ff99BasicUI:|r |cffFF0000No Profession Found!|r')
				end
			elseif button == 'MiddleButton' then
				ToggleSpellBook(BOOKTYPE_PROFESSION)	
			elseif button == "RightButton" then
				if prof2 then
					CastSpellByName((GetProfessionInfo(prof2)))
				else
					print('|cff33ff99BasicUI:|r |cffFF0000No Profession Found!|r')
				end
			end
		end)
Why does the leftbutton throw and error yet the middle and right do not?
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Block Function CastSpellByName

Thread Tools
Display Modes

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