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:
Thanks for any help with this.
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:
Apart from that, there is an actual syntax error in your code. This isn't valid Lua:
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:
or you could make a table instead:
and then do:
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:
For right now here is my Duarability.lua file that goes with my cData addon,
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.
|All times are GMT -6. The time now is 03:14 PM.|
vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI