Using Wildcards in Alias's

Posted by Darcon on Fri 19 Oct 2012 05:32 PM — 9 posts, 33,597 views.

#0
Ok, bare in mind that I am still very new to this, so don't laugh at me. In the mud that I play there is a gate spell. the syntax for the spell is:

cast 'gate' "whatever you want to gate to"

In the other client that I was using this was a relatively simple alias to create, because an alias could be used with out wildcards i.e.

cgate pocket gopher

After setting up the alias "cgate" in mush client and getting several "Huh?" in return I figured out the wildcard part.

The problem that i am running into is that some gate mobs require one word, some require three. Now I know I could just make several alias's to do what I want to accomplish.

cgate *
cgate * *
cgate * * *
etc...

I would rather not do that though because it makes things harder to find the more you add. So, my question is, is there a way to create an alias with an unknown amount of wildcards available to use?

I realize that this is probably covered in some other subject somewhere but searching through them has yielded very little results for me. I don't know the keywords that I should use.

At any rate, any help on this subject would be appreciated. Even if its just a link to a tutorial or something. Thanks for your patients with me.
Australia Forum Administrator #1
Can you post the whole alias please?

Template:copying
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.


The quick answer is that "cgate *" will match any number of words, so there must be more to your problem than that.
#2
The One that I have initially set up is

cgate *

In the send

cast 'gate' %1

I realize that I can set another one up to do

cgate * *

send

cast 'gate' %1 %2

and so on, but i figure there has to be a way to just use one alias to take care of this for a undertermined amount of wildcards.

That way I can do something like

cgate a crowd of rowdy onlookers

with out have to set up an individual alias

cgate * * * * *

send

cgate %1 %2 %3 %4 %5

I hope that makes sense. Thank for the help.

#3

<aliases>
  <alias
   match="cgate *"
   enabled="y"
   group="Spells Target"
   sequence="100"
  >
  <send>cast 'gate' %1</send>
  </alias>
</aliases>



This is the one I have now. It only matches one wildcard. Anything after 1 wildcard returns a Huh?

Sorry about the previous post...I caught on to what you wanted after I had already sent it.
Amended on Sat 20 Oct 2012 02:05 AM by Nick Gammon
Australia Forum Administrator #4
I don't quite get your problem. Using that alias, if I type:


cgate pocket gopher


It sends:


cast 'gate' pocket gopher


Isn't that what you want?
#5
The problem I was running into was getting the alias to execute in the script I was writing. Maybe I was just tired, I don't know. I have since went back over the script and finally got it working using the original alias I had set up.


<triggers>
  <trigger
   enabled="y"
   group="Xp Run"
   match=" The Glyph of Transportation"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable("Glyph", GetVariable ("Glyph") + 1)
if GetVariable ("Glyph") == "1" then
world.Execute ("cgate pocket gopher")
elseif GetVariable ("Glyph") == "2" then
world.Execute ("north")
world.Execute ("north")
world.Execute ("oass") -- order all sleep spring alias
world.Execute ("west")
world.Execute ("on") -- open north alias
world.Execute ("north")
world.Execute ("north")
world.Execute ("sell tower") -- starts my sell item trigger
end</send>
  </trigger>
</triggers>


It is possible that I had some character incorrect, but I have fixed it and it works. Thank you for your timely responses. Sorry to have wasted your time.
Amended on Sat 20 Oct 2012 05:58 AM by Nick Gammon
#6
In the second part of the script if I change the 2:

world.Execute ("north")
world.Execute ("north")

to

world.Execute ("2n")

It doesn't work. Any idea why?
Australia Forum Administrator #7
You mean you want the speedwalk evaluated?

Try:


 world.Execute (EvaluateSpeedwalk ("2n"))
#8
Yeah that did the trick. Thanks once again nick.