Help with aliases to allow targeting me or ally?

Post Reply
MechaGodJovi
Posts: 2
Joined: Thu Jul 21, 2022 6:43 am

Help with aliases to allow targeting me or ally?

Post by MechaGodJovi »

I'm quite unsure how to do this and after reading the manual over and over and searching the forums but I'm just confused.

So the aliases are simple and I understand how to to do but as example for the spell haste I have:

^hh$
c 'haste'

Obviously It works and it targets me but can someone explain to me like I'm 5 on how to also have it cast haste on someone else regardless of the targets name yet still cast haste on me when I don't input a target? Thanks.

User avatar
demonnic
Posts: 884
Joined: Sat Dec 05, 2009 3:19 pm

Re: Help with aliases to allow targeting me or ally?

Post by demonnic »

If you use the pattern

^hh( \w+)?$

Then it will match on either hh by itself, or hh followed by a word. Then remove anything you might have in the 'command' line, and instead use the script box at the bottom, with something like this
Code: [show] | [select all] lua
local target = matches[2] or ""
send("c 'haste'" .. target)
First line sets the local variable target to the word you used, if there is one. Otherwise if you didn't use a word, it just sets it to the empty string.
Second line uses send to send the command "c 'haste'" if there's no target, or "c 'haste' bob" if you passed in bob.

MechaGodJovi
Posts: 2
Joined: Thu Jul 21, 2022 6:43 am

Re: Help with aliases to allow targeting me or ally?

Post by MechaGodJovi »

Thank you so much that works perfectly I appreciate it!

Post Reply