How do you make a Targeting alias?

Post Reply
Eishi
Posts: 2
Joined: Fri May 07, 2010 2:31 am

How do you make a Targeting alias?

Post by Eishi »

Can someone tell us? And then how do we use it to attack etc.?

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: How do you make a Targeting alias?

Post by Vadi »


Acarion
Posts: 4
Joined: Tue Sep 07, 2010 2:50 am

Re: How do you make a Targeting alias?

Post by Acarion »

Is there a way to call a variable from within the command line so that if I have the simple targetting alias
Pattern: ^t (.*)$
Script:
tar = matches[2]
And I've already defined t by typing "t <mob>", I can then do something like "smite tar" or "punch tar" from within the command line?
(Assuming I don't want to set up a separate SMITE or PUNCH alias)

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Re: How do you make a Targeting alias?

Post by tsuujin »

Not from within the command line, no. The command line only accepts raw text and sends exactly what you type in.

You can create an alias, however, that can reference the variables you need.

For example, you could do something like:

Syntax: ^punch(?: (.+))?$
Script:
Code: [show] | [select all] lua
if matches[2] then
    send(matches[1])
else
    send(string.format("punch %s",tar))
end
Which would change depending on how you use it. You could save your target as "vadi", for example, and just type in "punch" to make it punch vadi. But if you wanted to punch me instead without changing your target you could type in "punch tsuujin" and it would bypass needing the second argument and use the variable instead.

This is an absurd example, because you could do the exact same thing by just using:
Syntax: ^punch$
Script:
Code: [show] | [select all] lua
send(string.format("punch %s",tar))
and it would still work exactly the same way, but it's still a good example of why aliases are cool and flexible. That said, I have used this technique heavily before if I always want to do some sort of script whenever the punch command is sent other than just punching.

Post Reply