|
Boca Wanderer
Joined: 04 Mar 2001 Posts: 58 Location: USA
|
Posted: 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 |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: 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 |
|
|
|
Boca Wanderer
Joined: 04 Mar 2001 Posts: 58 Location: USA
|
Posted: 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 |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: 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 |
|
|
|
Boca Wanderer
Joined: 04 Mar 2001 Posts: 58 Location: USA
|
Posted: 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 |
|
|
|
|
|