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
Boca
Wanderer


Joined: 04 Mar 2001
Posts: 58
Location: USA

PostPosted: Mon Nov 12, 2001 6:15 pm   

Help Capturing an Entire Line
 
Hi, I am trying to capture the room title line. Here is one from my mud:
Inside the East Gate of Midgaard [ e w ]

Here is the trigger that I thought should work: (*) ~[ * ~]$
All I am getting is the first word of the room title. So when I check the capture variable for the above room, I only get the value "Inside".
BTW, I need to force the match at the end of the line because of my prompt which ends in [available exits]> .
What am I doing wrong?
Thanks,
Boca
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Nov 12, 2001 6:29 pm   
 
quote:

Hi, I am trying to capture the room title line. Here is one from my mud:
Inside the East Gate of Midgaard [ e w ]

Here is the trigger that I thought should work: (*) ~[ * ~]$
All I am getting is the first word of the room title. So when I check the capture variable for the above room, I only get the value "Inside".
BTW, I need to force the match at the end of the line because of my prompt which ends in [available exits]> .
What am I doing wrong?
Thanks,
Boca



Actually, I think you might be getting it all, but you're looking at the variable incorrectly. Try surrounding the variable in quotes or the curly braces.

li'l shmoe of Dragon's Gate MUD
Reply with quote
Boca
Wanderer


Joined: 04 Mar 2001
Posts: 58
Location: USA

PostPosted: Mon Nov 12, 2001 6:44 pm   
 
Thanks for the suggestion, I could not get it to give more than the first word using the * . When I tried quotes or brackets:
('*') or ({*0} I did not get any match at all - perhaps I misunderstood what you meant.
But, I did get this to work which used your suggestion:
(&{where}) ~[ * ~]$
so I am all set.

Thanks,
Boca
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Mon Nov 12, 2001 7:45 pm   
 
You misunderstood Matt. What was meant is that it seems that when you were assigning the %1 to the variable, you didn't use quotes or curly braces. Since what zMUD does is just expand %1, when %1 contains more than one word, it can produce unexpected results when used in a function or command. Example, suppose you have this trigger:
You get a (*) from the container.

In the trigger you do this:
#VAR item %1

And you receive from the MUD:
You get a dark obsidian sword from the container.

@item will now contain the word darl and nothing else because when zMUD expands it, all the other words are interpreted as additional parameters to the #VAR command. If, instead, you do this:
#VAR item "%1"

or:
#VAR item {%1}

When zMUD expands it, the quotes or parameters will let know zMUD that it is just one argument that should all be entered into the variable.

Kjata
Reply with quote
Boca
Wanderer


Joined: 04 Mar 2001
Posts: 58
Location: USA

PostPosted: Mon Nov 12, 2001 9:05 pm   
 
Thanks for the suggestion, I could not get it to give more than the first word using the * . When I tried quotes or brackets:
('*') or ({*0} I did not get any match at all - perhaps I misunderstood what you meant.
But, I did get this to work which used your suggestion:
(&{where}) ~[ * ~]$
so I am all set.

Thanks,
Boca
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