|
Sunnfire Newbie
Joined: 15 Sep 2005 Posts: 5 Location: CT
|
Posted: Wed Dec 10, 2008 9:53 pm
Capture Text to variable with an Alias |
Ok. I am trying to create an Alias called Attack.
Overall it should be pretty simple, I just can't seem to find the command to make it do what I want.
I want to be able to type, Attack <Target>. With <Target> being anything from Bob, John, Horse, to swarm of harpies.
I want to capture the <Target> Section to a variable named KillTarget
Then have the Alias send Kill <Target> to the game.
When I code this,
Code: |
#VAR KillTarget %1
Kill @KillTarget
|
It only captures the one word after Attack. So works fine usually, except the variable is only the first word, which starts the killing, but fail to trip other triggers that need the full target name if its more than one word long.
So if I types Attack Swarm of Harpies, my @KillTarget has a value of Swarm
I also tried,
Code: |
#VAR KillTarget {%1}
#VAR KillTarget {^Attack (*)}
|
Any help on this, or a detailed explanation on how to catch specific parts of strings both incoming from the game, and from the command line would be more than welcome. [/code] |
|
|
|
Progonoi Magician
Joined: 28 Jan 2007 Posts: 430
|
Posted: Wed Dec 10, 2008 10:05 pm |
You need %-1.
|
|
_________________ The Proud new owner of CMud.
--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
-------------------------------- |
|
|
|
Sunnfire Newbie
Joined: 15 Sep 2005 Posts: 5 Location: CT
|
Posted: Wed Dec 10, 2008 10:51 pm |
That seems to create a new class with the last word on the line as the class name.
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Dec 10, 2008 10:56 pm |
Ah, this is zMUD. You need:
#var Varname {%-1} |
|
|
|
Sunnfire Newbie
Joined: 15 Sep 2005 Posts: 5 Location: CT
|
Posted: Thu Dec 11, 2008 3:06 pm |
Perfect. Thanks.
|
|
|
|
|
|