[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ Tips and tricks ➜ Making a targetable alias work with no target

Making a targetable alias work with no target

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Indradragon   (7 posts)  Bio
Date Sun 03 Dec 2006 12:29 AM (UTC)
Message
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?
Top

Posted by Nick Gammon   Australia  (23,046 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 03 Dec 2006 04:03 AM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Fletchling   Australia  (54 posts)  Bio
Date Reply #2 on Sat 09 Dec 2006 07:42 AM (UTC)
Message
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.
Top

Posted by Onoitsu2   USA  (248 posts)  Bio
Date Reply #3 on Sun 14 Jan 2007 09:55 AM (UTC)
Message
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
Top

Posted by Fletchling   Australia  (54 posts)  Bio
Date Reply #4 on Mon 15 Jan 2007 07:32 AM (UTC)
Message
How do you get it to "it auto copies to the clipboard"?, of course I can cntrl-v, but auto?

Fletchling
Top

Posted by Onoitsu2   USA  (248 posts)  Bio
Date Reply #5 on Mon 15 Jan 2007 07:53 AM (UTC)
Message
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
Top

Posted by Fletchling   Australia  (54 posts)  Bio
Date Reply #6 on Mon 15 Jan 2007 10:35 AM (UTC)
Message
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.
Top

Posted by Calvin   (1 post)  Bio
Date Reply #7 on Thu 25 Jan 2007 07:51 PM (UTC)
Message
i am new to alias work and neeed help on how to work alias
Top

Posted by Nick Gammon   Australia  (23,046 posts)  Bio   Forum Administrator
Date Reply #8 on Fri 26 Jan 2007 03:44 AM (UTC)
Message
Try it yourself, the interface is pretty simple. If that doesn't work for you, posting a specific example would help a great deal.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


25,511 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]