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, confirm your email, resolve issues, 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.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Combining Aliases?

Combining Aliases?

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


Posted by Azoroth   (31 posts)  Bio
Date Thu 15 Jan 2009 07:38 AM (UTC)
Message
I've created a very simple targetting system using the help files Nick has made in the FAQ. Now I've created several other aliases that help me display my target and change my mudlevel aliases to ease of use. What I'm trying to do, and what I have no idea of how to go about doing is how to combine some of these into one single alias. I'll post the following aliases seperately and show which ones I'm attempting to combine with which.

<aliases>
<alias
match="x *"
enabled="y"
expand_variables="y"
variable="target"
send_to="9"
sequence="100"
>
<send>%1
</send>
</alias>
</aliases>

This is my targetting alias as you can see.

<aliases>
<alias
match="xx"
enabled="y"
expand_variables="y"
send_to="2"
sequence="100"
>
<send>Prey is now: @target</send>
</alias>
</aliases>

Typing this displays who my target is, it is a seperate alias and I'm trying to make it so that when I type x *, it displays the line Prey is now: @target without the additional xx alias.

<aliases>
<alias
match="setit"
enabled="y"
expand_variables="y"
sequence="100"
>
<send>alias hh hunt @target
alias kk do kill @target,headbutt @target
alias hb headbutt @target
alias q trigger @target todo strike @target
alias t do headbutt @target,ram @target
alias r do hunt @target,drink mixed potion,2wear ring from pack,2wear ring from cloak,2detach gem,wear bands from pack,wear gloves from pack,draw @weapon,wield staff from pack,press button,backstab @target,3shape @target</send>
</alias>
</aliases>

This is the alias I have to type in order to change my mudlevel aliases. Is there a way I can get all of these to function just by typing x *? Any help in the right direction would be greatly appreciated.

Azo.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 16 Jan 2009 04:16 AM (UTC)
Message
I'm not sure what you mean by "combine into a single one".

However what may well work for you is set the "send to" field to Execute. That way, one alias can call other aliases.

- Nick Gammon

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

Posted by Azoroth   (31 posts)  Bio
Date Reply #2 on Sat 17 Jan 2009 01:26 PM (UTC)

Amended on Sat 17 Jan 2009 07:51 PM (UTC) by Azoroth

Message
Well, for example...my targetting alias and target display alias.

<aliases>
<alias
match="x *"
enabled="y"
expand_variables="y"
variable="target"
send_to="9"
sequence="100"
>
<send>%1</send>
</alias>
</aliases>

Targetting Display alias:

<aliases>
<alias
match="xx"
enabled="y"
expand_variables="y"
send_to="2"
sequence="100"
>
<send>Prey is now: @target</send>
</alias>
</aliases>

Basically using this example is I'm asking if there's a way for me to take what my xx alias does (send targets name to my screen), and just from pressing x * , send both set of commands(cuts down on aliases and allows you to see immediately if the target's name was spelt incorrectly, etc.)
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 17 Jan 2009 08:14 PM (UTC)
Message
One approach (which lets one alias call another) is to script "Execute ('xx')" from inside your "x *" alias, like this:


<aliases>
  <alias
   match="x *"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>
SetVariable ("target", "%1")
Execute ("xx")
</send>
  </alias>
</aliases>


This uses "send to script" to set the variable, and then call the other alias. However in the same number of lines you could just echo what the variable is, like this:


<aliases>
  <alias
   match="x *"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>
SetVariable ("target", "%1")
Note ("Prey is now: %1")
</send>
  </alias>
</aliases>



- Nick Gammon

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

Posted by Azoroth   (31 posts)  Bio
Date Reply #4 on Sat 17 Jan 2009 10:10 PM (UTC)
Message
Awesome, exactly what I was trying to accomplish, thanks alot Nick. Now I can implement this with various other features I have that do very similar things.
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.


13,427 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

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