Sending raw slash command.
Code:
local frame = CreateFrame("Frame") I'm trying to run a slash command (/changeactionbar 1) when casting a spell. It not be working. I took the code from here http://us.battle.net/wow/en/forum/topic/3657445305. Please halp.:< |
I can't tell you if this is the most direct reason why it's not working (it may be due to a bug in RunSlashCmd or something--I didn't run that code nor do I really understand how it's supposed to work), but according to WoWPedia, ChangeActionBarPage() is protected when in combat. It stands to reason therefore that /changeactionbar is also protected in combat. Therefore attempting to run that command in a non-secure context won't work if you're in combat, which the events you're using suggest you are.
|
Quote:
I'm not that smart in these things. |
It can but you need to utilize Secure Templates, either a SecureActionButtonTemplate if the actionbar swap is meant to happen on a click,
or a SecureStateHeaderTemplate if the swap is meant to happen on some condition (only conditions supported by the macro system are valid). It's going to be a bit uphill for a new programmer as these while simple in concepts are not very beginner friendly constructs. Edit: I should tell you upfront that some of the things you want to do are not possible (just looking at events). You cannot take action through code when you're silenced or a cast succeeded or a cast failed etc. That falls under automation and Blizzard has specifically disabled the ability for addons to make such decisions. Only conditions supported by secure frames are these: Conditionals |
Keep in mind that some slash commands are only usable with hardware events, i.e. a macro can only run if you use a key to activate it, otherwise people would make addons to run macro code for them, it does not work.
I am not sure about changing action bar, but it may require hardware event to work... or? But what is the idea? To avoid the bar from changing when pushing SHIFT+2 and such? |
Yes, it's obvious now that what I tried to do isn't possible.
I wanted to basically replace my stupid castsequence macro for Holy Fire / Smite with an addon that changes actionbars according to Holy Fire cooldown. Unfortunately /castsequence doesn't allow spell queuing which is... ****. As I'm short for keybindings and button space on my disc priest... is the /castsequence macro the ONLY way to combine the two abilities? |
I have a lot of macros on my chars that combine 2 or more spells in a macro, something modified to your use would be something like this:
Code:
#showtooltip Holy Fire |
Quote:
It's not so much that I can't watch out for the Holy Fire cooldown, it's more than I have to waste another keybind and a place for watching the CD on my UI for such a trivial task. |
Just a side note, use of slash commands from LUA has been completely broken as of the latest patch and no version of RunSlashCmd will work properly.
|
If you make a button that inherits from SecureActionButtonTemplate you can set attributes on it such as:
Code:
button:SetAttribute("alt-type1", "macro") This may allow you to get around using RunSlashCmd, but I have no idea whether the macros you want to use will be permitted. |
That'll be fine as long as you don't try to change anything while in combat, secure templates lock down and their attributes cannot be changed then. Only by a secure handler and that's another mess to go through that doesn't yield any differing result.
|
All times are GMT -6. The time now is 11:27 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI