Help with SetScript
I'm trying to make a clickable button for my data panel that allows the user to one click either a Repair Bot or Repair Mount.
I can not seem to get it to go threw all the options. Here is the code I'm trying to wwork with: Code:
plugin:SetScript("OnMouseDown", function(self, btn) Thanks for any help with this. Coke |
CastSpell related API are protected, meaning you shouldn't be able to use them, only Blizzards code may use these functions. There are some few exceptions to this, but in general it would be better to go about this issue in a different way, namely using the secure template system.
To get you started: http://wow.gamepedia.com/SecureActionButtonTemplate |
Apart from that, there is an actual syntax error in your code. This isn't valid Lua:
lua Code:
That second line would only be valid if it started with a variable assignment ("local x =") or a keyword like "if" or "return". I assume your intention was "try each of these and cast the first one that's available". Not only is (as Vlad already said) that not allowed -- you can't call CastSpellByName in an addon for any actual spell (only for professions, but there are better ways to open the tradeskill UI that you should use instead of that) -- but even if it was allowed, you couldn't do it that way. You'd need to do something like this instead: lua Code:
or you could make a table instead: lua Code:
and then do: lua Code:
To work around the fact that you can't call CastSpellByName directly, your best bet is probably: - Create an invisible secure action button - When the user mouses over your data panel button, check for combat lockdown - If you're not in combat, show the action button and reposition it to cover your data panel button - When the user mouses away from the action button, or the user enters combat, hide the secure button and ClearAllPoints it (if you leave it anchored to an insecure button it will break) |
Thanks for all the Help but for now I'm just going to use:
Lua Code:
For right now here is my Duarability.lua file that goes with my cData addon, Lua Code:
Thanks again Phanx for all the help you have given and still give to us not so good lua coders that want to make things our way. Coke |
All times are GMT -6. The time now is 12:19 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI