Making a targetable alias work with no target

Posted by Indradragon on Sun 03 Dec 2006 12:29 AM — 9 posts, 35,317 views.

#0
I have an alias cdm

which is c 'dispel magic'

I had it as cdm *
and c 'dispel magic' %1

However the problem I am running into is that when I want to use it I have to supply a target. I want it to work whether I supply a target or not. Any suggestions?
Australia Forum Administrator #1
You can use a regular expression to make the target (and the space before it) optional. This works:


<aliases>
  <alias
   match="^cdm( .*)?$"
   enabled="y"
   regexp="y"
   sequence="100"
  >
  <send>c 'dispel magic'%1</send>
  </alias>
</aliases>


I have removed the space before the %1 in the send text, because the space is part of the capture.
Australia #2
If you are less comfortable with regular expressions you can do exactly the same just with simple expressions by removing the space. The alias below casts faerie fire on a specific mob, or simply casts it on who I am fighting (implied target as muds will generally do).

<aliases>
<alias
match="cf*"
enabled="y"
sequence="100"
>
<send>cast 'faerie fire' %1
</send>
</alias>
</aliases>

I use this principle in other ways by aggregating a number of these simple aliases such as when you know you can kill a mob with a backstab, faerie fire (or curse,blind ...whatever for your mud) followed by a number of your best offensive spells for that level; like

<aliases>
<alias
match="mk*"
enabled="y"
expand_variables="y"
sequence="100"
>
<send>bs %1
cast 'faerie fire'
cast '@bestspell
cast '@bestspell
cast '@bestspell
cast '@bestspell
cast '@bestspell</send>
</alias>
</aliases>

This one is interesting for when I'm solo, or grouped with snuggles and either of us is fronting the mob. Note I use bestspell as a variable and each time I level and learn something nastier, I just setbestspell [spellname] so it works from level 1 to level 201 each life. good for levelling and general mayhem.

Short summary, lose the space, kill more mobs.
USA #3
I use macros to do 99% of my fighting ... and i hilight the mob's name to fight, and it auto copies to the clipboard. And once i am in the fight i have a macro that clears the clipboard, so that i don't accidentally attack another mob named the same thing in the room.

All you have to do is alter the words 'shard of ice' and NOTHING more, cause it will cast whatever you have in those parenthesis.

<aliases>
  <alias
   match="^(shard of ice)(\s(.*?))?$"
   enabled="y"
   regexp="y"
   send_to="12"
   ignore_case="y"
   sequence="100"
  >
  <send>if "%3" == "" then
Send("cast '" .. string.lower("%1") .. "' " .. GetClipboard ())
else
Send("cast '" .. string.lower("%1") .. "' " .. string.lower("%3"))
end -- if</send>
  </alias>
</aliases>



Laterzzz,
Onoitsu2
Australia #4
How do you get it to "it auto copies to the clipboard"?, of course I can cntrl-v, but auto?

Fletchling
USA #5
In the Output Settings Page (Alt + 5) and check 'Copy selection to clipboard', NOT the HTML one, make sure that is UNCHECKED.

If, and ONLY if it still will not double click a name properly, then go to Global Preferences, the General tab, and put this in the 'Double Click' Word Delimiters section... .,()[]"'
That is period comma open-paren close-paren open-square close-square double-quote single-quote space

Then you should be able to use this method :)

I type nearly nothing lol, it is a pain in the rear to set up at first, but once the initial setup is done it is so VERY simple to use ...

Enjoy,
Onoitsu2
Australia #6
I changed your alias to use my bestspell (offensive) variable.

<aliases>
<alias
match="^bsp(\s(.*))?$"
enabled="y"
expand_variables="y"
group="experiment"
regexp="y"
send_to="12"
ignore_case="y"
sequence="100"
>
<send>if "%2" == "" then
Send ("cast '@bestspell' " .. GetClipboard ())
else
Send ("cast '@bestspell' " .. string.lower ("%2"))
end -- if</send>
</alias>
</aliases>


Same principle works for me for identifying, wearing stuff, removing stuff, buying things from shops...and so on. Happy to post any Aardwolf related uses if anyone is interested.

Thanks Onoitsu2.
#7
i am new to alias work and neeed help on how to work alias
Australia Forum Administrator #8
Try it yourself, the interface is pretty simple. If that doesn't work for you, posting a specific example would help a great deal.