Is it possible to make a custom slash-command that mimics any other general slash-command? This is purely for convenience; an example of what I'm looking to do is have it so that typing /hg will be an alias for typing /use Have Group, Will Travel.
While this would be possible* via Lua script if CastSpellByName were not a protected function, it remains the case that typing /use is deemed acceptable. Since I'm not looking to automate anything, I can't think of a logical reason why it wouldn't be equally acceptable to type something else for the same effect.
Mainly asking because it seems like there would be no harm in it, and feels like something that should be possible.
*I've already made myself several short-hand commands for common pieces of script I use :)
Yes you can, slash commands work like this:
The function itself is in SlashCmdList["UniqueString"]
The "/..." is in SLASH_UniqueString1 = "/..." so all you got to do is find what "UniqueString" is and add one number higher and your own "/..." for example:
SLASH_UniqueString2 = "/mycmd"
In GlobalStrings.lua you got:
SLASH_USE2 = "/use";
SLASH_CAST4 = "/spell"; -- aka /cast
SLASH_CASTRANDOM2 = "/castrandom";
SLASH_CASTSEQUENCE2 = "/castsequence";
SLASH_CANCELAURA2 = "/cancelaura";
SLASH_CANCELFORM2 = "/cancelform";
(and many more)
For to have an alias for /use you could:
SLASH_USE3 = "/u"
I believe it would work :)
Close! Is there a way to also include an argument as part of the alias?
What I'm getting at is this:
If I wanted to make it so /fs does the same thing as /yell Frostshooock! , I could do this:
SLASH_FS1 = "/fs";
SlashCmdList["FS"] = function()
That works, but is avoiding the issue by doing it via script, which has no (unprotected) function to mimic /use with an argument.
I'm trying to get /hg to mimic /use Have Group, Will Travel; /gb to mimic /use Mobile Banking; etc.
This cannot actually be done; secure slash commands like /use or /cast are protected and cannot be extended by modifying the global SLASH_FOOn variables.
Mm, I thought I'd check at least, in the hope that Blizzard might have allowed it since it would not enable automation.
If you want a macro with more than 256 characters, use something like Macaroon or create a SecureActionButton with a macro-action.
Just one thing, if the function itself is secure why would the / mater really? Can't seem to figure this one out. If you add, remove or change the SLASH_XY global variable imo it shouldn't matter because the function is what is being triggered... maybe I am not getting something. :(
Anything an AddOn (or a user typing /script) does that modifies _anything_ in the default UI causes taint, which is Blizzard's way of saying "Hey - this was touched by a user and could have possible un-intended results". Anything which has been tainted cannot perform secure actions.
|All times are GMT -6. The time now is 10:49 PM.|
vBulletin © 2015, Jelsoft Enterprises Ltd
©2012 ZAM Network LLC