Page 3 of 3

Re: Flexible offensive aliases

Posted: Fri May 07, 2010 4:28 pm
by naftali
the flexibility comes in when you have optional arguments for your alias, kinda. Lets say, for example, you have a variable called 'tar' set to 'naftali', and another one 'bdp' set to 'neck'. You then make an alias that looks like such.

pattern: ^str(?:| (\w+)(?:| (\w+)))$

explanation of the pattern: whenever you type in 'str', followed by either one or two words, the alias will fire. Anyway, the script:

target = matches[2] or tar
bodypart = matches[3] or bdp
send("strike " .. target .. " " .. bodypart)

the way this alias is set up, if you just enter 'str' then matches[2] and matches[3] will be nil. The cool thing about 'or' is that if the first part is nil it goes to the second part. So heres some examples of what this alias would do. Remember, for these 'tar' is 'naftali' and 'bdp' is 'neck'

str - strike naftali neck
str bob - strike bob neck
str bob foot - strike bob foot

that help?

Re: Flexible offensive aliases

Posted: Fri Jun 11, 2010 1:57 am
by Digital Ninja
Just curious, but what if you have a target that is say 2.monster
With the following set up, it does not allow the 2.monster, only fear monster...

Any ideas on how to allow dot?
Code: [show] | [select all] lua

ALIAS: Fear
Pattern: ^fear(\s(\w+))?$
Body: send("cast 'fear'" ..targ(matches[3] or t))

SCRIPT:
targ function:
function targ( t )
   if t == nil then
      return " " ..tar
   else
      return " " ..t
   end
end

Re: Flexible offensive aliases

Posted: Fri Jun 11, 2010 4:37 pm
by naftali
Code: [show] | [select all] lua
ALIAS: Fear
Pattern: ^fear(\s([\w\.]+))?$
Body: send("cast 'fear'" ..targ(matches[3] or t))

SCRIPT:
targ function:
function targ( t )
   if t == nil then
      return " " ..tar
   else
      return " " ..t
   end
end

Re: Flexible offensive aliases

Posted: Sun Jun 27, 2010 5:28 am
by syrik
ok, need something more basic, I copied and pasted the first flexible one in, but it still didn't work. Sorry :(

Re: Flexible offensive aliases

Posted: Sun Jun 27, 2010 2:52 pm
by syrik
OK, got one of them to work!