Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ How To Exclude everything but the variable?
How To Exclude everything but the variable?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Karl_Newbie
USA (23 posts) Bio
|
Date
| Sun 25 Jul 2004 04:30 PM (UTC) Amended on Sun 25 Jul 2004 04:50 PM (UTC) by Karl_Newbie
|
Message
| Okay, from a status command and I get several pages of infomration.
type army status
return below
Pikemen [ID234c05] training: 3 dailycost: 117 morale: 234 [mobilized]
Pikemen [ID23408] training: 3 dailycost: 117 morale: 234 [mobilized]
Knights [274353] training: 14 dailycost: 72 morale: 104 [reserve]
ballista [26143] training: 3 dailycost: 186 morale: 252 [mobilized]
Peasants [479657] training: 1 dailycost: 17 morale: 4732 [reserve]
Slingers [489549] training: 3 dailycost: 27 morale: 1350 [mobilized]
wagons [4934602] training: 2 dailycost: 3 morale: 231 [engaged]
Peasants [4973952] training: 3 dailycost: 108 morale: 216 [panicked]
ballista [5267756] training: 3 dailycost: 186 morale: 252 [reserve]
Pikemen [2734708] training: 3 dailycost: 117 morale: 234 [mobilized]
ballista [5267757] training: 3 dailycost: 186 morale: 252 [mobilized]
Knights [5462522] training: 13 dailycost: 12 morale: 72 [reserve]
Peasants [5611447] training: 3 dailycost: 1 morale: 216 [mobilized]
RoyalGuard [7169887] training: 15 dailycost: 13 morale: 2814 [mobilized]
Slingers [7545073] training: 3 dailycost: 2 morale: 1340 [mobilized]
-----------------------------------------------------------
without the ----
Now I just want to be able to type 'army status *' ie 'army status pikemen' or whatever and just see those lines, which means excluding every other line that doesn't begin with that wildcard. Okay, here is my simple set the variable alias, works fine.
<aliases>
<alias
match="as *"
enabled="y"
expand_variables="y"
send_to="12"
ignore_case="y"
sequence="100"
>
<send>SetVariable "astat", "%1"
send "army status"</send>
</alias>
</aliases>
Okay, I set a variable named 'astat' and send the command to the mud.
But when I try to make a simple trigger idea I have no idea how to do so successfully.
I tried different sorts, made sure to expand the variable, had regular expression checked when I need it, etc.
Sort of like
(?!@astat) [(.*)] training: (.*) dailycost: (.*) morale: (.*) [(.*)]
Now I got the variable to match successfully once and be excluded, but I can't figure out how to omit anything BUT the variable.
So fustrating blah. :)
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sun 25 Jul 2004 10:18 PM (UTC) Amended on Sun 25 Jul 2004 10:19 PM (UTC) by Nick Gammon
|
Message
| You were on the right track. This seems to work for me:
<triggers>
<trigger
custom_colour="2"
enabled="y"
expand_variables="y"
match=
"(?!@astat)(.*?) \[(.*?)\] training: (.*?) dailycost: (.*?) morale: (.*?) \[(.*?)\]"
omit_from_output="y"
regexp="y"
sequence="100"
>
</trigger>
</triggers>
The change was that the negative look-ahead assertion you had does not consume characters, so I had to add (.*?) after it.
Also, putting \ in front of the brackets, otherwise they have a different meaning.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Karl_Newbie
USA (23 posts) Bio
|
Date
| Reply #2 on Tue 27 Jul 2004 09:23 PM (UTC) Amended on Tue 27 Jul 2004 09:24 PM (UTC) by Karl_Newbie
|
Message
| Works perfectly.
I had read a previous forum thread on the purpose of (.*? ) vs (.*) and didn't think it would have helped me :D
thanks. | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #3 on Tue 27 Jul 2004 09:46 PM (UTC) |
Message
| Nah, it doesnt really. Well, except for specific cases, the big thing he changed was the escaping of the brackets. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
12,046 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top