Combining Aliases?

Posted by Azoroth on Thu 15 Jan 2009 07:38 AM — 5 posts, 18,290 views.

#0
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.
Australia Forum Administrator #1
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.
#2
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.)
Amended on Sat 17 Jan 2009 07:51 PM by Azoroth
Australia Forum Administrator #3
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>


#4
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.