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
NoBrainer
Newbie


Joined: 29 Sep 2009
Posts: 4

PostPosted: Sun Oct 04, 2009 9:04 am   

First word in sentence
 
How do I store the first word of a sentence in a variable?

Example:

Pattern: {@names} walks (*).

Value: #SUB {Something flies to the %1 with a smile on its face}

@names is just a long list of names

I don't want it to say "Something" flies... obviously.
If I switch "Something" with @names it will list the whole list of names when the trigger executes, which I don't want either.

I just want the specific name from the name list to show in the sub.

Perhaps there is a way to store the first word of the sentence, which would be the specific name I want, in a temp variable, then use that variable instead of Something?

But I can't find how. Someone able to help?

Thanks again, you guys are very helpful here.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Oct 04, 2009 4:05 pm   
 
You can surround {@names} with (). This will capture it into the %1 variable, so you need to change your existing %1's that refer to the (*) to %2.
_________________
EDIT: I didn't like my old signature
Reply with quote
NoBrainer
Newbie


Joined: 29 Sep 2009
Posts: 4

PostPosted: Sun Oct 04, 2009 4:54 pm   
 
Thanks Matt!
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