WoWInterface

WoWInterface (http://www.wowinterface.com/forums/index.php)
-   Macro Help (http://www.wowinterface.com/forums/forumdisplay.php?f=140)
-   -   Slash-command aliases (http://www.wowinterface.com/forums/showthread.php?t=40503)

TLH 06-16-11 07:58 AM

Slash-command aliases
 
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 :)

Vlad 06-16-11 09:55 AM

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 :)

TLH 06-16-11 10:30 AM

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()
SendChatMessage("Frostshooock!", "YELL");
end

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.

Foxlit 06-16-11 10:39 AM

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.

TLH 06-16-11 01:03 PM

Mm, I thought I'd check at least, in the hope that Blizzard might have allowed it since it would not enable automation.

Thanks!

humfras 06-16-11 03:15 PM

Quote:

Originally Posted by TLH (Post 239488)
Mm, I thought I'd check at least, in the hope that Blizzard might have allowed it since it would not enable automation.

Since these commands would be processed in unrestricted, unprotected LUA, automation would be possible.

If you want a macro with more than 256 characters, use something like Macaroon or create a SecureActionButton with a macro-action.

Vlad 06-16-11 03:43 PM

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. :(

Torhal 06-17-11 12:48 AM

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 06:34 AM.

vBulletin © 2014, Jelsoft Enterprises Ltd
©2012 ZAM Network LLC