Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Sunnfire
Newbie


Joined: 15 Sep 2005
Posts: 5
Location: CT

PostPosted: 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]
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: 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
--------------------------------
Reply with quote
Sunnfire
Newbie


Joined: 15 Sep 2005
Posts: 5
Location: CT

PostPosted: 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.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Wed Dec 10, 2008 10:56 pm   
 
Ah, this is zMUD. You need:

#var Varname {%-1}
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Sunnfire
Newbie


Joined: 15 Sep 2005
Posts: 5
Location: CT

PostPosted: Thu Dec 11, 2008 3:06 pm   
 
Perfect. Thanks.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net